@srcker/editor-vue-next 1.0.3 → 1.0.5

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 (102) hide show
  1. package/dist/rich-editor.es.js +21256 -0
  2. package/dist/style/index.css +1 -0
  3. package/dist/style/style.css +1 -0
  4. package/dist/style/variables.css +1 -0
  5. package/dist/style.es.js +1 -0
  6. package/dist/variables.es.js +1 -0
  7. package/package.json +8 -2
  8. package/.vscode/extensions.json +0 -3
  9. package/index.html +0 -13
  10. package/index.ts +0 -6
  11. package/jsconfig.json +0 -8
  12. package/public/favicon.ico +0 -0
  13. package/src/App.vue +0 -9
  14. package/src/App.vue.js +0 -17
  15. package/src/Button/BackgroundButton.vue +0 -331
  16. package/src/Button/BackgroundButton.vue.js +0 -243
  17. package/src/Button/BlockQuoteButton.vue +0 -26
  18. package/src/Button/BlockQuoteButton.vue.js +0 -56
  19. package/src/Button/BoldButton.vue +0 -29
  20. package/src/Button/BoldButton.vue.js +0 -56
  21. package/src/Button/BulletListButton.vue +0 -114
  22. package/src/Button/BulletListButton.vue.js +0 -147
  23. package/src/Button/CodeBlockButton.vue +0 -28
  24. package/src/Button/CodeBlockButton.vue.js +0 -56
  25. package/src/Button/CodeButton.vue +0 -30
  26. package/src/Button/CodeButton.vue.js +0 -56
  27. package/src/Button/FontSizeButton.vue +0 -85
  28. package/src/Button/FontSizeButton.vue.js +0 -131
  29. package/src/Button/FormatButton.vue +0 -25
  30. package/src/Button/FormatButton.vue.js +0 -54
  31. package/src/Button/HeadingButton.vue +0 -103
  32. package/src/Button/HeadingButton.vue.js +0 -164
  33. package/src/Button/ImageUploadButton.vue +0 -93
  34. package/src/Button/ImageUploadButton.vue.js +0 -123
  35. package/src/Button/IndentLeftButton.vue +0 -25
  36. package/src/Button/IndentLeftButton.vue.js +0 -54
  37. package/src/Button/IndentRightButton.vue +0 -29
  38. package/src/Button/IndentRightButton.vue.js +0 -54
  39. package/src/Button/ItalicButton.vue +0 -29
  40. package/src/Button/ItalicButton.vue.js +0 -56
  41. package/src/Button/LineHeightButton.vue +0 -88
  42. package/src/Button/LineHeightButton.vue.js +0 -131
  43. package/src/Button/LinkButton.vue +0 -44
  44. package/src/Button/LinkButton.vue.js +0 -69
  45. package/src/Button/OrderedListButton.vue +0 -121
  46. package/src/Button/OrderedListButton.vue.js +0 -146
  47. package/src/Button/RedoButton.vue +0 -29
  48. package/src/Button/RedoButton.vue.js +0 -55
  49. package/src/Button/StrikeButton.vue +0 -30
  50. package/src/Button/StrikeButton.vue.js +0 -56
  51. package/src/Button/SubscriptButton.vue +0 -29
  52. package/src/Button/SubscriptButton.vue.js +0 -56
  53. package/src/Button/SuperscriptButton.vue +0 -29
  54. package/src/Button/SuperscriptButton.vue.js +0 -56
  55. package/src/Button/TextAlignCenterButton.vue +0 -26
  56. package/src/Button/TextAlignCenterButton.vue.js +0 -56
  57. package/src/Button/TextAlignLeftButton.vue +0 -26
  58. package/src/Button/TextAlignLeftButton.vue.js +0 -56
  59. package/src/Button/TextAlignRightButton.vue +0 -26
  60. package/src/Button/TextAlignRightButton.vue.js +0 -56
  61. package/src/Button/TextColorButton.vue +0 -329
  62. package/src/Button/TextColorButton.vue.js +0 -243
  63. package/src/Button/ThemeButton.vue +0 -34
  64. package/src/Button/ThemeButton.vue.js +0 -63
  65. package/src/Button/UnderLineButton.vue +0 -29
  66. package/src/Button/UnderLineButton.vue.js +0 -56
  67. package/src/Button/UndoButton.vue +0 -29
  68. package/src/Button/UndoButton.vue.js +0 -55
  69. package/src/Components/IconArrow.vue +0 -16
  70. package/src/Components/IconArrow.vue.js +0 -30
  71. package/src/Components/IconCheck.vue +0 -40
  72. package/src/Components/IconCheck.vue.js +0 -59
  73. package/src/EditorToolbar.vue +0 -150
  74. package/src/EditorToolbar.vue.js +0 -306
  75. package/src/Extensions/BulletListStyle.js +0 -19
  76. package/src/Extensions/BulletListStyle.ts +0 -24
  77. package/src/Extensions/FontSize.js +0 -27
  78. package/src/Extensions/FontSize.ts +0 -37
  79. package/src/Extensions/Indent.js +0 -58
  80. package/src/Extensions/Indent.ts +0 -73
  81. package/src/Extensions/OrderedListStyle.js +0 -19
  82. package/src/Extensions/OrderedListStyle.ts +0 -24
  83. package/src/Extensions/UploadImage.js +0 -18
  84. package/src/Extensions/UploadImage.ts +0 -22
  85. package/src/Extensions/index.js +0 -6
  86. package/src/Extensions/index.ts +0 -6
  87. package/src/Extensions/shims.d.ts +0 -26
  88. package/src/RichEditor.vue +0 -191
  89. package/src/RichEditor.vue.js +0 -199
  90. package/src/env.d.ts +0 -7
  91. package/src/index.js +0 -6
  92. package/src/index.ts +0 -11
  93. package/src/main.js +0 -4
  94. package/src/main.ts +0 -7
  95. package/src/styles/style.scss +0 -196
  96. package/src/styles/theme.css +0 -28
  97. package/src/styles/variables.css +0 -158
  98. package/src/styles/variables.scss +0 -175
  99. package/src/types.js +0 -1
  100. package/src/types.ts +0 -7
  101. package/tsconfig.json +0 -17
  102. package/vite.config.ts +0 -24
