goodteditor-ui 1.0.17 → 1.0.19

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 (46) hide show
  1. package/index.js +2 -0
  2. package/package.json +15 -2
  3. package/src/components/ui/WysiwygEditor/WysiwygEditor.d.ts +119 -0
  4. package/src/components/ui/WysiwygEditor/constants.js +255 -0
  5. package/src/components/ui/WysiwygEditor/extensions/blockquote.js +15 -0
  6. package/src/components/ui/WysiwygEditor/extensions/bold.js +15 -0
  7. package/src/components/ui/WysiwygEditor/extensions/bullet-list.js +15 -0
  8. package/src/components/ui/WysiwygEditor/extensions/code-block.js +13 -0
  9. package/src/components/ui/WysiwygEditor/extensions/code.js +13 -0
  10. package/src/components/ui/WysiwygEditor/extensions/font-size.js +34 -0
  11. package/src/components/ui/WysiwygEditor/extensions/formatting.js +14 -0
  12. package/src/components/ui/WysiwygEditor/extensions/heading.js +13 -0
  13. package/src/components/ui/WysiwygEditor/extensions/horizontal-rule.js +15 -0
  14. package/src/components/ui/WysiwygEditor/extensions/image.js +15 -0
  15. package/src/components/ui/WysiwygEditor/extensions/index.d.ts +32 -0
  16. package/src/components/ui/WysiwygEditor/extensions/index.js +32 -0
  17. package/src/components/ui/WysiwygEditor/extensions/italic.js +15 -0
  18. package/src/components/ui/WysiwygEditor/extensions/link.js +16 -0
  19. package/src/components/ui/WysiwygEditor/extensions/list-item.js +15 -0
  20. package/src/components/ui/WysiwygEditor/extensions/ordered-list.js +15 -0
  21. package/src/components/ui/WysiwygEditor/extensions/paragraph.js +23 -0
  22. package/src/components/ui/WysiwygEditor/extensions/strike.js +15 -0
  23. package/src/components/ui/WysiwygEditor/extensions/table-cell.js +13 -0
  24. package/src/components/ui/WysiwygEditor/extensions/table-header.js +15 -0
  25. package/src/components/ui/WysiwygEditor/extensions/table-row.js +15 -0
  26. package/src/components/ui/WysiwygEditor/extensions/table.js +29 -0
  27. package/src/components/ui/WysiwygEditor/extensions/text-align.js +5 -0
  28. package/src/components/ui/WysiwygEditor/extensions/text-style.js +15 -0
  29. package/src/components/ui/WysiwygEditor/extensions/underline.js +15 -0
  30. package/src/components/ui/WysiwygEditor/index.d.ts +4 -0
  31. package/src/components/ui/WysiwygEditor/index.js +4 -0
  32. package/src/components/ui/WysiwygEditor/renders/Button.vue +26 -0
  33. package/src/components/ui/WysiwygEditor/renders/ColorPicker.vue +42 -0
  34. package/src/components/ui/WysiwygEditor/renders/InputAuto.vue +33 -0
  35. package/src/components/ui/WysiwygEditor/renders/InputBrowse.vue +35 -0
  36. package/src/components/ui/WysiwygEditor/renders/InputUnits.vue +37 -0
  37. package/src/components/ui/WysiwygEditor/renders/Select.vue +45 -0
  38. package/src/components/ui/WysiwygEditor/renders/ToolbarPopover.vue +50 -0
  39. package/src/components/ui/WysiwygEditor/renders/index.d.ts +7 -0
  40. package/src/components/ui/WysiwygEditor/renders/index.js +7 -0
  41. package/src/components/ui/WysiwygEditor/renders/mixins/RenderMixin.js +39 -0
  42. package/src/components/ui/WysiwygEditor/renders/mixins/index.js +1 -0
  43. package/src/components/ui/WysiwygEditor/tools-and-commands.js +709 -0
  44. package/src/components/ui/WysiwygEditor/utils.js +72 -0
  45. package/src/components/ui/WysiwygEditor.md +18 -0
  46. package/src/components/ui/WysiwygEditor.vue +260 -0
package/index.js CHANGED
@@ -22,6 +22,7 @@ import Select from './src/components/ui/Select.vue';
22
22
  import TimePicker from './src/components/ui/TimePicker.vue';
