goodteditor-ui 1.0.26 → 1.0.27

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 (116) hide show
  1. package/.eslintrc.js +7 -7
  2. package/.prettierrc +14 -14
  3. package/README.md +35 -35
  4. package/babel.config.js +5 -5
  5. package/index.js +53 -53
  6. package/jsconfig.json +13 -13
  7. package/package.json +67 -67
  8. package/src/App.vue +36 -36
  9. package/src/components/ui/Avatar.md +68 -68
  10. package/src/components/ui/Avatar.vue +180 -180
  11. package/src/components/ui/Badge.md +20 -20
  12. package/src/components/ui/Badge.vue +75 -75
  13. package/src/components/ui/Collapse.md +90 -90
  14. package/src/components/ui/Collapse.vue +86 -86
  15. package/src/components/ui/ColorPicker/Alpha.vue +114 -114
  16. package/src/components/ui/ColorPicker/Colors.vue +117 -117
  17. package/src/components/ui/ColorPicker/Hue.vue +113 -113
  18. package/src/components/ui/ColorPicker/Preview.vue +55 -55
  19. package/src/components/ui/ColorPicker/Saturation.vue +123 -123
  20. package/src/components/ui/ColorPicker/mixin.js +105 -105
  21. package/src/components/ui/ColorPicker.md +17 -17
  22. package/src/components/ui/ColorPicker.vue +314 -314
  23. package/src/components/ui/Datalist.md +41 -41
  24. package/src/components/ui/Datalist.vue +164 -164
  25. package/src/components/ui/DatePicker.md +168 -168
  26. package/src/components/ui/DatePicker.vue +527 -527
  27. package/src/components/ui/FileSelector.md +105 -105
  28. package/src/components/ui/FileSelector.vue +82 -82
  29. package/src/components/ui/Grid.md +130 -130
  30. package/src/components/ui/Grid.vue +92 -92
  31. package/src/components/ui/Image.md +59 -59
  32. package/src/components/ui/Image.vue +57 -57
  33. package/src/components/ui/InputAutocomplete.md +115 -115
  34. package/src/components/ui/InputAutocomplete.vue +349 -349
  35. package/src/components/ui/InputColorPicker.md +51 -51
  36. package/src/components/ui/InputColorPicker.vue +151 -151
  37. package/src/components/ui/InputDatePicker.md +121 -121
  38. package/src/components/ui/InputDatePicker.vue +326 -326
  39. package/src/components/ui/InputTags.md +51 -51
  40. package/src/components/ui/InputTags.vue +184 -184
  41. package/src/components/ui/InputTimePicker.md +25 -25
  42. package/src/components/ui/InputTimePicker.vue +253 -253
  43. package/src/components/ui/InputUnits.md +20 -20
  44. package/src/components/ui/InputUnits.vue +257 -257
  45. package/src/components/ui/Lazy.md +37 -37
  46. package/src/components/ui/Lazy.vue +92 -92
  47. package/src/components/ui/Pagination.md +74 -74
  48. package/src/components/ui/Pagination.vue +138 -138
  49. package/src/components/ui/Paginator.md +34 -34
  50. package/src/components/ui/Paginator.vue +83 -83
  51. package/src/components/ui/Popover.md +34 -34
  52. package/src/components/ui/Popover.vue +274 -274
  53. package/src/components/ui/Popup.md +59 -59
  54. package/src/components/ui/Popup.vue +150 -150
  55. package/src/components/ui/ResponsiveContainer.md +58 -58
  56. package/src/components/ui/ResponsiveContainer.vue +99 -99
  57. package/src/components/ui/Select.md +187 -187
  58. package/src/components/ui/Select.vue +421 -421
  59. package/src/components/ui/TimePicker.md +50 -50
  60. package/src/components/ui/TimePicker.vue +252 -252
  61. package/src/components/ui/Tooltip.md +54 -54
  62. package/src/components/ui/Tooltip.vue +113 -113
  63. package/src/components/ui/WysiwygEditor/WysiwygEditor.d.ts +128 -128
  64. package/src/components/ui/WysiwygEditor/constants.js +273 -273
  65. package/src/components/ui/WysiwygEditor/extensions/blockquote.js +15 -15
  66. package/src/components/ui/WysiwygEditor/extensions/bold.js +15 -15
  67. package/src/components/ui/WysiwygEditor/extensions/bullet-list.js +15 -15
  68. package/src/components/ui/WysiwygEditor/extensions/code-block.js +13 -13
  69. package/src/components/ui/WysiwygEditor/extensions/code.js +13 -13
  70. package/src/components/ui/WysiwygEditor/extensions/font-size.js +34 -34
  71. package/src/components/ui/WysiwygEditor/extensions/formatting.js +14 -14
  72. package/src/components/ui/WysiwygEditor/extensions/heading.js +13 -13
  73. package/src/components/ui/WysiwygEditor/extensions/horizontal-rule.js +15 -15
  74. package/src/components/ui/WysiwygEditor/extensions/image.js +37 -33
  75. package/src/components/ui/WysiwygEditor/extensions/index.d.ts +32 -32
  76. package/src/components/ui/WysiwygEditor/extensions/index.js +32 -32
  77. package/src/components/ui/WysiwygEditor/extensions/italic.js +15 -15
  78. package/src/components/ui/WysiwygEditor/extensions/link.js +16 -16
  79. package/src/components/ui/WysiwygEditor/extensions/list-item.js +15 -15
  80. package/src/components/ui/WysiwygEditor/extensions/ordered-list.js +15 -15
  81. package/src/components/ui/WysiwygEditor/extensions/paragraph.js +23 -23
  82. package/src/components/ui/WysiwygEditor/extensions/strike.js +15 -15
  83. package/src/components/ui/WysiwygEditor/extensions/table-cell.js +13 -13
  84. package/src/components/ui/WysiwygEditor/extensions/table-header.js +15 -15
  85. package/src/components/ui/WysiwygEditor/extensions/table-row.js +15 -15
  86. package/src/components/ui/WysiwygEditor/extensions/table.js +29 -29
  87. package/src/components/ui/WysiwygEditor/extensions/text-align.js +6 -6
  88. package/src/components/ui/WysiwygEditor/extensions/text-style.js +12 -12
  89. package/src/components/ui/WysiwygEditor/extensions/underline.js +15 -15
  90. package/src/components/ui/WysiwygEditor/index.d.ts +4 -4
  91. package/src/components/ui/WysiwygEditor/index.js +4 -4
  92. package/src/components/ui/WysiwygEditor/renders/Button.vue +28 -28
  93. package/src/components/ui/WysiwygEditor/renders/ColorPicker.vue +41 -41
  94. package/src/components/ui/WysiwygEditor/renders/Image.vue +200 -162
  95. package/src/components/ui/WysiwygEditor/renders/InputAuto.vue +34 -34
  96. package/src/components/ui/WysiwygEditor/renders/InputUnits.vue +37 -37
  97. package/src/components/ui/WysiwygEditor/renders/Link.vue +82 -82
  98. package/src/components/ui/WysiwygEditor/renders/Select.vue +47 -47
  99. package/src/components/ui/WysiwygEditor/renders/ToolbarPopover.vue +49 -49
  100. package/src/components/ui/WysiwygEditor/renders/components/Popover.vue +15 -0
  101. package/src/components/ui/WysiwygEditor/renders/components/WithPopover.vue +35 -35
  102. package/src/components/ui/WysiwygEditor/renders/index.d.ts +8 -8
  103. package/src/components/ui/WysiwygEditor/renders/index.js +8 -8
  104. package/src/components/ui/WysiwygEditor/renders/mixins/RenderMixin.js +39 -39
  105. package/src/components/ui/WysiwygEditor/renders/mixins/index.js +1 -1
  106. package/src/components/ui/WysiwygEditor/tools-and-commands.js +709 -702
  107. package/src/components/ui/WysiwygEditor/utils.js +72 -72
  108. package/src/components/ui/WysiwygEditor.md +18 -18
  109. package/src/components/ui/WysiwygEditor.vue +266 -266
  110. package/src/components/ui/utils/FormComponent.js +107 -107
  111. package/src/components/ui/utils/Helpers.js +84 -84
  112. package/src/components/ui/utils/WithPopover.js +81 -81
  113. package/src/main.js +8 -8
  114. package/styleguide.config.js +37 -37
  115. package/vue.config.js +8 -8
  116. package/dist/js.png +0 -0
