vue-editify 0.2.13 → 0.2.15

Sign up to get free protection for your applications and to get access to all the features.
Files changed (190) hide show
  1. package/examples/App.vue +49 -67
  2. package/lib/components/button/button.vue.d.ts +62 -60
  3. package/lib/components/button/index.d.ts +4 -0
  4. package/lib/components/button/props.d.ts +12 -1
  5. package/lib/components/checkbox/checkbox.vue.d.ts +9 -9
  6. package/lib/components/checkbox/index.d.ts +4 -0
  7. package/lib/components/checkbox/props.d.ts +2 -2
  8. package/lib/components/colors/colors.vue.d.ts +4 -4
  9. package/lib/components/colors/index.d.ts +4 -0
  10. package/lib/components/colors/props.d.ts +2 -2
  11. package/lib/components/icon/index.d.ts +4 -0
  12. package/lib/components/insertAttachment/index.d.ts +4 -0
  13. package/lib/{plugins/attachment → components}/insertAttachment/insertAttachment.vue.d.ts +3 -3
  14. package/lib/{plugins/attachment → components}/insertAttachment/props.d.ts +1 -1
  15. package/lib/components/insertImage/index.d.ts +4 -0
  16. package/lib/components/insertImage/insertImage.vue.d.ts +3 -3
  17. package/lib/components/insertImage/props.d.ts +1 -1
  18. package/lib/components/insertLink/index.d.ts +4 -0
  19. package/lib/components/insertLink/insertLink.vue.d.ts +6 -6
  20. package/lib/components/insertLink/props.d.ts +3 -3
  21. package/lib/components/insertMathformula/index.d.ts +4 -0
  22. package/lib/{plugins/mathformula → components}/insertMathformula/insertMathformula.vue.d.ts +3 -3
  23. package/lib/{plugins/mathformula → components}/insertMathformula/props.d.ts +2 -2
  24. package/lib/components/insertTable/index.d.ts +4 -0
  25. package/lib/components/insertTable/insertTable.vue.d.ts +3 -3
  26. package/lib/components/insertTable/props.d.ts +2 -2
  27. package/lib/components/insertVideo/index.d.ts +4 -0
  28. package/lib/components/insertVideo/insertVideo.vue.d.ts +3 -3
  29. package/lib/components/insertVideo/props.d.ts +1 -1
  30. package/lib/components/layer/index.d.ts +4 -0
  31. package/lib/components/layer/layer.vue.d.ts +10 -8
  32. package/lib/components/tooltip/index.d.ts +4 -0
  33. package/lib/components/tooltip/tooltip.vue.d.ts +6 -4
  34. package/lib/components/triangle/index.d.ts +4 -0
  35. package/lib/components/triangle/triangle.vue.d.ts +1 -1
  36. package/lib/components/updateLink/index.d.ts +4 -0
  37. package/lib/components/updateLink/props.d.ts +17 -0
  38. package/lib/components/updateLink/updateLink.vue.d.ts +38 -0
  39. package/lib/core/function.d.ts +113 -36
  40. package/lib/core/rule.d.ts +20 -0
  41. package/lib/core/tool.d.ts +36 -34
  42. package/lib/editify/editify.vue.d.ts +86 -53
  43. package/lib/editify/menu/index.d.ts +4 -0
  44. package/lib/{components → editify}/menu/menu.vue.d.ts +3 -4
  45. package/lib/{components → editify}/menu/props.d.ts +1 -1
  46. package/lib/editify/props.d.ts +3 -7
  47. package/lib/editify/toolbar/index.d.ts +4 -0
  48. package/lib/{components → editify}/toolbar/props.d.ts +2 -2
  49. package/lib/{components → editify}/toolbar/toolbar.vue.d.ts +53 -53
  50. package/lib/editify.es.js +8879 -7668
  51. package/lib/editify.umd.js +2 -2
  52. package/lib/feature/align.d.ts +32 -0
  53. package/lib/feature/attachment.d.ts +18 -0
  54. package/lib/feature/backColor.d.ts +32 -0
  55. package/lib/feature/bold.d.ts +32 -0
  56. package/lib/feature/code.d.ts +32 -0
  57. package/lib/feature/codeBlock.d.ts +32 -0
  58. package/lib/feature/fontFamily.d.ts +32 -0
  59. package/lib/feature/fontSize.d.ts +32 -0
  60. package/lib/feature/foreColor.d.ts +32 -0
  61. package/lib/feature/formatClear.d.ts +32 -0
  62. package/lib/feature/fullScreen.d.ts +18 -0
  63. package/lib/feature/heading.d.ts +32 -0
  64. package/lib/feature/image.d.ts +32 -0
  65. package/lib/feature/indent.d.ts +18 -0
  66. package/lib/feature/infoBlock.d.ts +18 -0
  67. package/lib/feature/italic.d.ts +32 -0
  68. package/lib/feature/lineHeight.d.ts +32 -0
  69. package/lib/feature/link.d.ts +26 -0
  70. package/lib/feature/mathformula.d.ts +22 -0
  71. package/lib/feature/orderList.d.ts +32 -0
  72. package/lib/feature/panel.d.ts +18 -0
  73. package/lib/feature/quote.d.ts +18 -0
  74. package/lib/feature/redo.d.ts +18 -0
  75. package/lib/feature/separator.d.ts +18 -0
  76. package/lib/feature/sourceView.d.ts +18 -0
  77. package/lib/feature/strikethrough.d.ts +32 -0
  78. package/lib/feature/sub.d.ts +32 -0
  79. package/lib/feature/super.d.ts +32 -0
  80. package/lib/feature/table.d.ts +32 -0
  81. package/lib/feature/task.d.ts +32 -0
  82. package/lib/feature/underline.d.ts +32 -0
  83. package/lib/feature/undo.d.ts +18 -0
  84. package/lib/feature/unorderList.d.ts +32 -0
  85. package/lib/feature/video.d.ts +38 -0
  86. package/lib/index.d.ts +104 -69
  87. package/package.json +5 -5
  88. package/src/components/button/button.vue +21 -24
  89. package/src/components/button/index.ts +5 -0
  90. package/src/components/button/props.ts +14 -1
  91. package/src/components/checkbox/checkbox.vue +1 -1
  92. package/src/components/checkbox/index.ts +5 -0
  93. package/src/components/checkbox/props.ts +1 -1
  94. package/src/components/colors/colors.vue +3 -3
  95. package/src/components/colors/index.ts +5 -0
  96. package/src/components/colors/props.ts +2 -2
  97. package/src/components/icon/index.ts +5 -0
  98. package/src/components/insertAttachment/index.ts +5 -0
  99. package/src/{plugins/attachment → components}/insertAttachment/insertAttachment.vue +4 -2
  100. package/src/{plugins/attachment → components}/insertAttachment/props.ts +1 -1
  101. package/src/components/insertImage/index.ts +5 -0
  102. package/src/components/insertImage/insertImage.vue +5 -5
  103. package/src/components/insertImage/props.ts +1 -1
  104. package/src/components/insertLink/index.ts +5 -0
  105. package/src/components/insertLink/insertLink.vue +10 -10
  106. package/src/components/insertLink/props.ts +3 -3
  107. package/src/components/insertMathformula/index.ts +5 -0
  108. package/src/{plugins/mathformula → components}/insertMathformula/props.ts +2 -2
  109. package/src/components/insertTable/index.ts +5 -0
  110. package/src/components/insertTable/props.ts +2 -2
  111. package/src/components/insertVideo/index.ts +5 -0
  112. package/src/components/insertVideo/insertVideo.vue +2 -2
  113. package/src/components/insertVideo/props.ts +1 -1
  114. package/src/components/layer/index.ts +5 -0
  115. package/src/components/layer/layer.vue +42 -4
  116. package/src/components/tooltip/index.ts +5 -0
  117. package/src/components/tooltip/tooltip.vue +1 -1
  118. package/src/components/triangle/index.ts +5 -0
  119. package/src/components/triangle/triangle.vue +1 -1
  120. package/src/components/updateLink/index.ts +5 -0
  121. package/src/components/updateLink/props.ts +21 -0
  122. package/src/components/{toolbar/toolbar.less → updateLink/updateLink.less} +4 -20
  123. package/src/components/updateLink/updateLink.vue +74 -0
  124. package/src/core/function.ts +289 -97
  125. package/src/core/rule.ts +96 -7
  126. package/src/core/tool.ts +234 -78
  127. package/src/editify/editify.less +2 -0
  128. package/src/editify/editify.vue +182 -185
  129. package/src/editify/menu/index.ts +5 -0
  130. package/src/editify/menu/menu.vue +215 -0
  131. package/src/{components → editify}/menu/props.ts +1 -1
  132. package/src/editify/props.ts +7 -11
  133. package/src/editify/toolbar/index.ts +5 -0
  134. package/src/{components → editify}/toolbar/props.ts +1 -1
  135. package/src/editify/toolbar/toolbar.less +10 -0
  136. package/src/editify/toolbar/toolbar.vue +103 -0
  137. package/src/feature/align.ts +128 -0
  138. package/src/feature/attachment.ts +109 -0
  139. package/src/feature/backColor.ts +171 -0
  140. package/src/feature/bold.ts +136 -0
  141. package/src/feature/code.ts +136 -0
  142. package/src/feature/codeBlock.ts +204 -0
  143. package/src/feature/fontFamily.ts +140 -0
  144. package/src/feature/fontSize.ts +142 -0
  145. package/src/feature/foreColor.ts +173 -0
  146. package/src/feature/formatClear.ts +118 -0
  147. package/src/feature/fullScreen.ts +57 -0
  148. package/src/feature/heading.ts +154 -0
  149. package/src/feature/image.ts +225 -0
  150. package/src/feature/indent.ts +73 -0
  151. package/src/feature/infoBlock.ts +94 -0
  152. package/src/feature/italic.ts +136 -0
  153. package/src/feature/lineHeight.ts +165 -0
  154. package/src/feature/link.ts +149 -0
  155. package/src/feature/mathformula.ts +147 -0
  156. package/src/feature/orderList.ts +116 -0
  157. package/src/feature/panel.ts +108 -0
  158. package/src/feature/quote.ts +61 -0
  159. package/src/feature/redo.ts +56 -0
  160. package/src/feature/separator.ts +62 -0
  161. package/src/feature/sourceView.ts +59 -0
  162. package/src/feature/strikethrough.ts +136 -0
  163. package/src/feature/sub.ts +136 -0
  164. package/src/feature/super.ts +136 -0
  165. package/src/feature/table.ts +994 -0
  166. package/src/feature/task.ts +116 -0
  167. package/src/feature/underline.ts +136 -0
  168. package/src/feature/undo.ts +56 -0
  169. package/src/feature/unorderList.ts +116 -0
  170. package/src/feature/video.ts +339 -0
  171. package/src/hljs/index.ts +1 -1
  172. package/src/index.ts +69 -21
  173. package/src/locale/en_US.ts +3 -3
  174. package/src/locale/zh_CN.ts +3 -3
  175. package/lib/plugins/attachment/index.d.ts +0 -37
  176. package/lib/plugins/infoBlock/index.d.ts +0 -55
  177. package/lib/plugins/mathformula/index.d.ts +0 -49
  178. package/lib/plugins/panel/index.d.ts +0 -48
  179. package/src/components/menu/menu.vue +0 -1655
  180. package/src/components/toolbar/toolbar.vue +0 -1677
  181. package/src/plugins/attachment/index.ts +0 -237
  182. package/src/plugins/infoBlock/index.ts +0 -238
  183. package/src/plugins/mathformula/index.ts +0 -295
  184. package/src/plugins/panel/index.ts +0 -228
  185. package/tsconfig.json +0 -31
  186. package/tsconfig.node.json +0 -11
  187. /package/src/{plugins/attachment → components}/insertAttachment/insertAttachment.less +0 -0
  188. /package/src/{plugins/mathformula → components}/insertMathformula/insertMathformula.less +0 -0
  189. /package/src/{plugins/mathformula → components}/insertMathformula/insertMathformula.vue +0 -0
  190. /package/src/{components → editify}/menu/menu.less +0 -0
