vue-editify 0.2.18 → 0.2.19

Sign up to get free protection for your applications and to get access to all the features.
Files changed (62) hide show
  1. package/examples/App.vue +3 -287
  2. package/lib/components/tooltip/tooltip.vue.d.ts +1 -1
  3. package/lib/core/function.d.ts +1 -28
  4. package/lib/core/shortcut.d.ts +36 -0
  5. package/lib/core/tool.d.ts +11 -3
  6. package/lib/editify/editify.vue.d.ts +152 -14
  7. package/lib/editify/props.d.ts +0 -4
  8. package/lib/editify/toolbar/toolbar.vue.d.ts +1 -1
  9. package/lib/editify.es.js +3530 -2665
  10. package/lib/editify.umd.js +2 -2
  11. package/lib/index.d.ts +154 -16
  12. package/package.json +2 -2
  13. package/src/core/function.ts +1 -105
  14. package/src/core/rule.ts +2 -2
  15. package/src/core/shortcut.ts +386 -0
  16. package/src/core/tool.ts +107 -49
  17. package/src/css/var.less +0 -10
  18. package/src/editify/editify.less +1 -29
  19. package/src/editify/editify.vue +89 -25
  20. package/src/editify/menu/menu.vue +2 -3
  21. package/src/editify/props.ts +0 -5
  22. package/src/feature/align.ts +1 -1
  23. package/src/feature/attachment.ts +1 -1
  24. package/src/feature/backColor.ts +1 -1
  25. package/src/feature/bold.ts +1 -1
  26. package/src/feature/code.ts +1 -1
  27. package/src/feature/codeBlock.ts +3 -3
  28. package/src/feature/fontFamily.ts +1 -1
  29. package/src/feature/fontSize.ts +1 -1
  30. package/src/feature/foreColor.ts +1 -1
  31. package/src/feature/formatClear.ts +1 -1
  32. package/src/feature/fullScreen.ts +1 -1
  33. package/src/feature/heading.ts +3 -3
  34. package/src/feature/image.ts +1 -1
  35. package/src/feature/indent.ts +1 -1
  36. package/src/feature/infoBlock.ts +3 -3
  37. package/src/feature/italic.ts +1 -1
  38. package/src/feature/lineHeight.ts +1 -1
  39. package/src/feature/link.ts +1 -1
  40. package/src/feature/mathformula.ts +1 -1
  41. package/src/feature/orderList.ts +3 -3
  42. package/src/feature/quote.ts +3 -3
  43. package/src/feature/redo.ts +1 -1
  44. package/src/feature/separator.ts +1 -1
  45. package/src/feature/sourceView.ts +1 -1
  46. package/src/feature/strikethrough.ts +1 -1
  47. package/src/feature/sub.ts +1 -1
  48. package/src/feature/super.ts +1 -1
  49. package/src/feature/table.ts +3 -3
  50. package/src/feature/task.ts +3 -3
  51. package/src/feature/underline.ts +1 -1
  52. package/src/feature/undo.ts +1 -1
  53. package/src/feature/unorderList.ts +3 -3
  54. package/src/feature/video.ts +1 -1
  55. package/src/icon/iconfont.css +4 -8
  56. package/src/icon/iconfont.ttf +0 -0
  57. package/src/icon/iconfont.woff +0 -0
  58. package/src/index.ts +2 -6
  59. package/src/locale/en_US.ts +0 -3
  60. package/src/locale/zh_CN.ts +0 -3
  61. package/lib/feature/panel.d.ts +0 -18
  62. package/src/feature/panel.ts +0 -62
@@ -127,7 +127,7 @@ export const BackColorMenuButton = defineComponent(
127
127
  options: props.config.options
128
128
  },
129
129
  hideScroll: true,
130
- title: $editTrans('backColor'),
130
+ title: `${$editTrans('backColor')}${props.config.shortcut?.title ? `【${props.config.shortcut?.title}】` : ''}`,
131
131
  leftBorder: props.config.leftBorder,
132
132
  rightBorder: props.config.rightBorder,
133
133
  active: false,
