vue-editify 0.2.17 → 0.2.19
Sign up to get free protection for your applications and to get access to all the features.
- package/examples/App.vue +4 -12
- package/lib/components/colors/colors.vue.d.ts +9 -0
- package/lib/components/colors/props.d.ts +4 -0
- package/lib/components/tooltip/tooltip.vue.d.ts +1 -1
- package/lib/core/function.d.ts +112 -64
- package/lib/core/rule.d.ts +23 -17
- package/lib/core/shortcut.d.ts +36 -0
- package/lib/core/tool.d.ts +12 -16
- package/lib/editify/editify.vue.d.ts +162 -15
- package/lib/editify/props.d.ts +1 -5
- package/lib/editify/toolbar/props.d.ts +1 -1
- package/lib/editify/toolbar/toolbar.vue.d.ts +3 -3
- package/lib/editify.es.js +13660 -12954
- package/lib/editify.umd.js +2 -2
- package/lib/feature/align.d.ts +0 -14
- package/lib/feature/heading.d.ts +0 -14
- package/lib/feature/lineHeight.d.ts +0 -14
- package/lib/feature/orderList.d.ts +1 -3
- package/lib/feature/task.d.ts +0 -14
- package/lib/feature/unorderList.d.ts +1 -3
- package/lib/index.d.ts +164 -17
- package/package.json +2 -2
- package/src/components/button/button.vue +3 -3
- package/src/components/checkbox/checkbox.vue +1 -1
- package/src/components/colors/colors.vue +4 -4
- package/src/components/colors/props.ts +6 -1
- package/src/components/insertAttachment/insertAttachment.vue +1 -1
- package/src/components/insertImage/insertImage.vue +1 -1
- package/src/components/insertLink/insertLink.vue +1 -1
- package/src/components/insertVideo/insertVideo.vue +1 -1
- package/src/components/layer/layer.vue +9 -3
- package/src/components/tooltip/tooltip.vue +1 -1
- package/src/components/updateLink/updateLink.vue +1 -1
- package/src/core/function.ts +873 -491
- package/src/core/rule.ts +86 -368
- package/src/core/shortcut.ts +386 -0
- package/src/core/tool.ts +111 -159
- package/src/css/var.less +0 -10
- package/src/editify/editify.less +85 -39
- package/src/editify/editify.vue +204 -88
- package/src/editify/menu/menu.vue +2 -3
- package/src/editify/props.ts +1 -6
- package/src/editify/toolbar/props.ts +2 -2
- package/src/editify/toolbar/toolbar.vue +12 -12
- package/src/feature/align.ts +2 -62
- package/src/feature/attachment.ts +14 -27
- package/src/feature/backColor.ts +2 -1
- package/src/feature/bold.ts +1 -1
- package/src/feature/code.ts +1 -1
- package/src/feature/codeBlock.ts +3 -3
- package/src/feature/fontFamily.ts +1 -1
- package/src/feature/fontSize.ts +1 -1
- package/src/feature/foreColor.ts +2 -1
- package/src/feature/formatClear.ts +1 -1
- package/src/feature/fullScreen.ts +1 -1
- package/src/feature/heading.ts +5 -76
- package/src/feature/image.ts +1 -1
- package/src/feature/indent.ts +1 -1
- package/src/feature/infoBlock.ts +6 -37
- package/src/feature/italic.ts +1 -1
- package/src/feature/lineHeight.ts +2 -78
- package/src/feature/link.ts +1 -1
- package/src/feature/mathformula.ts +4 -51
- package/src/feature/orderList.ts +168 -37
- package/src/feature/quote.ts +3 -3
- package/src/feature/redo.ts +1 -1
- package/src/feature/separator.ts +1 -1
- package/src/feature/sourceView.ts +1 -1
- package/src/feature/strikethrough.ts +1 -1
- package/src/feature/sub.ts +1 -1
- package/src/feature/super.ts +1 -1
- package/src/feature/table.ts +3 -3
- package/src/feature/task.ts +4 -58
- package/src/feature/underline.ts +1 -1
- package/src/feature/undo.ts +1 -1
- package/src/feature/unorderList.ts +108 -37
- package/src/feature/video.ts +1 -1
- package/src/icon/iconfont.css +39 -3
- package/src/icon/iconfont.ttf +0 -0
- package/src/icon/iconfont.woff +0 -0
- package/src/index.ts +13 -11
- package/src/locale/en_US.ts +109 -110
- package/src/locale/zh_CN.ts +11 -12
- package/lib/feature/panel.d.ts +0 -18
- package/src/feature/panel.ts +0 -107
package/src/feature/panel.ts
DELETED
@@ -1,107 +0,0 @@
|
|
1
|
-
import { defineComponent, h, inject, PropType, Ref } from 'vue'
|
2
|
-
import { AlexEditor, AlexElement, AlexElementsRangeType } from 'alex-editor'
|
3
|
-
import { Button } from '@/components/button'
|
4
|
-
import { MenuButtonType } from '@/core/tool'
|
5
|
-
import { Icon } from '@/components/icon'
|
6
|
-
import { hasMathformulaInRange, hasPanelInRange, hasTableInRange } from '@/core/function'
|
7
|
-
|
8
|
-
/**
|
9
|
-
* feature名称
|
10
|
-
*/
|
11
|
-
const FEATURE_NAME = 'panel'
|
12
|
-
|
13
|
-
/**
|
14
|
-
* 菜单栏 - 插入面板
|
15
|
-
*/
|
16
|
-
export const PanelMenuButton = defineComponent(
|
17
|
-
props => {
|
18
|
-
const editor = inject<Ref<AlexEditor>>('editor')!
|
19
|
-
const dataRangeCaches = inject<Ref<AlexElementsRangeType>>('dataRangeCaches')!
|
20
|
-
const $editTrans = inject<(key: string) => any>('$editTrans')!
|
21
|
-
const isSourceView = inject<Ref<boolean>>('isSourceView')!
|
22
|
-
|
23
|
-
return () => {
|
24
|
-
return props.config.show
|
25
|
-
? h(
|
26
|
-
Button,
|
27
|
-
{
|
28
|
-
name: FEATURE_NAME,
|
29
|
-
tooltip: props.tooltip,
|
30
|
-
color: props.color,
|
31
|
-
zIndex: props.zIndex,
|
32
|
-
title: $editTrans('insertPanel'),
|
33
|
-
leftBorder: props.config.leftBorder,
|
34
|
-
rightBorder: props.config.rightBorder,
|
35
|
-
active: false,
|
36
|
-
disabled: props.disabled || isSourceView.value || hasPanelInRange(editor.value, dataRangeCaches.value) || hasTableInRange(editor.value, dataRangeCaches.value) || hasMathformulaInRange(editor.value, dataRangeCaches.value) || props.config.disabled,
|
37
|
-
onOperate: () => {
|
38
|
-
const panelElement = AlexElement.create({
|
39
|
-
type: 'block',
|
40
|
-
parsedom: 'div',
|
41
|
-
marks: {
|
42
|
-
'data-editify-panel': 'true'
|
43
|
-
},
|
44
|
-
children: [
|
45
|
-
{
|
46
|
-
type: 'inblock',
|
47
|
-
parsedom: 'div',
|
48
|
-
behavior: 'block',
|
49
|
-
children: [
|
50
|
-
{
|
51
|
-
type: 'text',
|
52
|
-
textcontent: $editTrans('panelTitle')
|
53
|
-
}
|
54
|
-
]
|
55
|
-
},
|
56
|
-
{
|
57
|
-
type: 'inblock',
|
58
|
-
parsedom: 'div',
|
59
|
-
behavior: 'block',
|
60
|
-
children: [
|
61
|
-
{
|
62
|
-
type: 'text',
|
63
|
-
textcontent: $editTrans('panelContent')
|
64
|
-
}
|
65
|
-
]
|
66
|
-
}
|
67
|
-
]
|
68
|
-
})
|
69
|
-
editor.value.insertElement(panelElement)
|
70
|
-
//面板后面插入段落
|
71
|
-
const paragraph = AlexElement.create({
|
72
|
-
type: 'block',
|
73
|
-
parsedom: AlexElement.BLOCK_NODE,
|
74
|
-
children: [
|
75
|
-
{
|
76
|
-
type: 'closed',
|
77
|
-
parsedom: 'br'
|
78
|
-
}
|
79
|
-
]
|
80
|
-
})
|
81
|
-
editor.value.addElementAfter(paragraph, panelElement)
|
82
|
-
//移动光标到新插入的元素
|
83
|
-
editor.value.range!.anchor.moveToEnd(panelElement.children![0])
|
84
|
-
editor.value.range!.focus.moveToEnd(panelElement.children![0])
|
85
|
-
//渲染
|
86
|
-
editor.value.domRender()
|
87
|
-
editor.value.rangeRender()
|
88
|
-
}
|
89
|
-
},
|
90
|
-
{
|
91
|
-
default: () => h(Icon, { value: 'panel' })
|
92
|
-
}
|
93
|
-
)
|
94
|
-
: null
|
95
|
-
}
|
96
|
-
},
|
97
|
-
{
|
98
|
-
name: `_${FEATURE_NAME}`,
|
99
|
-
props: {
|
100
|
-
color: String,
|
101
|
-
zIndex: Number,
|
102
|
-
config: Object as PropType<MenuButtonType>,
|
103
|
-
tooltip: Boolean,
|
104
|
-
disabled: Boolean
|
105
|
-
}
|
106
|
-
}
|
107
|
-
)
|