goodteditor-ui 1.0.21 → 1.0.23

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