@@ -97,7 +97,7 @@ export const BoldMenuButton = defineComponent(
97
97
  tooltip: props.tooltip,
98
98
  color: props.color,
99
99
  zIndex: props.zIndex,
100
- title: $editTrans('bold'),
100
+ title: `${$editTrans('bold')}${props.config.shortcut?.title ? `【${props.config.shortcut?.title}】` : ''}`,
101
101
  leftBorder: props.config.leftBorder,
102
102
  rightBorder: props.config.rightBorder,
103
103
  active: active.value,
@@ -97,7 +97,7 @@ export const CodeMenuButton = defineComponent(
97
97
  tooltip: props.tooltip,
98
98
  color: props.color,
99
99
  zIndex: props.zIndex,
100
- title: $editTrans('code'),
100
+ title: `${$editTrans('code')}${props.config.shortcut?.title ? `【${props.config.shortcut?.title}】` : ''}`,
101
101
  leftBorder: props.config.leftBorder,
102
102
  rightBorder: props.config.rightBorder,
103
103
  active: active.value,
@@ -2,7 +2,7 @@ import { computed, defineComponent, h, inject, PropType, ref, Ref } from 'vue'
2
2
  import { AlexEditor, AlexElement, AlexElementsRangeType } from 'alex-editor'
3
3
  import { Button } from '@/components/button'
4
4
  import { Icon } from '@/components/icon'
5
- import { getMatchElementByRange, hasAttachmentInRange, hasImageInRange, hasMathformulaInRange, hasPanelInRange, hasTableInRange, hasVideoInRange, insertCodeBlock } from '@/core/function'
5
+ import { getMatchElementByRange, hasAttachmentInRange, hasImageInRange, hasMathformulaInRange, hasTableInRange, hasVideoInRange, insertCodeBlock } from '@/core/function'
6
6
  import { MenuButtonType, MenuDisplayButtonType } from '@/core/tool'
7
7
 
8
8
  /**
@@ -170,11 +170,11 @@ export const CodeBlockMenuButton = defineComponent(
170
170
  tooltip: props.tooltip,
171
171
  color: props.color,
172
172
  zIndex: props.zIndex,
173
- title: $editTrans('inserCodeBlock'),
173
+ title: `${$editTrans('inserCodeBlock')}${props.config.shortcut?.title ? `【${props.config.shortcut?.title}】` : ''}`,
174
174
  leftBorder: props.config.leftBorder,
175
175
  rightBorder: props.config.rightBorder,
176
176
  active: !!getMatchElementByRange(editor.value, dataRangeCaches.value, { parsedom: 'pre' }),
177
- disabled: props.disabled || isSourceView.value || hasTableInRange(editor.value, dataRangeCaches.value) || hasImageInRange(editor.value, dataRangeCaches.value) || hasVideoInRange(editor.value, dataRangeCaches.value) || hasAttachmentInRange(editor.value, dataRangeCaches.value) || hasMathformulaInRange(editor.value, dataRangeCaches.value) || hasPanelInRange(editor.value, dataRangeCaches.value) || props.config.disabled,
177
+ disabled: props.disabled || isSourceView.value || hasTableInRange(editor.value, dataRangeCaches.value) || hasImageInRange(editor.value, dataRangeCaches.value) || hasVideoInRange(editor.value, dataRangeCaches.value) || hasAttachmentInRange(editor.value, dataRangeCaches.value) || hasMathformulaInRange(editor.value, dataRangeCaches.value) || props.config.disabled,
178
178
  onOperate: () => {
179
179
  insertCodeBlock(editor.value, dataRangeCaches.value)
180
180
  editor.value.domRender()
@@ -109,7 +109,7 @@ export const FontFamilyMenuButton = defineComponent(
109
109
  width: props.config.width,
110
110
  maxHeight: props.config.maxHeight
111
111
  },
112
- title: $editTrans('fontFamily'),
112
+ title: `${$editTrans('fontFamily')}${props.config.shortcut?.title ? `【${props.config.shortcut?.title}】` : ''}`,
113
113
  leftBorder: props.config.leftBorder,
114
114
  rightBorder: props.config.rightBorder,
115
115
  active: false,
@@ -111,7 +111,7 @@ export const FontSizeMenuButton = defineComponent(
111
111
  width: props.config.width,
112
112
  maxHeight: props.config.maxHeight
113
113
  },
114
- title: $editTrans('fontSize'),
114
+ title: `${$editTrans('fontSize')}${props.config.shortcut?.title ? `【${props.config.shortcut?.title}】` : ''}`,
115
115
  leftBorder: props.config.leftBorder,
116
116
  rightBorder: props.config.rightBorder,
117
117
  disabled: props.disabled || isSourceView.value || hasPreInRange(editor.value, dataRangeCaches.value) || props.config.disabled,
@@ -129,7 +129,7 @@ export const ForeColorMenuButton = defineComponent(
129
129
  options: props.config.options
130
130
  },
131
131
  hideScroll: true,
132
- title: $editTrans('foreColor'),
132
+ title: `${$editTrans('foreColor')}${props.config.shortcut?.title ? `【${props.config.shortcut?.title}】` : ''}`,
133
133
  leftBorder: props.config.leftBorder,
134
134
  rightBorder: props.config.rightBorder,
135
135
  disabled: props.disabled || isSourceView.value || hasPreInRange(editor.value, dataRangeCaches.value) || props.config.disabled,
@@ -84,7 +84,7 @@ export const FormatClearMenuButton = defineComponent(
84
84
  tooltip: props.tooltip,
85
85
  color: props.color,
86
86
  zIndex: props.zIndex,
87
- title: $editTrans('formatClear'),
87
+ title: `${$editTrans('formatClear')}${props.config.shortcut?.title ? `【${props.config.shortcut?.title}】` : ''}`,
88
88
  leftBorder: props.config.leftBorder,
89
89
  rightBorder: props.config.rightBorder,
90
90
  active: false,
@@ -27,7 +27,7 @@ export const FullScreenMenuButton = defineComponent(
27
27
  tooltip: props.tooltip,
28
28
  color: props.color,
29
29
  zIndex: props.zIndex,
30
- title: $editTrans('fullScreen'),
30
+ title: `${$editTrans('fullScreen')}${props.config.shortcut?.title ? `【${props.config.shortcut?.title}】` : ''}`,
31
31
  leftBorder: props.config.leftBorder,
32
32
  rightBorder: props.config.rightBorder,
33
33
  active: isFullScreen.value,
@@ -2,7 +2,7 @@ import { computed, defineComponent, h, inject, PropType, Ref } from 'vue'
2
2
  import { AlexElementsRangeType, AlexEditor } from 'alex-editor'
3
3
  import { common as DapCommon } from 'dap-util'
4
4
  import { MenuDisplayButtonType } from '@/core/tool'
5
- import { hasPanelInRange, hasPreInRange, hasTableInRange, setHeading } from '@/core/function'
5
+ import { hasPreInRange, hasTableInRange, setHeading } from '@/core/function'
6
6
  import { Button, ButtonOptionsItemType } from '@/components/button'
7
7
 
8
8
  /**
@@ -54,11 +54,11 @@ export const HeadingMenuButton = defineComponent(
54
54
  width: props.config.width,
55
55
  maxHeight: props.config.maxHeight
56
56
  },
57
- title: $editTrans('heading'),
57
+ title: `${$editTrans('heading')}${props.config.shortcut?.title ? `【${props.config.shortcut?.title}】` : ''}`,
58
58
  leftBorder: props.config.leftBorder,
59
59
  rightBorder: props.config.rightBorder,
60
60
  active: false,
61
- disabled: props.disabled || isSourceView.value || hasPreInRange(editor.value, dataRangeCaches.value) || hasTableInRange(editor.value, dataRangeCaches.value) || hasPanelInRange(editor.value, dataRangeCaches.value) || props.config.disabled,
61
+ disabled: props.disabled || isSourceView.value || hasPreInRange(editor.value, dataRangeCaches.value) || hasTableInRange(editor.value, dataRangeCaches.value) || props.config.disabled,
62
62
  onOperate: (_name: string, val: string) => {
63
63
  setHeading(editor.value, dataRangeCaches.value, val)
64
64
  editor.value.domRender()
@@ -163,7 +163,7 @@ export const ImageMenuButton = defineComponent(
163
163
  zIndex: props.zIndex,
164
164
  type: 'select',
165
165
  hideScroll: true,
166
- title: $editTrans('insertImage'),
166
+ title: `${$editTrans('insertImage')}${props.config.shortcut?.title ? `【${props.config.shortcut?.title}】` : ''}`,
167
167
  leftBorder: props.config.leftBorder,
168
168
  rightBorder: props.config.rightBorder,
169
169
  active: false,
@@ -30,7 +30,7 @@ export const IndentMenuButton = defineComponent(
30
30
  color: props.color,
31
31
  zIndex: props.zIndex,
32
32
  type: 'select',
33
- title: $editTrans('indent'),
33
+ title: `${$editTrans('indent')}${props.config.shortcut?.title ? `【${props.config.shortcut?.title}】` : ''}`,
34
34
  selectConfig: {
35
35
  options: props.config.options,
36
36
  width: props.config.width,
@@ -3,7 +3,7 @@ import { AlexEditor, AlexElementsRangeType } from 'alex-editor'
3
3
  import { Button } from '@/components/button'
4
4
  import { MenuButtonType } from '@/core/tool'
5
5
  import { Icon } from '@/components/icon'
6
- import { hasPanelInRange, hasPreInRange, hasTableInRange, insertInfoBlock, rangeIsInInfoBlock } from '@/core/function'
6
+ import { hasPreInRange, hasTableInRange, insertInfoBlock, rangeIsInInfoBlock } from '@/core/function'
7
7
 
8
8
  /**
9
9
  * feature名称
@@ -29,11 +29,11 @@ export const InfoBlockMenuButton = defineComponent(
29
29
  tooltip: props.tooltip,
30
30
  color: props.color,
31
31
  zIndex: props.zIndex,
32
- title: $editTrans('insertInfoBlock'),
32
+ title: `${$editTrans('insertInfoBlock')}${props.config.shortcut?.title ? `【${props.config.shortcut?.title}】` : ''}`,
33
33
  leftBorder: props.config.leftBorder,
34
34
  rightBorder: props.config.rightBorder,
35
35
  active: rangeIsInInfoBlock(editor.value, dataRangeCaches.value),
36
- disabled: props.disabled || isSourceView.value || hasPanelInRange(editor.value, dataRangeCaches.value) || hasTableInRange(editor.value, dataRangeCaches.value) || hasPreInRange(editor.value, dataRangeCaches.value) || props.config.disabled,
36
+ disabled: props.disabled || isSourceView.value || hasTableInRange(editor.value, dataRangeCaches.value) || hasPreInRange(editor.value, dataRangeCaches.value) || props.config.disabled,
37
37
  onOperate: () => {
38
38
  //插入信息块
39
39
  insertInfoBlock(editor.value, dataRangeCaches.value)
@@ -97,7 +97,7 @@ export const ItalicMenuButton = defineComponent(
97
97
  tooltip: props.tooltip,
98
98
  color: props.color,
99
99
  zIndex: props.zIndex,
100
- title: $editTrans('italic'),
100
+ title: `${$editTrans('italic')}${props.config.shortcut?.title ? `【${props.config.shortcut?.title}】` : ''}`,
101
101
  leftBorder: props.config.leftBorder,
102
102
  rightBorder: props.config.rightBorder,
103
103
  disabled: props.disabled || isSourceView.value || hasPreInRange(editor.value, dataRangeCaches.value) || props.config.disabled,
@@ -60,7 +60,7 @@ export const LineHeightMenuButton = defineComponent(
60
60
  width: props.config.width,
61
61
  maxHeight: props.config.maxHeight
62
62
  },
63
- title: $editTrans('lineHeight'),
63
+ title: `${$editTrans('lineHeight')}${props.config.shortcut?.title ? `【${props.config.shortcut?.title}】` : ''}`,
64
64
  leftBorder: props.config.leftBorder,
65
65
  rightBorder: props.config.rightBorder,
66
66
  disabled: props.disabled || isSourceView.value || hasPreInRange(editor.value, dataRangeCaches.value) || props.config.disabled,
@@ -103,7 +103,7 @@ export const LinkMenuButton = defineComponent(
103
103
  zIndex: props.zIndex,
104
104
  type: 'select',
105
105
  hideScroll: true,
106
- title: $editTrans('insertLink'),
106
+ title: `${$editTrans('insertLink')}${props.config.shortcut?.title ? `【${props.config.shortcut?.title}】` : ''}`,
107
107
  leftBorder: props.config.leftBorder,
108
108
  rightBorder: props.config.rightBorder,
109
109
  active: false,
@@ -54,7 +54,7 @@ export const MathformulaMenuButton = defineComponent(
54
54
  zIndex: props.zIndex,
55
55
  type: 'select',
56
56
  hideScroll: true,
57
- title: $editTrans('insertMathformula'),
57
+ title: `${$editTrans('insertMathformula')}${props.config.shortcut?.title ? `【${props.config.shortcut?.title}】` : ''}`,
58
58
  leftBorder: props.config.leftBorder,
59
59
  rightBorder: props.config.rightBorder,
60
60
  active: !!getMatchElementByRange(editor.value, dataRangeCaches.value, {
@@ -1,7 +1,7 @@
1
1
  import { computed, defineComponent, h, inject, PropType, Ref } from 'vue'
2
2
  import { AlexElementsRangeType, AlexEditor, AlexElement } from 'alex-editor'
3
3
  import { MenuButtonType } from '@/core/tool'
4
- import { elementIsList, getMatchElementByRange, hasPanelInRange, hasPreInRange, hasTableInRange, rangeIsInList, setList } from '@/core/function'
4
+ import { elementIsList, getMatchElementByRange, hasPreInRange, hasTableInRange, rangeIsInList, setList } from '@/core/function'
5
5
  import { Button } from '@/components/button'
6
6
  import { Icon } from '@/components/icon'
7
7
 
@@ -214,11 +214,11 @@ export const OrderListMenuButton = defineComponent(
214
214
  tooltip: props.tooltip,
215
215
  color: props.color,
216
216
  zIndex: props.zIndex,
217
- title: $editTrans('orderList'),
217
+ title: `${$editTrans('orderList')}${props.config.shortcut?.title ? `【${props.config.shortcut?.title}】` : ''}`,
218
218
  leftBorder: props.config.leftBorder,
219
219
  rightBorder: props.config.rightBorder,
220
220
  active: rangeIsInList(editor.value, dataRangeCaches.value, true),
221
- disabled: props.disabled || isSourceView.value || hasPreInRange(editor.value, dataRangeCaches.value) || hasTableInRange(editor.value, dataRangeCaches.value) || hasPanelInRange(editor.value, dataRangeCaches.value) || props.config.disabled,
221
+ disabled: props.disabled || isSourceView.value || hasPreInRange(editor.value, dataRangeCaches.value) || hasTableInRange(editor.value, dataRangeCaches.value) || props.config.disabled,
222
222
  onOperate: () => {
223
223
  setList(editor.value, dataRangeCaches.value, true)
224
224
  editor.value.domRender()
@@ -3,7 +3,7 @@ import { AlexEditor, AlexElementsRangeType } from 'alex-editor'
3
3
  import { Button } from '@/components/button'
4
4
  import { MenuSelectButtonType } from '@/core/tool'
5
5
  import { Icon } from '@/components/icon'
6
- import { hasPanelInRange, hasPreInRange, hasTableInRange, rangeIsInQuote, setQuote } from '@/core/function'
6
+ import { hasPreInRange, hasTableInRange, rangeIsInQuote, setQuote } from '@/core/function'
7
7
 
8
8
  /**
9
9
  * feature名称
@@ -29,11 +29,11 @@ export const QuoteMenuButton = defineComponent(
29
29
  tooltip: props.tooltip,
30
30
  color: props.color,
31
31
  zIndex: props.zIndex,
32
- title: $editTrans('quote'),
32
+ title: `${$editTrans('quote')}${props.config.shortcut?.title ? `【${props.config.shortcut?.title}】` : ''}`,
33
33
  leftBorder: props.config.leftBorder,
34
34
  rightBorder: props.config.rightBorder,
35
35
  active: rangeIsInQuote(editor.value, dataRangeCaches.value),
36
- disabled: props.disabled || isSourceView.value || hasPreInRange(editor.value, dataRangeCaches.value) || hasTableInRange(editor.value, dataRangeCaches.value) || hasPanelInRange(editor.value, dataRangeCaches.value) || props.config.disabled,
36
+ disabled: props.disabled || isSourceView.value || hasPreInRange(editor.value, dataRangeCaches.value) || hasTableInRange(editor.value, dataRangeCaches.value) || props.config.disabled,
37
37
  onOperate: () => {
38
38
  setQuote(editor.value, dataRangeCaches.value)
39
39
  editor.value.domRender()
@@ -33,7 +33,7 @@ export const RedoMenuButton = defineComponent(
33
33
  leftBorder: props.config.leftBorder,
34
34
  rightBorder: props.config.rightBorder,
35
35
  active: false,
36
- disabled: props.disabled || isSourceView.value || (rangeKey.value && editor.value.history && !editor.value.history.get(1)) || props.config.disabled,
36
+ disabled: props.disabled || isSourceView.value || (rangeKey.value && editor.value.history && editor.value.history.redoRecords.length == 0) || props.config.disabled,
37
37
  onOperate: () => redo()
38
38
  },
39
39
  {
@@ -29,7 +29,7 @@ export const SeparatorMenuButton = defineComponent(
29
29
  tooltip: props.tooltip,
30
30
  color: props.color,
31
31
  zIndex: props.zIndex,
32
- title: $editTrans('separator'),
32
+ title: `${$editTrans('separator')}${props.config.shortcut?.title ? `【${props.config.shortcut?.title}】` : ''}`,
33
33
  leftBorder: props.config.leftBorder,
34
34
  rightBorder: props.config.rightBorder,
35
35
  active: false,
@@ -27,7 +27,7 @@ export const SourceViewMenuButton = defineComponent(
27
27
  tooltip: props.tooltip,
28
28
  color: props.color,
29
29
  zIndex: props.zIndex,
30
- title: $editTrans('sourceView'),
30
+ title: `${$editTrans('sourceView')}${props.config.shortcut?.title ? `【${props.config.shortcut?.title}】` : ''}`,
31
31
  leftBorder: props.config.leftBorder,
32
32
  rightBorder: props.config.rightBorder,
33
33
  active: isSourceView.value,
@@ -97,7 +97,7 @@ export const StrikethroughMenuButton = defineComponent(
97
97
  tooltip: props.tooltip,
98
98
  color: props.color,
99
99
  zIndex: props.zIndex,
100
- title: $editTrans('strikethrough'),
100
+ title: `${$editTrans('strikethrough')}${props.config.shortcut?.title ? `【${props.config.shortcut?.title}】` : ''}`,
101
101
  leftBorder: props.config.leftBorder,
102
102
  rightBorder: props.config.rightBorder,
103
103
  active: active.value,
@@ -97,7 +97,7 @@ export const SubMenuButton = defineComponent(
97
97
  tooltip: props.tooltip,
98
98
  color: props.color,
99
99
  zIndex: props.zIndex,
100
- title: $editTrans('sub'),
100
+ title: `${$editTrans('sub')}${props.config.shortcut?.title ? `【${props.config.shortcut?.title}】` : ''}`,
101
101
  leftBorder: props.config.leftBorder,
102
102
  rightBorder: props.config.rightBorder,
103
103
  disabled: props.disabled || isSourceView.value || hasPreInRange(editor.value, dataRangeCaches.value) || props.config.disabled,
@@ -97,7 +97,7 @@ export const SuperMenuButton = defineComponent(
97
97
  tooltip: props.tooltip,
98
98
  color: props.color,
99
99
  zIndex: props.zIndex,
100
- title: $editTrans('super'),
100
+ title: `${$editTrans('super')}${props.config.shortcut?.title ? `【${props.config.shortcut?.title}】` : ''}`,
101
101
  leftBorder: props.config.leftBorder,
102
102
  rightBorder: props.config.rightBorder,
103
103
  active: active.value,
@@ -2,7 +2,7 @@ import { computed, defineComponent, h, inject, PropType, ref, Ref } from 'vue'
2
2
  import { AlexEditor, AlexElement, AlexElementsRangeType, AlexElementCreateConfigType } from 'alex-editor'
3
3
  import { Button } from '@/components/button'
4
4
  import { Icon } from '@/components/icon'
5
- import { getCellMergeElement, getCellSpanNumber, getMatchElementByElement, getMatchElementByRange, getTableSize, hasMathformulaInRange, hasPanelInRange, hasPreInRange, hasTableInRange, insertTable, setTableCellMerged } from '@/core/function'
5
+ import { getCellMergeElement, getCellSpanNumber, getMatchElementByElement, getMatchElementByRange, getTableSize, hasMathformulaInRange, hasPreInRange, hasTableInRange, insertTable, setTableCellMerged } from '@/core/function'
6
6
  import { MenuTableButtonType } from '@/core/tool'
7
7
  import { InsertTable } from '@/components/insertTable'
8
8
 
@@ -940,11 +940,11 @@ export const TableMenuButton = defineComponent(
940
940
  zIndex: props.zIndex,
941
941
  type: 'select',
942
942
  hideScroll: true,
943
- title: $editTrans('insertTable'),
943
+ title: `${$editTrans('insertTable')}${props.config.shortcut?.title ? `【${props.config.shortcut?.title}】` : ''}`,
944
944
  leftBorder: props.config.leftBorder,
945
945
  rightBorder: props.config.rightBorder,
946
946
  active: false,
947
- disabled: props.disabled || isSourceView.value || hasTableInRange(editor.value, dataRangeCaches.value) || hasPreInRange(editor.value, dataRangeCaches.value) || hasMathformulaInRange(editor.value, dataRangeCaches.value) || hasPanelInRange(editor.value, dataRangeCaches.value) || props.config.disabled
947
+ disabled: props.disabled || isSourceView.value || hasTableInRange(editor.value, dataRangeCaches.value) || hasPreInRange(editor.value, dataRangeCaches.value) || hasMathformulaInRange(editor.value, dataRangeCaches.value) || props.config.disabled
948
948
  },
949
949
  {
950
950
  default: () =>
@@ -1,7 +1,7 @@
1
1
  import { defineComponent, h, inject, PropType, Ref } from 'vue'
2
2
  import { AlexElementsRangeType, AlexEditor } from 'alex-editor'
3
3
  import { MenuButtonType } from '@/core/tool'
4
- import { hasPanelInRange, hasPreInRange, hasTableInRange, rangeIsInTask, setTask } from '@/core/function'
4
+ import { hasPreInRange, hasTableInRange, rangeIsInTask, setTask } from '@/core/function'
5
5
  import { Button } from '@/components/button'
6
6
  import { Icon } from '@/components/icon'
7
7
 
@@ -29,11 +29,11 @@ export const TaskMenuButton = defineComponent(
29
29
  tooltip: props.tooltip,
30
30
  color: props.color,
31
31
  zIndex: props.zIndex,
32
- title: $editTrans('task'),
32
+ title: `${$editTrans('task')}${props.config.shortcut?.title ? `【${props.config.shortcut?.title}】` : ''}`,
33
33
  leftBorder: props.config.leftBorder,
34
34
  rightBorder: props.config.rightBorder,
35
35
  active: rangeIsInTask(editor.value, dataRangeCaches.value),
36
- disabled: props.disabled || isSourceView.value || hasPreInRange(editor.value, dataRangeCaches.value) || hasTableInRange(editor.value, dataRangeCaches.value) || hasPanelInRange(editor.value, dataRangeCaches.value) || props.config.disabled,
36
+ disabled: props.disabled || isSourceView.value || hasPreInRange(editor.value, dataRangeCaches.value) || hasTableInRange(editor.value, dataRangeCaches.value) || props.config.disabled,
37
37
  onOperate: () => {
38
38
  setTask(editor.value, dataRangeCaches.value)
39
39
  editor.value.domRender()
@@ -97,7 +97,7 @@ export const UnderlineMenuButton = defineComponent(
97
97
  tooltip: props.tooltip,
98
98
  color: props.color,
99
99
  zIndex: props.zIndex,
100
- title: $editTrans('underline'),
100
+ title: `${$editTrans('underline')}${props.config.shortcut?.title ? `【${props.config.shortcut?.title}】` : ''}`,
101
101
  leftBorder: props.config.leftBorder,
102
102
  rightBorder: props.config.rightBorder,
103
103
  disabled: props.disabled || isSourceView.value || hasPreInRange(editor.value, dataRangeCaches.value) || props.config.disabled,
@@ -33,7 +33,7 @@ export const UndoMenuButton = defineComponent(
33
33
  leftBorder: props.config.leftBorder,
34
34
  rightBorder: props.config.rightBorder,
35
35
  active: false,
36
- disabled: props.disabled || isSourceView.value || (rangeKey.value && editor.value.history && !editor.value.history.get(-1)) || props.config.disabled,
36
+ disabled: props.disabled || isSourceView.value || (rangeKey.value && editor.value.history && editor.value.history.records.length <= 1) || props.config.disabled,
37
37
  onOperate: () => undo()
38
38
  },
39
39
  {
@@ -1,7 +1,7 @@
1
1
  import { computed, defineComponent, h, inject, PropType, Ref } from 'vue'
2
2
  import { AlexElementsRangeType, AlexEditor, AlexElement } from 'alex-editor'
3
3
  import { MenuButtonType } from '@/core/tool'
4
- import { elementIsList, getMatchElementByRange, hasPanelInRange, hasPreInRange, hasTableInRange, rangeIsInList, setList } from '@/core/function'
4
+ import { elementIsList, getMatchElementByRange, hasPreInRange, hasTableInRange, rangeIsInList, setList } from '@/core/function'
5
5
  import { Button } from '@/components/button'
6
6
  import { Icon } from '@/components/icon'
7
7
 
@@ -154,11 +154,11 @@ export const UnorderListMenuButton = defineComponent(
154
154
  tooltip: props.tooltip,
155
155
  color: props.color,
156
156
  zIndex: props.zIndex,
157
- title: $editTrans('unorderList'),
157
+ title: `${$editTrans('unorderList')}${props.config.shortcut?.title ? `【${props.config.shortcut?.title}】` : ''}`,
158
158
  leftBorder: props.config.leftBorder,
159
159
  rightBorder: props.config.rightBorder,
160
160
  active: rangeIsInList(editor.value, dataRangeCaches.value, false),
161
- disabled: props.disabled || isSourceView.value || hasPreInRange(editor.value, dataRangeCaches.value) || hasTableInRange(editor.value, dataRangeCaches.value) || hasPanelInRange(editor.value, dataRangeCaches.value) || props.config.disabled,
161
+ disabled: props.disabled || isSourceView.value || hasPreInRange(editor.value, dataRangeCaches.value) || hasTableInRange(editor.value, dataRangeCaches.value) || props.config.disabled,
162
162
  onOperate: () => {
163
163
  setList(editor.value, dataRangeCaches.value, false)
164
164
  editor.value.domRender()
@@ -278,7 +278,7 @@ export const VideoMenuButton = defineComponent(
278
278
  zIndex: props.zIndex,
279
279
  type: 'select',
280
280
  hideScroll: true,
281
- title: $editTrans('insertVideo'),
281
+ title: `${$editTrans('insertVideo')}${props.config.shortcut?.title ? `【${props.config.shortcut?.title}】` : ''}`,
282
282
  leftBorder: props.config.leftBorder,
283
283
  rightBorder: props.config.rightBorder,
284
284
  active: false,
@@ -1,3 +1,7 @@
1
+ .editify-icon-info:before {
2
+ content: '\e600';
3
+ }
4
+
1
5
  .editify-icon-list-square:before {
2
6
  content: '\e659';
3
7
  }
@@ -38,14 +42,6 @@
38
42
  content: '\e651';
39
43
  }
40
44
 
41
- .editify-icon-info:before {
42
- content: '\e610';
43
- }
44
-
45
- .editify-icon-panel:before {
46
- content: '\e6c0';
47
- }
48
-
49
45
  .editify-icon-merge-cells-up:before {
50
46
  content: '\e73e';
51
47
  }
Binary file
Binary file
package/src/index.ts CHANGED
@@ -57,9 +57,6 @@ export {
57
57
  elementIsMathformula,
58
58
  getMathformulaByElement,
59
59
  hasMathformulaInRange,
60
- elementIsPanel,
61
- getPanelByElement,
62
- hasPanelInRange,
63
60
  elementIsInfoBlock,
64
61
  getInfoBlockByElement,
65
62
  hasInfoBlockInRange,
@@ -95,8 +92,7 @@ export {
95
92
  insertSeparator,
96
93
  insertAttachment,
97
94
  insertMathformula,
98
- insertInfoBlock,
99
- insertPanel
95
+ insertInfoBlock
100
96
  } from '@/core/function'
101
97
 
102
98
  //安装函数
@@ -104,7 +100,7 @@ const install = (app: App) => {
104
100
  app.component(Editify.name!, Editify)
105
101
  }
106
102
  //版本号
107
- const version = '0.2.18'
103
+ const version = '0.2.19'
108
104
 
109
105
  //导出组件和安装函数
110
106
  export { Editify as default, Editify, install, AlexElement, version }
@@ -101,9 +101,6 @@ export const en_US: ObjectType = {
101
101
  insertMathformula: 'insert mathematical formula',
102
102
  editMathformula: 'edit mathematical formula',
103
103
  mathformulaPlaceholder: 'please enter latex syntax',
104
- insertPanel: 'insert panel',
105
- panelTitle: 'here is the title',
106
- panelContent: 'here is the content',
107
104
  insertInfoBlock: 'insert Information Block',
108
105
  decimal: 'decimal',
109
106
  lowerRoman: 'lower roman',
@@ -101,9 +101,6 @@ export const zh_CN: ObjectType = {
101
101
  insertMathformula: '插入数学公式',
102
102
  editMathformula: '编辑数学公式',
103
103
  mathformulaPlaceholder: '请输入LaTex语法',
104
- insertPanel: '插入面板',
105
- panelTitle: '这里是标题',
106
- panelContent: '这里是内容',
107
104
  insertInfoBlock: '插入信息块',
108
105
  decimal: '默认数字',
109
106
  lowerRoman: '小写罗马数字',
@@ -1,18 +0,0 @@
1
- import { MenuButtonType } from '../core/tool';
2
-
3
- /**
4
- * 菜单栏 - 插入面板
5
- */
6
- export declare const PanelMenuButton: import('vue').DefineSetupFnComponent<{
7
- color: string;
8
- zIndex: number;
9
- config: MenuButtonType;
10
- tooltip: boolean;
11
- disabled: boolean;
12
- }, {}, {}, {
13
- color: string;
14
- zIndex: number;
15
- config: MenuButtonType;
16
- tooltip: boolean;
17
- disabled: boolean;
18
- } & {}, import('vue').PublicProps>;
@@ -1,62 +0,0 @@
1
- import { defineComponent, h, inject, PropType, Ref } from 'vue'
2
- import { AlexEditor, 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, insertPanel } 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
- //插入面板
39
- insertPanel(editor.value, $editTrans('panelTitle'), $editTrans('panelContent'))
40
- //渲染
41
- editor.value.domRender()
42
- editor.value.rangeRender()
43
- }
44
- },
45
- {
46
- default: () => h(Icon, { value: 'panel' })
47
- }
48
- )
49
- : null
50
- }
51
- },
52
- {
53
- name: `_${FEATURE_NAME}`,
54
- props: {
55
- color: String,
56
- zIndex: Number,
57
- config: Object as PropType<MenuButtonType>,
58
- tooltip: Boolean,
59
- disabled: Boolean
60
- }
61
- }
62
- )