vue-editify 0.2.14 → 0.2.16
Sign up to get free protection for your applications and to get access to all the features.
- package/examples/App.vue +41 -88
- package/lib/components/button/button.vue.d.ts +62 -60
- package/lib/components/button/index.d.ts +4 -0
- package/lib/components/button/props.d.ts +12 -1
- package/lib/components/checkbox/checkbox.vue.d.ts +9 -9
- package/lib/components/checkbox/index.d.ts +4 -0
- package/lib/components/checkbox/props.d.ts +2 -2
- package/lib/components/colors/colors.vue.d.ts +4 -4
- package/lib/components/colors/index.d.ts +4 -0
- package/lib/components/colors/props.d.ts +2 -2
- package/lib/components/icon/index.d.ts +4 -0
- package/lib/components/insertAttachment/index.d.ts +4 -0
- package/lib/{plugins/attachment → components}/insertAttachment/insertAttachment.vue.d.ts +3 -3
- package/lib/{plugins/attachment → components}/insertAttachment/props.d.ts +1 -1
- package/lib/components/insertImage/index.d.ts +4 -0
- package/lib/components/insertImage/insertImage.vue.d.ts +3 -3
- package/lib/components/insertImage/props.d.ts +1 -1
- package/lib/components/insertLink/index.d.ts +4 -0
- package/lib/components/insertLink/insertLink.vue.d.ts +6 -6
- package/lib/components/insertLink/props.d.ts +3 -3
- package/lib/components/insertMathformula/index.d.ts +4 -0
- package/lib/{plugins/mathformula → components}/insertMathformula/insertMathformula.vue.d.ts +3 -3
- package/lib/{plugins/mathformula → components}/insertMathformula/props.d.ts +2 -2
- package/lib/components/insertTable/index.d.ts +4 -0
- package/lib/components/insertTable/insertTable.vue.d.ts +3 -3
- package/lib/components/insertTable/props.d.ts +2 -2
- package/lib/components/insertVideo/index.d.ts +4 -0
- package/lib/components/insertVideo/insertVideo.vue.d.ts +3 -3
- package/lib/components/insertVideo/props.d.ts +1 -1
- package/lib/components/layer/index.d.ts +4 -0
- package/lib/components/layer/layer.vue.d.ts +10 -8
- package/lib/components/tooltip/index.d.ts +4 -0
- package/lib/components/tooltip/tooltip.vue.d.ts +6 -4
- package/lib/components/triangle/index.d.ts +4 -0
- package/lib/components/triangle/triangle.vue.d.ts +1 -1
- package/lib/components/updateLink/index.d.ts +4 -0
- package/lib/components/updateLink/props.d.ts +17 -0
- package/lib/components/updateLink/updateLink.vue.d.ts +38 -0
- package/lib/core/function.d.ts +113 -36
- package/lib/core/rule.d.ts +20 -0
- package/lib/core/tool.d.ts +36 -34
- package/lib/editify/editify.vue.d.ts +18 -28
- package/lib/editify/menu/index.d.ts +4 -0
- package/lib/{components → editify}/menu/menu.vue.d.ts +3 -4
- package/lib/{components → editify}/menu/props.d.ts +1 -1
- package/lib/editify/props.d.ts +3 -7
- package/lib/editify/toolbar/index.d.ts +4 -0
- package/lib/{components → editify}/toolbar/props.d.ts +2 -2
- package/lib/{components → editify}/toolbar/toolbar.vue.d.ts +53 -53
- package/lib/editify.es.js +38964 -37727
- package/lib/editify.umd.js +2 -2
- package/lib/feature/align.d.ts +32 -0
- package/lib/feature/attachment.d.ts +18 -0
- package/lib/feature/backColor.d.ts +32 -0
- package/lib/feature/bold.d.ts +32 -0
- package/lib/feature/code.d.ts +32 -0
- package/lib/feature/codeBlock.d.ts +32 -0
- package/lib/feature/fontFamily.d.ts +32 -0
- package/lib/feature/fontSize.d.ts +32 -0
- package/lib/feature/foreColor.d.ts +32 -0
- package/lib/feature/formatClear.d.ts +32 -0
- package/lib/feature/fullScreen.d.ts +18 -0
- package/lib/feature/heading.d.ts +32 -0
- package/lib/feature/image.d.ts +32 -0
- package/lib/feature/indent.d.ts +18 -0
- package/lib/feature/infoBlock.d.ts +18 -0
- package/lib/feature/italic.d.ts +32 -0
- package/lib/feature/lineHeight.d.ts +32 -0
- package/lib/feature/link.d.ts +26 -0
- package/lib/feature/mathformula.d.ts +22 -0
- package/lib/feature/orderList.d.ts +32 -0
- package/lib/feature/panel.d.ts +18 -0
- package/lib/feature/quote.d.ts +18 -0
- package/lib/feature/redo.d.ts +18 -0
- package/lib/feature/separator.d.ts +18 -0
- package/lib/feature/sourceView.d.ts +18 -0
- package/lib/feature/strikethrough.d.ts +32 -0
- package/lib/feature/sub.d.ts +32 -0
- package/lib/feature/super.d.ts +32 -0
- package/lib/feature/table.d.ts +32 -0
- package/lib/feature/task.d.ts +32 -0
- package/lib/feature/underline.d.ts +32 -0
- package/lib/feature/undo.d.ts +18 -0
- package/lib/feature/unorderList.d.ts +32 -0
- package/lib/feature/video.d.ts +38 -0
- package/lib/index.d.ts +194 -202
- package/package.json +5 -5
- package/src/components/button/button.vue +21 -24
- package/src/components/button/index.ts +5 -0
- package/src/components/button/props.ts +14 -1
- package/src/components/checkbox/checkbox.vue +1 -1
- package/src/components/checkbox/index.ts +5 -0
- package/src/components/checkbox/props.ts +1 -1
- package/src/components/colors/colors.vue +3 -3
- package/src/components/colors/index.ts +5 -0
- package/src/components/colors/props.ts +2 -2
- package/src/components/icon/index.ts +5 -0
- package/src/components/insertAttachment/index.ts +5 -0
- package/src/{plugins/attachment → components}/insertAttachment/insertAttachment.vue +4 -2
- package/src/{plugins/attachment → components}/insertAttachment/props.ts +1 -1
- package/src/components/insertImage/index.ts +5 -0
- package/src/components/insertImage/insertImage.vue +5 -5
- package/src/components/insertImage/props.ts +1 -1
- package/src/components/insertLink/index.ts +5 -0
- package/src/components/insertLink/insertLink.vue +10 -10
- package/src/components/insertLink/props.ts +3 -3
- package/src/components/insertMathformula/index.ts +5 -0
- package/src/{plugins/mathformula → components}/insertMathformula/props.ts +2 -2
- package/src/components/insertTable/index.ts +5 -0
- package/src/components/insertTable/props.ts +2 -2
- package/src/components/insertVideo/index.ts +5 -0
- package/src/components/insertVideo/insertVideo.vue +2 -2
- package/src/components/insertVideo/props.ts +1 -1
- package/src/components/layer/index.ts +5 -0
- package/src/components/layer/layer.vue +42 -4
- package/src/components/tooltip/index.ts +5 -0
- package/src/components/tooltip/tooltip.vue +1 -1
- package/src/components/triangle/index.ts +5 -0
- package/src/components/triangle/triangle.vue +1 -1
- package/src/components/updateLink/index.ts +5 -0
- package/src/components/updateLink/props.ts +21 -0
- package/src/components/{toolbar/toolbar.less → updateLink/updateLink.less} +4 -20
- package/src/components/updateLink/updateLink.vue +74 -0
- package/src/core/function.ts +289 -97
- package/src/core/rule.ts +108 -29
- package/src/core/tool.ts +237 -81
- package/src/editify/editify.less +4 -0
- package/src/editify/editify.vue +183 -194
- package/src/editify/menu/index.ts +5 -0
- package/src/editify/menu/menu.vue +215 -0
- package/src/{components → editify}/menu/props.ts +1 -1
- package/src/editify/props.ts +7 -11
- package/src/editify/toolbar/index.ts +5 -0
- package/src/{components → editify}/toolbar/props.ts +1 -1
- package/src/editify/toolbar/toolbar.less +10 -0
- package/src/editify/toolbar/toolbar.vue +103 -0
- package/src/feature/align.ts +126 -0
- package/src/feature/attachment.ts +108 -0
- package/src/feature/backColor.ts +169 -0
- package/src/feature/bold.ts +134 -0
- package/src/feature/code.ts +134 -0
- package/src/feature/codeBlock.ts +201 -0
- package/src/feature/fontFamily.ts +138 -0
- package/src/feature/fontSize.ts +140 -0
- package/src/feature/foreColor.ts +171 -0
- package/src/feature/formatClear.ts +116 -0
- package/src/feature/fullScreen.ts +57 -0
- package/src/feature/heading.ts +152 -0
- package/src/feature/image.ts +222 -0
- package/src/feature/indent.ts +72 -0
- package/src/feature/infoBlock.ts +93 -0
- package/src/feature/italic.ts +134 -0
- package/src/feature/lineHeight.ts +163 -0
- package/src/feature/link.ts +146 -0
- package/src/feature/mathformula.ts +146 -0
- package/src/feature/orderList.ts +114 -0
- package/src/feature/panel.ts +107 -0
- package/src/feature/quote.ts +60 -0
- package/src/feature/redo.ts +56 -0
- package/src/feature/separator.ts +61 -0
- package/src/feature/sourceView.ts +59 -0
- package/src/feature/strikethrough.ts +134 -0
- package/src/feature/sub.ts +134 -0
- package/src/feature/super.ts +134 -0
- package/src/feature/table.ts +981 -0
- package/src/feature/task.ts +114 -0
- package/src/feature/underline.ts +134 -0
- package/src/feature/undo.ts +56 -0
- package/src/feature/unorderList.ts +114 -0
- package/src/feature/video.ts +335 -0
- package/src/hljs/index.ts +1 -1
- package/src/index.ts +82 -25
- package/src/locale/en_US.ts +3 -3
- package/src/locale/zh_CN.ts +3 -3
- package/lib/plugins/attachment/index.d.ts +0 -37
- package/lib/plugins/infoBlock/index.d.ts +0 -55
- package/lib/plugins/mathformula/index.d.ts +0 -49
- package/lib/plugins/panel/index.d.ts +0 -48
- package/src/components/menu/menu.vue +0 -1655
- package/src/components/toolbar/toolbar.vue +0 -1677
- package/src/plugins/attachment/index.ts +0 -237
- package/src/plugins/infoBlock/index.ts +0 -238
- package/src/plugins/mathformula/index.ts +0 -295
- package/src/plugins/panel/index.ts +0 -228
- package/tsconfig.json +0 -31
- package/tsconfig.node.json +0 -11
- /package/src/{plugins/attachment → components}/insertAttachment/insertAttachment.less +0 -0
- /package/src/{plugins/mathformula → components}/insertMathformula/insertMathformula.less +0 -0
- /package/src/{plugins/mathformula → components}/insertMathformula/insertMathformula.vue +0 -0
- /package/src/{components → editify}/menu/menu.less +0 -0
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "vue-editify",
|
3
|
-
"version": "0.2.
|
3
|
+
"version": "0.2.16",
|
4
4
|
"private": false,
|
5
5
|
"sideEffects": [
|
6
6
|
"*.css"
|
@@ -17,7 +17,7 @@
|
|
17
17
|
"lib": "vue-tsc && vite build"
|
18
18
|
},
|
19
19
|
"dependencies": {
|
20
|
-
"alex-editor": "^1.4.
|
20
|
+
"alex-editor": "^1.4.24",
|
21
21
|
"dap-util": "^1.5.8",
|
22
22
|
"highlight.js": "^11.8.0",
|
23
23
|
"katex": "^0.16.10",
|
@@ -29,11 +29,11 @@
|
|
29
29
|
"@vitejs/plugin-vue": "^5.0.4",
|
30
30
|
"less": "^3.0.4",
|
31
31
|
"terser": "^5.16.9",
|
32
|
-
"typescript": "^5.
|
32
|
+
"typescript": "^5.5.3",
|
33
33
|
"vite": "^5.2.8",
|
34
34
|
"vite-plugin-css-injected-by-js": "^3.5.1",
|
35
|
-
"vite-plugin-dts": "^3.
|
36
|
-
"vue-tsc": "^
|
35
|
+
"vite-plugin-dts": "^3.9.1",
|
36
|
+
"vue-tsc": "^2.0.26"
|
37
37
|
},
|
38
38
|
"browserslist": [
|
39
39
|
"> 1%",
|
@@ -30,11 +30,11 @@
|
|
30
30
|
<script setup lang="ts">
|
31
31
|
import { computed, ref } from 'vue'
|
32
32
|
import { common as DapCommon, color as DapColor } from 'dap-util'
|
33
|
-
import Tooltip from '@/components/tooltip/tooltip.vue'
|
34
|
-
import Layer from '@/components/layer/layer.vue'
|
35
|
-
import Icon from '@/components/icon/icon.vue'
|
36
33
|
import { ObjectType } from '@/core/tool'
|
37
|
-
import {
|
34
|
+
import { Tooltip } from '@/components/tooltip'
|
35
|
+
import { Layer } from '@/components/layer'
|
36
|
+
import { Icon } from '@/components/icon'
|
37
|
+
import { ButtonOptionsItemType, ButtonParseDisplayConfigType, ButtonParseSelectConfigType, ButtonProps } from './props'
|
38
38
|
|
39
39
|
defineOptions({
|
40
40
|
name: 'Button'
|
@@ -50,7 +50,7 @@ const btnRef = ref<HTMLElement | null>(null)
|
|
50
50
|
const layerRef = ref<InstanceType<typeof Layer> | null>(null)
|
51
51
|
|
52
52
|
//处理后的select配置
|
53
|
-
const parseSelectConfig = computed<
|
53
|
+
const parseSelectConfig = computed<ButtonParseSelectConfigType>(() => {
|
54
54
|
let options: ButtonOptionsItemType[] = []
|
55
55
|
let width: number | '' = ''
|
56
56
|
let maxHeight: number | '' = ''
|
@@ -59,15 +59,15 @@ const parseSelectConfig = computed<ButtonSelectConfigType>(() => {
|
|
59
59
|
options = props.selectConfig.options.map(item => {
|
60
60
|
if (DapCommon.isObject(item)) {
|
61
61
|
return {
|
62
|
-
label: (
|
63
|
-
value: (
|
64
|
-
icon: (
|
65
|
-
style: (
|
62
|
+
label: (item as ButtonOptionsItemType).label,
|
63
|
+
value: (item as ButtonOptionsItemType).value,
|
64
|
+
icon: (item as ButtonOptionsItemType).icon,
|
65
|
+
style: (item as ButtonOptionsItemType).style
|
66
66
|
}
|
67
67
|
}
|
68
68
|
return {
|
69
|
-
label:
|
70
|
-
value:
|
69
|
+
label: item as string | number,
|
70
|
+
value: item as string | number
|
71
71
|
}
|
72
72
|
})
|
73
73
|
}
|
@@ -85,7 +85,7 @@ const parseSelectConfig = computed<ButtonSelectConfigType>(() => {
|
|
85
85
|
}
|
86
86
|
})
|
87
87
|
//处理后的display配置
|
88
|
-
const parseDisplayConfig = computed<
|
88
|
+
const parseDisplayConfig = computed<ButtonParseDisplayConfigType>(() => {
|
89
89
|
let options: ButtonOptionsItemType[] = []
|
90
90
|
let width: number | '' = ''
|
91
91
|
let maxHeight: number | '' = ''
|
@@ -98,15 +98,15 @@ const parseDisplayConfig = computed<ButtonDisplayConfigType>(() => {
|
|
98
98
|
options = props.displayConfig.options.map(item => {
|
99
99
|
if (DapCommon.isObject(item)) {
|
100
100
|
return {
|
101
|
-
label: (
|
102
|
-
value: (
|
103
|
-
icon: (
|
104
|
-
style: (
|
101
|
+
label: (item as ButtonOptionsItemType).label,
|
102
|
+
value: (item as ButtonOptionsItemType).value,
|
103
|
+
icon: (item as ButtonOptionsItemType).icon,
|
104
|
+
style: (item as ButtonOptionsItemType).style
|
105
105
|
}
|
106
106
|
}
|
107
107
|
return {
|
108
|
-
label:
|
109
|
-
value:
|
108
|
+
label: item as string | number,
|
109
|
+
value: item as string | number
|
110
110
|
}
|
111
111
|
})
|
112
112
|
let optItem = options.find(item => {
|
@@ -132,11 +132,11 @@ const parseDisplayConfig = computed<ButtonDisplayConfigType>(() => {
|
|
132
132
|
})
|
133
133
|
//渲染的浮层列表数据
|
134
134
|
const cmpOptions = computed<ButtonOptionsItemType[]>(() => {
|
135
|
-
return props.type == 'select' ?
|
135
|
+
return props.type == 'select' ? parseSelectConfig.value.options! : parseDisplayConfig.value.options!
|
136
136
|
})
|
137
137
|
//显示在页面的value值对应的label
|
138
138
|
const displayLabel = computed<string | number>(() => {
|
139
|
-
const val =
|
139
|
+
const val = parseDisplayConfig.value.options!.find(item => {
|
140
140
|
return item.value == parseDisplayConfig.value.value
|
141
141
|
})
|
142
142
|
return val ? val.label! : ''
|
@@ -150,10 +150,7 @@ const parseColor = computed<number[]>(() => {
|
|
150
150
|
})
|
151
151
|
//按钮样式
|
152
152
|
const btnStyle = computed<ObjectType>(() => {
|
153
|
-
if (props.disabled) {
|
154
|
-
return {}
|
155
|
-
}
|
156
|
-
if (props.color) {
|
153
|
+
if (!props.disabled && props.color) {
|
157
154
|
//激活情况下和鼠标按下状态
|
158
155
|
if (props.active || status.value == 'down') {
|
159
156
|
return {
|
@@ -16,6 +16,12 @@ export type ButtonSelectConfigType = {
|
|
16
16
|
maxHeight?: number | ''
|
17
17
|
}
|
18
18
|
|
19
|
+
export type ButtonParseSelectConfigType = {
|
20
|
+
options?: ButtonOptionsItemType[]
|
21
|
+
width?: number | ''
|
22
|
+
maxHeight?: number | ''
|
23
|
+
}
|
24
|
+
|
19
25
|
export type ButtonDisplayConfigType = {
|
20
26
|
options?: (ButtonOptionsItemType | number | string)[]
|
21
27
|
width?: number | ''
|
@@ -23,6 +29,13 @@ export type ButtonDisplayConfigType = {
|
|
23
29
|
value?: string | number
|
24
30
|
}
|
25
31
|
|
32
|
+
export type ButtonParseDisplayConfigType = {
|
33
|
+
options?: ButtonOptionsItemType[]
|
34
|
+
width?: number | ''
|
35
|
+
maxHeight?: number | ''
|
36
|
+
value?: string | number
|
37
|
+
}
|
38
|
+
|
26
39
|
export const ButtonProps = {
|
27
40
|
//按钮类型
|
28
41
|
type: {
|
@@ -62,7 +75,7 @@ export const ButtonProps = {
|
|
62
75
|
},
|
63
76
|
//主题色,用于按钮悬浮颜色变化使用,仅支持十六进制
|
64
77
|
color: {
|
65
|
-
type: String
|
78
|
+
type: String,
|
66
79
|
default: ''
|
67
80
|
},
|
68
81
|
//是否禁用
|
@@ -12,7 +12,7 @@
|
|
12
12
|
<script setup lang="ts">
|
13
13
|
import { computed } from 'vue'
|
14
14
|
import { common as DapCommon } from 'dap-util'
|
15
|
-
import Icon from '@/components/icon
|
15
|
+
import { Icon } from '@/components/icon'
|
16
16
|
import { ObjectType } from '@/core/tool'
|
17
17
|
import { CheckboxProps } from './props'
|
18
18
|
|
@@ -15,9 +15,9 @@
|
|
15
15
|
</template>
|
16
16
|
<script setup lang="ts">
|
17
17
|
import { inject } from 'vue'
|
18
|
-
import Icon from '@/components/icon
|
19
|
-
import Tooltip from '@/components/tooltip
|
20
|
-
import { ButtonOptionsItemType } from '@/components/button
|
18
|
+
import { Icon } from '@/components/icon'
|
19
|
+
import { Tooltip } from '@/components/tooltip'
|
20
|
+
import { ButtonOptionsItemType } from '@/components/button'
|
21
21
|
import { ColorsProps } from './props'
|
22
22
|
|
23
23
|
defineOptions({
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { ExtractPublicPropTypes, PropType } from 'vue'
|
2
|
-
import { ButtonOptionsItemType } from '@/components/button
|
2
|
+
import { ButtonOptionsItemType } from '@/components/button'
|
3
3
|
|
4
4
|
export const ColorsProps = {
|
5
5
|
//颜色数组
|
@@ -16,7 +16,7 @@ export const ColorsProps = {
|
|
16
16
|
},
|
17
17
|
//激活状态颜色
|
18
18
|
color: {
|
19
|
-
type: String
|
19
|
+
type: String,
|
20
20
|
default: ''
|
21
21
|
},
|
22
22
|
//是否使用工具提示
|
@@ -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
|
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')!
|
@@ -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
|
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
|
-
;(
|
64
|
+
;(e.currentTarget as HTMLInputElement).style.borderColor = props.color
|
65
65
|
}
|
66
66
|
}
|
67
67
|
//输入框失去焦点
|
68
68
|
const handleInputBlur = (e: Event) => {
|
69
|
-
;(
|
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 =
|
77
|
+
const inputEle = e.currentTarget as HTMLInputElement
|
78
78
|
const files = inputEle.files
|
79
79
|
if (!files || !files.length) {
|
80
80
|
return
|
@@ -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="
|
5
|
-
<input @focus="handleInputFocus" @blur="handleInputBlur" :placeholder="$editTrans('linkUrlEnterPlaceholder')" v-model.trim="
|
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
|
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
|
28
|
+
const url = ref<string>('')
|
29
29
|
//链接文本
|
30
|
-
const
|
30
|
+
const text = ref<string>('')
|
31
31
|
//是否新窗口打开
|
32
32
|
const newOpen = ref<boolean>(false)
|
33
33
|
|
34
34
|
watch(
|
35
|
-
() => props.
|
35
|
+
() => props.presetText,
|
36
36
|
newVal => {
|
37
|
-
|
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
|
-
;(
|
46
|
+
;(e.currentTarget as HTMLInputElement).style.borderColor = props.color
|
47
47
|
}
|
48
48
|
}
|
49
49
|
//输入框失去焦点
|
50
50
|
const handleInputBlur = (e: Event) => {
|
51
|
-
;(
|
51
|
+
;(e.currentTarget as HTMLInputElement).style.borderColor = ''
|
52
52
|
}
|
53
53
|
//插入链接
|
54
54
|
const insertLink = () => {
|
55
|
-
emits('insert',
|
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
|
1
|
+
import { ExtractPublicPropTypes } from 'vue'
|
2
2
|
|
3
3
|
export const InsertLinkProps = {
|
4
4
|
//主题色
|
5
5
|
color: {
|
6
|
-
type: String
|
6
|
+
type: String,
|
7
7
|
default: ''
|
8
8
|
},
|
9
9
|
//预置的链接文本值
|
10
|
-
|
10
|
+
presetText: {
|
11
11
|
type: String,
|
12
12
|
default: ''
|
13
13
|
}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { ExtractPublicPropTypes
|
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
|
12
|
+
type: String,
|
13
13
|
default: ''
|
14
14
|
},
|
15
15
|
//最大行数
|
@@ -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
|
26
|
+
import { Icon } from '@/components/icon'
|
27
27
|
import { InsertVideoProps } from './props'
|
28
28
|
|
29
29
|
defineOptions({
|
@@ -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,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>
|