adtec-core-package 2.7.4 → 2.7.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "adtec-core-package",
3
- "version": "2.7.4",
3
+ "version": "2.7.6",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "scripts": {
@@ -17,13 +17,14 @@
17
17
  <script setup lang="ts">
18
18
  import { AiEditor } from 'aieditor'
19
19
  import 'aieditor/dist/style.css'
20
- import { onMounted, onUnmounted, ref, watch, nextTick } from 'vue'
21
20
  import type { WatchStopHandle } from 'vue'
21
+ import { onMounted, onUnmounted, ref, watch } from 'vue'
22
22
  import { ElMessage } from 'element-plus'
23
+
23
24
  enum WatchType {
24
25
  initWatch = 'initWatch',
25
26
  }
26
- const watchHandlers = ref<Partial<Record<WatchType, WatchStopHandle>>>({});
27
+ const watchHandlers = ref<Partial<Record<WatchType, WatchStopHandle>>>({})
27
28
 
28
29
  const divRef = ref()
29
30
  let aiEditor: AiEditor | null
@@ -55,12 +56,13 @@ const props = withDefaults(
55
56
  showToolbar: true,
56
57
  borderWidth: '1px',
57
58
  editorConfig: {},
59
+ isEdit: true,
58
60
  },
59
61
  )
60
62
  const model = defineModel({
61
63
  type: [String, null, undefined],
62
64
  required: false,
63
- default: null
65
+ default: null,
64
66
  })
65
67
  const text = defineModel('text', {
66
68
  type: String,
@@ -327,7 +329,6 @@ function customStringReplacement(
327
329
  return result
328
330
  }
329
331
 
330
-
331
332
  function initHtml(html: string) {
332
333
  html = customStringReplacement(html, '<img', '>', 'height="[0-9]+"', 'height="auto"')
333
334
  return convertPtToPx(html)
@@ -359,7 +360,7 @@ onMounted(() => {
359
360
  },
360
361
  onCreated: (editor: AiEditor) => {
361
362
  stopWatchByType(WatchType.initWatch)
362
- watchHandlers.value[WatchType.initWatch] =watch(
363
+ watchHandlers.value[WatchType.initWatch] = watch(
363
364
  () => props.isEdit,
364
365
  (val) => {
365
366
  if (aiEditor) {
@@ -434,9 +435,9 @@ defineExpose({
434
435
  return ''
435
436
  }
436
437
  },
437
- setContent: (html: string,focus: boolean=false) => {
438
+ setContent: (html: string, focus: boolean = false) => {
438
439
  if (aiEditor) {
439
- aiEditor.setContent(initHtml(html),focus)
440
+ aiEditor.setContent(initHtml(html), focus)
440
441
  }
441
442
  },
442
443
  })
@@ -75,7 +75,7 @@
75
75
  ></el-icons>
76
76
  </el-flex>
77
77
  </el-flex>
78
- <slot></slot>
78
+ <slot @submit.prevent ></slot>
79
79
  <el-flex align="flex-end" justify="flex-end" height="40px" style="border-top: var(--border)">
80
80
  <el-button @click="reset">重置</el-button>
81
81
  <el-button type="primary" @click="search">查询</el-button>
@@ -33,7 +33,8 @@ const submitEvent = (event: KeyboardEvent) => {
33
33
  if (target) {
34
34
  const elForm = target.closest?.('.el-form')
35
35
  if (elForm) {
36
- event.stopPropagation()
36
+ event.preventDefault();
37
+ event.stopPropagation();
37
38
  }
38
39
  }
39
40
  }