@@ -1,306 +0,0 @@
1
- import UndoButton from './Button/UndoButton.vue';
2
- import RedoButton from './Button/RedoButton.vue';
3
- import FormatButton from './Button/FormatButton.vue';
4
- import HeadingButton from './Button/HeadingButton.vue';
5
- import FontSizeButton from './Button/FontSizeButton.vue';
6
- import BoldButton from './Button/BoldButton.vue';
7
- import ItalicButton from './Button/ItalicButton.vue';
8
- import UnderLineButton from './Button/UnderLineButton.vue';
9
- import StrikeButton from './Button/StrikeButton.vue';
10
- import CodeButton from './Button/CodeButton.vue';
11
- import CodeBlockButton from './Button/CodeBlockButton.vue';
12
- import IndentLeftButton from './Button/IndentLeftButton.vue';
13
- import IndentRightButton from './Button/IndentRightButton.vue';
14
- import TextAlignLeftButton from './Button/TextAlignLeftButton.vue';
15
- import TextAlignCenterButton from './Button/TextAlignCenterButton.vue';
16
- import TextAlignRightButton from './Button/TextAlignRightButton.vue';
17
- import BlockQuoteButton from './Button/BlockQuoteButton.vue';
18
- import LinkButton from './Button/LinkButton.vue';
19
- import LineHeightButton from './Button/LineHeightButton.vue';
20
- import ImageUploadButton from './Button/ImageUploadButton.vue';
21
- import TextColorButton from './Button/TextColorButton.vue';
22
- import BackgroundButton from './Button/BackgroundButton.vue';
23
- import SubscriptButton from './Button/SubscriptButton.vue';
24
- import SuperscriptButton from './Button/SuperscriptButton.vue';
25
- import BulletListButton from './Button/BulletListButton.vue';
26
- import OrderedListButton from './Button/OrderedListButton.vue';
27
- import ThemeButton from './Button/ThemeButton.vue';
28
- const __VLS_props = defineProps();
29
- const emit = defineEmits();
30
- const __VLS_ctx = {
31
- ...{},
32
- ...{},
33
- ...{},
34
- ...{},
35
- ...{},
36
- };
37
- let __VLS_components;
38
- let __VLS_intrinsics;
39
- let __VLS_directives;
40
- if (__VLS_ctx.editor) {
41
- __VLS_asFunctionalElement1(__VLS_intrinsics.div, __VLS_intrinsics.div)({
42
- ...{ onClick: () => { } },
43
- ...{ class: "toolbar" },
44
- });
45
- /** @type {__VLS_StyleScopedClasses['toolbar']} */ ;
46
- __VLS_asFunctionalElement1(__VLS_intrinsics.div, __VLS_intrinsics.div)({
47
- ...{ class: "group" },
48
- });
49
- /** @type {__VLS_StyleScopedClasses['group']} */ ;
50
- const __VLS_0 = UndoButton;
51
- // @ts-ignore
52
- const __VLS_1 = __VLS_asFunctionalComponent1(__VLS_0, new __VLS_0({
53
- editor: (__VLS_ctx.editor),
54
- }));
55
- const __VLS_2 = __VLS_1({
56
- editor: (__VLS_ctx.editor),
57
- }, ...__VLS_functionalComponentArgsRest(__VLS_1));
58
- const __VLS_5 = RedoButton;
59
- // @ts-ignore
60
- const __VLS_6 = __VLS_asFunctionalComponent1(__VLS_5, new __VLS_5({
61
- editor: (__VLS_ctx.editor),
62
- }));
63
- const __VLS_7 = __VLS_6({
64
- editor: (__VLS_ctx.editor),
65
- }, ...__VLS_functionalComponentArgsRest(__VLS_6));
66
- const __VLS_10 = FormatButton;
67
- // @ts-ignore
68
- const __VLS_11 = __VLS_asFunctionalComponent1(__VLS_10, new __VLS_10({
69
- editor: (__VLS_ctx.editor),
70
- }));
71
- const __VLS_12 = __VLS_11({
72
- editor: (__VLS_ctx.editor),
73
- }, ...__VLS_functionalComponentArgsRest(__VLS_11));
74
- __VLS_asFunctionalElement1(__VLS_intrinsics.div, __VLS_intrinsics.div)({
75
- ...{ class: "group" },
76
- });
77
- /** @type {__VLS_StyleScopedClasses['group']} */ ;
78
- const __VLS_15 = HeadingButton;
79
- // @ts-ignore
80
- const __VLS_16 = __VLS_asFunctionalComponent1(__VLS_15, new __VLS_15({
81
- editor: (__VLS_ctx.editor),
82
- }));
83
- const __VLS_17 = __VLS_16({
84
- editor: (__VLS_ctx.editor),
85
- }, ...__VLS_functionalComponentArgsRest(__VLS_16));
86
- const __VLS_20 = FontSizeButton;
87
- // @ts-ignore
88
- const __VLS_21 = __VLS_asFunctionalComponent1(__VLS_20, new __VLS_20({
89
- editor: (__VLS_ctx.editor),
90
- }));
91
- const __VLS_22 = __VLS_21({
92
- editor: (__VLS_ctx.editor),
93
- }, ...__VLS_functionalComponentArgsRest(__VLS_21));
94
- const __VLS_25 = LineHeightButton;
95
- // @ts-ignore
96
- const __VLS_26 = __VLS_asFunctionalComponent1(__VLS_25, new __VLS_25({
97
- editor: (__VLS_ctx.editor),
98
- }));
99
- const __VLS_27 = __VLS_26({
100
- editor: (__VLS_ctx.editor),
101
- }, ...__VLS_functionalComponentArgsRest(__VLS_26));
102
- __VLS_asFunctionalElement1(__VLS_intrinsics.div, __VLS_intrinsics.div)({
103
- ...{ class: "group" },
104
- });
105
- /** @type {__VLS_StyleScopedClasses['group']} */ ;
106
- const __VLS_30 = BoldButton;
107
- // @ts-ignore
108
- const __VLS_31 = __VLS_asFunctionalComponent1(__VLS_30, new __VLS_30({
109
- editor: (__VLS_ctx.editor),
110
- }));
111
- const __VLS_32 = __VLS_31({
112
- editor: (__VLS_ctx.editor),
113
- }, ...__VLS_functionalComponentArgsRest(__VLS_31));
114
- const __VLS_35 = ItalicButton;
115
- // @ts-ignore
116
- const __VLS_36 = __VLS_asFunctionalComponent1(__VLS_35, new __VLS_35({
117
- editor: (__VLS_ctx.editor),
118
- }));
119
- const __VLS_37 = __VLS_36({
120
- editor: (__VLS_ctx.editor),
121
- }, ...__VLS_functionalComponentArgsRest(__VLS_36));
122
- const __VLS_40 = UnderLineButton;
123
- // @ts-ignore
124
- const __VLS_41 = __VLS_asFunctionalComponent1(__VLS_40, new __VLS_40({
125
- editor: (__VLS_ctx.editor),
126
- }));
127
- const __VLS_42 = __VLS_41({
128
- editor: (__VLS_ctx.editor),
129
- }, ...__VLS_functionalComponentArgsRest(__VLS_41));
130
- const __VLS_45 = StrikeButton;
131
- // @ts-ignore
132
- const __VLS_46 = __VLS_asFunctionalComponent1(__VLS_45, new __VLS_45({
133
- editor: (__VLS_ctx.editor),
134
- }));
135
- const __VLS_47 = __VLS_46({
136
- editor: (__VLS_ctx.editor),
137
- }, ...__VLS_functionalComponentArgsRest(__VLS_46));
138
- const __VLS_50 = IndentRightButton;
139
- // @ts-ignore
140
- const __VLS_51 = __VLS_asFunctionalComponent1(__VLS_50, new __VLS_50({
141
- editor: (__VLS_ctx.editor),
142
- }));
143
- const __VLS_52 = __VLS_51({
144
- editor: (__VLS_ctx.editor),
145
- }, ...__VLS_functionalComponentArgsRest(__VLS_51));
146
- const __VLS_55 = IndentLeftButton;
147
- // @ts-ignore
148
- const __VLS_56 = __VLS_asFunctionalComponent1(__VLS_55, new __VLS_55({
149
- editor: (__VLS_ctx.editor),
150
- }));
151
- const __VLS_57 = __VLS_56({
152
- editor: (__VLS_ctx.editor),
153
- }, ...__VLS_functionalComponentArgsRest(__VLS_56));
154
- const __VLS_60 = TextColorButton;
155
- // @ts-ignore
156
- const __VLS_61 = __VLS_asFunctionalComponent1(__VLS_60, new __VLS_60({
157
- editor: (__VLS_ctx.editor),
158
- }));
159
- const __VLS_62 = __VLS_61({
160
- editor: (__VLS_ctx.editor),
161
- }, ...__VLS_functionalComponentArgsRest(__VLS_61));
162
- const __VLS_65 = BackgroundButton;
163
- // @ts-ignore
164
- const __VLS_66 = __VLS_asFunctionalComponent1(__VLS_65, new __VLS_65({
165
- editor: (__VLS_ctx.editor),
166
- }));
167
- const __VLS_67 = __VLS_66({
168
- editor: (__VLS_ctx.editor),
169
- }, ...__VLS_functionalComponentArgsRest(__VLS_66));
170
- const __VLS_70 = BlockQuoteButton;
171
- // @ts-ignore
172
- const __VLS_71 = __VLS_asFunctionalComponent1(__VLS_70, new __VLS_70({
173
- editor: (__VLS_ctx.editor),
174
- }));
175
- const __VLS_72 = __VLS_71({
176
- editor: (__VLS_ctx.editor),
177
- }, ...__VLS_functionalComponentArgsRest(__VLS_71));
178
- __VLS_asFunctionalElement1(__VLS_intrinsics.div, __VLS_intrinsics.div)({
179
- ...{ class: "group" },
180
- });
181
- /** @type {__VLS_StyleScopedClasses['group']} */ ;
182
- const __VLS_75 = BulletListButton;
183
- // @ts-ignore
184
- const __VLS_76 = __VLS_asFunctionalComponent1(__VLS_75, new __VLS_75({
185
- editor: (__VLS_ctx.editor),
186
- }));
187
- const __VLS_77 = __VLS_76({
188
- editor: (__VLS_ctx.editor),
189
- }, ...__VLS_functionalComponentArgsRest(__VLS_76));
190
- const __VLS_80 = OrderedListButton;
191
- // @ts-ignore
192
- const __VLS_81 = __VLS_asFunctionalComponent1(__VLS_80, new __VLS_80({
193
- editor: (__VLS_ctx.editor),
194
- }));
195
- const __VLS_82 = __VLS_81({
196
- editor: (__VLS_ctx.editor),
197
- }, ...__VLS_functionalComponentArgsRest(__VLS_81));
198
- __VLS_asFunctionalElement1(__VLS_intrinsics.div, __VLS_intrinsics.div)({
199
- ...{ class: "group" },
200
- });
201
- /** @type {__VLS_StyleScopedClasses['group']} */ ;
202
- const __VLS_85 = TextAlignLeftButton;
203
- // @ts-ignore
204
- const __VLS_86 = __VLS_asFunctionalComponent1(__VLS_85, new __VLS_85({
205
- editor: (__VLS_ctx.editor),
206
- }));
207
- const __VLS_87 = __VLS_86({
208
- editor: (__VLS_ctx.editor),
209
- }, ...__VLS_functionalComponentArgsRest(__VLS_86));
210
- const __VLS_90 = TextAlignCenterButton;
211
- // @ts-ignore
212
- const __VLS_91 = __VLS_asFunctionalComponent1(__VLS_90, new __VLS_90({
213
- editor: (__VLS_ctx.editor),
214
- }));
215
- const __VLS_92 = __VLS_91({
216
- editor: (__VLS_ctx.editor),
217
- }, ...__VLS_functionalComponentArgsRest(__VLS_91));
218
- const __VLS_95 = TextAlignRightButton;
219
- // @ts-ignore
220
- const __VLS_96 = __VLS_asFunctionalComponent1(__VLS_95, new __VLS_95({
221
- editor: (__VLS_ctx.editor),
222
- }));
223
- const __VLS_97 = __VLS_96({
224
- editor: (__VLS_ctx.editor),
225
- }, ...__VLS_functionalComponentArgsRest(__VLS_96));
226
- const __VLS_100 = SubscriptButton;
227
- // @ts-ignore
228
- const __VLS_101 = __VLS_asFunctionalComponent1(__VLS_100, new __VLS_100({
229
- editor: (__VLS_ctx.editor),
230
- }));
231
- const __VLS_102 = __VLS_101({
232
- editor: (__VLS_ctx.editor),
233
- }, ...__VLS_functionalComponentArgsRest(__VLS_101));
234
- const __VLS_105 = SuperscriptButton;
235
- // @ts-ignore
236
- const __VLS_106 = __VLS_asFunctionalComponent1(__VLS_105, new __VLS_105({
237
- editor: (__VLS_ctx.editor),
238
- }));
239
- const __VLS_107 = __VLS_106({
240
- editor: (__VLS_ctx.editor),
241
- }, ...__VLS_functionalComponentArgsRest(__VLS_106));
242
- __VLS_asFunctionalElement1(__VLS_intrinsics.div, __VLS_intrinsics.div)({
243
- ...{ class: "group" },
244
- });
245
- /** @type {__VLS_StyleScopedClasses['group']} */ ;
246
- const __VLS_110 = LinkButton;
247
- // @ts-ignore
248
- const __VLS_111 = __VLS_asFunctionalComponent1(__VLS_110, new __VLS_110({
249
- editor: (__VLS_ctx.editor),
250
- }));
251
- const __VLS_112 = __VLS_111({
252
- editor: (__VLS_ctx.editor),
253
- }, ...__VLS_functionalComponentArgsRest(__VLS_111));
254
- const __VLS_115 = CodeButton;
255
- // @ts-ignore
256
- const __VLS_116 = __VLS_asFunctionalComponent1(__VLS_115, new __VLS_115({
257
- editor: (__VLS_ctx.editor),
258
- }));
259
- const __VLS_117 = __VLS_116({
260
- editor: (__VLS_ctx.editor),
261
- }, ...__VLS_functionalComponentArgsRest(__VLS_116));
262
- const __VLS_120 = CodeBlockButton;
263
- // @ts-ignore
264
- const __VLS_121 = __VLS_asFunctionalComponent1(__VLS_120, new __VLS_120({
265
- editor: (__VLS_ctx.editor),
266
- }));
267
- const __VLS_122 = __VLS_121({
268
- editor: (__VLS_ctx.editor),
269
- }, ...__VLS_functionalComponentArgsRest(__VLS_121));
270
- const __VLS_125 = ImageUploadButton;
271
- // @ts-ignore
272
- const __VLS_126 = __VLS_asFunctionalComponent1(__VLS_125, new __VLS_125({
273
- editor: (__VLS_ctx.editor),
274
- uploadImage: (__VLS_ctx.uploadImage),
275
- }));
276
- const __VLS_127 = __VLS_126({
277
- editor: (__VLS_ctx.editor),
278
- uploadImage: (__VLS_ctx.uploadImage),
279
- }, ...__VLS_functionalComponentArgsRest(__VLS_126));
280
- __VLS_asFunctionalElement1(__VLS_intrinsics.div, __VLS_intrinsics.div)({
281
- ...{ class: "group" },
282
- });
283
- /** @type {__VLS_StyleScopedClasses['group']} */ ;
284
- const __VLS_130 = ThemeButton;
285
- // @ts-ignore
286
- const __VLS_131 = __VLS_asFunctionalComponent1(__VLS_130, new __VLS_130({
287
- ...{ 'onToggleTheme': {} },
288
- theme: (__VLS_ctx.theme),
289
- }));
290
- const __VLS_132 = __VLS_131({
291
- ...{ 'onToggleTheme': {} },
292
- theme: (__VLS_ctx.theme),
293
- }, ...__VLS_functionalComponentArgsRest(__VLS_131));
294
- let __VLS_135;
295
- const __VLS_136 = ({ toggleTheme: {} },
296
- { onToggleTheme: (() => __VLS_ctx.emit('toggle-theme')) });
297
- var __VLS_133;
298
- var __VLS_134;
299
- }
300
- // @ts-ignore
301
- [editor, editor, editor, editor, editor, editor, editor, editor, editor, editor, editor, editor, editor, editor, editor, editor, editor, editor, editor, editor, editor, editor, editor, editor, editor, editor, editor, uploadImage, theme, emit,];
302
- const __VLS_export = (await import('vue')).defineComponent({
303
- __typeEmits: {},
304
- __typeProps: {},
305
- });
306
- export default {};
@@ -1,19 +0,0 @@
1
- import { BulletList } from '@tiptap/extension-bullet-list';
2
- export const BulletListStyle = BulletList.extend({
3
- addAttributes() {
4
- return {
5
- listStyleType: {
6
- default: 'disc',
7
- parseHTML: (element) => {
8
- return element.style.listStyleType || 'disc';
9
- },
10
- renderHTML: (attributes) => {
11
- return {
12
- style: `list-style-type: ${attributes.listStyleType}`,
13
- };
14
- },
15
- },
16
- };
17
- },
18
- });
19
- export default BulletListStyle;
@@ -1,24 +0,0 @@
1
- import { BulletList } from '@tiptap/extension-bullet-list'
2
- import type { Attribute } from '@tiptap/core'
3
-
4
- export const BulletListStyle = BulletList.extend({
5
- addAttributes() {
6
- return {
7
- listStyleType: {
8
- default: 'disc',
9
-
10
- parseHTML: (element: HTMLElement) => {
11
- return element.style.listStyleType || 'disc'
12
- },
13
-
14
- renderHTML: (attributes) => {
15
- return {
16
- style: `list-style-type: ${attributes.listStyleType}`,
17
- }
18
- },
19
- } as Attribute,
20
- }
21
- },
22
- })
23
-
24
- export default BulletListStyle
@@ -1,27 +0,0 @@
1
- import { Extension } from '@tiptap/core';
2
- import '@tiptap/core';
3
- export const FontSize = Extension.create({
4
- name: 'fontSize',
5
- addOptions() {
6
- return {
7
- types: ['textStyle']
8
- };
9
- },
10
- addGlobalAttributes() {
11
- return [{
12
- types: this.options.types,
13
- attributes: {
14
- fontSize: {
15
- default: null,
16
- parseHTML: element => element.style.fontSize.replace(/['"]+/g, ''),
17
- renderHTML: attributes => {
18
- if (!attributes.fontSize)
19
- return {};
20
- return { style: `font-size: ${attributes.fontSize}` };
21
- },
22
- },
23
- },
24
- }];
25
- },
26
- });
27
- export default FontSize;
@@ -1,37 +0,0 @@
1
- import { Extension } from '@tiptap/core'
2
- import '@tiptap/core'
3
-
4
- declare module '@tiptap/core' {
5
- interface Commands<ReturnType> {
6
- indent: {
7
- increaseIndent: () => ReturnType
8
- decreaseIndent: () => ReturnType
9
- }
10
- }
11
- }
12
-
13
-
14
- export const FontSize = Extension.create({
15
- name: 'fontSize',
16
- addOptions() {
17
- return {
18
- types: ['textStyle']
19
- }
20
- },
21
- addGlobalAttributes() {
22
- return [{
23
- types: this.options.types,
24
- attributes: {
25
- fontSize: {
26
- default: null,
27
- parseHTML: element => element.style.fontSize.replace(/['"]+/g, ''),
28
- renderHTML: attributes => {
29
- if (!attributes.fontSize) return {}
30
- return { style: `font-size: ${attributes.fontSize}` }
31
- },
32
- },
33
- },
34
- }]
35
- },
36
- })
37
- export default FontSize
@@ -1,58 +0,0 @@
1
- import { Extension } from '@tiptap/core';
2
- import '@tiptap/core';
3
- export const Indent = Extension.create({
4
- name: 'indent',
5
- addOptions() {
6
- return {
7
- types: ['paragraph', 'heading'],
8
- min: 0,
9
- max: 7,
10
- step: 1
11
- };
12
- },
13
- addGlobalAttributes() {
14
- return [
15
- {
16
- types: this.options.types,
17
- attributes: {
18
- indent: {
19
- default: 0,
20
- parseHTML: element => {
21
- return parseInt(element.style.marginLeft || '0') / 24 || 0;
22
- },
23
- renderHTML: attributes => {
24
- if (!attributes.indent)
25
- return {};
26
- return {
27
- style: `margin-left: ${attributes.indent * 24}px`
28
- };
29
- }
30
- }
31
- }
32
- }
33
- ];
34
- },
35
- addCommands() {
36
- return {
37
- increaseIndent: () => ({ state, chain }) => {
38
- const { min, max } = this.options;
39
- const indent = state.selection.$from.node().attrs.indent || 0;
40
- if (indent >= max)
41
- return false;
42
- return chain().updateAttributes(state.selection.$from.node().type.name, {
43
- indent: indent + 1
44
- }).run();
45
- },
46
- decreaseIndent: () => ({ state, chain }) => {
47
- const { min } = this.options;
48
- const indent = state.selection.$from.node().attrs.indent || 0;
49
- if (indent <= min)
50
- return false;
51
- return chain().updateAttributes(state.selection.$from.node().type.name, {
52
- indent: indent - 1
53
- }).run();
54
- }
55
- };
56
- }
57
- });
58
- export default Indent;
@@ -1,73 +0,0 @@
1
- import { Extension } from '@tiptap/core'
2
- import '@tiptap/core'
3
-
4
- declare module '@tiptap/core' {
5
- interface Commands<ReturnType> {
6
- indent: {
7
- increaseIndent: () => ReturnType
8
- decreaseIndent: () => ReturnType
9
- }
10
- }
11
- }
12
-
13
- export const Indent = Extension.create({
14
- name: 'indent',
15
-
16
- addOptions() {
17
- return {
18
- types: ['paragraph', 'heading'],
19
- min: 0,
20
- max: 7,
21
- step: 1
22
- }
23
- },
24
-
25
- addGlobalAttributes() {
26
- return [
27
- {
28
- types: this.options.types,
29
- attributes: {
30
- indent: {
31
- default: 0,
32
- parseHTML: element => {
33
- return parseInt(element.style.marginLeft || '0') / 24 || 0
34
- },
35
- renderHTML: attributes => {
36
- if (!attributes.indent) return {}
37
- return {
38
- style: `margin-left: ${attributes.indent * 24}px`
39
- }
40
- }
41
- }
42
- }
43
- }
44
- ]
45
- },
46
-
47
- addCommands() {
48
- return {
49
- increaseIndent:
50
- () =>
51
- ({ state, chain }) => {
52
- const { min, max } = this.options
53
- const indent = state.selection.$from.node().attrs.indent || 0
54
- if (indent >= max) return false
55
- return chain().updateAttributes(state.selection.$from.node().type.name, {
56
- indent: indent + 1
57
- }).run()
58
- },
59
-
60
- decreaseIndent:
61
- () =>
62
- ({ state, chain }) => {
63
- const { min } = this.options
64
- const indent = state.selection.$from.node().attrs.indent || 0
65
- if (indent <= min) return false
66
- return chain().updateAttributes(state.selection.$from.node().type.name, {
67
- indent: indent - 1
68
- }).run()
69
- }
70
- }
71
- }
72
- })
73
- export default Indent
@@ -1,19 +0,0 @@
1
- import { OrderedList } from '@tiptap/extension-ordered-list';
2
- export const OrderedListStyle = OrderedList.extend({
3
- addAttributes() {
4
- return {
5
- listStyleType: {
6
- default: 'decimal',
7
- parseHTML: (element) => {
8
- return element.style.listStyleType || 'decimal';
9
- },
10
- renderHTML: (attributes) => {
11
- return {
12
- style: `list-style-type: ${attributes.listStyleType}`
13
- };
14
- }
15
- },
16
- };
17
- }
18
- });
19
- export default OrderedListStyle;
@@ -1,24 +0,0 @@
1
- import { OrderedList } from '@tiptap/extension-ordered-list'
2
- import type { Attribute } from '@tiptap/core'
3
-
4
- export const OrderedListStyle = OrderedList.extend({
5
- addAttributes() {
6
- return {
7
- listStyleType: {
8
- default: 'decimal',
9
-
10
- parseHTML: (element: HTMLElement) => {
11
- return element.style.listStyleType || 'decimal'
12
- },
13
-
14
- renderHTML: (attributes) => {
15
- return {
16
- style: `list-style-type: ${attributes.listStyleType}`
17
- }
18
- }
19
- } as Attribute,
20
- }
21
- }
22
- })
23
-
24
- export default OrderedListStyle
@@ -1,18 +0,0 @@
1
- import { Image } from '@tiptap/extension-image';
2
- export const UploadImage = Image.extend({
3
- addAttributes() {
4
- return {
5
- ...this.parent?.(),
6
- width: {
7
- default: 'auto'
8
- },
9
- align: {
10
- default: 'center'
11
- },
12
- caption: {
13
- default: ''
14
- }
15
- };
16
- }
17
- });
18
- export default UploadImage;
@@ -1,22 +0,0 @@
1
- import { Image } from '@tiptap/extension-image'
2
-
3
- export const UploadImage = Image.extend({
4
- addAttributes() {
5
- return {
6
- ...this.parent?.(),
7
-
8
- width: {
9
- default: 'auto'
10
- },
11
-
12
- align: {
13
- default: 'center'
14
- },
15
-
16
- caption: {
17
- default: ''
18
- }
19
- }
20
- }
21
- })
22
- export default UploadImage
@@ -1,6 +0,0 @@
1
- // 统一导出所有自定义 Tiptap 扩展
2
- export { default as UploadImage } from './UploadImage';
3
- export { default as BulletListStyle } from './BulletListStyle';
4
- export { default as OrderedListStyle } from './OrderedListStyle';
5
- export { default as Indent } from './Indent';
6
- export { default as FontSize } from './FontSize';
@@ -1,6 +0,0 @@
1
- // 统一导出所有自定义 Tiptap 扩展
2
- export { default as UploadImage } from './UploadImage'
3
- export { default as BulletListStyle } from './BulletListStyle'
4
- export { default as OrderedListStyle } from './OrderedListStyle'
5
- export { default as Indent } from './Indent'
6
- export { default as FontSize } from './FontSize'
@@ -1,26 +0,0 @@
1
- declare module '@/extensions/BulletListStyle' {
2
- import { BulletList } from '@tiptap/extension-bullet-list'
3
- import type { Attribute } from '@tiptap/core'
4
- export const BulletListStyle: ReturnType<typeof BulletList.extend>
5
- }
6
-
7
- declare module '@/extensions/OrderedListStyle' {
8
- import { OrderedList } from '@tiptap/extension-ordered-list'
9
- import type { Attribute } from '@tiptap/core'
10
- export const OrderedListStyle: ReturnType<typeof OrderedList.extend>
11
- }
12
-
13
- declare module '@/extensions/UploadImage' {
14
- import { Image } from '@tiptap/extension-image'
15
- export const UploadImage: ReturnType<typeof Image.extend>
16
- }
17
-
18
- declare module '@/extensions/Indent' {
19
- import { Extension } from '@tiptap/core'
20
- export const Indent: ReturnType<typeof Extension.create>
21
- }
22
-
23
- declare module '@/extensions/FontSize' {
24
- import { Extension } from '@tiptap/core'
25
- export const FontSize: ReturnType<typeof Extension.create>
26
- }