Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 25 additions & 22 deletions ui/src/components/codemirror-editor/index.vue
Original file line number Diff line number Diff line change
@@ -1,34 +1,37 @@
<template>
<div class="codemirror-editor w-full">
<Codemirror
v-model="data"
ref="cmRef"
:extensions="extensions"
:style="codemirrorStyle"
:tab-size="4"
:autofocus="true"
v-bind="$attrs"
/>

<form @submit.prevent>
<Codemirror
v-model="data"
ref="cmRef"
:extensions="extensions"
:style="codemirrorStyle"
:tab-size="4"
:autofocus="true"
v-bind="$attrs"
/>
</form>
<div class="codemirror-editor__footer">
<el-button text type="info" @click="openCodemirrorDialog" class="magnify">
<AppIcon iconName="app-magnify" style="font-size: 16px"></AppIcon>
</el-button>
</div>
<!-- Codemirror 弹出层 -->
<el-dialog v-model="dialogVisible" :title="title" append-to-body fullscreen>
<Codemirror
v-model="cloneContent"
:extensions="extensions"
:style="codemirrorStyle"
:tab-size="4"
:autofocus="true"
style="
height: calc(100vh - 160px) !important;
border: 1px solid #bbbfc4;
border-radius: 4px;
"
/>
<form @submit.prevent>
<Codemirror
v-model="cloneContent"
:extensions="extensions"
:style="codemirrorStyle"
:tab-size="4"
:autofocus="true"
style="
height: calc(100vh - 160px) !important;
border: 1px solid #bbbfc4;
border-radius: 4px;
"
/>
</form>
<template #footer>
<div class="dialog-footer mt-24">
<el-button type="primary" @click="submitDialog"> {{ $t('common.confirm') }}</el-button>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no evident problem with this code. The changes you've made do not introduce bugs or unexpected behaviors. However, adding a <form> element around the Codemirror components might add unintended side effects because forms typically submit data to server-side routes unless explicitly handled. If your intent was only to group elements (like buttons), consider removing the form tags or use them appropriately.

Here’s what you could simplify:

-<form @submit.prevent>

To

<!-- Alternatively, if simply grouping elements -->
<div> <!-- You can also use divs instead of form elements here... -->   
  [...]
</div>

If there's any specific feature added by adding forms, please let me know so I can assist further!

Expand Down
Loading