vue-editify 0.2.10 → 0.2.12
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/lib/components/button/button.vue.d.ts +19 -2
- package/lib/components/layer/layer.vue.d.ts +10 -0
- package/lib/components/layer/props.d.ts +4 -0
- package/lib/components/toolbar/toolbar.vue.d.ts +283 -1
- package/lib/editify.es.js +87 -43
- package/lib/editify.umd.js +2 -2
- package/lib/index.d.ts +1 -1
- package/package.json +1 -1
- package/src/components/layer/layer.vue +12 -22
- package/src/components/layer/props.ts +7 -0
- package/src/components/toolbar/toolbar.vue +60 -13
- package/src/editify/editify.vue +6 -7
- package/src/index.ts +1 -1
- package/src/plugins/attachment/index.ts +1 -2
package/lib/index.d.ts
CHANGED
@@ -804,7 +804,7 @@ export type { MenuButtonType, MenuSelectButtonType, MenuDisplayButtonType, MenuI
|
|
804
804
|
export type { ElementMatchConfigType } from './core/function';
|
805
805
|
export { elementIsMatch, getMatchElementByElement, getMatchElementByRange, isList, isTask, elementIsInList, elementIsInTask, hasPreInRange, hasQuoteInRange, hasListInRange, hasTaskInRange, hasLinkInRange, hasTableInRange, hasImageInRange, hasVideoInRange, isRangeInQuote, isRangeInList, isRangeInTask, queryTextStyle, queryTextMark, getRangeText, setIndentIncrease, setIndentDecrease, setQuote, setAlign, setList, setTask, setTextStyle, setTextMark, removeTextStyle, removeTextMark, setLineHeight, insertLink, insertImage, insertVideo, insertTable, insertCodeBlock, insertSeparator } from './core/function';
|
806
806
|
declare const install: (app: App) => void;
|
807
|
-
declare const version = "0.2.
|
807
|
+
declare const version = "0.2.12";
|
808
808
|
export { AlexElement } from 'alex-editor';
|
809
809
|
export type { AttachmentOptionsType } from './plugins/attachment';
|
810
810
|
export type { InsertAttachmentUploadErrorType } from './plugins/attachment/insertAttachment/props';
|
package/package.json
CHANGED
@@ -29,8 +29,6 @@ const realPlacement = ref<LayerPlacementType | null>(null)
|
|
29
29
|
const wrapRef = ref<HTMLElement | null>(null)
|
30
30
|
const elRef = ref<HTMLElement | null>(null)
|
31
31
|
const triangleRef = ref<InstanceType<typeof Triangle> | null>(null)
|
32
|
-
const MOUSEDOWN = ref<boolean>(false)
|
33
|
-
const MOUSEMOVE = ref<boolean>(false)
|
34
32
|
|
35
33
|
//三角形位置
|
36
34
|
const triPlacement = computed<TrianglePlacementType>(() => {
|
@@ -576,19 +574,22 @@ const handleResize = () => {
|
|
576
574
|
}
|
577
575
|
//点击定位元素和自身以外的元素关闭浮层
|
578
576
|
const handleClick = (e: Event) => {
|
579
|
-
//如果鼠标移动了则不是点击事件
|
580
|
-
if (MOUSEMOVE.value) {
|
581
|
-
return
|
582
|
-
}
|
583
577
|
if (!DapElement.isElement(elRef.value)) {
|
584
578
|
return
|
585
579
|
}
|
580
|
+
//如果在浮层内点击,不用关闭
|
586
581
|
if (DapElement.isContains(elRef.value!, e.target as HTMLElement)) {
|
587
582
|
return
|
588
583
|
}
|
584
|
+
//如果在浮层关联的元素内点击,不用关闭
|
589
585
|
if (!props.useRange && getNode()! && DapElement.isContains(getNode()!, e.target as HTMLElement)) {
|
590
586
|
return
|
591
587
|
}
|
588
|
+
//如果在insideElement规定的元素内,不用关闭
|
589
|
+
if (props.insideElements.some(el => DapElement.isContains(el, e.target as HTMLElement))) {
|
590
|
+
return
|
591
|
+
}
|
592
|
+
|
592
593
|
if (props.modelValue) {
|
593
594
|
emits('update:modelValue', false)
|
594
595
|
}
|
@@ -598,28 +599,17 @@ onMounted(() => {
|
|
598
599
|
if (props.modelValue) {
|
599
600
|
setPosition()
|
600
601
|
}
|
601
|
-
DapEvent.on(window, `mousedown.editify_layer_${instance.uid}
|
602
|
-
if (e.type == 'mousedown') {
|
603
|
-
MOUSEDOWN.value = true
|
604
|
-
MOUSEMOVE.value = false
|
605
|
-
} else if (e.type == 'mousemove') {
|
606
|
-
if (MOUSEDOWN.value) {
|
607
|
-
MOUSEMOVE.value = true
|
608
|
-
}
|
609
|
-
} else if (e.type == 'mouseup') {
|
610
|
-
MOUSEDOWN.value = false
|
611
|
-
}
|
612
|
-
})
|
613
|
-
|
614
|
-
DapEvent.on(window, `click.editify_layer_${instance.uid}`, handleClick)
|
602
|
+
DapEvent.on(window, `mousedown.editify_layer_${instance.uid}`, handleClick)
|
615
603
|
DapEvent.on(window, `resize.editify_layer_${instance.uid}`, handleResize)
|
616
604
|
})
|
605
|
+
|
617
606
|
onBeforeUnmount(() => {
|
618
|
-
DapEvent.off(window, `
|
607
|
+
DapEvent.off(window, `mousedown.editify_layer_${instance.uid} resize.editify_layer_${instance.uid}`)
|
619
608
|
})
|
620
609
|
|
621
610
|
defineExpose({
|
622
|
-
setPosition
|
611
|
+
setPosition,
|
612
|
+
elRef
|
623
613
|
})
|
624
614
|
</script>
|
625
615
|
<style scoped src="./layer.less"></style>
|
@@ -1,5 +1,5 @@
|
|
1
1
|
<template>
|
2
|
-
<Layer v-model="show" ref="layerRef" :node="node" :scroll-node="scrollNode" border placement="bottom-start" @show="layerShow" :useRange="type == 'text'" :z-index="zIndex">
|
2
|
+
<Layer v-model="show" ref="layerRef" :node="node" :scroll-node="scrollNode" border placement="bottom-start" @show="layerShow" :useRange="type == 'text'" :z-index="zIndex" :inside-elements="insideElements">
|
3
3
|
<div class="editify-toolbar" ref="toolbarRef" :style="config.style">
|
4
4
|
<!-- 链接工具条 -->
|
5
5
|
<template v-if="type == 'link'">
|
@@ -131,14 +131,14 @@
|
|
131
131
|
<Icon value="text-wrap"></Icon>
|
132
132
|
</Button>
|
133
133
|
<!-- 代码块语言选择 -->
|
134
|
-
<Button v-if="languageConfig.show" name="languages" type="display" :title="$editTrans('selectLanguages')" :tooltip="config.tooltip" :leftBorder="languageConfig.leftBorder" :rightBorder="languageConfig.rightBorder" :display-config="languageConfig.displayConfig" :color="color" :active="languageConfig.active" :disabled="languageConfig.disabled" @operate="selectLanguage" :z-index="zIndex + 1"></Button>
|
134
|
+
<Button v-if="languageConfig.show" ref="languagesBtnRef" name="languages" type="display" :title="$editTrans('selectLanguages')" :tooltip="config.tooltip" :leftBorder="languageConfig.leftBorder" :rightBorder="languageConfig.rightBorder" :display-config="languageConfig.displayConfig" :color="color" :active="languageConfig.active" :disabled="languageConfig.disabled" @operate="selectLanguage" :z-index="zIndex + 1"></Button>
|
135
135
|
</template>
|
136
136
|
<!-- 文本工具条 -->
|
137
137
|
<template v-else-if="type == 'text'">
|
138
138
|
<!-- 设置段落和标题 -->
|
139
|
-
<Button v-if="headingConfig.show" name="heading" type="display" :title="$editTrans('heading')" :tooltip="config.tooltip" :display-config="headingConfig.displayConfig" :leftBorder="headingConfig.leftBorder" :rightBorder="headingConfig.rightBorder" :color="color" :active="headingConfig.active" :disabled="headingConfig.disabled" @operate="_setHeading" :z-index="zIndex + 1"></Button>
|
139
|
+
<Button v-if="headingConfig.show" ref="headingBtnRef" name="heading" type="display" :title="$editTrans('heading')" :tooltip="config.tooltip" :display-config="headingConfig.displayConfig" :leftBorder="headingConfig.leftBorder" :rightBorder="headingConfig.rightBorder" :color="color" :active="headingConfig.active" :disabled="headingConfig.disabled" @operate="_setHeading" :z-index="zIndex + 1"></Button>
|
140
140
|
<!-- 对齐方式 -->
|
141
|
-
<Button v-if="alignConfig.show" name="align" type="select" :title="$editTrans('align')" :tooltip="config.tooltip" :select-config="alignConfig.selectConfig" :leftBorder="alignConfig.leftBorder" :rightBorder="alignConfig.rightBorder" :color="color" :active="alignConfig.active" :disabled="alignConfig.disabled" @operate="_setAlign" :z-index="zIndex + 1">
|
141
|
+
<Button v-if="alignConfig.show" name="align" ref="alignBtnRef" type="select" :title="$editTrans('align')" :tooltip="config.tooltip" :select-config="alignConfig.selectConfig" :leftBorder="alignConfig.leftBorder" :rightBorder="alignConfig.rightBorder" :color="color" :active="alignConfig.active" :disabled="alignConfig.disabled" @operate="_setAlign" :z-index="zIndex + 1">
|
142
142
|
<Icon value="align-left"></Icon>
|
143
143
|
</Button>
|
144
144
|
<!-- 有序列表 -->
|
@@ -182,20 +182,20 @@
|
|
182
182
|
<Icon value="subscript"></Icon>
|
183
183
|
</Button>
|
184
184
|
<!-- 字号大小 -->
|
185
|
-
<Button v-if="fontSizeConfig.show" name="fontSize" type="display" :title="$editTrans('fontSize')" :tooltip="config.tooltip" :display-config="fontSizeConfig.displayConfig" :leftBorder="fontSizeConfig.leftBorder" :rightBorder="fontSizeConfig.rightBorder" :color="color" :active="fontSizeConfig.active" :disabled="fontSizeConfig.disabled" @operate="setFontSize" :z-index="zIndex + 1"></Button>
|
185
|
+
<Button v-if="fontSizeConfig.show" ref="fontSizeBtnRef" name="fontSize" type="display" :title="$editTrans('fontSize')" :tooltip="config.tooltip" :display-config="fontSizeConfig.displayConfig" :leftBorder="fontSizeConfig.leftBorder" :rightBorder="fontSizeConfig.rightBorder" :color="color" :active="fontSizeConfig.active" :disabled="fontSizeConfig.disabled" @operate="setFontSize" :z-index="zIndex + 1"></Button>
|
186
186
|
<!-- 字体 -->
|
187
|
-
<Button v-if="fontFamilyConfig.show" name="fontFamily" type="display" :title="$editTrans('fontFamily')" :tooltip="config.tooltip" :display-config="fontFamilyConfig.displayConfig" :leftBorder="fontFamilyConfig.leftBorder" :rightBorder="fontFamilyConfig.rightBorder" :color="color" :active="fontFamilyConfig.active" :disabled="fontFamilyConfig.disabled" @operate="setFontFamily" :z-index="zIndex + 1"></Button>
|
187
|
+
<Button v-if="fontFamilyConfig.show" ref="fontFamilyBtnRef" name="fontFamily" type="display" :title="$editTrans('fontFamily')" :tooltip="config.tooltip" :display-config="fontFamilyConfig.displayConfig" :leftBorder="fontFamilyConfig.leftBorder" :rightBorder="fontFamilyConfig.rightBorder" :color="color" :active="fontFamilyConfig.active" :disabled="fontFamilyConfig.disabled" @operate="setFontFamily" :z-index="zIndex + 1"></Button>
|
188
188
|
<!-- 行高 -->
|
189
|
-
<Button v-if="lineHeightConfig.show" name="lineHeight" type="display" :title="$editTrans('lineHeight')" :tooltip="config.tooltip" :display-config="lineHeightConfig.displayConfig" :leftBorder="lineHeightConfig.leftBorder" :rightBorder="lineHeightConfig.rightBorder" :color="color" :active="lineHeightConfig.active" :disabled="lineHeightConfig.disabled" @operate="_setLineHeight" :z-index="zIndex + 1"></Button>
|
189
|
+
<Button v-if="lineHeightConfig.show" ref="lineHeightBtnRef" name="lineHeight" type="display" :title="$editTrans('lineHeight')" :tooltip="config.tooltip" :display-config="lineHeightConfig.displayConfig" :leftBorder="lineHeightConfig.leftBorder" :rightBorder="lineHeightConfig.rightBorder" :color="color" :active="lineHeightConfig.active" :disabled="lineHeightConfig.disabled" @operate="_setLineHeight" :z-index="zIndex + 1"></Button>
|
190
190
|
<!-- 前景色 -->
|
191
|
-
<Button v-if="foreColorConfig.show" name="foreColor" type="select" :title="$editTrans('foreColor')" :tooltip="config.tooltip" :select-config="foreColorConfig.selectConfig" :leftBorder="foreColorConfig.leftBorder" :rightBorder="foreColorConfig.rightBorder" :color="color" :active="foreColorConfig.active" :disabled="foreColorConfig.disabled" hideScroll ref="
|
191
|
+
<Button v-if="foreColorConfig.show" name="foreColor" type="select" :title="$editTrans('foreColor')" :tooltip="config.tooltip" :select-config="foreColorConfig.selectConfig" :leftBorder="foreColorConfig.leftBorder" :rightBorder="foreColorConfig.rightBorder" :color="color" :active="foreColorConfig.active" :disabled="foreColorConfig.disabled" hideScroll ref="foreColorBtnRef" :z-index="zIndex + 1">
|
192
192
|
<Icon value="font-color"></Icon>
|
193
193
|
<template #layer="{ options }">
|
194
194
|
<Colors :tooltip="config.tooltip" :color="color" :value="foreColorConfig.value" @change="setForeColor" :data="options"></Colors>
|
195
195
|
</template>
|
196
196
|
</Button>
|
197
197
|
<!-- 背景色 -->
|
198
|
-
<Button v-if="backColorConfig.show" name="backColor" type="select" :title="$editTrans('backColor')" :tooltip="config.tooltip" :select-config="backColorConfig.selectConfig" :leftBorder="backColorConfig.leftBorder" :rightBorder="backColorConfig.rightBorder" :color="color" :active="backColorConfig.active" :disabled="backColorConfig.disabled" hideScroll ref="
|
198
|
+
<Button v-if="backColorConfig.show" name="backColor" type="select" :title="$editTrans('backColor')" :tooltip="config.tooltip" :select-config="backColorConfig.selectConfig" :leftBorder="backColorConfig.leftBorder" :rightBorder="backColorConfig.rightBorder" :color="color" :active="backColorConfig.active" :disabled="backColorConfig.disabled" hideScroll ref="backColorBtnRef" :z-index="zIndex + 1">
|
199
199
|
<Icon value="brush"></Icon>
|
200
200
|
<template #layer="{ options }">
|
201
201
|
<Colors :tooltip="config.tooltip" :color="color" :value="backColorConfig.value" @change="setBackColor" :data="options"></Colors>
|
@@ -235,8 +235,14 @@ const $editTrans = inject<(key: string) => any>('$editTrans')!
|
|
235
235
|
|
236
236
|
const layerRef = ref<InstanceType<typeof Layer> | null>(null)
|
237
237
|
const toolbarRef = ref<HTMLElement | null>(null)
|
238
|
-
const
|
239
|
-
const
|
238
|
+
const foreColorBtnRef = ref<InstanceType<typeof Button> | null>(null)
|
239
|
+
const backColorBtnRef = ref<InstanceType<typeof Button> | null>(null)
|
240
|
+
const languagesBtnRef = ref<InstanceType<typeof Button> | null>(null)
|
241
|
+
const headingBtnRef = ref<InstanceType<typeof Button> | null>(null)
|
242
|
+
const alignBtnRef = ref<InstanceType<typeof Button> | null>(null)
|
243
|
+
const fontSizeBtnRef = ref<InstanceType<typeof Button> | null>(null)
|
244
|
+
const fontFamilyBtnRef = ref<InstanceType<typeof Button> | null>(null)
|
245
|
+
const lineHeightBtnRef = ref<InstanceType<typeof Button> | null>(null)
|
240
246
|
|
241
247
|
//链接参数配置
|
242
248
|
const linkConfig = ref<ObjectType>({
|
@@ -622,6 +628,43 @@ const canMergeCells = computed<(type: 'left' | 'right' | 'up' | 'down') => boole
|
|
622
628
|
return false
|
623
629
|
}
|
624
630
|
})
|
631
|
+
//点击不关闭工具条浮层的元素(算在工具条浮层元素范围内)
|
632
|
+
const insideElements = computed<HTMLElement[]>(() => {
|
633
|
+
let elements: HTMLElement[] = []
|
634
|
+
//语言选择浮层元素
|
635
|
+
if (languagesBtnRef.value && languagesBtnRef.value.layerRef && languagesBtnRef.value.layerRef.elRef) {
|
636
|
+
elements.push(languagesBtnRef.value.layerRef.elRef)
|
637
|
+
}
|
638
|
+
//前景色选择浮层元素
|
639
|
+
if (foreColorBtnRef.value && foreColorBtnRef.value.layerRef && foreColorBtnRef.value.layerRef.elRef) {
|
640
|
+
elements.push(foreColorBtnRef.value.layerRef.elRef)
|
641
|
+
}
|
642
|
+
//背景色选择浮层元素
|
643
|
+
if (backColorBtnRef.value && backColorBtnRef.value.layerRef && backColorBtnRef.value.layerRef.elRef) {
|
644
|
+
elements.push(backColorBtnRef.value.layerRef.elRef)
|
645
|
+
}
|
646
|
+
//标题选择浮层元素
|
647
|
+
if (headingBtnRef.value && headingBtnRef.value.layerRef && headingBtnRef.value.layerRef.elRef) {
|
648
|
+
elements.push(headingBtnRef.value.layerRef.elRef)
|
649
|
+
}
|
650
|
+
//对齐方式选择浮层元素
|
651
|
+
if (alignBtnRef.value && alignBtnRef.value.layerRef && alignBtnRef.value.layerRef.elRef) {
|
652
|
+
elements.push(alignBtnRef.value.layerRef.elRef)
|
653
|
+
}
|
654
|
+
//字号选择浮层元素
|
655
|
+
if (fontSizeBtnRef.value && fontSizeBtnRef.value.layerRef && fontSizeBtnRef.value.layerRef.elRef) {
|
656
|
+
elements.push(fontSizeBtnRef.value.layerRef.elRef)
|
657
|
+
}
|
658
|
+
//字体选择浮层元素
|
659
|
+
if (fontFamilyBtnRef.value && fontFamilyBtnRef.value.layerRef && fontFamilyBtnRef.value.layerRef.elRef) {
|
660
|
+
elements.push(fontFamilyBtnRef.value.layerRef.elRef)
|
661
|
+
}
|
662
|
+
//行高选择浮层元素
|
663
|
+
if (lineHeightBtnRef.value && lineHeightBtnRef.value.layerRef && lineHeightBtnRef.value.layerRef.elRef) {
|
664
|
+
elements.push(lineHeightBtnRef.value.layerRef.elRef)
|
665
|
+
}
|
666
|
+
return elements
|
667
|
+
})
|
625
668
|
|
626
669
|
//输入框获取焦点
|
627
670
|
const handleInputFocus = (e: Event) => {
|
@@ -646,7 +689,7 @@ const setBackColor = (value: string) => {
|
|
646
689
|
setTextStyle(editor.value, dataRangeCaches.value, {
|
647
690
|
'background-color': value
|
648
691
|
})
|
649
|
-
|
692
|
+
backColorBtnRef.value!.show = false
|
650
693
|
editor.value.formatElementStack()
|
651
694
|
editor.value.domRender()
|
652
695
|
editor.value.rangeRender()
|
@@ -656,7 +699,7 @@ const setForeColor = (value: string) => {
|
|
656
699
|
setTextStyle(editor.value, dataRangeCaches.value, {
|
657
700
|
color: value
|
658
701
|
})
|
659
|
-
|
702
|
+
foreColorBtnRef.value!.show = false
|
660
703
|
editor.value.formatElementStack()
|
661
704
|
editor.value.domRender()
|
662
705
|
editor.value.rangeRender()
|
@@ -1626,5 +1669,9 @@ const layerShow = () => {
|
|
1626
1669
|
formatClearConfig.value.disabled = extraDisabled('formatClear')
|
1627
1670
|
}
|
1628
1671
|
}
|
1672
|
+
|
1673
|
+
defineExpose({
|
1674
|
+
layerRef
|
1675
|
+
})
|
1629
1676
|
</script>
|
1630
1677
|
<style scoped src="./toolbar.less"></style>
|
package/src/editify/editify.vue
CHANGED
@@ -27,7 +27,6 @@ import { parseList, orderdListHandle, commonElementHandle, tableThTdHandle, tabl
|
|
27
27
|
import { isTask, elementToParagraph, getMatchElementByRange, hasTableInRange, hasLinkInRange, hasPreInRange, hasImageInRange, hasVideoInRange } from '@/core/function'
|
28
28
|
import Toolbar from '@/components/toolbar/toolbar.vue'
|
29
29
|
import Menu from '@/components/menu/menu.vue'
|
30
|
-
import Layer from '@/components/layer/layer.vue'
|
31
30
|
import { trans } from '@/locale'
|
32
31
|
import { LanguagesItemType } from '@/hljs'
|
33
32
|
import { EditifyProps, EditifyResizeParamsType, EditifyToolbarOptionsType } from './props'
|
@@ -194,7 +193,7 @@ const handleToolbar = () => {
|
|
194
193
|
toolbarOptions.value.type = 'link'
|
195
194
|
toolbarOptions.value.node = `[data-editify-uid="${instance.uid}"] [data-editify-element="${link.key}"]`
|
196
195
|
if (toolbarOptions.value.show) {
|
197
|
-
|
196
|
+
toolbarRef.value!.layerRef!.setPosition()
|
198
197
|
} else {
|
199
198
|
toolbarOptions.value.show = true
|
200
199
|
}
|
@@ -204,7 +203,7 @@ const handleToolbar = () => {
|
|
204
203
|
toolbarOptions.value.type = 'image'
|
205
204
|
toolbarOptions.value.node = `[data-editify-uid="${instance.uid}"] [data-editify-element="${image.key}"]`
|
206
205
|
if (toolbarOptions.value.show) {
|
207
|
-
|
206
|
+
toolbarRef.value!.layerRef!.setPosition()
|
208
207
|
} else {
|
209
208
|
toolbarOptions.value.show = true
|
210
209
|
}
|
@@ -214,7 +213,7 @@ const handleToolbar = () => {
|
|
214
213
|
toolbarOptions.value.type = 'video'
|
215
214
|
toolbarOptions.value.node = `[data-editify-uid="${instance.uid}"] [data-editify-element="${video.key}"]`
|
216
215
|
if (toolbarOptions.value.show) {
|
217
|
-
|
216
|
+
toolbarRef.value!.layerRef!.setPosition()
|
218
217
|
} else {
|
219
218
|
toolbarOptions.value.show = true
|
220
219
|
}
|
@@ -224,7 +223,7 @@ const handleToolbar = () => {
|
|
224
223
|
toolbarOptions.value.type = 'table'
|
225
224
|
toolbarOptions.value.node = `[data-editify-uid="${instance.uid}"] [data-editify-element="${table.key}"]`
|
226
225
|
if (toolbarOptions.value.show) {
|
227
|
-
|
226
|
+
toolbarRef.value!.layerRef!.setPosition()
|
228
227
|
} else {
|
229
228
|
toolbarOptions.value.show = true
|
230
229
|
}
|
@@ -234,7 +233,7 @@ const handleToolbar = () => {
|
|
234
233
|
toolbarOptions.value.type = 'codeBlock'
|
235
234
|
toolbarOptions.value.node = `[data-editify-uid="${instance.uid}"] [data-editify-element="${pre.key}"]`
|
236
235
|
if (toolbarOptions.value.show) {
|
237
|
-
|
236
|
+
toolbarRef.value!.layerRef!.setPosition()
|
238
237
|
} else {
|
239
238
|
toolbarOptions.value.show = true
|
240
239
|
}
|
@@ -247,7 +246,7 @@ const handleToolbar = () => {
|
|
247
246
|
if (result.length && !hasTableInRange(editor.value!, dataRangeCaches.value) && !hasPreInRange(editor.value!, dataRangeCaches.value) && !hasLinkInRange(editor.value!, dataRangeCaches.value) && !hasImageInRange(editor.value!, dataRangeCaches.value) && !hasVideoInRange(editor.value!, dataRangeCaches.value)) {
|
248
247
|
toolbarOptions.value.type = 'text'
|
249
248
|
if (toolbarOptions.value.show) {
|
250
|
-
|
249
|
+
toolbarRef.value!.layerRef!.setPosition()
|
251
250
|
} else {
|
252
251
|
toolbarOptions.value.show = true
|
253
252
|
}
|
package/src/index.ts
CHANGED
@@ -2,7 +2,6 @@ import { ComponentInternalInstance, h } from 'vue'
|
|
2
2
|
import { AlexEditor, AlexElement, AlexElementsRangeType } from 'alex-editor'
|
3
3
|
import { event as DapEvent, common as DapCommon } from 'dap-util'
|
4
4
|
import { ObjectType, PluginType } from '@/core/tool'
|
5
|
-
import Layer from '@/components/layer/layer.vue'
|
6
5
|
import Button from '@/components/button/button.vue'
|
7
6
|
import Icon from '@/components/icon/icon.vue'
|
8
7
|
import InsertAttachment from './insertAttachment/insertAttachment.vue'
|
@@ -114,7 +113,7 @@ export const attachment = (options?: AttachmentOptionsType) => {
|
|
114
113
|
customUpload: options!.customUpload,
|
115
114
|
handleError: options!.handleError,
|
116
115
|
onChange: () => {
|
117
|
-
|
116
|
+
btnInstance.layerRef!.setPosition()
|
118
117
|
},
|
119
118
|
onInsert: (name: string, urls: string[]) => {
|
120
119
|
//过滤掉空的地址
|