goodteditor-ui 1.0.16 → 1.0.18

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 (47) hide show
  1. package/index.js +2 -0
  2. package/package.json +15 -2
  3. package/src/components/ui/Select.vue +11 -10
  4. package/src/components/ui/WysiwygEditor/WysiwygEditor.d.ts +119 -0
  5. package/src/components/ui/WysiwygEditor/constants.js +209 -0
  6. package/src/components/ui/WysiwygEditor/extensions/blockquote.js +15 -0
  7. package/src/components/ui/WysiwygEditor/extensions/bold.js +15 -0
  8. package/src/components/ui/WysiwygEditor/extensions/bullet-list.js +15 -0
  9. package/src/components/ui/WysiwygEditor/extensions/code-block.js +13 -0
  10. package/src/components/ui/WysiwygEditor/extensions/code.js +13 -0
  11. package/src/components/ui/WysiwygEditor/extensions/font-size.js +34 -0
  12. package/src/components/ui/WysiwygEditor/extensions/formatting.js +14 -0
  13. package/src/components/ui/WysiwygEditor/extensions/heading.js +13 -0
  14. package/src/components/ui/WysiwygEditor/extensions/horizontal-rule.js +15 -0
  15. package/src/components/ui/WysiwygEditor/extensions/image.js +15 -0
  16. package/src/components/ui/WysiwygEditor/extensions/index.d.ts +32 -0
  17. package/src/components/ui/WysiwygEditor/extensions/index.js +31 -0
  18. package/src/components/ui/WysiwygEditor/extensions/italic.js +15 -0
  19. package/src/components/ui/WysiwygEditor/extensions/link.js +16 -0
  20. package/src/components/ui/WysiwygEditor/extensions/list-item.js +15 -0
  21. package/src/components/ui/WysiwygEditor/extensions/ordered-list.js +15 -0
  22. package/src/components/ui/WysiwygEditor/extensions/paragraph.js +23 -0
  23. package/src/components/ui/WysiwygEditor/extensions/strike.js +15 -0
  24. package/src/components/ui/WysiwygEditor/extensions/table-cell.js +13 -0
  25. package/src/components/ui/WysiwygEditor/extensions/table-header.js +15 -0
  26. package/src/components/ui/WysiwygEditor/extensions/table-row.js +15 -0
  27. package/src/components/ui/WysiwygEditor/extensions/table.js +29 -0
  28. package/src/components/ui/WysiwygEditor/extensions/text-align.js +5 -0
  29. package/src/components/ui/WysiwygEditor/extensions/text-style.js +15 -0
  30. package/src/components/ui/WysiwygEditor/extensions/underline.js +15 -0
  31. package/src/components/ui/WysiwygEditor/index.d.ts +4 -0
  32. package/src/components/ui/WysiwygEditor/index.js +4 -0
  33. package/src/components/ui/WysiwygEditor/renders/Button.vue +26 -0
  34. package/src/components/ui/WysiwygEditor/renders/ColorPicker.vue +42 -0
  35. package/src/components/ui/WysiwygEditor/renders/InputAuto.vue +33 -0
  36. package/src/components/ui/WysiwygEditor/renders/InputBrowse.vue +35 -0
  37. package/src/components/ui/WysiwygEditor/renders/InputUnits.vue +37 -0
  38. package/src/components/ui/WysiwygEditor/renders/Select.vue +45 -0
  39. package/src/components/ui/WysiwygEditor/renders/ToolbarPopover.vue +50 -0
  40. package/src/components/ui/WysiwygEditor/renders/index.d.ts +7 -0
  41. package/src/components/ui/WysiwygEditor/renders/index.js +7 -0
  42. package/src/components/ui/WysiwygEditor/renders/mixins/RenderMixin.js +39 -0
  43. package/src/components/ui/WysiwygEditor/renders/mixins/index.js +1 -0
  44. package/src/components/ui/WysiwygEditor/tools-and-commands.js +709 -0
  45. package/src/components/ui/WysiwygEditor/utils.js +72 -0
  46. package/src/components/ui/WysiwygEditor.md +18 -0
  47. package/src/components/ui/WysiwygEditor.vue +236 -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.16",
3
+ "version": "1.0.18",
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"
@@ -10,7 +10,7 @@
10
10
  <div class="ui-select-label u-select-none">