@@ -24,16 +24,18 @@
24
24
  </div>
25
25
  </template>
26
26
  <script setup lang="ts">
27
- import { file as DapFile } from 'dap-util'
28
27
  import { computed, inject, ref, watch } from 'vue'
28
+ import { file as DapFile } from 'dap-util'
29
29
  import { ObjectType } from '@/core/tool'
30
- import Icon from '@/components/icon/icon.vue'
30
+ import { Icon } from '@/components/icon'
31
31
  import { InsertAttachmentProps } from './props'
32
32
 
33
33
  defineOptions({
34
34
  name: 'InsertAttachment'
35
35
  })
36
+ //属性
36
37
  const props = defineProps(InsertAttachmentProps)
38
+ //事件
37
39
  const emits = defineEmits(['change', 'insert'])
38
40
 
39
41
  const $editTrans = inject<(key: string) => any>('$editTrans')!
@@ -5,7 +5,7 @@ export type InsertAttachmentUploadErrorType = 'suffixError' | 'maxSizeError' | '
5
5
  export const InsertAttachmentProps = {
6
6
  //主题色
7
7
  color: {
8
- type: String as PropType<string | null>,
8
+ type: String,
9
9
  default: ''
10
10
  },
11
11
  //可选择的文件类型
@@ -0,0 +1,5 @@
1
+ import InsertImage from './insertImage.vue'
2
+
3
+ export type * from './props'
4
+
5
+ export { InsertImage }
@@ -20,10 +20,10 @@
20
20
  </div>
21
21
  </template>
22
22
  <script setup lang="ts">
23
- import { file as DapFile } from 'dap-util'
24
23
  import { computed, inject, ref, watch } from 'vue'
25
- import Icon from '@/components/icon/icon.vue'
24
+ import { file as DapFile } from 'dap-util'
26
25
  import { ObjectType } from '@/core/tool'
26
+ import { Icon } from '@/components/icon'
27
27
  import { InsertImageProps } from './props'
28
28
 
29
29
  defineOptions({
@@ -61,12 +61,12 @@ const getSuffix = (file: File) => {
61
61
  //输入框获取焦点
62
62
  const handleInputFocus = (e: Event) => {
63
63
  if (props.color) {
64
- ;(<HTMLInputElement>e.currentTarget).style.borderColor = props.color
64
+ ;(e.currentTarget as HTMLInputElement).style.borderColor = props.color
65
65
  }
66
66
  }
67
67
  //输入框失去焦点
68
68
  const handleInputBlur = (e: Event) => {
69
- ;(<HTMLInputElement>e.currentTarget).style.borderColor = ''
69
+ ;(e.currentTarget as HTMLInputElement).style.borderColor = ''
70
70
  }
71
71
  //插入网络图片
72
72
  const insertRemoteImage = () => {
@@ -74,7 +74,7 @@ const insertRemoteImage = () => {
74
74
  }
75
75
  //选择文件
76
76
  const selectFile = async (e: Event) => {
77
- const inputEle = <HTMLInputElement>e.currentTarget
77
+ const inputEle = e.currentTarget as HTMLInputElement
78
78
  const files = inputEle.files
79
79
  if (!files || !files.length) {
80
80
  return
@@ -5,7 +5,7 @@ export type InsertImageUploadErrorType = 'suffixError' | 'maxSizeError' | 'minSi
5
5
  export const InsertImageProps = {
6
6
  //主题色
7
7
  color: {
8
- type: String as PropType<string | null>,
8
+ type: String,
9
9
  default: ''
10
10
  },
11
11
  //支持的图片类型数组
@@ -0,0 +1,5 @@
1
+ import InsertLink from './insertLink.vue'
2
+
3
+ export type * from './props'
4
+
5
+ export { InsertLink }
@@ -1,8 +1,8 @@
1
1
  <template>
2
2
  <div class="editify-link">
3
3
  <div class="editify-link-label">{{ $editTrans('linkAddress') }}</div>
4
- <input @focus="handleInputFocus" @blur="handleInputBlur" :placeholder="$editTrans('linkTextEnterPlaceholder')" v-model.trim="linkText" type="text" />
5
- <input @focus="handleInputFocus" @blur="handleInputBlur" :placeholder="$editTrans('linkUrlEnterPlaceholder')" v-model.trim="linkUrl" type="url" />
4
+ <input @focus="handleInputFocus" @blur="handleInputBlur" :placeholder="$editTrans('linkTextEnterPlaceholder')" v-model.trim="text" type="text" />
5
+ <input @focus="handleInputFocus" @blur="handleInputBlur" :placeholder="$editTrans('linkUrlEnterPlaceholder')" v-model.trim="url" type="url" />
6
6
  <div class="editify-link-footer">
7
7
  <Checkbox v-model="newOpen" :label="$editTrans('newWindowOpen')" :color="color" :size="10"></Checkbox>
8
8
  <div class="editify-link-operations">
@@ -13,7 +13,7 @@
13
13
  </template>
14
14
  <script setup lang="ts">
15
15
  import { inject, ref, watch } from 'vue'
16
- import Checkbox from '@/components/checkbox/checkbox.vue'
16
+ import { Checkbox } from '@/components/checkbox'
17
17
  import { InsertLinkProps } from './props'
18
18
 
19
19
  defineOptions({
@@ -25,16 +25,16 @@ const emits = defineEmits(['insert'])
25
25
  const $editTrans = inject<(key: string) => any>('$editTrans')!
26
26
 
27
27
  //链接地址
28
- const linkUrl = ref<string>('')
28
+ const url = ref<string>('')
29
29
  //链接文本
30
- const linkText = ref<string>('')
30
+ const text = ref<string>('')
31
31
  //是否新窗口打开
32
32
  const newOpen = ref<boolean>(false)
33
33
 
34
34
  watch(
35
- () => props.text,
35
+ () => props.presetText,
36
36
  newVal => {
37
- linkText.value = newVal
37
+ text.value = newVal || ''
38
38
  },
39
39
  {
40
40
  immediate: true
@@ -43,16 +43,16 @@ watch(
43
43
  //输入框获取焦点
44
44
  const handleInputFocus = (e: Event) => {
45
45
  if (props.color) {
46
- ;(<HTMLInputElement>e.currentTarget).style.borderColor = props.color
46
+ ;(e.currentTarget as HTMLInputElement).style.borderColor = props.color
47
47
  }
48
48
  }
49
49
  //输入框失去焦点
50
50
  const handleInputBlur = (e: Event) => {
51
- ;(<HTMLInputElement>e.currentTarget).style.borderColor = ''
51
+ ;(e.currentTarget as HTMLInputElement).style.borderColor = ''
52
52
  }
53
53
  //插入链接
54
54
  const insertLink = () => {
55
- emits('insert', linkText.value, linkUrl.value, newOpen.value)
55
+ emits('insert', text.value, url.value, newOpen.value)
56
56
  }
57
57
  </script>
58
58
  <style scoped src="./insertLink.less"></style>
@@ -1,13 +1,13 @@
1
- import { ExtractPublicPropTypes, PropType } from 'vue'
1
+ import { ExtractPublicPropTypes } from 'vue'
2
2
 
3
3
  export const InsertLinkProps = {
4
4
  //主题色
5
5
  color: {
6
- type: String as PropType<string | null>,
6
+ type: String,
7
7
  default: ''
8
8
  },
9
9
  //预置的链接文本值
10
- text: {
10
+ presetText: {
11
11
  type: String,
12
12
  default: ''
13
13
  }
@@ -0,0 +1,5 @@
1
+ import InsertMathformula from './insertMathformula.vue'
2
+
3
+ export type * from './props'
4
+
5
+ export { InsertMathformula }
@@ -1,9 +1,9 @@
1
- import { ExtractPublicPropTypes, PropType } from 'vue'
1
+ import { ExtractPublicPropTypes } from 'vue'
2
2
 
3
3
  export const InsertMathformulaProps = {
4
4
  //主题色
5
5
  color: {
6
- type: String as PropType<string | null>,
6
+ type: String,
7
7
  default: ''
8
8
  },
9
9
  //预置的LaTex文本内容
@@ -0,0 +1,5 @@
1
+ import InsertTable from './insertTable.vue'
2
+
3
+ export type * from './props'
4
+
5
+ export { InsertTable }
@@ -1,4 +1,4 @@
1
- import { ExtractPublicPropTypes, PropType } from 'vue'
1
+ import { ExtractPublicPropTypes } from 'vue'
2
2
 
3
3
  export type InsertTableGridType = {
4
4
  x: number
@@ -9,7 +9,7 @@ export type InsertTableGridType = {
9
9
  export const InsertTableProps = {
10
10
  //主题色
11
11
  color: {
12
- type: String as PropType<string | null>,
12
+ type: String,
13
13
  default: ''
14
14
  },
15
15
  //最大行数
@@ -0,0 +1,5 @@
1
+ import InsertVideo from './insertVideo.vue'
2
+
3
+ export type * from './props'
4
+
5
+ export { InsertVideo }
@@ -20,10 +20,10 @@
20
20
  </div>
21
21
  </template>
22
22
  <script setup lang="ts">
23
- import { file as DapFile } from 'dap-util'
24
23
  import { computed, inject, ref, watch } from 'vue'
24
+ import { file as DapFile } from 'dap-util'
25
25
  import { ObjectType } from '@/core/tool'
26
- import Icon from '@/components/icon/icon.vue'
26
+ import { Icon } from '@/components/icon'
27
27
  import { InsertVideoProps } from './props'
28
28
 
29
29
  defineOptions({
@@ -5,7 +5,7 @@ export type InsertVideoUploadErrorType = 'suffixError' | 'maxSizeError' | 'minSi
5
5
  export const InsertVideoProps = {
6
6
  //主题色
7
7
  color: {
8
- type: String as PropType<string | null>,
8
+ type: String,
9
9
  default: ''
10
10
  },
11
11
  //支持的视频类型数组
@@ -0,0 +1,5 @@
1
+ import Layer from './layer.vue'
2
+
3
+ export type * from './props'
4
+
5
+ export { Layer }
@@ -1,6 +1,6 @@
1
1
  <template>
2
2
  <Teleport to="body">
3
- <Transition :name="animation ? 'editify-layer-' + animation : 'editify-layer'" @enter="handleEnter" @after-enter="el => emits('shown', el)" @after-leave="el => emits('hidden', el)">
3
+ <Transition :name="animation ? 'editify-layer-' + animation : 'editify-layer'" @enter="handleEnter" @after-enter="(el:Element) => emits('shown', el)" @after-leave="(el:Element) => emits('hidden', el)">
4
4
  <div v-if="modelValue" class="editify-layer" :data-editify-placement="realPlacement || null" :style="{ zIndex: zIndex }" ref="elRef">
5
5
  <Triangle v-if="showTriangle" :color="border && borderColor ? borderColor : background" :background="background" :placement="triPlacement" ref="triangleRef" />
6
6
  <div ref="wrapRef" class="editify-layer-wrap" :class="{ 'editify-border': border }" :style="wrapStyle">
@@ -11,11 +11,10 @@
11
11
  </Teleport>
12
12
  </template>
13
13
  <script setup lang="ts">
14
- import { computed, getCurrentInstance, nextTick, onBeforeUnmount, onMounted, ref } from 'vue'
14
+ import { computed, getCurrentInstance, nextTick, onBeforeUnmount, onMounted, ref, watch } from 'vue'
15
15
  import { element as DapElement, event as DapEvent } from 'dap-util'
16
- import Triangle from '@/components/triangle/triangle.vue'
17
- import { TrianglePlacementType } from '@/components/triangle/props'
18
16
  import { ObjectType } from '@/core/tool'
17
+ import { Triangle, TrianglePlacementType } from '@/components/triangle'
19
18
  import { LayerPlacementType, LayerProps } from './props'
20
19
 
21
20
  defineOptions({
@@ -572,6 +571,30 @@ const handleResize = () => {
572
571
  emits('update:modelValue', false)
573
572
  }
574
573
  }
574
+ //有元素滚动
575
+ const handleScroll = () => {
576
+ const setScroll = (el: HTMLElement) => {
577
+ DapEvent.on(el, `scroll.editify_layer_${instance.uid}`, () => {
578
+ if (props.modelValue) {
579
+ emits('update:modelValue', false)
580
+ }
581
+ })
582
+ if (el.parentNode) {
583
+ setScroll(el.parentNode as HTMLElement)
584
+ }
585
+ }
586
+ setScroll(getNode()! || getScrollNode()!)
587
+ }
588
+ //移除上述滚动事件的监听
589
+ const removeScrollHandle = () => {
590
+ const removeScroll = (el: HTMLElement) => {
591
+ DapEvent.off(el, `scroll.editify_layer_${instance.uid}`)
592
+ if (el.parentNode) {
593
+ removeScroll(el.parentNode as HTMLElement)
594
+ }
595
+ }
596
+ removeScroll(getNode()! || getScrollNode()!)
597
+ }
575
598
  //点击定位元素和自身以外的元素关闭浮层
576
599
  const handleClick = (e: Event) => {
577
600
  if (!DapElement.isElement(elRef.value)) {
@@ -595,6 +618,20 @@ const handleClick = (e: Event) => {
595
618
  }
596
619
  }
597
620
 
621
+ watch(
622
+ () => props.modelValue,
623
+ newVal => {
624
+ if (newVal) {
625
+ nextTick(() => {
626
+ handleScroll()
627
+ })
628
+ }
629
+ },
630
+ {
631
+ immediate: true
632
+ }
633
+ )
634
+
598
635
  onMounted(() => {
599
636
  if (props.modelValue) {
600
637
  setPosition()
@@ -604,6 +641,7 @@ onMounted(() => {
604
641
  })
605
642
 
606
643
  onBeforeUnmount(() => {
644
+ removeScrollHandle()
607
645
  DapEvent.off(window, `mousedown.editify_layer_${instance.uid} resize.editify_layer_${instance.uid}`)
608
646
  })
609
647
 
@@ -0,0 +1,5 @@
1
+ import Tooltip from './tooltip.vue'
2
+
3
+ export type * from './props'
4
+
5
+ export { Tooltip }
@@ -8,7 +8,7 @@
8
8
  </template>
9
9
  <script setup lang="ts">
10
10
  import { ComputedRef, inject, ref } from 'vue'
11
- import Layer from '@/components/layer/layer.vue'
11
+ import { Layer } from '@/components/layer'
12
12
  import { TooltipProps } from './props'
13
13
 
14
14
  defineOptions({
@@ -0,0 +1,5 @@
1
+ import Triangle from './triangle.vue'
2
+
3
+ export type * from './props'
4
+
5
+ export { Triangle }
@@ -6,8 +6,8 @@
6
6
 
7
7
  <script setup lang="ts">
8
8
  import { computed } from 'vue'
9
- import { TriangleProps } from './props'
10
9
  import { ObjectType } from '@/core/tool'
10
+ import { TriangleProps } from './props'
11
11
 
12
12
  defineOptions({
13
13
  name: 'Triangle'
@@ -0,0 +1,5 @@
1
+ import UpdateLink from './updateLink.vue'
2
+
3
+ export type * from './props'
4
+
5
+ export { UpdateLink }
@@ -0,0 +1,21 @@
1
+ import { ExtractPublicPropTypes } from 'vue'
2
+
3
+ export const UpdateLinkProps = {
4
+ //主题色
5
+ color: {
6
+ type: String,
7
+ default: ''
8
+ },
9
+ //预置链接值
10
+ presetUrl: {
11
+ type: String,
12
+ default: ''
13
+ },
14
+ //预置是否新窗口打开
15
+ presetNewOpen: {
16
+ type: Boolean,
17
+ default: false
18
+ }
19
+ }
20
+
21
+ export type UpdateLinkPropsType = ExtractPublicPropTypes<typeof UpdateLinkProps>
@@ -1,20 +1,9 @@
1
- .editify-toolbar {
2
- display: flex;
3
- justify-content: flex-start;
4
- align-items: center;
5
- padding: 6px 10px;
6
-
7
- .editify-icon-rotate {
8
- transform: rotate(180deg);
9
- }
10
- }
11
-
12
- .editify-toolbar-link {
1
+ .editify-link {
13
2
  display: block;
14
3
  width: 280px;
15
4
  padding: 4px;
16
5
 
17
- .editify-toolbar-link-label {
6
+ .editify-link-label {
18
7
  display: block;
19
8
  text-align: left;
20
9
  margin-bottom: 10px;
@@ -46,14 +35,9 @@
46
35
  font-size: inherit;
47
36
  vertical-align: middle;
48
37
  }
49
-
50
- &[disabled] {
51
- background-color: transparent;
52
- opacity: 0.6;
53
- }
54
38
  }
55
39
 
56
- .editify-toolbar-link-footer {
40
+ .editify-link-footer {
57
41
  display: flex;
58
42
  justify-content: space-between;
59
43
  align-items: center;
@@ -61,7 +45,7 @@
61
45
  font-size: var(--editify-font-size);
62
46
  color: var(--editify-font-color-light);
63
47
 
64
- .editify-toolbar-link-operations {
48
+ .editify-link-operations {
65
49
  display: flex;
66
50
  justify-content: flex-start;
67
51
  align-items: center;
@@ -0,0 +1,74 @@
1
+ <template>
2
+ <div class="editify-link">
3
+ <div class="editify-link-label">{{ $editTrans('linkAddress') }}</div>
4
+ <input @change="modifyLink" @focus="handleInputFocus" @blur="handleInputBlur" :placeholder="$editTrans('linkUrlEnterPlaceholder')" v-model.trim="url" type="url" />
5
+ <div class="editify-link-footer">
6
+ <Checkbox @change="modifyLink" v-model="newOpen" :label="$editTrans('newWindowOpen')" :color="color" :size="10"></Checkbox>
7
+ <div class="editify-link-operations">
8
+ <span @click="removeLink">{{ $editTrans('removeLink') }}</span>
9
+ <a :href="url" target="_blank" :style="{ color: color || '' }">{{ $editTrans('viewLink') }}</a>
10
+ </div>
11
+ </div>
12
+ </div>
13
+ </template>
14
+ <script setup lang="ts">
15
+ import { inject, onBeforeUnmount, ref, watch } from 'vue'
16
+ import { Checkbox } from '@/components/checkbox'
17
+ import { UpdateLinkProps } from './props'
18
+
19
+ defineOptions({
20
+ name: 'UpdateLink'
21
+ })
22
+ const props = defineProps(UpdateLinkProps)
23
+ const emits = defineEmits(['remove', 'modify'])
24
+
25
+ const $editTrans = inject<(key: string) => any>('$editTrans')!
26
+
27
+ //链接地址
28
+ const url = ref<string>('')
29
+ //是否新窗口打开
30
+ const newOpen = ref<boolean>(false)
31
+
32
+ watch(
33
+ () => props.presetNewOpen,
34
+ newVal => {
35
+ newOpen.value = !!newVal
36
+ },
37
+ {
38
+ immediate: true
39
+ }
40
+ )
41
+ watch(
42
+ () => props.presetUrl,
43
+ newVal => {
44
+ url.value = newVal || ''
45
+ },
46
+ {
47
+ immediate: true
48
+ }
49
+ )
50
+ //输入框获取焦点
51
+ const handleInputFocus = (e: Event) => {
52
+ if (props.color) {
53
+ ;(e.currentTarget as HTMLInputElement).style.borderColor = props.color
54
+ }
55
+ }
56
+ //输入框失去焦点
57
+ const handleInputBlur = (e: Event) => {
58
+ ;(e.currentTarget as HTMLInputElement).style.borderColor = ''
59
+ }
60
+ //移除链接
61
+ const removeLink = () => {
62
+ emits('remove')
63
+ }
64
+ //修改链接
65
+ const modifyLink = () => {
66
+ emits('modify', url.value, newOpen.value)
67
+ }
68
+
69
+ //组件销毁前触发修改,解决组件销毁时change事件触发不了emits的问题
70
+ onBeforeUnmount(() => {
71
+ emits('modify', url.value, newOpen.value)
72
+ })
73
+ </script>
74
+ <style scoped src="./updateLink.less"></style>