vue-editify 0.2.20 → 0.2.22
Sign up to get free protection for your applications and to get access to all the features.
- 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/examples/App.vue
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
<template>
|
2
2
|
<div style="height: 100%">
|
3
|
-
<Editify :dark="dark" ref="editifyRef" border v-model="val" :menu="menuConfig" placeholder="Please Enter Text..." :toolbar="toolbarConfig" locale="zh_CN"
|
3
|
+
<Editify :dark="dark" ref="editifyRef" border v-model="val" :menu="menuConfig" placeholder="Please Enter Text..." :toolbar="toolbarConfig" locale="zh_CN" show-word-length></Editify>
|
4
4
|
</div>
|
5
5
|
</template>
|
6
6
|
<script setup lang="ts">
|
@@ -22,7 +22,11 @@ const menuConfig = ref({
|
|
22
22
|
sourceView: {
|
23
23
|
show: true
|
24
24
|
},
|
25
|
-
heading: {
|
25
|
+
heading: {
|
26
|
+
shortcut: {
|
27
|
+
operation: null
|
28
|
+
}
|
29
|
+
},
|
26
30
|
fullScreen: {
|
27
31
|
show: true
|
28
32
|
},
|
@@ -49,6 +53,11 @@ const menuConfig = ref({
|
|
49
53
|
default: () => h('span', dark.value ? '深色模式' : '浅色模式'),
|
50
54
|
onOperate: () => {
|
51
55
|
dark.value = !dark.value
|
56
|
+
},
|
57
|
+
shortcut: {
|
58
|
+
title: 'Command + ]',
|
59
|
+
define: event => event.key == ']' && event.metaKey,
|
60
|
+
useDefault: true
|
52
61
|
}
|
53
62
|
}
|
54
63
|
}
|
@@ -57,7 +66,7 @@ const toolbarConfig = ref({
|
|
57
66
|
use: true,
|
58
67
|
text: {}
|
59
68
|
})
|
60
|
-
const val = ref<string>(`<p
|
69
|
+
const val = ref<string>(`<p><br/></p>`)
|
61
70
|
</script>
|
62
71
|
<style lang="less">
|
63
72
|
html,
|
package/examples/test.html
CHANGED
@@ -1,32 +1,29 @@
|
|
1
1
|
<!DOCTYPE html>
|
2
2
|
<html lang="en">
|
3
|
+
<head>
|
4
|
+
<meta charset="UTF-8" />
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
6
|
+
<title>Document</title>
|
7
|
+
<script src="../node_modules/vue/dist/vue.global.prod.js"></script>
|
8
|
+
<script src="../lib/editify.umd.js"></script>
|
9
|
+
</head>
|
3
10
|
|
4
|
-
<
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
value: '<p><br></p>'
|
24
|
-
}
|
25
|
-
}
|
26
|
-
})
|
27
|
-
console.log(editify.version)
|
28
|
-
app.use(editify)
|
29
|
-
app.mount('#app')
|
30
|
-
</script>
|
31
|
-
|
32
|
-
</html>
|
11
|
+
<body>
|
12
|
+
<div id="app">
|
13
|
+
<editify v-model="value" placeholder="请输入"></editify>
|
14
|
+
</div>
|
15
|
+
</body>
|
16
|
+
<script>
|
17
|
+
const { createApp } = Vue
|
18
|
+
const app = createApp({
|
19
|
+
data() {
|
20
|
+
return {
|
21
|
+
value: '<p><br></p>'
|
22
|
+
}
|
23
|
+
}
|
24
|
+
})
|
25
|
+
console.log(editify.version)
|
26
|
+
app.use(editify)
|
27
|
+
app.mount('#app')
|
28
|
+
</script>
|
29
|
+
</html>
|
@@ -345,6 +345,7 @@ declare const __VLS_component: import('vue').DefineComponent<{
|
|
345
345
|
default?(_: {}): any;
|
346
346
|
};
|
347
347
|
}) | null>;
|
348
|
+
handleClick: () => void;
|
348
349
|
}, unknown, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
349
350
|
operate: (...args: any[]) => void;
|
350
351
|
layerShow: (...args: any[]) => void;
|
package/lib/core/tool.d.ts
CHANGED
@@ -23,7 +23,7 @@ export type ShortcutType = {
|
|
23
23
|
define: ((event: KeyboardEvent) => boolean | {
|
24
24
|
[code: string]: boolean;
|
25
25
|
}) | null;
|
26
|
-
operation
|
26
|
+
operation: ((editor: AlexEditor, dataRangeCaches: AlexElementsRangeType, isSourceView: Ref<boolean>, isFullScreen: Ref<boolean>, code?: string) => void) | null;
|
27
27
|
};
|
28
28
|
export interface MenuButtonType {
|
29
29
|
show?: boolean;
|
@@ -1,5 +1,9 @@
|
|
1
|
-
import { Ref } from 'vue';
|
1
|
+
import { Ref, ComponentPublicInstance } from 'vue';
|
2
|
+
import { Button } from '../../components/button';
|
2
3
|
|
4
|
+
type MenuItemComponentPublicInstance = ComponentPublicInstance & {
|
5
|
+
btnRef: InstanceType<typeof Button>;
|
6
|
+
};
|
3
7
|
declare const _default: import('vue').DefineComponent<{
|
4
8
|
config: {
|
5
9
|
type: import('vue').PropType<import('../../core/tool').MenuConfigType>;
|
@@ -15,6 +19,9 @@ declare const _default: import('vue').DefineComponent<{
|
|
15
19
|
};
|
16
20
|
}, {
|
17
21
|
height: Ref<number>;
|
22
|
+
menuItemRefs: Ref<{
|
23
|
+
[name: string]: MenuItemComponentPublicInstance;
|
24
|
+
}>;
|
18
25
|
}, unknown, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
|
19
26
|
config: {
|
20
27
|
type: import('vue').PropType<import('../../core/tool').MenuConfigType>;
|