23
23
  import Tooltip from './src/components/ui/Tooltip.vue';
24
24
  import Grid from './src/components/ui/Grid.vue';
25
+ import WysiwygEditor from './src/components/ui/WysiwygEditor.vue';
25
26
 
26
27
  export {
27
28
  Avatar,
@@ -48,4 +49,5 @@ export {
48
49
  TimePicker,
49
50
  Tooltip,
50
51
  Grid,
52
+ WysiwygEditor
51
53
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "goodteditor-ui",
3
- "version": "1.0.17",
3
+ "version": "1.0.19",
4
4
  "main": "index.js",
5
5
  "homepage": "https://goodt-ui.netlify.app/",
6
6
  "scripts": {
@@ -27,7 +27,20 @@
27
27
  "less-loader": "^5.0.0",
28
28
  "netlify-cli": "^5.0.1",
29
29
  "vue-styleguidist": "4.35.0",
30
- "vue-template-compiler": "^2.6.12"
30
+ "vue-template-compiler": "^2.6.12",
31
+ "@tiptap/extension-color": "^2.0.0-beta.207",
32
+ "@tiptap/extension-font-family": "^2.0.0-beta.207",
33
+ "@tiptap/extension-image": "^2.0.0-beta.27",
34
+ "@tiptap/extension-link": "^2.0.0-beta.36",
35
+ "@tiptap/extension-table": "2.0.0-beta.48",
36
+ "@tiptap/extension-table-cell": "^2.0.0-beta.20",
37
+ "@tiptap/extension-table-header": "^2.0.0-beta.22",
38
+ "@tiptap/extension-table-row": "^2.0.0-beta.19",
39
+ "@tiptap/extension-text-align": "^2.0.0-beta.207",
40
+ "@tiptap/extension-text-style": "^2.0.0-beta.207",
41
+ "@tiptap/extension-underline": "^2.0.0-beta.207",
42
+ "@tiptap/starter-kit": "^2.0.0-beta.183",
43
+ "@tiptap/vue-2": "^2.0.0-beta.84"
31
44
  },
32
45
  "peerDependencies": {
33
46
  "vue": "^2.6.12"
@@ -0,0 +1,119 @@
1
+ import { Button, Select, InputUnits, ColorPicker, ToolbarPopover, InputAuto, InputBrowse } from './renders';
2
+
3
+ export type Render = Readonly<{
4
+ BUTTON: Button;
5
+ COLOR_PICKER: ColorPicker;
6
+ INPUT_UNITS: InputUnits;
7
+ SELECT: Select;
8
+ TOOLBAR_POPOVER: ToolbarPopover;
9
+ INPUT_AUTO: InputAuto;
10
+ INPUT_BROWSE: InputBrowse;
11
+ }>;
12
+
13
+ export type CommandDef = {
14
+ name: String;
15
+ title: String;
16
+ exec: () => void;
17
+ isActive: () => Boolean;
18
+ isEnabled: () => Boolean;
19
+ };
20
+
21
+ export type ToolDef = {
22
+ name: String;
23
+ render: Render;
24
+ title: String;
25
+ icon: String;
26
+ exec: (value?: String) => void;
27
+ isActive: () => Boolean;
28
+ isEnabled: () => Boolean;
29
+ getValue?: () => String;
30
+ options?: Array<String | ToolDef | CommandDef>;
31
+ units?: Array<String>
32
+ };
33
+
34
+ export type NodeType = Readonly<{
35
+ BLOCKQUOTE: 'blockquote',
36
+ BULLET_LIST: 'bulletList',
37
+ CODE_BLOCK: 'codeBlock',
38
+ DOCUMENT: 'document',
39
+ HARD_BREAK: 'hardBreak',
40
+ HEADING: 'heading',
41
+ HORIZONTAL_RULE: 'horizontalRule',
42
+ IMAGE: 'image',
43
+ LIST_ITEM: 'listItem',
44
+ ORDERED_LIST: 'orderedList',
45
+ PARAGRAPH: 'paragraph',
46
+ TABLE: 'table',
47
+ TABLE_ROW: 'tableRow',
48
+ TABLE_CELL: 'tableCell',
49
+ TEXT: 'text'
50
+ }>;
51
+
52
+ export type MarkType = Readonly<{
53
+ BOLD: 'bold',
54
+ CODE: 'code',
55
+ ITALIC: 'italic',
56
+ LINK: 'link',
57
+ STRIKE: 'strike',
58
+ UNDERLINE: 'underline',
59
+ TEXT_STYLE: 'textStyle'
60
+ }>;
61
+
62
+ export type CommandType = Readonly<{
63
+ PARAGRAPH: 'paragraph',
64
+ HEADING_1: 'heading1',
65
+ HEADING_2: 'heading2',
66
+ HEADING_3: 'heading3',
67
+ HEADING_4: 'heading4',
68
+ TEXT_SMALL: 'textSmall',
69
+ TEXT_XSMALL: 'textXsmall',
70
+ CODE_BLOCK: 'codeBlock',
71
+ SINK_LIST_ITEM: 'sinkListItem',
72
+ LIFT_LIST_ITEM: 'liftListItem'
73
+ }>;
74
+
75
+ export type ToolType = Readonly<{
76
+ PARAGRAPH_STYLE: 'paragraphStyle',
77
+ FONT_SIZE: 'fontSize',
78
+ FONT_FAMILY: 'fontFamily',
79
+ TEXT_COLOR: 'textColor',
80
+ BLOCKQUOTE: 'blockquote',
81
+ ORDERED_LIST: 'orderedList',
82
+ BULLET_LIST: 'bulletList',
83
+ TEXT_ALIGN_LEFT: 'textAlignLeft',
84
+ TEXT_ALIGN_RIGHT: 'textAlignRight',
85
+ TEXT_ALIGN_CENTER: 'textAlignCenter',
86
+ HORIZONTAL_RULE: 'horizontalRule',
87
+ LINK: 'link',
88
+ IMAGE: 'image',
89
+ TABLE: 'table',
90
+ BOLD: 'bold',
91
+ CODE: 'code',
92
+ ITALIC: 'italic',
93
+ STRIKE: 'strike',
94
+ UNDERLINE: 'underline',
95
+ UNDO: 'undo',
96
+ REDO: 'redo',
97
+ SAVE: 'save',
98
+ CLEAR_FORMATTING: 'clearFormatting',
99
+ HARD_BREAK: 'hardBreak',
100
+ INSERT_TABLE: 'insertTable',
101
+ DELETE_TABLE: 'deleteTable',
102
+ ADD_COLUMN_BEFORE: 'addColumnBefore',
103
+ ADD_COLUMN_AFTER: 'addColumnAfter',
104
+ DELETE_COLUMN: 'deleteColumn',
105
+ ADD_ROW_BEFORE: 'addRowBefore',
106
+ ADD_ROW_AFTER: 'addRowAfter',
107
+ DELETE_ROW: 'deleteRow',
108
+ MERGE_CELLS: 'mergeCells',
109
+ SPLIT_CELL: 'splitCell',
110
+ TOGGLE_HEADER_COLUMN: 'toggleHeaderColumn',
111
+ TOGGLE_HEADER_ROW: 'toggleHeaderRow',
112
+ ALIGN_V_TOP: 'alignVTop',
113
+ ALIGN_V_MID: 'alignVMid',
114
+ ALIGN_V_BOT: 'alignVBot',
115
+ TOGGLE_BORDERS: 'toggleBorders',
116
+ TOGGLE_ZEBRA: 'toggleZebra',
117
+ INSERT_IMAGE: 'insertImage',
118
+ INSERT_LINK: 'insertLink'
119
+ }>;
@@ -0,0 +1,255 @@
1
+ import { Button, Select, InputUnits, ColorPicker, ToolbarPopover, InputAuto, InputBrowse } 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
+ INSERT_LINK: 'insertLink'
121
+ });
122
+
123
+ /**
124
+ * @param {Command} command
125
+ * @return Command
126
+ */
127
+ export const createCommand = ({
128
+ name,
129
+ title = 'Unknown command',
130
+ exec = () => {},
131
+ isActive = () => false,
132
+ isEnabled = () => true
133
+ }) => ({
134
+ name,
135
+ title,
136
+ exec,
137
+ isActive,
138
+ isEnabled
139
+ });
140
+
141
+ /**
142
+ * @type Render
143
+ */
144
+ export const Render = Object.freeze({
145
+ BUTTON: Button,
146
+ COLOR_PICKER: ColorPicker,
147
+ INPUT_UNITS: InputUnits,
148
+ SELECT: Select,
149
+ TOOLBAR_POPOVER: ToolbarPopover,
150
+ INPUT_AUTO: InputAuto,
151
+ INPUT_BROWSE: InputBrowse
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
+ export const DefaultTools = [
240
+ [ToolType.PARAGRAPH_STYLE, ToolType.TEXT_COLOR, ToolType.FONT_SIZE, ToolType.FONT_FAMILY, ToolType.BLOCKQUOTE],
241
+ [ToolType.BOLD, ToolType.ITALIC, ToolType.UNDERLINE, ToolType.STRIKE, ToolType.CODE],
242
+ [ToolType.TEXT_ALIGN_LEFT, ToolType.TEXT_ALIGN_CENTER, ToolType.TEXT_ALIGN_RIGHT],
243
+ [ToolType.ORDERED_LIST, ToolType.BULLET_LIST],
244
+ [ToolType.IMAGE, ToolType.LINK, ToolType.TABLE],
245
+ [ToolType.CLEAR_FORMATTING, ToolType.HARD_BREAK]
246
+ ];
247
+
248
+ export const DefaultToolGroupsTitles = [
249
+ 'Оформление',
250
+ 'Форматирование',
251
+ 'Выравнивание',
252
+ 'Нумерация',
253
+ 'Вставка',
254
+ ''
255
+ ];
@@ -0,0 +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
+ })
@@ -0,0 +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
+ })
@@ -0,0 +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
+ })
@@ -0,0 +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
+ })
@@ -0,0 +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
+ })
@@ -0,0 +1,34 @@
1
+ import { Extension } from '@tiptap/vue-2';
2
+ import { MarkType } from '../constants';
3
+
4
+ export const FontSize = Extension.create({
5
+ name: 'fontSize',
6
+ addOptions() {
7
+ return {
8
+ types: [MarkType.TEXT_STYLE]
9
+ };
10
+ },
11
+ addGlobalAttributes() {
12
+ return [
13
+ {
14
+ types: this.options.types,
15
+ attributes: {
16
+ fontSize: {
17
+ default: null,
18
+ parseHTML: ({ style }) => style.fontSize?.replace(/['"]+/g, ''),
19
+ renderHTML: ({ fontSize }) => ({ ...(fontSize && { style: `font-size: ${fontSize}` }) })
20
+ }
21
+ }
22
+ }
23
+ ];
24
+ },
25
+ addCommands() {
26
+ return {
27
+ setFontSize: fontSize => ({ chain }) => chain().setMark(MarkType.TEXT_STYLE, { fontSize }).run(),
28
+ unsetFontSize: () => ({ chain }) => chain()
29
+ .setMark(MarkType.TEXT_STYLE, { fontSize: null })
30
+ .removeEmptyTextStyle()
31
+ .run()
32
+ };
33
+ }
34
+ });
@@ -0,0 +1,14 @@
1
+ import { Extension } from '@tiptap/vue-2';
2
+
3
+ export const Formatting = Extension.create({
4
+ name: 'formatting',
5
+ addCommands() {
6
+ return {
7
+ clearFormatting: () => ({ chain }) =>
8
+ chain()
9
+ .clearNodes()
10
+ .unsetAllMarks()
11
+ .run()
12
+ }
13
+ }
14
+ })
@@ -0,0 +1,13 @@
1
+ import { Heading as HeadingToExtend } from '@tiptap/extension-heading';
2
+
3
+ export const Heading = HeadingToExtend.extend({
4
+ addAttributes() {
5
+ return {
6
+ ...this.parent?.(),
7
+ class: {
8
+ default: null
9
+ },
10
+ style: null
11
+ }
12
+ }
13
+ })
@@ -0,0 +1,15 @@
1
+ import { HorizontalRule as HorizontalRuleToExtend } from '@tiptap/extension-horizontal-rule';
2
+
3
+ export const HorizontalRule = HorizontalRuleToExtend.extend({
4
+ addAttributes() {
5
+ return {
6
+ ...this.parent?.(),
7
+ class: {
8
+ default: null
9
+ },
10
+ style: {
11
+ default: null
12
+ }
13
+ }
14
+ }
15
+ })
@@ -0,0 +1,15 @@
1
+ import { Image as ImageToExtend } from '@tiptap/extension-image';
2
+
3
+ export const Image = ImageToExtend.extend({
4
+ addAttributes() {
5
+ return {
6
+ ...this.parent?.(),
7
+ class: {
8
+ default: 'responsive'
9
+ },
10
+ style: {
11
+ default: null
12
+ }
13
+ }
14
+ }
15
+ })
@@ -0,0 +1,32 @@
1
+ export { Document } from '@tiptap/extension-document';
2
+ export { Text } from '@tiptap/extension-text';
3
+ export { History } from '@tiptap/extension-history';
4
+ export { Dropcursor } from '@tiptap/extension-dropcursor';
5
+ export { Gapcursor } from '@tiptap/extension-gapcursor';
6
+ export { Color } from '@tiptap/extension-color';
7
+ export { FontFamily } from '@tiptap/extension-font-family';
8
+ export { HardBreak } from '@tiptap/extension-hard-break';
9
+
10
+ export { Table } from './table';
11
+ export { TableRow } from './table-row';
12
+ export { TableCell } from './table-cell';
13
+ export { TableHeader } from './table-header';
14
+ export { Heading } from './heading';
15
+ export { Code } from './code';
16
+ export { CodeBlock } from './code-block';
17
+ export { Link } from './link';
18
+ export { TextAlign } from './text-align';
19
+ export { FontSize } from './font-size';
20
+ export { Paragraph } from './paragraph';
21
+ export { Formatting } from './formatting';
22
+ export { TextStyle } from './text-style';
23
+ export { Blockquote } from './blockquote';
24
+ export { Bold } from './bold';
25
+ export { Italic } from './italic';
26
+ export { Underline } from './underline';
27
+ export { Strike } from './strike';
28
+ export { OrderedList } from './ordered-list';
29
+ export { BulletList } from './bullet-list';
30
+ export { ListItem } from './list-item';
31
+ export { Image } from './image';
32
+ export { HorizontalRule } from './horizontal-rule';
@@ -0,0 +1,32 @@
1
+ export { Document } from '@tiptap/extension-document';
2
+ export { Text } from '@tiptap/extension-text';
3
+ export { History } from '@tiptap/extension-history';
4
+ export { Dropcursor } from '@tiptap/extension-dropcursor';
5
+ export { Gapcursor } from '@tiptap/extension-gapcursor';
6
+ export { Color } from '@tiptap/extension-color';
7
+ export { FontFamily } from '@tiptap/extension-font-family';
8
+ export { HardBreak } from '@tiptap/extension-hard-break';
9
+
10
+ export { Table } from './table';
11
+ export { TableRow } from './table-row';
12
+ export { TableCell } from './table-cell';
13
+ export { TableHeader } from './table-header';
14
+ export { Heading } from './heading';
15
+ export { Code } from './code';
16
+ export { CodeBlock } from './code-block';
17
+ export { Link } from './link';
18
+ export { TextAlign } from './text-align';
19
+ export { FontSize } from './font-size';
20
+ export { Paragraph } from './paragraph';
21
+ export { Formatting } from './formatting';
22
+ export { TextStyle } from './text-style';
23
+ export { Blockquote } from './blockquote';
24
+ export { Bold } from './bold';
25
+ export { Italic } from './italic';
26
+ export { Underline } from './underline';
27
+ export { Strike } from './strike';
28
+ export { OrderedList } from './ordered-list';
29
+ export { BulletList } from './bullet-list';
30
+ export { ListItem } from './list-item';
31
+ export { Image } from './image';
32
+ export { HorizontalRule } from './horizontal-rule';
@@ -0,0 +1,15 @@
1
+ import { Italic as ItalicToExtend } from '@tiptap/extension-italic';
2
+
3
+ export const Italic = ItalicToExtend.extend({
4
+ addAttributes() {
5
+ return {
6
+ ...this.parent?.(),
7
+ class: {
8
+ default: null
9
+ },
10
+ style: {
11
+ default: null
12
+ }
13
+ }
14
+ }
15
+ })