11
11
  <template v-if="multiple">
12
12
  <template v-if="optionsSelected.length">
13
- <!--
13
+ <!--
14
14
  @slot Label slot for multiple mode
15
15
  @binding {Object} option option
16
16
  @binding {any} value option's value
@@ -41,7 +41,7 @@
41
41
  </slot>
42
42
  </template>
43
43
  <div class="ui-select-placeholder events-none" v-else>
44
- <!--
44
+ <!--
45
45
  @slot Placeholder slot
46
46
  -->
47
47
  <slot name="placeholder">
@@ -51,7 +51,7 @@
51
51
  </template>
52
52
 
53
53
  <template v-else>
54
- <!--
54
+ <!--
55
55
  @slot Label slot for single mode
56
56
  @binding {Object} option option
57
57
  @binding {any} value option's value
@@ -69,7 +69,7 @@
69
69
  {{ getOptionLabel(optionsSelected[0]) }}
70
70
  </slot>
71
71
  <div class="ui-select-placeholder events-none" v-else>
72
- <!--
72
+ <!--
73
73
  @slot Placeholder slot
74
74
  -->
75
75
  <slot name="placeholder">
@@ -78,7 +78,7 @@
78
78
  </div>
79
79
  </template>
80
80
  </div>
81
- <!--
81
+ <!--
82
82
  @slot Open state icon slot
83
83
  -->
84
84
  <slot name="icon-open" v-if="popoverShow">
@@ -86,7 +86,7 @@
86
86
  <i class="mdi mdi-chevron-up"></i>
87
87
  </div>
88
88
  </slot>
89
- <!--
89
+ <!--
90
90
  @slot Close state icon slot
91
91
  -->
92
92
  <slot name="icon-close" v-else>
@@ -105,13 +105,13 @@
105
105
  ref="datalist"
106
106
  >
107
107
  <template #header>
108
- <!--
108
+ <!--
109
109
  @slot Dropdown header slot
110
110
  -->
111
111
  <slot name="dropdown-header"></slot>
112
112
  </template>
113
113
  <template #option="{ option, index, cursorIndex }">
114
- <!--
114
+ <!--
115
115
  @slot Label slot for single mode
116
116
  @binding {Object} option option
117
117
  @binding {any} value option's value
@@ -121,7 +121,7 @@
121
121
  @binding {Number} cursorIndex current cursor index
122
122
  @binding {Function} selectOption function that selects option
123
123
  @binding {Function} deselectOption function that deselects option
124
- @binding {Function} toggleOption function that toggles option selection
124
+ @binding {Function} toggleOption function that toggles option selection
125
125
  @binding {Number} optionIndex option's index
126
126
  @binding {Boolean} isOptionSelected option selection status
127
127
  -->
@@ -148,6 +148,7 @@
148
148
  'bg-grey-lighter': index == cursorIndex,
149
149
  }"
150
150
  :key="index"
151
+ :title="getOptionLabel(option)"
151
152
  @click="toggleOption(option)"
152
153
  >
153
154
  <div class="row row-collapse" v-if="multiple">
@@ -174,7 +175,7 @@
174
175
  </slot>
175
176
  </template>
176
177
  <template #footer>
177
- <!--
178
+ <!--
178
179
  @slot Dropdown footer slot
179
180
  -->
180
181
  <slot name="dropdown-footer"></slot>
