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.
Files changed (49) hide show
  1. package/examples/App.vue +12 -3
  2. package/examples/test.html +26 -29
  3. package/lib/components/button/button.vue.d.ts +1 -0
  4. package/lib/core/tool.d.ts +1 -1
  5. package/lib/editify/menu/menu.vue.d.ts +8 -1
  6. package/lib/editify.es.js +272 -250
  7. package/lib/editify.umd.js +2 -2
  8. package/lib/index.d.ts +1 -1
  9. package/package.json +2 -2
  10. package/src/components/button/button.vue +2 -1
  11. package/src/core/shortcut.ts +48 -201
  12. package/src/core/tool.ts +1 -1
  13. package/src/editify/editify.vue +20 -4
  14. package/src/editify/menu/menu.vue +15 -6
  15. package/src/editify/toolbar/toolbar.vue +1 -1
  16. package/src/feature/align.ts +9 -2
  17. package/src/feature/attachment.ts +5 -1
  18. package/src/feature/backColor.ts +7 -1
  19. package/src/feature/bold.ts +8 -1
  20. package/src/feature/code.ts +8 -1
  21. package/src/feature/codeBlock.ts +8 -1
  22. package/src/feature/fontFamily.ts +10 -1
  23. package/src/feature/fontSize.ts +8 -1
  24. package/src/feature/foreColor.ts +5 -1
  25. package/src/feature/formatClear.ts +8 -1
  26. package/src/feature/fullScreen.ts +9 -2
  27. package/src/feature/heading.ts +9 -2
  28. package/src/feature/image.ts +5 -1
  29. package/src/feature/indent.ts +9 -2
  30. package/src/feature/infoBlock.ts +9 -2
  31. package/src/feature/italic.ts +8 -1
  32. package/src/feature/lineHeight.ts +9 -2
  33. package/src/feature/link.ts +5 -1
  34. package/src/feature/mathformula.ts +5 -1
  35. package/src/feature/orderList.ts +9 -2
  36. package/src/feature/quote.ts +9 -2
  37. package/src/feature/redo.ts +9 -2
  38. package/src/feature/separator.ts +9 -2
  39. package/src/feature/sourceView.ts +9 -2
  40. package/src/feature/strikethrough.ts +8 -1
  41. package/src/feature/sub.ts +8 -1
  42. package/src/feature/super.ts +8 -1
  43. package/src/feature/table.ts +5 -1
  44. package/src/feature/task.ts +9 -2
  45. package/src/feature/underline.ts +8 -1
  46. package/src/feature/undo.ts +9 -2
  47. package/src/feature/unorderList.ts +9 -2
  48. package/src/feature/video.ts +5 -1
  49. 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" allow-paste-html show-word-length></Editify>
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>333</p>`)
69
+ const val = ref<string>(`<p><br/></p>`)
61
70
  </script>
62
71
  <style lang="less">
63
72
  html,
@@ -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
- <head>
5
- <meta charset="UTF-8">
6
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
7
- <title>Document</title>
8
- <link rel="stylesheet" href="../lib/style.css">
9
- <script src="../node_modules/vue/dist/vue.global.prod.js"></script>
10
- <script src="../lib/editify.umd.js"></script>
11
- </head>
12
-
13
- <body>
14
- <div id="app">
15
- <editify v-model="value" placeholder="请输入"></editify>
16
- </div>
17
- </body>
18
- <script>
19
- const { createApp } = Vue
20
- const app = createApp({
21
- data() {
22
- return {
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;
@@ -23,7 +23,7 @@ export type ShortcutType = {
23
23
  define: ((event: KeyboardEvent) => boolean | {
24
24
  [code: string]: boolean;
25
25
  }) | null;
26
- operation?: (editor: AlexEditor, dataRangeCaches: AlexElementsRangeType, isSourceView: Ref<boolean>, isFullScreen: Ref<boolean>, code?: string) => void;
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>;