vue-editify 0.2.20 → 0.2.22
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/examples/App.vue +12 -3
- package/examples/test.html +26 -29
- package/lib/components/button/button.vue.d.ts +1 -0
- package/lib/core/tool.d.ts +1 -1
- package/lib/editify/menu/menu.vue.d.ts +8 -1
- package/lib/editify.es.js +272 -250
- package/lib/editify.umd.js +2 -2
- package/lib/index.d.ts +1 -1
- package/package.json +2 -2
- package/src/components/button/button.vue +2 -1
- package/src/core/shortcut.ts +48 -201
- package/src/core/tool.ts +1 -1
- package/src/editify/editify.vue +20 -4
- package/src/editify/menu/menu.vue +15 -6
- package/src/editify/toolbar/toolbar.vue +1 -1
- package/src/feature/align.ts +9 -2
- package/src/feature/attachment.ts +5 -1
- package/src/feature/backColor.ts +7 -1
- package/src/feature/bold.ts +8 -1
- package/src/feature/code.ts +8 -1
- package/src/feature/codeBlock.ts +8 -1
- package/src/feature/fontFamily.ts +10 -1
- package/src/feature/fontSize.ts +8 -1
- package/src/feature/foreColor.ts +5 -1
- package/src/feature/formatClear.ts +8 -1
- package/src/feature/fullScreen.ts +9 -2
- package/src/feature/heading.ts +9 -2
- package/src/feature/image.ts +5 -1
- package/src/feature/indent.ts +9 -2
- package/src/feature/infoBlock.ts +9 -2
- package/src/feature/italic.ts +8 -1
- package/src/feature/lineHeight.ts +9 -2
- package/src/feature/link.ts +5 -1
- package/src/feature/mathformula.ts +5 -1
- package/src/feature/orderList.ts +9 -2
- package/src/feature/quote.ts +9 -2
- package/src/feature/redo.ts +9 -2
- package/src/feature/separator.ts +9 -2
- package/src/feature/sourceView.ts +9 -2
- package/src/feature/strikethrough.ts +8 -1
- package/src/feature/sub.ts +8 -1
- package/src/feature/super.ts +8 -1
- package/src/feature/table.ts +5 -1
- package/src/feature/task.ts +9 -2
- package/src/feature/underline.ts +8 -1
- package/src/feature/undo.ts +9 -2
- package/src/feature/unorderList.ts +9 -2
- package/src/feature/video.ts +5 -1
- package/src/index.ts +1 -1
package/src/feature/table.ts
CHANGED
@@ -920,7 +920,7 @@ export const TableToolbar = defineComponent(
|
|
920
920
|
* 菜单栏 - 插入表格
|
921
921
|
*/
|
922
922
|
export const TableMenuButton = defineComponent(
|
923
|
-
props => {
|
923
|
+
(props, { expose }) => {
|
924
924
|
const editor = inject<Ref<AlexEditor>>('editor')!
|
925
925
|
const dataRangeCaches = inject<Ref<AlexElementsRangeType>>('dataRangeCaches')!
|
926
926
|
const $editTrans = inject<(key: string) => any>('$editTrans')!
|
@@ -928,6 +928,10 @@ export const TableMenuButton = defineComponent(
|
|
928
928
|
|
929
929
|
const btnRef = ref<InstanceType<typeof Button> | null>(null)
|
930
930
|
|
931
|
+
expose({
|
932
|
+
btnRef
|
933
|
+
})
|
934
|
+
|
931
935
|
return () => {
|
932
936
|
return props.config.show
|
933
937
|
? h(
|
package/src/feature/task.ts
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import { defineComponent, h, inject, PropType, Ref } from 'vue'
|
1
|
+
import { defineComponent, h, inject, PropType, ref, Ref } from 'vue'
|
2
2
|
import { AlexElementsRangeType, AlexEditor } from 'alex-editor'
|
3
3
|
import { MenuButtonType } from '@/core/tool'
|
4
4
|
import { hasPreInRange, hasTableInRange, rangeIsInTask, setTask } from '@/core/function'
|
@@ -14,17 +14,24 @@ const FEATURE_NAME = 'task'
|
|
14
14
|
* 菜单栏 - 任务列表
|
15
15
|
*/
|
16
16
|
export const TaskMenuButton = defineComponent(
|
17
|
-
props => {
|
17
|
+
(props, { expose }) => {
|
18
18
|
const editor = inject<Ref<AlexEditor>>('editor')!
|
19
19
|
const dataRangeCaches = inject<Ref<AlexElementsRangeType>>('dataRangeCaches')!
|
20
20
|
const $editTrans = inject<(key: string) => any>('$editTrans')!
|
21
21
|
const isSourceView = inject<Ref<boolean>>('isSourceView')!
|
22
22
|
|
23
|
+
const btnRef = ref<InstanceType<typeof Button> | null>(null)
|
24
|
+
|
25
|
+
expose({
|
26
|
+
btnRef
|
27
|
+
})
|
28
|
+
|
23
29
|
return () => {
|
24
30
|
return props.config.show
|
25
31
|
? h(
|
26
32
|
Button,
|
27
33
|
{
|
34
|
+
ref: btnRef,
|
28
35
|
name: FEATURE_NAME,
|
29
36
|
tooltip: props.tooltip,
|
30
37
|
color: props.color,
|
package/src/feature/underline.ts
CHANGED
@@ -78,21 +78,28 @@ export const UnderlineToolbarButton = defineComponent(
|
|
78
78
|
* 菜单栏 - 下划线
|
79
79
|
*/
|
80
80
|
export const UnderlineMenuButton = defineComponent(
|
81
|
-
props => {
|
81
|
+
(props, { expose }) => {
|
82
82
|
const editor = inject<Ref<AlexEditor>>('editor')!
|
83
83
|
const dataRangeCaches = inject<Ref<AlexElementsRangeType>>('dataRangeCaches')!
|
84
84
|
const $editTrans = inject<(key: string) => any>('$editTrans')!
|
85
85
|
const isSourceView = inject<Ref<boolean>>('isSourceView')!
|
86
86
|
|
87
|
+
const btnRef = ref<InstanceType<typeof Button> | null>(null)
|
88
|
+
|
87
89
|
const active = computed<boolean>(() => {
|
88
90
|
return queryTextStyle(editor.value, dataRangeCaches.value, 'text-decoration', 'underline') || queryTextStyle(editor.value, dataRangeCaches.value, 'text-decoration-line', 'underline')
|
89
91
|
})
|
90
92
|
|
93
|
+
expose({
|
94
|
+
btnRef
|
95
|
+
})
|
96
|
+
|
91
97
|
return () => {
|
92
98
|
return props.config.show
|
93
99
|
? h(
|
94
100
|
Button,
|
95
101
|
{
|
102
|
+
ref: btnRef,
|
96
103
|
name: FEATURE_NAME,
|
97
104
|
tooltip: props.tooltip,
|
98
105
|
color: props.color,
|
package/src/feature/undo.ts
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import { defineComponent, h, inject, PropType, Ref } from 'vue'
|
1
|
+
import { defineComponent, h, inject, PropType, ref, Ref } from 'vue'
|
2
2
|
import { AlexEditor } from 'alex-editor'
|
3
3
|
import { Button } from '@/components/button'
|
4
4
|
import { MenuButtonType } from '@/core/tool'
|
@@ -13,18 +13,25 @@ const FEATURE_NAME = 'undo'
|
|
13
13
|
* 菜单栏 - 撤销
|
14
14
|
*/
|
15
15
|
export const UndoMenuButton = defineComponent(
|
16
|
-
props => {
|
16
|
+
(props, { expose }) => {
|
17
17
|
const editor = inject<Ref<AlexEditor>>('editor')!
|
18
18
|
const $editTrans = inject<(key: string) => any>('$editTrans')!
|
19
19
|
const isSourceView = inject<Ref<boolean>>('isSourceView')!
|
20
20
|
const rangeKey = inject<Ref<number | null>>('rangeKey')!
|
21
21
|
const undo = inject<() => void>('undo')!
|
22
22
|
|
23
|
+
const btnRef = ref<InstanceType<typeof Button> | null>(null)
|
24
|
+
|
25
|
+
expose({
|
26
|
+
btnRef
|
27
|
+
})
|
28
|
+
|
23
29
|
return () => {
|
24
30
|
return props.config.show
|
25
31
|
? h(
|
26
32
|
Button,
|
27
33
|
{
|
34
|
+
ref: btnRef,
|
28
35
|
name: FEATURE_NAME,
|
29
36
|
tooltip: props.tooltip,
|
30
37
|
color: props.color,
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { computed, defineComponent, h, inject, PropType, Ref } from 'vue'
|
1
|
+
import { computed, defineComponent, h, inject, PropType, ref, Ref } from 'vue'
|
2
2
|
import { AlexElementsRangeType, AlexEditor, AlexElement } from 'alex-editor'
|
3
3
|
import { MenuButtonType } from '@/core/tool'
|
4
4
|
import { elementIsList, getMatchElementByRange, hasPreInRange, hasTableInRange, rangeIsInList, setList } from '@/core/function'
|
@@ -139,17 +139,24 @@ export const UnorderListToolbar = defineComponent(
|
|
139
139
|
* 菜单栏 - 无序列表
|
140
140
|
*/
|
141
141
|
export const UnorderListMenuButton = defineComponent(
|
142
|
-
props => {
|
142
|
+
(props, { expose }) => {
|
143
143
|
const editor = inject<Ref<AlexEditor>>('editor')!
|
144
144
|
const dataRangeCaches = inject<Ref<AlexElementsRangeType>>('dataRangeCaches')!
|
145
145
|
const $editTrans = inject<(key: string) => any>('$editTrans')!
|
146
146
|
const isSourceView = inject<Ref<boolean>>('isSourceView')!
|
147
147
|
|
148
|
+
const btnRef = ref<InstanceType<typeof Button> | null>(null)
|
149
|
+
|
150
|
+
expose({
|
151
|
+
btnRef
|
152
|
+
})
|
153
|
+
|
148
154
|
return () => {
|
149
155
|
return props.config.show
|
150
156
|
? h(
|
151
157
|
Button,
|
152
158
|
{
|
159
|
+
ref: btnRef,
|
153
160
|
name: FEATURE_NAME,
|
154
161
|
tooltip: props.tooltip,
|
155
162
|
color: props.color,
|
package/src/feature/video.ts
CHANGED
@@ -258,7 +258,7 @@ export const VideoToolbar = defineComponent(
|
|
258
258
|
* 菜单栏 - 插入视频
|
259
259
|
*/
|
260
260
|
export const VideoMenuButton = defineComponent(
|
261
|
-
props => {
|
261
|
+
(props, { expose }) => {
|
262
262
|
const editor = inject<Ref<AlexEditor>>('editor')!
|
263
263
|
const dataRangeCaches = inject<Ref<AlexElementsRangeType>>('dataRangeCaches')!
|
264
264
|
const $editTrans = inject<(key: string) => any>('$editTrans')!
|
@@ -266,6 +266,10 @@ export const VideoMenuButton = defineComponent(
|
|
266
266
|
|
267
267
|
const btnRef = ref<InstanceType<typeof Button> | null>(null)
|
268
268
|
|
269
|
+
expose({
|
270
|
+
btnRef
|
271
|
+
})
|
272
|
+
|
269
273
|
return () => {
|
270
274
|
return props.config.show
|
271
275
|
? h(
|
package/src/index.ts
CHANGED