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.
Files changed (85) hide show
  1. package/examples/App.vue +4 -12
  2. package/lib/components/colors/colors.vue.d.ts +9 -0
  3. package/lib/components/colors/props.d.ts +4 -0
  4. package/lib/components/tooltip/tooltip.vue.d.ts +1 -1
  5. package/lib/core/function.d.ts +112 -64
  6. package/lib/core/rule.d.ts +23 -17
  7. package/lib/core/shortcut.d.ts +36 -0
  8. package/lib/core/tool.d.ts +12 -16
  9. package/lib/editify/editify.vue.d.ts +162 -15
  10. package/lib/editify/props.d.ts +1 -5
  11. package/lib/editify/toolbar/props.d.ts +1 -1
  12. package/lib/editify/toolbar/toolbar.vue.d.ts +3 -3
  13. package/lib/editify.es.js +13660 -12954
  14. package/lib/editify.umd.js +2 -2
  15. package/lib/feature/align.d.ts +0 -14
  16. package/lib/feature/heading.d.ts +0 -14
  17. package/lib/feature/lineHeight.d.ts +0 -14
  18. package/lib/feature/orderList.d.ts +1 -3
  19. package/lib/feature/task.d.ts +0 -14
  20. package/lib/feature/unorderList.d.ts +1 -3
  21. package/lib/index.d.ts +164 -17
  22. package/package.json +2 -2
  23. package/src/components/button/button.vue +3 -3
  24. package/src/components/checkbox/checkbox.vue +1 -1
  25. package/src/components/colors/colors.vue +4 -4
  26. package/src/components/colors/props.ts +6 -1
  27. package/src/components/insertAttachment/insertAttachment.vue +1 -1
  28. package/src/components/insertImage/insertImage.vue +1 -1
  29. package/src/components/insertLink/insertLink.vue +1 -1
  30. package/src/components/insertVideo/insertVideo.vue +1 -1
  31. package/src/components/layer/layer.vue +9 -3
  32. package/src/components/tooltip/tooltip.vue +1 -1
  33. package/src/components/updateLink/updateLink.vue +1 -1
  34. package/src/core/function.ts +873 -491
  35. package/src/core/rule.ts +86 -368
  36. package/src/core/shortcut.ts +386 -0
  37. package/src/core/tool.ts +111 -159
  38. package/src/css/var.less +0 -10
  39. package/src/editify/editify.less +85 -39
  40. package/src/editify/editify.vue +204 -88
  41. package/src/editify/menu/menu.vue +2 -3
  42. package/src/editify/props.ts +1 -6
  43. package/src/editify/toolbar/props.ts +2 -2
  44. package/src/editify/toolbar/toolbar.vue +12 -12
  45. package/src/feature/align.ts +2 -62
  46. package/src/feature/attachment.ts +14 -27
  47. package/src/feature/backColor.ts +2 -1
  48. package/src/feature/bold.ts +1 -1
  49. package/src/feature/code.ts +1 -1
  50. package/src/feature/codeBlock.ts +3 -3
  51. package/src/feature/fontFamily.ts +1 -1
  52. package/src/feature/fontSize.ts +1 -1
  53. package/src/feature/foreColor.ts +2 -1
  54. package/src/feature/formatClear.ts +1 -1
  55. package/src/feature/fullScreen.ts +1 -1
  56. package/src/feature/heading.ts +5 -76
  57. package/src/feature/image.ts +1 -1
  58. package/src/feature/indent.ts +1 -1
  59. package/src/feature/infoBlock.ts +6 -37
  60. package/src/feature/italic.ts +1 -1
  61. package/src/feature/lineHeight.ts +2 -78
  62. package/src/feature/link.ts +1 -1
  63. package/src/feature/mathformula.ts +4 -51
  64. package/src/feature/orderList.ts +168 -37
  65. package/src/feature/quote.ts +3 -3
  66. package/src/feature/redo.ts +1 -1
  67. package/src/feature/separator.ts +1 -1
  68. package/src/feature/sourceView.ts +1 -1
  69. package/src/feature/strikethrough.ts +1 -1
  70. package/src/feature/sub.ts +1 -1
  71. package/src/feature/super.ts +1 -1
  72. package/src/feature/table.ts +3 -3
  73. package/src/feature/task.ts +4 -58
  74. package/src/feature/underline.ts +1 -1
  75. package/src/feature/undo.ts +1 -1
  76. package/src/feature/unorderList.ts +108 -37
  77. package/src/feature/video.ts +1 -1
  78. package/src/icon/iconfont.css +39 -3
  79. package/src/icon/iconfont.ttf +0 -0
  80. package/src/icon/iconfont.woff +0 -0
  81. package/src/index.ts +13 -11
  82. package/src/locale/en_US.ts +109 -110
  83. package/src/locale/zh_CN.ts +11 -12
  84. package/lib/feature/panel.d.ts +0 -18
  85. package/src/feature/panel.ts +0 -107
@@ -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
- )