adtec-core-package 2.7.3 → 2.7.5

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.3",
3
+ "version": "2.7.5",
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>
@@ -95,15 +95,16 @@ const blurEvent = (event: FocusEvent) => {
95
95
 
96
96
  const keyUpEvent = (event: KeyboardEvent) => {
97
97
  if (event.key === 'Enter') {
98
+ event.preventDefault();
99
+ event.stopPropagation();
100
+
98
101
  const applicationModule = moduleName.value || sessionStorage.getItem('applicationModule');
99
- // 首先判断当前页面有没有抽屉
100
102
  const docTemp = event.currentTarget as any;
101
103
  const doc = applicationModule === 'system'
102
104
  ? (docTemp as Document)
103
105
  : (docTemp && docTemp[applicationModule ?? 'default'] && docTemp[applicationModule ?? 'default'].document) || undefined;
104
106
 
105
107
  if (!doc) return;
106
-
107
108
  // 工具函数:判断元素是否可见(未隐藏、display不为none、visibility不为hidden)
108
109
  const isElementVisible = (el: HTMLElement | null): boolean => {
109
110
  if (!el) return false;