@@ -1,273 +1,273 @@
1
- import {
2
- Button,
3
- Select,
4
- InputUnits,
5
- ColorPicker,
6
- ToolbarPopover,
7
- InputAuto,
8
- Link,
9
- Image
10
- } from './renders';
11
-
12
- /**
13
- * @typedef {import('./WysiwygEditor').NodeType} NodeType
14
- * @typedef {import('./WysiwygEditor').MarkType} MarkType
15
- * @typedef {import('./WysiwygEditor').CommandType} CommandType
16
- * @typedef {import('./WysiwygEditor').ToolType} ToolType
17
- * @typedef {import('./WysiwygEditor').Render} Render
18
- * @typedef {import('./WysiwygEditor').CommandDef} Command
19
- * @typedef {import('./WysiwygEditor').ToolDef} Tool
20
- */
21
-
22
- /**
23
- * @type NodeType
24
- */
25
- export const NodeType = Object.freeze({
26
- BLOCKQUOTE: 'blockquote',
27
- BULLET_LIST: 'bulletList',
28
- CODE_BLOCK: 'codeBlock',
29
- DOCUMENT: 'document',
30
- HARD_BREAK: 'hardBreak',
31
- HEADING: 'heading',
32
- HORIZONTAL_RULE: 'horizontalRule',
33
- IMAGE: 'image',
34
- LIST_ITEM: 'listItem',
35
- ORDERED_LIST: 'orderedList',
36
- PARAGRAPH: 'paragraph',
37
- TABLE: 'table',
38
- TABLE_ROW: 'tableRow',
39
- TABLE_CELL: 'tableCell',
40
- TEXT: 'text'
41
- });
42
-
43
- /**
44
- * @type MarkType
45
- */
46
- export const MarkType = Object.freeze({
47
- BOLD: 'bold',
48
- CODE: 'code',
49
- ITALIC: 'italic',
50
- LINK: 'link',
51
- STRIKE: 'strike',
52
- UNDERLINE: 'underline',
53
- TEXT_STYLE: 'textStyle'
54
- });
55
-
56
- /**
57
- * @type CommandType
58
- */
59
- export const CommandType = Object.freeze({
60
- /* paragraph style */
61
- PARAGRAPH: 'paragraph',
62
- HEADING_1: `heading1`,
63
- HEADING_2: `heading2`,
64
- HEADING_3: `heading3`,
65
- HEADING_4: `heading4`,
66
- TEXT_SMALL: 'textSmall',
67
- TEXT_XSMALL: 'textXsmall',
68
- CODE_BLOCK: 'codeBlock',
69
- /* list */
70
- SINK_LIST_ITEM: 'sinkListItem',
71
- LIFT_LIST_ITEM: 'liftListItem'
72
- });
73
-
74
- /**
75
- * @type ToolType
76
- */
77
- export const ToolType = Object.freeze({
78
- /* typography */
79
- PARAGRAPH_STYLE: 'paragraphStyle',
80
- FONT_SIZE: 'fontSize',
81
- FONT_FAMILY: 'fontFamily',
82
- TEXT_COLOR: 'textColor',
83
- BLOCKQUOTE: 'blockquote',
84
- /* lists */
85
- ORDERED_LIST: 'orderedList',
86
- BULLET_LIST: 'bulletList',
87
- /* alignment */
88
- TEXT_ALIGN_LEFT: 'textAlignLeft',
89
- TEXT_ALIGN_RIGHT: 'textAlignRight',
90
- TEXT_ALIGN_CENTER: 'textAlignCenter',
91
- /* insertion */
92
- LINK: 'link',
93
- IMAGE: 'image',
94
- TABLE: 'table',
95
- /* formatting */
96
- BOLD: 'bold',
97
- CODE: 'code',
98
- ITALIC: 'italic',
99
- STRIKE: 'strike',
100
- UNDERLINE: 'underline',
101
- /* history */
102
- UNDO: 'undo',
103
- REDO: 'redo',
104
- SAVE: 'save',
105
- /* other */
106
- CLEAR_FORMATTING: 'clearFormatting',
107
- HARD_BREAK: 'hardBreak',
108
- HORIZONTAL_RULE: 'horizontalRule',
109
- /** table options */
110
- INSERT_TABLE: 'insertTable',
111
- DELETE_TABLE: 'deleteTable',
112
- ADD_COLUMN_BEFORE: 'addColumnBefore',
113
- ADD_COLUMN_AFTER: 'addColumnAfter',
114
- DELETE_COLUMN: 'deleteColumn',
115
- ADD_ROW_BEFORE: 'addRowBefore',
116
- ADD_ROW_AFTER: 'addRowAfter',
117
- DELETE_ROW: 'deleteRow',
118
- MERGE_CELLS: 'mergeCells',
119
- SPLIT_CELL: 'splitCell',
120
- TOGGLE_HEADER_COLUMN: 'toggleHeaderColumn',
121
- TOGGLE_HEADER_ROW: 'toggleHeaderRow',
122
- ALIGN_V_TOP: 'alignVTop',
123
- ALIGN_V_MID: 'alignVMid',
124
- ALIGN_V_BOT: 'alignVBot',
125
- TOGGLE_BORDERS: 'toggleBorders',
126
- TOGGLE_ZEBRA: 'toggleZebra',
127
- /** image options */
128
- INSERT_IMAGE: 'insertImage'
129
- });
130
-
131
- /**
132
- * @param {Command} command
133
- * @return Command
134
- */
135
- export const createCommand = ({
136
- name,
137
- title = 'Unknown command',
138
- exec = () => {},
139
- isActive = () => false,
140
- isEnabled = () => true
141
- }) => ({
142
- name,
143
- title,
144
- exec,
145
- isActive,
146
- isEnabled
147
- });
148
-
149
- /**
150
- * @type Render
151
- */
152
- export const Render = Object.freeze({
153
- BUTTON: Button,
154
- COLOR_PICKER: ColorPicker,
155
- INPUT_UNITS: InputUnits,
156
- SELECT: Select,
157
- TOOLBAR_POPOVER: ToolbarPopover,
158
- INPUT_AUTO: InputAuto,
159
- LINK: Link,
160
- IMAGE: Image
161
- });
162
-
163
- /**
164
- * @param {Tool} tool
165
- * @return Tool
166
- */
167
- export const createBaseTool = ({
168
- name,
169
- render = Render.BUTTON,
170
- title = 'Unknown tool',
171
- icon = 'help-circle-outline',
172
- exec = () => {},
173
- isActive = () => false,
174
- isEnabled = () => true
175
- }) => ({
176
- name,
177
- render,
178
- title,
179
- icon,
180
- exec,
181
- isActive,
182
- isEnabled
183
- });
184
-
185
- /**
186
- * @param {Tool} toolOptions
187
- * @return Tool
188
- */
189
- export const createButtonTool = (toolOptions) => createBaseTool(toolOptions);
190
-
191
- /**
192
- * @param {Tool} tool
193
- * @return Tool
194
- */
195
- export const createSelectTool = ({ getValue = () => null, options = [], ...toolOptions }) => ({
196
- ...createBaseTool({ render: Render.SELECT, ...toolOptions }),
197
- getValue,
198
- options
199
- });
200
-
201
- /**
202
- * @param {Tool} tool
203
- * @return Tool
204
- */
205
- export const createColorPickerTool = ({ getValue = () => null, ...toolOptions }) => ({
206
- ...createBaseTool({ render: Render.COLOR_PICKER, ...toolOptions }),
207
- getValue
208
- });
209
-
210
- /**
211
- * @param {Tool} tool
212
- * @return Tool
213
- */
214
- export const createInputUnitsTool = ({ getValue = () => null, units = [], ...toolOptions }) => ({
215
- ...createBaseTool({ render: Render.INPUT_UNITS, ...toolOptions }),
216
- getValue,
217
- units
218
- });
219
-
220
- /**
221
- * @param {Tool} tool
222
- * @return Tool
223
- */
224
- export const createToolbarPopoverTool = ({ options = [], ...toolOptions }) => ({
225
- ...createBaseTool({ render: Render.TOOLBAR_POPOVER, ...toolOptions }),
226
- options
227
- });
228
-
229
- /**
230
- * @param {Tool} tool
231
- * @return Tool
232
- */
233
- export const createInputAutoTool = ({ getValue = () => null, options = [], ...toolOptions }) => ({
234
- ...createBaseTool({ render: Render.INPUT_AUTO, ...toolOptions }),
235
- getValue,
236
- options
237
- });
238
-
239
- /**
240
- * @param {Tool} tool
241
- * @return Tool
242
- */
243
- export const createImageTool = ({ getValue = () => null, ...toolOptions }) => ({
244
- ...createBaseTool({ render: Render.IMAGE, ...toolOptions }),
245
- getValue
246
- });
247
-
248
- /**
249
- * @param {Tool} tool
250
- * @return Tool
251
- */
252
- export const createLinkTool = ({ getValue = () => null, ...toolOptions }) => ({
253
- ...createBaseTool({ render: Render.LINK, ...toolOptions }),
254
- getValue
255
- });
256
-
257
- export const DefaultTools = [
258
- [ToolType.PARAGRAPH_STYLE, ToolType.TEXT_COLOR, ToolType.FONT_SIZE, ToolType.FONT_FAMILY, ToolType.BLOCKQUOTE],
259
- [ToolType.BOLD, ToolType.ITALIC, ToolType.UNDERLINE, ToolType.STRIKE, ToolType.CODE],
260
- [ToolType.TEXT_ALIGN_LEFT, ToolType.TEXT_ALIGN_CENTER, ToolType.TEXT_ALIGN_RIGHT],
261
- [ToolType.ORDERED_LIST, ToolType.BULLET_LIST],
262
- [ToolType.IMAGE, ToolType.LINK, ToolType.TABLE],
263
- [ToolType.CLEAR_FORMATTING, ToolType.HARD_BREAK]
264
- ];
265
-
266
- export const DefaultToolGroupsTitles = [
267
- 'Оформление',
268
- 'Форматирование',
269
- 'Выравнивание',
270
- 'Нумерация',
271
- 'Вставка',
272
- ''
273
- ];
1
+ import {
2
+ Button,
3
+ Select,
4
+ InputUnits,
5
+ ColorPicker,
6
+ ToolbarPopover,
7
+ InputAuto,
8
+ Link,
9
+ Image
10
+ } from './renders';
11
+
12
+ /**
13
+ * @typedef {import('./WysiwygEditor').NodeType} NodeType
14
+ * @typedef {import('./WysiwygEditor').MarkType} MarkType
15
+ * @typedef {import('./WysiwygEditor').CommandType} CommandType
16
+ * @typedef {import('./WysiwygEditor').ToolType} ToolType
17
+ * @typedef {import('./WysiwygEditor').Render} Render
18
+ * @typedef {import('./WysiwygEditor').CommandDef} Command
19
+ * @typedef {import('./WysiwygEditor').ToolDef} Tool
20
+ */
21
+
22
+ /**
23
+ * @type NodeType
24
+ */
25
+ export const NodeType = Object.freeze({
26
+ BLOCKQUOTE: 'blockquote',
27
+ BULLET_LIST: 'bulletList',
28
+ CODE_BLOCK: 'codeBlock',
29
+ DOCUMENT: 'document',
30
+ HARD_BREAK: 'hardBreak',
31
+ HEADING: 'heading',
32
+ HORIZONTAL_RULE: 'horizontalRule',
33
+ IMAGE: 'image',
34
+ LIST_ITEM: 'listItem',
35
+ ORDERED_LIST: 'orderedList',
36
+ PARAGRAPH: 'paragraph',
37
+ TABLE: 'table',
38
+ TABLE_ROW: 'tableRow',
39
+ TABLE_CELL: 'tableCell',
40
+ TEXT: 'text'
41
+ });
42
+
43
+ /**
44
+ * @type MarkType
45
+ */
46
+ export const MarkType = Object.freeze({
47
+ BOLD: 'bold',
48
+ CODE: 'code',
49
+ ITALIC: 'italic',
50
+ LINK: 'link',
51
+ STRIKE: 'strike',
52
+ UNDERLINE: 'underline',
53
+ TEXT_STYLE: 'textStyle'
54
+ });
55
+
56
+ /**
57
+ * @type CommandType
58
+ */
59
+ export const CommandType = Object.freeze({
60
+ /* paragraph style */
61
+ PARAGRAPH: 'paragraph',
62
+ HEADING_1: `heading1`,
63
+ HEADING_2: `heading2`,
64
+ HEADING_3: `heading3`,
65
+ HEADING_4: `heading4`,
66
+ TEXT_SMALL: 'textSmall',
67
+ TEXT_XSMALL: 'textXsmall',
68
+ CODE_BLOCK: 'codeBlock',
69
+ /* list */
70
+ SINK_LIST_ITEM: 'sinkListItem',
71
+ LIFT_LIST_ITEM: 'liftListItem'
72
+ });
73
+
74
+ /**
75
+ * @type ToolType
76
+ */
77
+ export const ToolType = Object.freeze({
78
+ /* typography */
79
+ PARAGRAPH_STYLE: 'paragraphStyle',
80
+ FONT_SIZE: 'fontSize',
81
+ FONT_FAMILY: 'fontFamily',
82
+ TEXT_COLOR: 'textColor',
83
+ BLOCKQUOTE: 'blockquote',
84
+ /* lists */
85
+ ORDERED_LIST: 'orderedList',
86
+ BULLET_LIST: 'bulletList',
87
+ /* alignment */
88
+ TEXT_ALIGN_LEFT: 'textAlignLeft',
89
+ TEXT_ALIGN_RIGHT: 'textAlignRight',
90
+ TEXT_ALIGN_CENTER: 'textAlignCenter',
91
+ /* insertion */
92
+ LINK: 'link',
93
+ IMAGE: 'image',
94
+ TABLE: 'table',
95
+ /* formatting */
96
+ BOLD: 'bold',
97
+ CODE: 'code',
98
+ ITALIC: 'italic',
99
+ STRIKE: 'strike',
100
+ UNDERLINE: 'underline',
101
+ /* history */
102
+ UNDO: 'undo',
103
+ REDO: 'redo',
104
+ SAVE: 'save',
105
+ /* other */
106
+ CLEAR_FORMATTING: 'clearFormatting',
107
+ HARD_BREAK: 'hardBreak',
108
+ HORIZONTAL_RULE: 'horizontalRule',
109
+ /** table options */
110
+ INSERT_TABLE: 'insertTable',
111
+ DELETE_TABLE: 'deleteTable',
112
+ ADD_COLUMN_BEFORE: 'addColumnBefore',
113
+ ADD_COLUMN_AFTER: 'addColumnAfter',
114
+ DELETE_COLUMN: 'deleteColumn',
115
+ ADD_ROW_BEFORE: 'addRowBefore',
116
+ ADD_ROW_AFTER: 'addRowAfter',
117
+ DELETE_ROW: 'deleteRow',
118
+ MERGE_CELLS: 'mergeCells',
119
+ SPLIT_CELL: 'splitCell',
120
+ TOGGLE_HEADER_COLUMN: 'toggleHeaderColumn',
121
+ TOGGLE_HEADER_ROW: 'toggleHeaderRow',
122
+ ALIGN_V_TOP: 'alignVTop',
123
+ ALIGN_V_MID: 'alignVMid',
124
+ ALIGN_V_BOT: 'alignVBot',
125
+ TOGGLE_BORDERS: 'toggleBorders',
126
+ TOGGLE_ZEBRA: 'toggleZebra',
127
+ /** image options */
128
+ INSERT_IMAGE: 'insertImage'
129
+ });
130
+
131
+ /**
132
+ * @param {Command} command
133
+ * @return Command
134
+ */
135
+ export const createCommand = ({
136
+ name,
137
+ title = 'Unknown command',
138
+ exec = () => {},
139
+ isActive = () => false,
140
+ isEnabled = () => true
141
+ }) => ({
142
+ name,
143
+ title,
144
+ exec,
145
+ isActive,
146
+ isEnabled
147
+ });
148
+
149
+ /**
150
+ * @type Render
151
+ */
152
+ export const Render = Object.freeze({
153
+ BUTTON: Button,
154
+ COLOR_PICKER: ColorPicker,
155
+ INPUT_UNITS: InputUnits,
156
+ SELECT: Select,
157
+ TOOLBAR_POPOVER: ToolbarPopover,
158
+ INPUT_AUTO: InputAuto,
159
+ LINK: Link,
160
+ IMAGE: Image
161
+ });
162
+
163
+ /**
164
+ * @param {Tool} tool
165
+ * @return Tool
166
+ */
167
+ export const createBaseTool = ({
168
+ name,
169
+ render = Render.BUTTON,
170
+ title = 'Unknown tool',
171
+ icon = 'help-circle-outline',
172
+ exec = () => {},
173
+ isActive = () => false,
174
+ isEnabled = () => true
175
+ }) => ({
176
+ name,
177
+ render,
178
+ title,
179
+ icon,
180
+ exec,
181
+ isActive,
182
+ isEnabled
183
+ });
184
+
185
+ /**
186
+ * @param {Tool} toolOptions
187
+ * @return Tool
188
+ */
189
+ export const createButtonTool = (toolOptions) => createBaseTool(toolOptions);
190
+
191
+ /**
192
+ * @param {Tool} tool
193
+ * @return Tool
194
+ */
195
+ export const createSelectTool = ({ getValue = () => null, options = [], ...toolOptions }) => ({
196
+ ...createBaseTool({ render: Render.SELECT, ...toolOptions }),
197
+ getValue,
198
+ options
199
+ });
200
+
201
+ /**
202
+ * @param {Tool} tool
203
+ * @return Tool
204
+ */
205
+ export const createColorPickerTool = ({ getValue = () => null, ...toolOptions }) => ({
206
+ ...createBaseTool({ render: Render.COLOR_PICKER, ...toolOptions }),
207
+ getValue
208
+ });
209
+
210
+ /**
211
+ * @param {Tool} tool
212
+ * @return Tool
213
+ */
214
+ export const createInputUnitsTool = ({ getValue = () => null, units = [], ...toolOptions }) => ({
215
+ ...createBaseTool({ render: Render.INPUT_UNITS, ...toolOptions }),
216
+ getValue,
217
+ units
218
+ });
219
+
220
+ /**
221
+ * @param {Tool} tool
222
+ * @return Tool
223
+ */
224
+ export const createToolbarPopoverTool = ({ options = [], ...toolOptions }) => ({
225
+ ...createBaseTool({ render: Render.TOOLBAR_POPOVER, ...toolOptions }),
226
+ options
227
+ });
228
+
229
+ /**
230
+ * @param {Tool} tool
231
+ * @return Tool
232
+ */
233
+ export const createInputAutoTool = ({ getValue = () => null, options = [], ...toolOptions }) => ({
234
+ ...createBaseTool({ render: Render.INPUT_AUTO, ...toolOptions }),
235
+ getValue,
236
+ options
237
+ });
238
+
239
+ /**
240
+ * @param {Tool} tool
241
+ * @return Tool
242
+ */
243
+ export const createImageTool = ({ getValue = () => null, ...toolOptions }) => ({
244
+ ...createBaseTool({ render: Render.IMAGE, ...toolOptions }),
245
+ getValue
246
+ });
247
+
248
+ /**
249
+ * @param {Tool} tool
250
+ * @return Tool
251
+ */
252
+ export const createLinkTool = ({ getValue = () => null, ...toolOptions }) => ({
253
+ ...createBaseTool({ render: Render.LINK, ...toolOptions }),
254
+ getValue
255
+ });
256
+
257
+ export const DefaultTools = [
258
+ [ToolType.PARAGRAPH_STYLE, ToolType.TEXT_COLOR, ToolType.FONT_SIZE, ToolType.FONT_FAMILY, ToolType.BLOCKQUOTE],
259
+ [ToolType.BOLD, ToolType.ITALIC, ToolType.UNDERLINE, ToolType.STRIKE, ToolType.CODE],
260
+ [ToolType.TEXT_ALIGN_LEFT, ToolType.TEXT_ALIGN_CENTER, ToolType.TEXT_ALIGN_RIGHT],
261
+ [ToolType.ORDERED_LIST, ToolType.BULLET_LIST],
262
+ [ToolType.IMAGE, ToolType.LINK, ToolType.TABLE],
263
+ [ToolType.CLEAR_FORMATTING, ToolType.HARD_BREAK]
264
+ ];
265
+
266
+ export const DefaultToolGroupsTitles = [
267
+ 'Оформление',
268
+ 'Форматирование',
269
+ 'Выравнивание',
270
+ 'Нумерация',
271
+ 'Вставка',
272
+ ''
273
+ ];
@@ -1,15 +1,15 @@
1
- import { Blockquote as BlockquoteToExtend } from '@tiptap/extension-blockquote';
2
-
3
- export const Blockquote = BlockquoteToExtend.extend({
4
- addAttributes() {
5
- return {
6
- ...this.parent?.(),
7
- class: {
8
- default: null
9
- },
10
- style: {
11
- default: null
12
- }
13
- }
14
- }
15
- })
1
+ import { Blockquote as BlockquoteToExtend } from '@tiptap/extension-blockquote';
2
+
3
+ export const Blockquote = BlockquoteToExtend.extend({
4
+ addAttributes() {
5
+ return {
6
+ ...this.parent?.(),
7
+ class: {
8
+ default: null
9
+ },
10
+ style: {
11
+ default: null
12
+ }
13
+ }
14
+ }
15
+ })
@@ -1,15 +1,15 @@
1
- import { Bold as BoldToExtend } from '@tiptap/extension-bold';
2
-
3
- export const Bold = BoldToExtend.extend({
4
- addAttributes() {
5
- return {
6
- ...this.parent?.(),
7
- class: {
8
- default: null
9
- },
10
- style: {
11
- default: null
12
- }
13
- }
14
- }
15
- })
1
+ import { Bold as BoldToExtend } from '@tiptap/extension-bold';
2
+
3
+ export const Bold = BoldToExtend.extend({
4
+ addAttributes() {
5
+ return {
6
+ ...this.parent?.(),
7
+ class: {
8
+ default: null
9
+ },
10
+ style: {
11
+ default: null
12
+ }
13
+ }
14
+ }
15
+ })
@@ -1,15 +1,15 @@
1
- import { BulletList as BulletListToExtend } from '@tiptap/extension-bullet-list';
2
-
3
- export const BulletList = BulletListToExtend.extend({
4
- addAttributes() {
5
- return {
6
- ...this.parent?.(),
7
- class: {
8
- default: 'list-outside'
9
- },
10
- style: {
11
- default: null
12
- }
13
- }
14
- }
15
- })
1
+ import { BulletList as BulletListToExtend } from '@tiptap/extension-bullet-list';
2
+
3
+ export const BulletList = BulletListToExtend.extend({
4
+ addAttributes() {
5
+ return {
6
+ ...this.parent?.(),
7
+ class: {
8
+ default: 'list-outside'
9
+ },
10
+ style: {
11
+ default: null
12
+ }
13
+ }
14
+ }
15
+ })
@@ -1,13 +1,13 @@
1
- import { CodeBlock as CodeBlockToExtend } from '@tiptap/extension-code-block';
2
-
3
- export const CodeBlock = CodeBlockToExtend.extend({
4
- addAttributes() {
5
- return {
6
- ...this.parent?.(),
7
- class: {
8
- default: null
9
- },
10
- style: null
11
- }
12
- }
13
- })
1
+ import { CodeBlock as CodeBlockToExtend } from '@tiptap/extension-code-block';
2
+
3
+ export const CodeBlock = CodeBlockToExtend.extend({
4
+ addAttributes() {
5
+ return {
6
+ ...this.parent?.(),
7
+ class: {
8
+ default: null
9
+ },
10
+ style: null
11
+ }
12
+ }
13
+ })