@@ -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?: () => unknown;
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,209 @@
1
+ import { Button, Select, InputUnits, ColorPicker, ToolbarPopover, InputAuto, InputBrowse } from './renders';
2
+
3
+ /**
4
+ * @type {import('./WysiwygEditor').NodeType}
5
+ */
6
+ export const NodeType = Object.freeze({
7
+ BLOCKQUOTE: 'blockquote',
8
+ BULLET_LIST: 'bulletList',
9
+ CODE_BLOCK: 'codeBlock',
10
+ DOCUMENT: 'document',
11
+ HARD_BREAK: 'hardBreak',
12
+ HEADING: 'heading',
13
+ HORIZONTAL_RULE: 'horizontalRule',
14
+ IMAGE: 'image',
15
+ LIST_ITEM: 'listItem',
16
+ ORDERED_LIST: 'orderedList',
17
+ PARAGRAPH: 'paragraph',
18
+ TABLE: 'table',
19
+ TABLE_ROW: 'tableRow',
20
+ TABLE_CELL: 'tableCell',
21
+ TEXT: 'text'
22
+ });
23
+
24
+ /**
25
+ * @type {import('./WysiwygEditor').MarkType}
26
+ */
27
+ export const MarkType = Object.freeze({
28
+ BOLD: 'bold',
29
+ CODE: 'code',
30
+ ITALIC: 'italic',
31
+ LINK: 'link',
32
+ STRIKE: 'strike',
33
+ UNDERLINE: 'underline',
34
+ TEXT_STYLE: 'textStyle'
35
+ });
36
+
37
+ /**
38
+ * @type {import('./WysiwygEditor').CommandType}
39
+ */
40
+ export const CommandType = Object.freeze({
41
+ /* paragraph style */
42
+ PARAGRAPH: 'paragraph',
43
+ HEADING_1: `heading1`,
44
+ HEADING_2: `heading2`,
45
+ HEADING_3: `heading3`,
46
+ HEADING_4: `heading4`,
47
+ TEXT_SMALL: 'textSmall',
48
+ TEXT_XSMALL: 'textXsmall',
49
+ CODE_BLOCK: 'codeBlock',
50
+ /* list */
51
+ SINK_LIST_ITEM: 'sinkListItem',
52
+ LIFT_LIST_ITEM: 'liftListItem'
53
+ });
54
+
55
+ /**
56
+ * @type {import('./WysiwygEditor').ToolType}
57
+ */
58
+ export const ToolType = Object.freeze({
59
+ /* typography */
60
+ PARAGRAPH_STYLE: 'paragraphStyle',
61
+ FONT_SIZE: 'fontSize',
62
+ FONT_FAMILY: 'fontFamily',
63
+ TEXT_COLOR: 'textColor',
64
+ BLOCKQUOTE: 'blockquote',
65
+ /* lists */
66
+ ORDERED_LIST: 'orderedList',
67
+ BULLET_LIST: 'bulletList',
68
+ /* alignment */
69
+ TEXT_ALIGN_LEFT: 'textAlignLeft',
70
+ TEXT_ALIGN_RIGHT: 'textAlignRight',
71
+ TEXT_ALIGN_CENTER: 'textAlignCenter',
72
+ /* insertion */
73
+ LINK: 'link',
74
+ IMAGE: 'image',
75
+ TABLE: 'table',
76
+ /* formatting */
77
+ BOLD: 'bold',
78
+ CODE: 'code',
79
+ ITALIC: 'italic',
80
+ STRIKE: 'strike',
81
+ UNDERLINE: 'underline',
82
+ /* history */
83
+ UNDO: 'undo',
84
+ REDO: 'redo',
85
+ SAVE: 'save',
86
+ /* other */
87
+ CLEAR_FORMATTING: 'clearFormatting',
88
+ HARD_BREAK: 'hardBreak',
89
+ HORIZONTAL_RULE: 'horizontalRule',
90
+ /** table options */
91
+ INSERT_TABLE: 'insertTable',
92
+ DELETE_TABLE: 'deleteTable',
93
+ ADD_COLUMN_BEFORE: 'addColumnBefore',
94
+ ADD_COLUMN_AFTER: 'addColumnAfter',
95
+ DELETE_COLUMN: 'deleteColumn',
96
+ ADD_ROW_BEFORE: 'addRowBefore',
97
+ ADD_ROW_AFTER: 'addRowAfter',
98
+ DELETE_ROW: 'deleteRow',
99
+ MERGE_CELLS: 'mergeCells',
100
+ SPLIT_CELL: 'splitCell',
101
+ TOGGLE_HEADER_COLUMN: 'toggleHeaderColumn',
102
+ TOGGLE_HEADER_ROW: 'toggleHeaderRow',
103
+ ALIGN_V_TOP: 'alignVTop',
104
+ ALIGN_V_MID: 'alignVMid',
105
+ ALIGN_V_BOT: 'alignVBot',
106
+ TOGGLE_BORDERS: 'toggleBorders',
107
+ TOGGLE_ZEBRA: 'toggleZebra',
108
+ /** image options */
109
+ INSERT_IMAGE: 'insertImage',
110
+ INSERT_LINK: 'insertLink'
111
+ });
112
+
113
+ export const createCommand = ({
114
+ name,
115
+ title = 'Unknown command',
116
+ exec = () => {},
117
+ isActive = () => false,
118
+ isEnabled = () => true
119
+ }) => ({
120
+ name,
121
+ title,
122
+ exec,
123
+ isActive,
124
+ isEnabled
125
+ });
126
+
127
+ /**
128
+ * @type {import('./WysiwygEditor').Render}
129
+ */
130
+ export const Render = Object.freeze({
131
+ BUTTON: Button,
132
+ COLOR_PICKER: ColorPicker,
133
+ INPUT_UNITS: InputUnits,
134
+ SELECT: Select,
135
+ TOOLBAR_POPOVER: ToolbarPopover,
136
+ INPUT_AUTO: InputAuto,
137
+ INPUT_BROWSE: InputBrowse
138
+ });
139
+
140
+ export const createBaseTool = ({
141
+ name,
142
+ render = Render.BUTTON,
143
+ title = 'Unknown tool',
144
+ icon = 'help-circle-outline',
145
+ exec = () => {},
146
+ isActive = () => false,
147
+ isEnabled = () => true
148
+ }) => ({
149
+ name,
150
+ render,
151
+ title,
152
+ icon,
153
+ exec,
154
+ isActive,
155
+ isEnabled
156
+ });
157
+
158
+ export const createButtonTool = (toolOptions) => createBaseTool(toolOptions);
159
+
160
+ export const createSelectTool = ({ getValue = () => null, options = [], ...toolOptions }) => ({
161
+ ...createBaseTool({ render: Render.SELECT, ...toolOptions }),
162
+ getValue,
163
+ options
164
+ });
165
+
166
+ export const createColorPickerTool = ({ getValue = () => null, ...toolOptions }) => ({
167
+ ...createBaseTool({ render: Render.COLOR_PICKER, ...toolOptions }),
168
+ getValue
169
+ });
170
+
171
+ export const createInputUnitsTool = ({ getValue = () => null, units = [], ...toolOptions }) => ({
172
+ ...createBaseTool({ render: Render.INPUT_UNITS, ...toolOptions }),
173
+ getValue,
174
+ units
175
+ });
176
+
177
+ export const createToolbarPopoverTool = ({ options = [], ...toolOptions }) => ({
178
+ ...createBaseTool({ render: Render.TOOLBAR_POPOVER, ...toolOptions }),
179
+ options
180
+ });
181
+
182
+ export const createInputAutoTool = ({ getValue = () => null, options = [], ...toolOptions }) => ({
183
+ ...createBaseTool({ render: Render.INPUT_AUTO, ...toolOptions }),
184
+ getValue,
185
+ options
186
+ });
187
+
188
+ export const createInputBrowseTool = ({ getValue = () => null, ...toolOptions }) => ({
189
+ ...createBaseTool({ render: Render.INPUT_BROWSE, ...toolOptions }),
190
+ getValue
191
+ });
192
+
193
+ export const DefaultTools = [
194
+ [ToolType.PARAGRAPH_STYLE, ToolType.TEXT_COLOR, ToolType.FONT_SIZE, ToolType.FONT_FAMILY, ToolType.BLOCKQUOTE],
195
+ [ToolType.BOLD, ToolType.ITALIC, ToolType.UNDERLINE, ToolType.STRIKE, ToolType.CODE],
196
+ [ToolType.TEXT_ALIGN_LEFT, ToolType.TEXT_ALIGN_CENTER, ToolType.TEXT_ALIGN_RIGHT],
197
+ [ToolType.ORDERED_LIST, ToolType.BULLET_LIST],
198
+ [ToolType.IMAGE, ToolType.LINK, ToolType.TABLE],
199
+ [ToolType.CLEAR_FORMATTING, ToolType.HARD_BREAK]
200
+ ];
201
+
202
+ export const DefaultToolGroupsTitles = [
203
+ 'Оформление',
204
+ 'Форматирование',
205
+ 'Выравнивание',
206
+ 'Нумерация',
207
+ 'Вставка',
208
+ ''
209
+ ];
@@ -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';