@mantine-vue/tiptap 1.1.2
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.
- package/cjs/index.cjs +1413 -0
- package/cjs/index.cjs.map +1 -0
- package/esm/index.mjs +1346 -0
- package/esm/index.mjs.map +1 -0
- package/lib/RichTextEditor.context.d.ts +21 -0
- package/lib/RichTextEditor.d.ts +2674 -0
- package/lib/RichTextEditorContent/RichTextEditorContent.d.ts +42 -0
- package/lib/RichTextEditorControl/RichTextEditorColorControl.d.ts +17 -0
- package/lib/RichTextEditorControl/RichTextEditorColorPickerControl.d.ts +39 -0
- package/lib/RichTextEditorControl/RichTextEditorControl.d.ts +241 -0
- package/lib/RichTextEditorControl/RichTextEditorLinkControl.d.ts +81 -0
- package/lib/RichTextEditorControl/RichTextEditorSourceCodeControl.d.ts +6 -0
- package/lib/RichTextEditorControl/controls.d.ts +2139 -0
- package/lib/RichTextEditorControl/index.d.ts +6 -0
- package/lib/RichTextEditorControlsGroup/RichTextEditorControlsGroup.d.ts +50 -0
- package/lib/RichTextEditorToolbar/RichTextEditorToolbar.d.ts +81 -0
- package/lib/extensions/Link.d.ts +1 -0
- package/lib/extensions/TaskList.d.ts +1 -0
- package/lib/extensions/index.d.ts +2 -0
- package/lib/icons/Icons.d.ts +115 -0
- package/lib/index.d.mts +8 -0
- package/lib/index.d.ts +8 -0
- package/lib/labels.d.ts +49 -0
- package/package.json +56 -0
- package/styles.css +450 -0
- package/styles.layer.css +452 -0
package/cjs/index.cjs
ADDED
|
@@ -0,0 +1,1413 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
//#region \0rolldown/runtime.js
|
|
3
|
+
var __create = Object.create;
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
8
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
11
|
+
key = keys[i];
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
13
|
+
get: ((k) => from[k]).bind(null, key),
|
|
14
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
20
|
+
value: mod,
|
|
21
|
+
enumerable: true
|
|
22
|
+
}) : target, mod));
|
|
23
|
+
//#endregion
|
|
24
|
+
let vue = require("vue");
|
|
25
|
+
let _mantine_vue_core = require("@mantine-vue/core");
|
|
26
|
+
let _tiptap_vue_3 = require("@tiptap/vue-3");
|
|
27
|
+
let _mantine_vue_hooks = require("@mantine-vue/hooks");
|
|
28
|
+
let _tiptap_extension_link = require("@tiptap/extension-link");
|
|
29
|
+
_tiptap_extension_link = __toESM(_tiptap_extension_link);
|
|
30
|
+
//#region src/labels.ts
|
|
31
|
+
var DEFAULT_LABELS = {
|
|
32
|
+
linkControlLabel: "Link",
|
|
33
|
+
colorPickerControlLabel: "Text color",
|
|
34
|
+
highlightControlLabel: "Highlight text",
|
|
35
|
+
colorControlLabel: (color) => `Set text color ${color}`,
|
|
36
|
+
boldControlLabel: "Bold",
|
|
37
|
+
italicControlLabel: "Italic",
|
|
38
|
+
underlineControlLabel: "Underline",
|
|
39
|
+
strikeControlLabel: "Strikethrough",
|
|
40
|
+
clearFormattingControlLabel: "Clear formatting",
|
|
41
|
+
unlinkControlLabel: "Remove link",
|
|
42
|
+
bulletListControlLabel: "Bullet list",
|
|
43
|
+
orderedListControlLabel: "Ordered list",
|
|
44
|
+
sourceCodeControlLabel: "Switch between text/source code",
|
|
45
|
+
h1ControlLabel: "Heading 1",
|
|
46
|
+
h2ControlLabel: "Heading 2",
|
|
47
|
+
h3ControlLabel: "Heading 3",
|
|
48
|
+
h4ControlLabel: "Heading 4",
|
|
49
|
+
h5ControlLabel: "Heading 5",
|
|
50
|
+
h6ControlLabel: "Heading 6",
|
|
51
|
+
blockquoteControlLabel: "Blockquote",
|
|
52
|
+
alignLeftControlLabel: "Align text: left",
|
|
53
|
+
alignCenterControlLabel: "Align text: center",
|
|
54
|
+
alignRightControlLabel: "Align text: right",
|
|
55
|
+
alignJustifyControlLabel: "Align text: justify",
|
|
56
|
+
codeControlLabel: "Code",
|
|
57
|
+
codeBlockControlLabel: "Code block",
|
|
58
|
+
subscriptControlLabel: "Subscript",
|
|
59
|
+
superscriptControlLabel: "Superscript",
|
|
60
|
+
unsetColorControlLabel: "Unset color",
|
|
61
|
+
hrControlLabel: "Horizontal line",
|
|
62
|
+
undoControlLabel: "Undo",
|
|
63
|
+
redoControlLabel: "Redo",
|
|
64
|
+
tasksControlLabel: "Task list",
|
|
65
|
+
tasksSinkLabel: "Decrease task level",
|
|
66
|
+
tasksLiftLabel: "Increase task level",
|
|
67
|
+
linkEditorInputLabel: "Enter URL",
|
|
68
|
+
linkEditorInputPlaceholder: "https://example.com/",
|
|
69
|
+
linkEditorExternalLink: "Open link in a new tab",
|
|
70
|
+
linkEditorInternalLink: "Open link in the same tab",
|
|
71
|
+
linkEditorSave: "Save",
|
|
72
|
+
colorPickerCancel: "Cancel",
|
|
73
|
+
colorPickerClear: "Clear color",
|
|
74
|
+
colorPickerColorPicker: "Color picker",
|
|
75
|
+
colorPickerPalette: "Color palette",
|
|
76
|
+
colorPickerSave: "Save",
|
|
77
|
+
colorPickerColorLabel: (color) => `Set text color ${color}`
|
|
78
|
+
};
|
|
79
|
+
//#endregion
|
|
80
|
+
//#region src/RichTextEditor.context.ts
|
|
81
|
+
var [provideRichTextEditorContext, useRichTextEditorContext] = (0, _mantine_vue_core.createSafeContext)("RichTextEditor component was not found in tree");
|
|
82
|
+
var RichTextEditor_module_default = {
|
|
83
|
+
root: "_root_1ljoi_1",
|
|
84
|
+
Typography: "_Typography_1ljoi_15",
|
|
85
|
+
content: "_content_1ljoi_43",
|
|
86
|
+
linkEditorDropdown: "_linkEditorDropdown_1ljoi_156",
|
|
87
|
+
control: "_control_1ljoi_160",
|
|
88
|
+
controlIcon: "_controlIcon_1ljoi_236",
|
|
89
|
+
controlsGroup: "_controlsGroup_1ljoi_241",
|
|
90
|
+
linkEditor: "_linkEditor_1ljoi_156",
|
|
91
|
+
linkEditorInput: "_linkEditorInput_1ljoi_270",
|
|
92
|
+
linkEditorExternalControl: "_linkEditorExternalControl_1ljoi_276",
|
|
93
|
+
linkEditorSave: "_linkEditorSave_1ljoi_306",
|
|
94
|
+
toolbar: "_toolbar_1ljoi_311",
|
|
95
|
+
taskList: "_taskList_1ljoi_345"
|
|
96
|
+
};
|
|
97
|
+
//#endregion
|
|
98
|
+
//#region src/RichTextEditorContent/RichTextEditorContent.ts
|
|
99
|
+
var RichTextEditorContent = (0, vue.defineComponent)({
|
|
100
|
+
name: "RichTextEditorContent",
|
|
101
|
+
inheritAttrs: false,
|
|
102
|
+
props: {
|
|
103
|
+
classNames: {
|
|
104
|
+
type: [Object, Function],
|
|
105
|
+
default: void 0
|
|
106
|
+
},
|
|
107
|
+
styles: {
|
|
108
|
+
type: [Object, Function],
|
|
109
|
+
default: void 0
|
|
110
|
+
},
|
|
111
|
+
vars: {
|
|
112
|
+
type: [Object, Function],
|
|
113
|
+
default: void 0
|
|
114
|
+
}
|
|
115
|
+
},
|
|
116
|
+
setup(rawProps, { attrs }) {
|
|
117
|
+
const props = (0, _mantine_vue_core.useProps)("RichTextEditorContent", null, rawProps);
|
|
118
|
+
const ctx = useRichTextEditorContext();
|
|
119
|
+
return () => {
|
|
120
|
+
const editorContent = (0, vue.h)(_mantine_vue_core.Box, {
|
|
121
|
+
component: _tiptap_vue_3.EditorContent,
|
|
122
|
+
editor: ctx.editor,
|
|
123
|
+
...ctx.getStyles("content", {
|
|
124
|
+
classNames: props.classNames,
|
|
125
|
+
styles: props.styles,
|
|
126
|
+
className: ctx.withTypographyStyles ? void 0 : attrs.class,
|
|
127
|
+
style: ctx.withTypographyStyles ? void 0 : attrs.style
|
|
128
|
+
}),
|
|
129
|
+
...attrs
|
|
130
|
+
});
|
|
131
|
+
return ctx.withTypographyStyles ? (0, vue.h)(_mantine_vue_core.Typography, {
|
|
132
|
+
...ctx.getStyles("Typography", {
|
|
133
|
+
className: attrs.class,
|
|
134
|
+
style: attrs.style,
|
|
135
|
+
styles: props.styles,
|
|
136
|
+
classNames: props.classNames
|
|
137
|
+
}),
|
|
138
|
+
unstyled: ctx.unstyled
|
|
139
|
+
}, () => editorContent) : editorContent;
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
});
|
|
143
|
+
Object.assign(RichTextEditorContent, { classes: RichTextEditor_module_default });
|
|
144
|
+
//#endregion
|
|
145
|
+
//#region src/RichTextEditorControl/RichTextEditorControl.ts
|
|
146
|
+
var defaultProps$1 = { interactive: true };
|
|
147
|
+
var RichTextEditorControl = (0, vue.defineComponent)({
|
|
148
|
+
name: "RichTextEditorControl",
|
|
149
|
+
inheritAttrs: false,
|
|
150
|
+
props: {
|
|
151
|
+
active: {
|
|
152
|
+
type: Boolean,
|
|
153
|
+
default: void 0
|
|
154
|
+
},
|
|
155
|
+
interactive: {
|
|
156
|
+
type: Boolean,
|
|
157
|
+
default: void 0
|
|
158
|
+
},
|
|
159
|
+
disabled: {
|
|
160
|
+
type: Boolean,
|
|
161
|
+
default: void 0
|
|
162
|
+
},
|
|
163
|
+
variant: {
|
|
164
|
+
type: String,
|
|
165
|
+
default: void 0
|
|
166
|
+
},
|
|
167
|
+
classNames: {
|
|
168
|
+
type: [Object, Function],
|
|
169
|
+
default: void 0
|
|
170
|
+
},
|
|
171
|
+
styles: {
|
|
172
|
+
type: [Object, Function],
|
|
173
|
+
default: void 0
|
|
174
|
+
},
|
|
175
|
+
vars: {
|
|
176
|
+
type: [Object, Function],
|
|
177
|
+
default: void 0
|
|
178
|
+
}
|
|
179
|
+
},
|
|
180
|
+
setup(rawProps, { attrs, slots }) {
|
|
181
|
+
const props = (0, _mantine_vue_core.useProps)("RichTextEditorControl", defaultProps$1, rawProps);
|
|
182
|
+
const ctx = useRichTextEditorContext();
|
|
183
|
+
return () => (0, vue.h)(_mantine_vue_core.UnstyledButton, {
|
|
184
|
+
...attrs,
|
|
185
|
+
...ctx.getStyles("control", {
|
|
186
|
+
className: attrs.class,
|
|
187
|
+
style: attrs.style,
|
|
188
|
+
classNames: props.classNames,
|
|
189
|
+
styles: props.styles
|
|
190
|
+
}),
|
|
191
|
+
disabled: props.disabled,
|
|
192
|
+
"data-rich-text-editor-control": "",
|
|
193
|
+
tabindex: props.interactive ? 0 : -1,
|
|
194
|
+
"data-interactive": props.interactive || void 0,
|
|
195
|
+
"data-disabled": props.disabled || void 0,
|
|
196
|
+
"data-active": props.active || void 0,
|
|
197
|
+
"aria-pressed": props.active && props.interactive ? true : void 0,
|
|
198
|
+
"aria-hidden": !props.interactive || void 0,
|
|
199
|
+
unstyled: ctx.unstyled,
|
|
200
|
+
variant: props.variant || ctx.variant || "default",
|
|
201
|
+
onMousedown: (event) => {
|
|
202
|
+
event.preventDefault();
|
|
203
|
+
attrs.onMousedown?.(event);
|
|
204
|
+
}
|
|
205
|
+
}, slots);
|
|
206
|
+
}
|
|
207
|
+
});
|
|
208
|
+
Object.assign(RichTextEditorControl, { classes: RichTextEditor_module_default });
|
|
209
|
+
var RichTextEditorControlBase = (0, vue.defineComponent)({
|
|
210
|
+
name: "RichTextEditorControlBase",
|
|
211
|
+
inheritAttrs: false,
|
|
212
|
+
props: {
|
|
213
|
+
icon: {
|
|
214
|
+
type: [Object, Function],
|
|
215
|
+
required: true
|
|
216
|
+
},
|
|
217
|
+
active: {
|
|
218
|
+
type: Boolean,
|
|
219
|
+
default: void 0
|
|
220
|
+
},
|
|
221
|
+
interactive: {
|
|
222
|
+
type: Boolean,
|
|
223
|
+
default: void 0
|
|
224
|
+
},
|
|
225
|
+
disabled: {
|
|
226
|
+
type: Boolean,
|
|
227
|
+
default: void 0
|
|
228
|
+
},
|
|
229
|
+
variant: {
|
|
230
|
+
type: String,
|
|
231
|
+
default: void 0
|
|
232
|
+
},
|
|
233
|
+
classNames: {
|
|
234
|
+
type: [Object, Function],
|
|
235
|
+
default: void 0
|
|
236
|
+
},
|
|
237
|
+
styles: {
|
|
238
|
+
type: [Object, Function],
|
|
239
|
+
default: void 0
|
|
240
|
+
}
|
|
241
|
+
},
|
|
242
|
+
setup(props, { attrs }) {
|
|
243
|
+
const ctx = useRichTextEditorContext();
|
|
244
|
+
return () => (0, vue.h)(RichTextEditorControl, {
|
|
245
|
+
...attrs,
|
|
246
|
+
...props
|
|
247
|
+
}, () => (0, vue.h)(props.icon, ctx.getStyles("controlIcon")));
|
|
248
|
+
}
|
|
249
|
+
});
|
|
250
|
+
function isSafeEditor(editor) {
|
|
251
|
+
return !!editor && !editor.isDestroyed;
|
|
252
|
+
}
|
|
253
|
+
function useEditorSelector(editor, selector) {
|
|
254
|
+
const tick = (0, vue.ref)(0);
|
|
255
|
+
const update = () => {
|
|
256
|
+
tick.value += 1;
|
|
257
|
+
};
|
|
258
|
+
const listen = (current) => {
|
|
259
|
+
current?.on("transaction", update);
|
|
260
|
+
current?.on("selectionUpdate", update);
|
|
261
|
+
current?.on("update", update);
|
|
262
|
+
};
|
|
263
|
+
const unlisten = (current) => {
|
|
264
|
+
current?.off("transaction", update);
|
|
265
|
+
current?.off("selectionUpdate", update);
|
|
266
|
+
current?.off("update", update);
|
|
267
|
+
};
|
|
268
|
+
const stop = (0, vue.watch)(editor, (current, previous) => {
|
|
269
|
+
unlisten(previous);
|
|
270
|
+
listen(current);
|
|
271
|
+
update();
|
|
272
|
+
}, { immediate: true });
|
|
273
|
+
(0, vue.onBeforeUnmount)(() => {
|
|
274
|
+
stop();
|
|
275
|
+
unlisten(editor());
|
|
276
|
+
});
|
|
277
|
+
return (0, vue.computed)(() => {
|
|
278
|
+
tick.value;
|
|
279
|
+
return selector(editor());
|
|
280
|
+
});
|
|
281
|
+
}
|
|
282
|
+
function createControl({ label, isActive, operation, icon, isDisabled }) {
|
|
283
|
+
return (0, vue.defineComponent)({
|
|
284
|
+
name: `RichTextEditor${String(label)}`,
|
|
285
|
+
inheritAttrs: false,
|
|
286
|
+
props: {
|
|
287
|
+
icon: {
|
|
288
|
+
type: [Object, Function],
|
|
289
|
+
default: void 0
|
|
290
|
+
},
|
|
291
|
+
active: {
|
|
292
|
+
type: Boolean,
|
|
293
|
+
default: void 0
|
|
294
|
+
},
|
|
295
|
+
interactive: {
|
|
296
|
+
type: Boolean,
|
|
297
|
+
default: void 0
|
|
298
|
+
},
|
|
299
|
+
disabled: {
|
|
300
|
+
type: Boolean,
|
|
301
|
+
default: void 0
|
|
302
|
+
},
|
|
303
|
+
variant: {
|
|
304
|
+
type: String,
|
|
305
|
+
default: void 0
|
|
306
|
+
},
|
|
307
|
+
classNames: {
|
|
308
|
+
type: [Object, Function],
|
|
309
|
+
default: void 0
|
|
310
|
+
},
|
|
311
|
+
styles: {
|
|
312
|
+
type: [Object, Function],
|
|
313
|
+
default: void 0
|
|
314
|
+
}
|
|
315
|
+
},
|
|
316
|
+
setup(props, { attrs }) {
|
|
317
|
+
const ctx = useRichTextEditorContext();
|
|
318
|
+
const editorState = useEditorSelector(() => ctx.editor, (editor) => {
|
|
319
|
+
const safeEditor = isSafeEditor(editor) ? editor : null;
|
|
320
|
+
return {
|
|
321
|
+
active: safeEditor && isActive?.name ? safeEditor.isActive(isActive.name, isActive.attributes) : false,
|
|
322
|
+
disabled: safeEditor ? isDisabled?.(safeEditor) ?? false : true
|
|
323
|
+
};
|
|
324
|
+
});
|
|
325
|
+
return () => {
|
|
326
|
+
const controlLabel = ctx.labels[label];
|
|
327
|
+
return (0, vue.h)(RichTextEditorControlBase, {
|
|
328
|
+
...attrs,
|
|
329
|
+
...props,
|
|
330
|
+
"aria-label": controlLabel,
|
|
331
|
+
title: controlLabel,
|
|
332
|
+
active: props.active ?? editorState.value.active,
|
|
333
|
+
icon: props.icon || icon,
|
|
334
|
+
disabled: props.disabled ?? editorState.value.disabled,
|
|
335
|
+
onClick: () => {
|
|
336
|
+
if (!isSafeEditor(ctx.editor)) return;
|
|
337
|
+
ctx.editor.chain().focus()[operation.name](operation.attributes).run();
|
|
338
|
+
}
|
|
339
|
+
});
|
|
340
|
+
};
|
|
341
|
+
}
|
|
342
|
+
});
|
|
343
|
+
}
|
|
344
|
+
function renderControlIcon(Icon) {
|
|
345
|
+
return (0, vue.h)(_mantine_vue_core.Box, {
|
|
346
|
+
component: Icon,
|
|
347
|
+
class: RichTextEditor_module_default.controlIcon
|
|
348
|
+
});
|
|
349
|
+
}
|
|
350
|
+
//#endregion
|
|
351
|
+
//#region src/RichTextEditorControl/RichTextEditorColorControl.ts
|
|
352
|
+
var RichTextEditorColorControl = (0, vue.defineComponent)({
|
|
353
|
+
name: "RichTextEditorColorControl",
|
|
354
|
+
inheritAttrs: false,
|
|
355
|
+
props: { color: {
|
|
356
|
+
type: String,
|
|
357
|
+
required: true
|
|
358
|
+
} },
|
|
359
|
+
setup(rawProps, { attrs }) {
|
|
360
|
+
const props = (0, _mantine_vue_core.useProps)("RichTextEditorColorControl", null, rawProps);
|
|
361
|
+
const ctx = useRichTextEditorContext();
|
|
362
|
+
return () => {
|
|
363
|
+
const currentColor = ctx.editor?.getAttributes("textStyle").color || null;
|
|
364
|
+
const label = ctx.labels.colorControlLabel(props.color);
|
|
365
|
+
return (0, vue.h)(RichTextEditorControl, {
|
|
366
|
+
...attrs,
|
|
367
|
+
variant: ctx.variant,
|
|
368
|
+
active: currentColor === props.color,
|
|
369
|
+
"aria-label": label,
|
|
370
|
+
title: label,
|
|
371
|
+
onClick: () => (ctx.editor?.chain())?.focus().setColor(props.color).run()
|
|
372
|
+
}, () => (0, vue.h)(_mantine_vue_core.ColorSwatch, {
|
|
373
|
+
color: props.color,
|
|
374
|
+
size: 14
|
|
375
|
+
}));
|
|
376
|
+
};
|
|
377
|
+
}
|
|
378
|
+
});
|
|
379
|
+
//#endregion
|
|
380
|
+
//#region src/icons/Icons.ts
|
|
381
|
+
function createIcon(name, children) {
|
|
382
|
+
return (0, vue.defineComponent)({
|
|
383
|
+
name,
|
|
384
|
+
inheritAttrs: false,
|
|
385
|
+
setup(_, { attrs }) {
|
|
386
|
+
return () => (0, vue.h)("svg", {
|
|
387
|
+
...attrs,
|
|
388
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
389
|
+
viewBox: "0 0 24 24",
|
|
390
|
+
strokeWidth: "1.5",
|
|
391
|
+
stroke: "currentColor",
|
|
392
|
+
fill: "none",
|
|
393
|
+
strokeLinecap: "round",
|
|
394
|
+
strokeLinejoin: "round"
|
|
395
|
+
}, [(0, vue.h)("path", {
|
|
396
|
+
stroke: "none",
|
|
397
|
+
d: "M0 0h24v24H0z",
|
|
398
|
+
fill: "none"
|
|
399
|
+
}), ...children]);
|
|
400
|
+
}
|
|
401
|
+
});
|
|
402
|
+
}
|
|
403
|
+
var path = (d) => (0, vue.h)("path", { d });
|
|
404
|
+
var IconBold = createIcon("IconBold", [path("M7 5h6a3.5 3.5 0 0 1 0 7h-6z"), path("M13 12h1a3.5 3.5 0 0 1 0 7h-7v-7")]);
|
|
405
|
+
var IconItalic = createIcon("IconItalic", [
|
|
406
|
+
path("M11 5l6 0"),
|
|
407
|
+
path("M7 19l6 0"),
|
|
408
|
+
path("M14 5l-4 14")
|
|
409
|
+
]);
|
|
410
|
+
var IconUnderline = createIcon("IconUnderline", [path("M7 5v5a5 5 0 0 0 10 0v-5"), path("M5 19h14")]);
|
|
411
|
+
var IconStrikethrough = createIcon("IconStrikethrough", [path("M5 12l14 0"), path("M16 6.5a4 2 0 0 0 -4 -1.5h-1a3.5 3.5 0 0 0 0 7h2a3.5 3.5 0 0 1 0 7h-1.5a4 2 0 0 1 -4 -1.5")]);
|
|
412
|
+
var IconClearFormatting = createIcon("IconClearFormatting", [
|
|
413
|
+
path("M17 15l4 4m0 -4l-4 4"),
|
|
414
|
+
path("M7 6v-1h11v1"),
|
|
415
|
+
path("M7 19l4 0"),
|
|
416
|
+
path("M13 5l-4 14")
|
|
417
|
+
]);
|
|
418
|
+
var IconH1 = createIcon("IconH1", [
|
|
419
|
+
path("M19 18v-8l-2 2"),
|
|
420
|
+
path("M4 6v12"),
|
|
421
|
+
path("M12 6v12"),
|
|
422
|
+
path("M11 18h2"),
|
|
423
|
+
path("M3 18h2"),
|
|
424
|
+
path("M4 12h8"),
|
|
425
|
+
path("M3 6h2"),
|
|
426
|
+
path("M11 6h2")
|
|
427
|
+
]);
|
|
428
|
+
var IconH2 = createIcon("IconH2", [
|
|
429
|
+
path("M17 12a2 2 0 1 1 4 0c0 .591 -.417 1.318 -.816 1.858l-3.184 4.143l4 0"),
|
|
430
|
+
path("M4 6v12"),
|
|
431
|
+
path("M12 6v12"),
|
|
432
|
+
path("M11 18h2"),
|
|
433
|
+
path("M3 18h2"),
|
|
434
|
+
path("M4 12h8"),
|
|
435
|
+
path("M3 6h2"),
|
|
436
|
+
path("M11 6h2")
|
|
437
|
+
]);
|
|
438
|
+
var IconH3 = createIcon("IconH3", [
|
|
439
|
+
path("M19 14a2 2 0 1 0 -2 -2"),
|
|
440
|
+
path("M17 16a2 2 0 1 0 2 -2"),
|
|
441
|
+
path("M4 6v12"),
|
|
442
|
+
path("M12 6v12"),
|
|
443
|
+
path("M11 18h2"),
|
|
444
|
+
path("M3 18h2"),
|
|
445
|
+
path("M4 12h8"),
|
|
446
|
+
path("M3 6h2"),
|
|
447
|
+
path("M11 6h2")
|
|
448
|
+
]);
|
|
449
|
+
var IconH4 = createIcon("IconH4", [
|
|
450
|
+
path("M20 18v-8l-4 6h5"),
|
|
451
|
+
path("M4 6v12"),
|
|
452
|
+
path("M12 6v12"),
|
|
453
|
+
path("M11 18h2"),
|
|
454
|
+
path("M3 18h2"),
|
|
455
|
+
path("M4 12h8"),
|
|
456
|
+
path("M3 6h2"),
|
|
457
|
+
path("M11 6h2")
|
|
458
|
+
]);
|
|
459
|
+
var IconH5 = createIcon("IconH5", [
|
|
460
|
+
path("M17 18h2a2 2 0 1 0 0 -4h-2v-4h4"),
|
|
461
|
+
path("M4 6v12"),
|
|
462
|
+
path("M12 6v12"),
|
|
463
|
+
path("M11 18h2"),
|
|
464
|
+
path("M3 18h2"),
|
|
465
|
+
path("M4 12h8"),
|
|
466
|
+
path("M3 6h2"),
|
|
467
|
+
path("M11 6h2")
|
|
468
|
+
]);
|
|
469
|
+
var IconH6 = createIcon("IconH6", [
|
|
470
|
+
path("M19 14a2 2 0 1 0 0 4a2 2 0 0 0 0 -4z"),
|
|
471
|
+
path("M21 12a2 2 0 1 0 -4 0v4"),
|
|
472
|
+
path("M4 6v12"),
|
|
473
|
+
path("M12 6v12"),
|
|
474
|
+
path("M11 18h2"),
|
|
475
|
+
path("M3 18h2"),
|
|
476
|
+
path("M4 12h8"),
|
|
477
|
+
path("M3 6h2"),
|
|
478
|
+
path("M11 6h2")
|
|
479
|
+
]);
|
|
480
|
+
var IconList = createIcon("IconList", [
|
|
481
|
+
path("M9 6l11 0"),
|
|
482
|
+
path("M9 12l11 0"),
|
|
483
|
+
path("M9 18l11 0"),
|
|
484
|
+
path("M5 6l0 .01"),
|
|
485
|
+
path("M5 12l0 .01"),
|
|
486
|
+
path("M5 18l0 .01")
|
|
487
|
+
]);
|
|
488
|
+
var IconListNumbers = createIcon("IconListNumbers", [
|
|
489
|
+
path("M11 6h9"),
|
|
490
|
+
path("M11 12h9"),
|
|
491
|
+
path("M12 18h8"),
|
|
492
|
+
path("M4 16a2 2 0 1 1 4 0c0 .591 -.5 1 -1 1.5l-3 2.5h4"),
|
|
493
|
+
path("M6 10v-6l-2 2")
|
|
494
|
+
]);
|
|
495
|
+
var IconUnlink = createIcon("IconUnlink", [
|
|
496
|
+
path("M17 22v-2"),
|
|
497
|
+
path("M9 15l6 -6"),
|
|
498
|
+
path("M11 6l.463 -.536a5 5 0 0 1 7.071 7.072l-.534 .464"),
|
|
499
|
+
path("M13 18l-.397 .534a5.068 5.068 0 0 1 -7.127 0a4.972 4.972 0 0 1 0 -7.071l.524 -.463"),
|
|
500
|
+
path("M20 17h2"),
|
|
501
|
+
path("M2 7h2"),
|
|
502
|
+
path("M7 2v2")
|
|
503
|
+
]);
|
|
504
|
+
var IconBlockquote = createIcon("IconBlockquote", [
|
|
505
|
+
path("M6 15h15"),
|
|
506
|
+
path("M21 19h-15"),
|
|
507
|
+
path("M15 11h6"),
|
|
508
|
+
path("M21 7h-6"),
|
|
509
|
+
path("M9 9h1a1 1 0 1 1 -1 1v-2.5a2 2 0 0 1 2 -2"),
|
|
510
|
+
path("M3 9h1a1 1 0 1 1 -1 1v-2.5a2 2 0 0 1 2 -2")
|
|
511
|
+
]);
|
|
512
|
+
var IconAlignLeft = createIcon("IconAlignLeft", [
|
|
513
|
+
path("M4 6l16 0"),
|
|
514
|
+
path("M4 12l10 0"),
|
|
515
|
+
path("M4 18l14 0")
|
|
516
|
+
]);
|
|
517
|
+
var IconAlignRight = createIcon("IconAlignRight", [
|
|
518
|
+
path("M4 6l16 0"),
|
|
519
|
+
path("M10 12l10 0"),
|
|
520
|
+
path("M6 18l14 0")
|
|
521
|
+
]);
|
|
522
|
+
var IconAlignCenter = createIcon("IconAlignCenter", [
|
|
523
|
+
path("M4 6l16 0"),
|
|
524
|
+
path("M8 12l8 0"),
|
|
525
|
+
path("M6 18l12 0")
|
|
526
|
+
]);
|
|
527
|
+
var IconAlignJustified = createIcon("IconAlignJustified", [
|
|
528
|
+
path("M4 6l16 0"),
|
|
529
|
+
path("M4 12l16 0"),
|
|
530
|
+
path("M4 18l12 0")
|
|
531
|
+
]);
|
|
532
|
+
var IconSubscript = createIcon("IconSubscript", [path("M5 7l8 10m-8 0l8 -10"), path("M21 20h-4l3.5 -4a1.73 1.73 0 0 0 -3.5 -2")]);
|
|
533
|
+
var IconSuperscript = createIcon("IconSuperscript", [path("M5 7l8 10m-8 0l8 -10"), path("M21 11h-4l3.5 -4a1.73 1.73 0 0 0 -3.5 -2")]);
|
|
534
|
+
var IconCode = createIcon("IconCode", [
|
|
535
|
+
path("M7 8l-4 4l4 4"),
|
|
536
|
+
path("M17 8l4 4l-4 4"),
|
|
537
|
+
path("M14 4l-4 16")
|
|
538
|
+
]);
|
|
539
|
+
var IconHighlight = createIcon("IconHighlight", [
|
|
540
|
+
path("M3 19h4l10.5 -10.5a2.828 2.828 0 1 0 -4 -4l-10.5 10.5v4"),
|
|
541
|
+
path("M12.5 5.5l4 4"),
|
|
542
|
+
path("M4.5 13.5l4 4"),
|
|
543
|
+
path("M21 15v4h-8l4 -4z")
|
|
544
|
+
]);
|
|
545
|
+
var IconLineDashed = createIcon("IconLineDashed", [
|
|
546
|
+
path("M5 12h2"),
|
|
547
|
+
path("M17 12h2"),
|
|
548
|
+
path("M11 12h2")
|
|
549
|
+
]);
|
|
550
|
+
var IconCircleOff = createIcon("IconCircleOff", [path("M20.042 16.045a9 9 0 0 0 -12.087 -12.087m-2.318 1.677a9 9 0 1 0 12.725 12.73"), path("M3 3l18 18")]);
|
|
551
|
+
var IconColorPicker = createIcon("IconColorPicker", [path("M11 7l6 6"), path("M4 16l11.7 -11.7a1 1 0 0 1 1.4 0l2.6 2.6a1 1 0 0 1 0 1.4l-11.7 11.7h-4v-4z")]);
|
|
552
|
+
var IconX = createIcon("IconX", [path("M18 6l-12 12"), path("M6 6l12 12")]);
|
|
553
|
+
var IconPalette = createIcon("IconPalette", [
|
|
554
|
+
path("M12 21a9 9 0 0 1 0 -18c4.97 0 9 3.582 9 8c0 1.06 -.474 2.078 -1.318 2.828c-.844 .75 -1.989 1.172 -3.182 1.172h-2.5a2 2 0 0 0 -1 3.75a1.3 1.3 0 0 1 -1 2.25"),
|
|
555
|
+
path("M8.5 10.5m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"),
|
|
556
|
+
path("M12.5 7.5m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"),
|
|
557
|
+
path("M16.5 10.5m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0")
|
|
558
|
+
]);
|
|
559
|
+
var IconCheck = createIcon("IconCheck", [path("M5 12l5 5l10 -10")]);
|
|
560
|
+
var IconLink = createIcon("IconLink", [
|
|
561
|
+
path("M9 15l6 -6"),
|
|
562
|
+
path("M11 6l.463 -.536a5 5 0 0 1 7.071 7.072l-.534 .464"),
|
|
563
|
+
path("M13 18l-.397 .534a5.068 5.068 0 0 1 -7.127 0a4.972 4.972 0 0 1 0 -7.071l.524 -.463")
|
|
564
|
+
]);
|
|
565
|
+
var IconExternalLink = createIcon("IconExternalLink", [
|
|
566
|
+
path("M12 6h-6a2 2 0 0 0 -2 2v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2 -2v-6"),
|
|
567
|
+
path("M11 13l9 -9"),
|
|
568
|
+
path("M15 4h5v5")
|
|
569
|
+
]);
|
|
570
|
+
var IconArrowBackUp = createIcon("IconArrowBackUp", [path("M9 14l-4 -4l4 -4"), path("M5 10h11a4 4 0 1 1 0 8h-1")]);
|
|
571
|
+
var IconArrowForwardUp = createIcon("IconArrowForwardUp", [path("M15 14l4 -4l-4 -4"), path("M19 10h-11a4 4 0 1 0 0 8h1")]);
|
|
572
|
+
var IconListCheck = createIcon("IconListCheck", [
|
|
573
|
+
path("M3.5 5.5l1.5 1.5l2.5 -2.5"),
|
|
574
|
+
path("M3.5 11.5l1.5 1.5l2.5 -2.5"),
|
|
575
|
+
path("M3.5 17.5l1.5 1.5l2.5 -2.5"),
|
|
576
|
+
path("M11 6l9 0"),
|
|
577
|
+
path("M11 12l9 0"),
|
|
578
|
+
path("M11 18l9 0")
|
|
579
|
+
]);
|
|
580
|
+
var IconIndentIncrease = createIcon("IconIndentIncrease", [
|
|
581
|
+
path("M20 6l-11 0"),
|
|
582
|
+
path("M20 12l-7 0"),
|
|
583
|
+
path("M20 18l-11 0"),
|
|
584
|
+
path("M4 8l4 4l-4 4")
|
|
585
|
+
]);
|
|
586
|
+
var IconIndentDecrease = createIcon("IconIndentDecrease", [
|
|
587
|
+
path("M20 6l-7 0"),
|
|
588
|
+
path("M20 12l-9 0"),
|
|
589
|
+
path("M20 18l-7 0"),
|
|
590
|
+
path("M8 8l-4 4l4 4")
|
|
591
|
+
]);
|
|
592
|
+
var IconBraces = createIcon("IconBraces", [
|
|
593
|
+
path("M19 3v16a1 1 0 0 1-1 1H6a1 1 0 0 1-1-1V7.914a1 1 0 0 1 .293-.707l3.914-3.914A1 1 0 0 1 9.914 3H18a1 1 0 0 1 1 1Z"),
|
|
594
|
+
path("M10 11l-2 2 2 2"),
|
|
595
|
+
path("M14 11l2 2-2 2")
|
|
596
|
+
]);
|
|
597
|
+
//#endregion
|
|
598
|
+
//#region src/RichTextEditorControl/RichTextEditorColorPickerControl.ts
|
|
599
|
+
var RichTextEditorColorPickerControl = (0, vue.defineComponent)({
|
|
600
|
+
name: "RichTextEditorColorPickerControl",
|
|
601
|
+
inheritAttrs: false,
|
|
602
|
+
props: {
|
|
603
|
+
popoverProps: {
|
|
604
|
+
type: Object,
|
|
605
|
+
default: void 0
|
|
606
|
+
},
|
|
607
|
+
colorPickerProps: {
|
|
608
|
+
type: Object,
|
|
609
|
+
default: void 0
|
|
610
|
+
},
|
|
611
|
+
colors: {
|
|
612
|
+
type: Array,
|
|
613
|
+
required: true
|
|
614
|
+
}
|
|
615
|
+
},
|
|
616
|
+
setup(rawProps, { attrs }) {
|
|
617
|
+
const props = (0, _mantine_vue_core.useProps)("RichTextEditorColorPickerControl", null, rawProps);
|
|
618
|
+
const ctx = useRichTextEditorContext();
|
|
619
|
+
const [opened, handlers] = (0, _mantine_vue_hooks.useDisclosure)(false);
|
|
620
|
+
const state = (0, vue.ref)("palette");
|
|
621
|
+
const handleChange = (value, shouldClose = true) => {
|
|
622
|
+
(ctx.editor?.chain())?.focus().setColor(value).run();
|
|
623
|
+
if (shouldClose) handlers.close();
|
|
624
|
+
};
|
|
625
|
+
const handleClear = () => {
|
|
626
|
+
(ctx.editor?.chain())?.focus().unsetColor().run();
|
|
627
|
+
handlers.close();
|
|
628
|
+
};
|
|
629
|
+
return () => {
|
|
630
|
+
const currentColor = ctx.editor?.getAttributes("textStyle").color || "var(--mantine-color-text)";
|
|
631
|
+
return (0, vue.h)(_mantine_vue_core.Popover, {
|
|
632
|
+
opened: opened.value,
|
|
633
|
+
withinPortal: true,
|
|
634
|
+
trapFocus: true,
|
|
635
|
+
onChange: (nextOpened) => !nextOpened && handlers.close(),
|
|
636
|
+
...props.popoverProps
|
|
637
|
+
}, { default: () => [(0, vue.h)(_mantine_vue_core.Popover.Target, null, () => (0, vue.h)(RichTextEditorControl, {
|
|
638
|
+
...attrs,
|
|
639
|
+
variant: ctx.variant,
|
|
640
|
+
"aria-label": ctx.labels.colorPickerControlLabel,
|
|
641
|
+
title: ctx.labels.colorPickerControlLabel,
|
|
642
|
+
onClick: handlers.toggle
|
|
643
|
+
}, () => (0, vue.h)(_mantine_vue_core.ColorSwatch, {
|
|
644
|
+
color: currentColor,
|
|
645
|
+
size: 14
|
|
646
|
+
}))), (0, vue.h)(_mantine_vue_core.Popover.Dropdown, ctx.getStyles("linkEditorDropdown"), () => [
|
|
647
|
+
state.value === "palette" ? (0, vue.h)(_mantine_vue_core.SimpleGrid, {
|
|
648
|
+
cols: 7,
|
|
649
|
+
spacing: 2
|
|
650
|
+
}, () => props.colors.map((color, index) => (0, vue.h)(_mantine_vue_core.ColorSwatch, {
|
|
651
|
+
key: index,
|
|
652
|
+
component: "button",
|
|
653
|
+
color,
|
|
654
|
+
onClick: () => handleChange(color),
|
|
655
|
+
size: 26,
|
|
656
|
+
radius: "xs",
|
|
657
|
+
style: { cursor: "pointer" },
|
|
658
|
+
title: ctx.labels.colorPickerColorLabel(color),
|
|
659
|
+
"aria-label": ctx.labels.colorPickerColorLabel(color)
|
|
660
|
+
}))) : null,
|
|
661
|
+
state.value === "colorPicker" ? (0, vue.h)(_mantine_vue_core.ColorPicker, {
|
|
662
|
+
defaultValue: currentColor,
|
|
663
|
+
onChange: (value) => handleChange(value, false),
|
|
664
|
+
...props.colorPickerProps
|
|
665
|
+
}) : null,
|
|
666
|
+
(0, vue.h)(_mantine_vue_core.Group, {
|
|
667
|
+
justify: "flex-end",
|
|
668
|
+
gap: "xs",
|
|
669
|
+
mt: "sm"
|
|
670
|
+
}, () => [
|
|
671
|
+
state.value === "palette" ? (0, vue.h)(_mantine_vue_core.ActionIcon, {
|
|
672
|
+
variant: "default",
|
|
673
|
+
onClick: handlers.close,
|
|
674
|
+
title: ctx.labels.colorPickerCancel,
|
|
675
|
+
"aria-label": ctx.labels.colorPickerCancel
|
|
676
|
+
}, () => (0, vue.h)(IconX, { style: {
|
|
677
|
+
width: (0, _mantine_vue_core.rem)(16),
|
|
678
|
+
height: (0, _mantine_vue_core.rem)(16)
|
|
679
|
+
} })) : null,
|
|
680
|
+
(0, vue.h)(_mantine_vue_core.ActionIcon, {
|
|
681
|
+
variant: "default",
|
|
682
|
+
onClick: handleClear,
|
|
683
|
+
title: ctx.labels.colorPickerClear,
|
|
684
|
+
"aria-label": ctx.labels.colorPickerClear
|
|
685
|
+
}, () => (0, vue.h)(IconCircleOff, { style: {
|
|
686
|
+
width: (0, _mantine_vue_core.rem)(16),
|
|
687
|
+
height: (0, _mantine_vue_core.rem)(16)
|
|
688
|
+
} })),
|
|
689
|
+
state.value === "palette" ? (0, vue.h)(_mantine_vue_core.ActionIcon, {
|
|
690
|
+
variant: "default",
|
|
691
|
+
onClick: () => {
|
|
692
|
+
state.value = "colorPicker";
|
|
693
|
+
},
|
|
694
|
+
title: ctx.labels.colorPickerColorPicker,
|
|
695
|
+
"aria-label": ctx.labels.colorPickerColorPicker
|
|
696
|
+
}, () => (0, vue.h)(IconColorPicker, { style: {
|
|
697
|
+
width: (0, _mantine_vue_core.rem)(16),
|
|
698
|
+
height: (0, _mantine_vue_core.rem)(16)
|
|
699
|
+
} })) : (0, vue.h)(_mantine_vue_core.ActionIcon, {
|
|
700
|
+
variant: "default",
|
|
701
|
+
onClick: () => {
|
|
702
|
+
state.value = "palette";
|
|
703
|
+
},
|
|
704
|
+
title: ctx.labels.colorPickerPalette,
|
|
705
|
+
"aria-label": ctx.labels.colorPickerPalette
|
|
706
|
+
}, () => (0, vue.h)(IconPalette, { style: {
|
|
707
|
+
width: (0, _mantine_vue_core.rem)(16),
|
|
708
|
+
height: (0, _mantine_vue_core.rem)(16)
|
|
709
|
+
} })),
|
|
710
|
+
state.value === "colorPicker" ? (0, vue.h)(_mantine_vue_core.ActionIcon, {
|
|
711
|
+
variant: "default",
|
|
712
|
+
onClick: handlers.close,
|
|
713
|
+
title: ctx.labels.colorPickerSave,
|
|
714
|
+
"aria-label": ctx.labels.colorPickerSave
|
|
715
|
+
}, () => (0, vue.h)(IconCheck, { style: {
|
|
716
|
+
width: (0, _mantine_vue_core.rem)(16),
|
|
717
|
+
height: (0, _mantine_vue_core.rem)(16)
|
|
718
|
+
} })) : null
|
|
719
|
+
])
|
|
720
|
+
])] });
|
|
721
|
+
};
|
|
722
|
+
}
|
|
723
|
+
});
|
|
724
|
+
//#endregion
|
|
725
|
+
//#region src/RichTextEditorControl/RichTextEditorLinkControl.ts
|
|
726
|
+
var RichTextEditorLinkControl = (0, vue.defineComponent)({
|
|
727
|
+
name: "RichTextEditorLinkControl",
|
|
728
|
+
inheritAttrs: false,
|
|
729
|
+
props: {
|
|
730
|
+
popoverProps: {
|
|
731
|
+
type: Object,
|
|
732
|
+
default: void 0
|
|
733
|
+
},
|
|
734
|
+
disableTooltips: {
|
|
735
|
+
type: Boolean,
|
|
736
|
+
default: false
|
|
737
|
+
},
|
|
738
|
+
initialExternal: {
|
|
739
|
+
type: Boolean,
|
|
740
|
+
default: false
|
|
741
|
+
},
|
|
742
|
+
icon: {
|
|
743
|
+
type: [Object, Function],
|
|
744
|
+
default: void 0
|
|
745
|
+
},
|
|
746
|
+
classNames: {
|
|
747
|
+
type: [Object, Function],
|
|
748
|
+
default: void 0
|
|
749
|
+
},
|
|
750
|
+
styles: {
|
|
751
|
+
type: [Object, Function],
|
|
752
|
+
default: void 0
|
|
753
|
+
},
|
|
754
|
+
vars: {
|
|
755
|
+
type: [Object, Function],
|
|
756
|
+
default: void 0
|
|
757
|
+
}
|
|
758
|
+
},
|
|
759
|
+
setup(rawProps, { attrs }) {
|
|
760
|
+
const props = (0, _mantine_vue_core.useProps)("RichTextEditorLinkControl", null, rawProps);
|
|
761
|
+
const ctx = useRichTextEditorContext();
|
|
762
|
+
const url = (0, vue.ref)("");
|
|
763
|
+
const external = (0, vue.ref)(props.initialExternal);
|
|
764
|
+
const [opened, handlers] = (0, _mantine_vue_hooks.useDisclosure)(false);
|
|
765
|
+
const handleOpen = () => {
|
|
766
|
+
handlers.open();
|
|
767
|
+
const linkData = ctx.editor?.getAttributes("link");
|
|
768
|
+
url.value = linkData?.href || "";
|
|
769
|
+
external.value = linkData?.href ? linkData?.target === "_blank" : !!props.initialExternal;
|
|
770
|
+
};
|
|
771
|
+
const handleClose = () => {
|
|
772
|
+
handlers.close();
|
|
773
|
+
url.value = "";
|
|
774
|
+
external.value = !!props.initialExternal;
|
|
775
|
+
};
|
|
776
|
+
const setLink = () => {
|
|
777
|
+
handleClose();
|
|
778
|
+
if (url.value === "") ctx.editor?.chain().focus().extendMarkRange("link").unsetLink().run();
|
|
779
|
+
else ctx.editor?.chain().focus().extendMarkRange("link").setLink({
|
|
780
|
+
href: url.value,
|
|
781
|
+
target: external.value ? "_blank" : null
|
|
782
|
+
}).run();
|
|
783
|
+
};
|
|
784
|
+
(0, _mantine_vue_hooks.useWindowEvent)("edit-link", handleOpen);
|
|
785
|
+
return () => {
|
|
786
|
+
const stylesApiProps = {
|
|
787
|
+
classNames: props.classNames,
|
|
788
|
+
styles: props.styles
|
|
789
|
+
};
|
|
790
|
+
const active = ctx.editor && !ctx.editor.isDestroyed ? ctx.editor.isActive("link") : false;
|
|
791
|
+
return (0, vue.h)(_mantine_vue_core.Popover, {
|
|
792
|
+
trapFocus: true,
|
|
793
|
+
shadow: "md",
|
|
794
|
+
withinPortal: true,
|
|
795
|
+
opened: opened.value,
|
|
796
|
+
onChange: (nextOpened) => !nextOpened && handleClose(),
|
|
797
|
+
offset: -44,
|
|
798
|
+
zIndex: 1e4,
|
|
799
|
+
...props.popoverProps
|
|
800
|
+
}, { default: () => [(0, vue.h)(_mantine_vue_core.Popover.Target, null, () => (0, vue.h)(RichTextEditorControlBase, {
|
|
801
|
+
...attrs,
|
|
802
|
+
icon: props.icon || IconLink,
|
|
803
|
+
"aria-label": ctx.labels.linkControlLabel,
|
|
804
|
+
title: ctx.labels.linkControlLabel,
|
|
805
|
+
onClick: handleOpen,
|
|
806
|
+
active,
|
|
807
|
+
classNames: props.classNames,
|
|
808
|
+
styles: props.styles,
|
|
809
|
+
variant: ctx.variant
|
|
810
|
+
})), (0, vue.h)(_mantine_vue_core.Popover.Dropdown, ctx.getStyles("linkEditorDropdown", stylesApiProps), () => (0, vue.h)("div", ctx.getStyles("linkEditor", stylesApiProps), [(0, vue.h)(_mantine_vue_core.TextInput, {
|
|
811
|
+
placeholder: ctx.labels.linkEditorInputPlaceholder,
|
|
812
|
+
"aria-label": ctx.labels.linkEditorInputLabel,
|
|
813
|
+
type: "url",
|
|
814
|
+
value: url.value,
|
|
815
|
+
onInput: (event) => {
|
|
816
|
+
url.value = event.currentTarget.value;
|
|
817
|
+
},
|
|
818
|
+
classNames: { input: ctx.getStyles("linkEditorInput", stylesApiProps).class },
|
|
819
|
+
onKeydown: (event) => {
|
|
820
|
+
if (event.key === "Enter") {
|
|
821
|
+
event.preventDefault();
|
|
822
|
+
setLink();
|
|
823
|
+
}
|
|
824
|
+
},
|
|
825
|
+
rightSection: () => (0, vue.h)(_mantine_vue_core.Tooltip, {
|
|
826
|
+
label: external.value ? ctx.labels.linkEditorExternalLink : ctx.labels.linkEditorInternalLink,
|
|
827
|
+
events: {
|
|
828
|
+
hover: true,
|
|
829
|
+
focus: true,
|
|
830
|
+
touch: true
|
|
831
|
+
},
|
|
832
|
+
withinPortal: true,
|
|
833
|
+
withArrow: true,
|
|
834
|
+
disabled: props.disableTooltips,
|
|
835
|
+
zIndex: 1e4
|
|
836
|
+
}, () => (0, vue.h)(_mantine_vue_core.UnstyledButton, {
|
|
837
|
+
onClick: () => {
|
|
838
|
+
external.value = !external.value;
|
|
839
|
+
},
|
|
840
|
+
"data-active": external.value || void 0,
|
|
841
|
+
...ctx.getStyles("linkEditorExternalControl", stylesApiProps)
|
|
842
|
+
}, () => (0, vue.h)(IconExternalLink, { style: {
|
|
843
|
+
width: (0, _mantine_vue_core.rem)(14),
|
|
844
|
+
height: (0, _mantine_vue_core.rem)(14)
|
|
845
|
+
} })))
|
|
846
|
+
}), (0, vue.h)(_mantine_vue_core.Button, {
|
|
847
|
+
variant: "default",
|
|
848
|
+
onClick: setLink,
|
|
849
|
+
...ctx.getStyles("linkEditorSave", stylesApiProps)
|
|
850
|
+
}, () => ctx.labels.linkEditorSave)]))] });
|
|
851
|
+
};
|
|
852
|
+
}
|
|
853
|
+
});
|
|
854
|
+
Object.assign(RichTextEditorLinkControl, { classes: RichTextEditor_module_default });
|
|
855
|
+
//#endregion
|
|
856
|
+
//#region src/RichTextEditorControl/RichTextEditorSourceCodeControl.ts
|
|
857
|
+
var RichTextEditorSourceCodeControl = (0, vue.defineComponent)({
|
|
858
|
+
name: "RichTextEditorSourceCodeControl",
|
|
859
|
+
inheritAttrs: false,
|
|
860
|
+
setup(rawProps, { attrs }) {
|
|
861
|
+
(0, _mantine_vue_core.useProps)("RichTextEditorSourceCodeControl", {}, rawProps);
|
|
862
|
+
const ctx = useRichTextEditorContext();
|
|
863
|
+
const isSourceCodeModeActive = (0, vue.ref)(false);
|
|
864
|
+
const handleStateChange = () => {
|
|
865
|
+
if (isSourceCodeModeActive.value) ctx.editor?.commands.setContent(ctx.editor.getText(), { emitUpdate: true });
|
|
866
|
+
else ctx.editor?.commands.setContent(`<textarea>${ctx.editor.getHTML()}</textarea>`);
|
|
867
|
+
isSourceCodeModeActive.value = !isSourceCodeModeActive.value;
|
|
868
|
+
ctx.onSourceCodeTextSwitch?.(isSourceCodeModeActive.value);
|
|
869
|
+
};
|
|
870
|
+
return () => (0, vue.h)(RichTextEditorControl, {
|
|
871
|
+
...attrs,
|
|
872
|
+
variant: ctx.variant,
|
|
873
|
+
active: isSourceCodeModeActive.value,
|
|
874
|
+
"aria-label": ctx.labels.sourceCodeControlLabel,
|
|
875
|
+
title: ctx.labels.sourceCodeControlLabel,
|
|
876
|
+
onClick: handleStateChange
|
|
877
|
+
}, () => (0, vue.h)(IconBraces, { style: {
|
|
878
|
+
width: (0, _mantine_vue_core.rem)(16),
|
|
879
|
+
height: (0, _mantine_vue_core.rem)(16)
|
|
880
|
+
} }));
|
|
881
|
+
}
|
|
882
|
+
});
|
|
883
|
+
//#endregion
|
|
884
|
+
//#region src/RichTextEditorControl/controls.ts
|
|
885
|
+
var BoldControl = createControl({
|
|
886
|
+
label: "boldControlLabel",
|
|
887
|
+
icon: IconBold,
|
|
888
|
+
isActive: { name: "bold" },
|
|
889
|
+
operation: { name: "toggleBold" }
|
|
890
|
+
});
|
|
891
|
+
var ItalicControl = createControl({
|
|
892
|
+
label: "italicControlLabel",
|
|
893
|
+
icon: IconItalic,
|
|
894
|
+
isActive: { name: "italic" },
|
|
895
|
+
operation: { name: "toggleItalic" }
|
|
896
|
+
});
|
|
897
|
+
var UnderlineControl = createControl({
|
|
898
|
+
label: "underlineControlLabel",
|
|
899
|
+
icon: IconUnderline,
|
|
900
|
+
isActive: { name: "underline" },
|
|
901
|
+
operation: { name: "toggleUnderline" }
|
|
902
|
+
});
|
|
903
|
+
var StrikeThroughControl = createControl({
|
|
904
|
+
label: "strikeControlLabel",
|
|
905
|
+
icon: IconStrikethrough,
|
|
906
|
+
isActive: { name: "strike" },
|
|
907
|
+
operation: { name: "toggleStrike" }
|
|
908
|
+
});
|
|
909
|
+
var ClearFormattingControl = createControl({
|
|
910
|
+
label: "clearFormattingControlLabel",
|
|
911
|
+
icon: IconClearFormatting,
|
|
912
|
+
operation: { name: "unsetAllMarks" }
|
|
913
|
+
});
|
|
914
|
+
var UnlinkControl = createControl({
|
|
915
|
+
label: "unlinkControlLabel",
|
|
916
|
+
icon: IconUnlink,
|
|
917
|
+
operation: { name: "unsetLink" }
|
|
918
|
+
});
|
|
919
|
+
var BulletListControl = createControl({
|
|
920
|
+
label: "bulletListControlLabel",
|
|
921
|
+
icon: IconList,
|
|
922
|
+
isActive: { name: "bulletList" },
|
|
923
|
+
operation: { name: "toggleBulletList" }
|
|
924
|
+
});
|
|
925
|
+
var OrderedListControl = createControl({
|
|
926
|
+
label: "orderedListControlLabel",
|
|
927
|
+
icon: IconListNumbers,
|
|
928
|
+
isActive: { name: "orderedList" },
|
|
929
|
+
operation: { name: "toggleOrderedList" }
|
|
930
|
+
});
|
|
931
|
+
var H1Control = createControl({
|
|
932
|
+
label: "h1ControlLabel",
|
|
933
|
+
icon: IconH1,
|
|
934
|
+
isActive: {
|
|
935
|
+
name: "heading",
|
|
936
|
+
attributes: { level: 1 }
|
|
937
|
+
},
|
|
938
|
+
operation: {
|
|
939
|
+
name: "toggleHeading",
|
|
940
|
+
attributes: { level: 1 }
|
|
941
|
+
}
|
|
942
|
+
});
|
|
943
|
+
var H2Control = createControl({
|
|
944
|
+
label: "h2ControlLabel",
|
|
945
|
+
icon: IconH2,
|
|
946
|
+
isActive: {
|
|
947
|
+
name: "heading",
|
|
948
|
+
attributes: { level: 2 }
|
|
949
|
+
},
|
|
950
|
+
operation: {
|
|
951
|
+
name: "toggleHeading",
|
|
952
|
+
attributes: { level: 2 }
|
|
953
|
+
}
|
|
954
|
+
});
|
|
955
|
+
var H3Control = createControl({
|
|
956
|
+
label: "h3ControlLabel",
|
|
957
|
+
icon: IconH3,
|
|
958
|
+
isActive: {
|
|
959
|
+
name: "heading",
|
|
960
|
+
attributes: { level: 3 }
|
|
961
|
+
},
|
|
962
|
+
operation: {
|
|
963
|
+
name: "toggleHeading",
|
|
964
|
+
attributes: { level: 3 }
|
|
965
|
+
}
|
|
966
|
+
});
|
|
967
|
+
var H4Control = createControl({
|
|
968
|
+
label: "h4ControlLabel",
|
|
969
|
+
icon: IconH4,
|
|
970
|
+
isActive: {
|
|
971
|
+
name: "heading",
|
|
972
|
+
attributes: { level: 4 }
|
|
973
|
+
},
|
|
974
|
+
operation: {
|
|
975
|
+
name: "toggleHeading",
|
|
976
|
+
attributes: { level: 4 }
|
|
977
|
+
}
|
|
978
|
+
});
|
|
979
|
+
var H5Control = createControl({
|
|
980
|
+
label: "h5ControlLabel",
|
|
981
|
+
icon: IconH5,
|
|
982
|
+
isActive: {
|
|
983
|
+
name: "heading",
|
|
984
|
+
attributes: { level: 5 }
|
|
985
|
+
},
|
|
986
|
+
operation: {
|
|
987
|
+
name: "toggleHeading",
|
|
988
|
+
attributes: { level: 5 }
|
|
989
|
+
}
|
|
990
|
+
});
|
|
991
|
+
var H6Control = createControl({
|
|
992
|
+
label: "h6ControlLabel",
|
|
993
|
+
icon: IconH6,
|
|
994
|
+
isActive: {
|
|
995
|
+
name: "heading",
|
|
996
|
+
attributes: { level: 6 }
|
|
997
|
+
},
|
|
998
|
+
operation: {
|
|
999
|
+
name: "toggleHeading",
|
|
1000
|
+
attributes: { level: 6 }
|
|
1001
|
+
}
|
|
1002
|
+
});
|
|
1003
|
+
var BlockquoteControl = createControl({
|
|
1004
|
+
label: "blockquoteControlLabel",
|
|
1005
|
+
icon: IconBlockquote,
|
|
1006
|
+
isActive: { name: "blockquote" },
|
|
1007
|
+
operation: { name: "toggleBlockquote" }
|
|
1008
|
+
});
|
|
1009
|
+
var AlignLeftControl = createControl({
|
|
1010
|
+
label: "alignLeftControlLabel",
|
|
1011
|
+
icon: IconAlignLeft,
|
|
1012
|
+
operation: {
|
|
1013
|
+
name: "setTextAlign",
|
|
1014
|
+
attributes: "left"
|
|
1015
|
+
}
|
|
1016
|
+
});
|
|
1017
|
+
var AlignRightControl = createControl({
|
|
1018
|
+
label: "alignRightControlLabel",
|
|
1019
|
+
icon: IconAlignRight,
|
|
1020
|
+
operation: {
|
|
1021
|
+
name: "setTextAlign",
|
|
1022
|
+
attributes: "right"
|
|
1023
|
+
}
|
|
1024
|
+
});
|
|
1025
|
+
var AlignCenterControl = createControl({
|
|
1026
|
+
label: "alignCenterControlLabel",
|
|
1027
|
+
icon: IconAlignCenter,
|
|
1028
|
+
operation: {
|
|
1029
|
+
name: "setTextAlign",
|
|
1030
|
+
attributes: "center"
|
|
1031
|
+
}
|
|
1032
|
+
});
|
|
1033
|
+
var AlignJustifyControl = createControl({
|
|
1034
|
+
label: "alignJustifyControlLabel",
|
|
1035
|
+
icon: IconAlignJustified,
|
|
1036
|
+
operation: {
|
|
1037
|
+
name: "setTextAlign",
|
|
1038
|
+
attributes: "justify"
|
|
1039
|
+
}
|
|
1040
|
+
});
|
|
1041
|
+
var SubscriptControl = createControl({
|
|
1042
|
+
label: "subscriptControlLabel",
|
|
1043
|
+
icon: IconSubscript,
|
|
1044
|
+
isActive: { name: "subscript" },
|
|
1045
|
+
operation: { name: "toggleSubscript" }
|
|
1046
|
+
});
|
|
1047
|
+
var SuperscriptControl = createControl({
|
|
1048
|
+
label: "superscriptControlLabel",
|
|
1049
|
+
icon: IconSuperscript,
|
|
1050
|
+
isActive: { name: "superscript" },
|
|
1051
|
+
operation: { name: "toggleSuperscript" }
|
|
1052
|
+
});
|
|
1053
|
+
var CodeControl = createControl({
|
|
1054
|
+
label: "codeControlLabel",
|
|
1055
|
+
icon: IconCode,
|
|
1056
|
+
isActive: { name: "code" },
|
|
1057
|
+
operation: { name: "toggleCode" }
|
|
1058
|
+
});
|
|
1059
|
+
var CodeBlockControl = createControl({
|
|
1060
|
+
label: "codeBlockControlLabel",
|
|
1061
|
+
icon: IconCode,
|
|
1062
|
+
isActive: { name: "codeBlock" },
|
|
1063
|
+
operation: { name: "toggleCodeBlock" }
|
|
1064
|
+
});
|
|
1065
|
+
var HighlightControl = createControl({
|
|
1066
|
+
label: "highlightControlLabel",
|
|
1067
|
+
icon: IconHighlight,
|
|
1068
|
+
isActive: { name: "highlight" },
|
|
1069
|
+
operation: { name: "toggleHighlight" }
|
|
1070
|
+
});
|
|
1071
|
+
var HrControl = createControl({
|
|
1072
|
+
label: "hrControlLabel",
|
|
1073
|
+
icon: IconLineDashed,
|
|
1074
|
+
operation: { name: "setHorizontalRule" }
|
|
1075
|
+
});
|
|
1076
|
+
var UnsetColorControl = createControl({
|
|
1077
|
+
label: "unsetColorControlLabel",
|
|
1078
|
+
icon: IconCircleOff,
|
|
1079
|
+
operation: { name: "unsetColor" }
|
|
1080
|
+
});
|
|
1081
|
+
var UndoControl = createControl({
|
|
1082
|
+
label: "undoControlLabel",
|
|
1083
|
+
icon: IconArrowBackUp,
|
|
1084
|
+
isDisabled: (editor) => !(editor?.can())?.undo(),
|
|
1085
|
+
operation: { name: "undo" }
|
|
1086
|
+
});
|
|
1087
|
+
var RedoControl = createControl({
|
|
1088
|
+
label: "redoControlLabel",
|
|
1089
|
+
icon: IconArrowForwardUp,
|
|
1090
|
+
isDisabled: (editor) => !(editor?.can())?.redo(),
|
|
1091
|
+
operation: { name: "redo" }
|
|
1092
|
+
});
|
|
1093
|
+
var TaskListControl = createControl({
|
|
1094
|
+
label: "tasksControlLabel",
|
|
1095
|
+
icon: IconListCheck,
|
|
1096
|
+
isActive: { name: "taskList" },
|
|
1097
|
+
operation: { name: "toggleTaskList" }
|
|
1098
|
+
});
|
|
1099
|
+
var TaskListSinkControl = createControl({
|
|
1100
|
+
label: "tasksSinkLabel",
|
|
1101
|
+
icon: IconIndentIncrease,
|
|
1102
|
+
operation: {
|
|
1103
|
+
name: "sinkListItem",
|
|
1104
|
+
attributes: "taskItem"
|
|
1105
|
+
},
|
|
1106
|
+
isDisabled: (editor) => !editor?.can().sinkListItem("taskItem")
|
|
1107
|
+
});
|
|
1108
|
+
var TaskListLiftControl = createControl({
|
|
1109
|
+
label: "tasksLiftLabel",
|
|
1110
|
+
icon: IconIndentDecrease,
|
|
1111
|
+
operation: {
|
|
1112
|
+
name: "liftListItem",
|
|
1113
|
+
attributes: "taskItem"
|
|
1114
|
+
},
|
|
1115
|
+
isDisabled: (editor) => !editor?.can().liftListItem("taskItem")
|
|
1116
|
+
});
|
|
1117
|
+
//#endregion
|
|
1118
|
+
//#region src/RichTextEditorControlsGroup/RichTextEditorControlsGroup.ts
|
|
1119
|
+
var RichTextEditorControlsGroup = (0, vue.defineComponent)({
|
|
1120
|
+
name: "RichTextEditorControlsGroup",
|
|
1121
|
+
inheritAttrs: false,
|
|
1122
|
+
props: {
|
|
1123
|
+
variant: {
|
|
1124
|
+
type: String,
|
|
1125
|
+
default: void 0
|
|
1126
|
+
},
|
|
1127
|
+
classNames: {
|
|
1128
|
+
type: [Object, Function],
|
|
1129
|
+
default: void 0
|
|
1130
|
+
},
|
|
1131
|
+
styles: {
|
|
1132
|
+
type: [Object, Function],
|
|
1133
|
+
default: void 0
|
|
1134
|
+
},
|
|
1135
|
+
vars: {
|
|
1136
|
+
type: [Object, Function],
|
|
1137
|
+
default: void 0
|
|
1138
|
+
}
|
|
1139
|
+
},
|
|
1140
|
+
setup(rawProps, { attrs, slots }) {
|
|
1141
|
+
const props = (0, _mantine_vue_core.useProps)("RichTextEditorControlsGroup", null, rawProps);
|
|
1142
|
+
const ctx = useRichTextEditorContext();
|
|
1143
|
+
return () => (0, vue.h)(_mantine_vue_core.Box, {
|
|
1144
|
+
...attrs,
|
|
1145
|
+
variant: props.variant || ctx.variant,
|
|
1146
|
+
...ctx.getStyles("controlsGroup", {
|
|
1147
|
+
className: attrs.class,
|
|
1148
|
+
style: attrs.style,
|
|
1149
|
+
styles: props.styles,
|
|
1150
|
+
classNames: props.classNames
|
|
1151
|
+
})
|
|
1152
|
+
}, slots);
|
|
1153
|
+
}
|
|
1154
|
+
});
|
|
1155
|
+
Object.assign(RichTextEditorControlsGroup, { classes: RichTextEditor_module_default });
|
|
1156
|
+
//#endregion
|
|
1157
|
+
//#region src/RichTextEditorToolbar/RichTextEditorToolbar.ts
|
|
1158
|
+
var RichTextEditorToolbar = (0, vue.defineComponent)({
|
|
1159
|
+
name: "RichTextEditorToolbar",
|
|
1160
|
+
inheritAttrs: false,
|
|
1161
|
+
props: {
|
|
1162
|
+
sticky: {
|
|
1163
|
+
type: Boolean,
|
|
1164
|
+
default: false
|
|
1165
|
+
},
|
|
1166
|
+
stickyOffset: {
|
|
1167
|
+
type: [String, Number],
|
|
1168
|
+
default: void 0
|
|
1169
|
+
},
|
|
1170
|
+
variant: {
|
|
1171
|
+
type: String,
|
|
1172
|
+
default: void 0
|
|
1173
|
+
},
|
|
1174
|
+
classNames: {
|
|
1175
|
+
type: [Object, Function],
|
|
1176
|
+
default: void 0
|
|
1177
|
+
},
|
|
1178
|
+
styles: {
|
|
1179
|
+
type: [Object, Function],
|
|
1180
|
+
default: void 0
|
|
1181
|
+
},
|
|
1182
|
+
vars: {
|
|
1183
|
+
type: [Object, Function],
|
|
1184
|
+
default: void 0
|
|
1185
|
+
},
|
|
1186
|
+
mod: {
|
|
1187
|
+
type: [Object, Array],
|
|
1188
|
+
default: void 0
|
|
1189
|
+
}
|
|
1190
|
+
},
|
|
1191
|
+
setup(rawProps, { attrs, slots }) {
|
|
1192
|
+
const props = (0, _mantine_vue_core.useProps)("RichTextEditorToolbar", null, rawProps);
|
|
1193
|
+
const ctx = useRichTextEditorContext();
|
|
1194
|
+
return () => (0, vue.h)(_mantine_vue_core.Box, {
|
|
1195
|
+
...attrs,
|
|
1196
|
+
mod: [{ sticky: props.sticky }, props.mod],
|
|
1197
|
+
variant: props.variant || ctx.variant,
|
|
1198
|
+
...ctx.getStyles("toolbar", {
|
|
1199
|
+
className: attrs.class,
|
|
1200
|
+
style: [attrs.style, { "--rte-sticky-offset": (0, _mantine_vue_core.rem)(props.stickyOffset) }],
|
|
1201
|
+
styles: props.styles,
|
|
1202
|
+
classNames: props.classNames
|
|
1203
|
+
})
|
|
1204
|
+
}, slots);
|
|
1205
|
+
}
|
|
1206
|
+
});
|
|
1207
|
+
Object.assign(RichTextEditorToolbar, { classes: RichTextEditor_module_default });
|
|
1208
|
+
//#endregion
|
|
1209
|
+
//#region src/RichTextEditor.ts
|
|
1210
|
+
var defaultProps = {
|
|
1211
|
+
withCodeHighlightStyles: true,
|
|
1212
|
+
withTypographyStyles: true,
|
|
1213
|
+
variant: "default"
|
|
1214
|
+
};
|
|
1215
|
+
var RichTextEditorBase = (0, vue.defineComponent)({
|
|
1216
|
+
name: "RichTextEditor",
|
|
1217
|
+
inheritAttrs: false,
|
|
1218
|
+
props: {
|
|
1219
|
+
editor: {
|
|
1220
|
+
type: Object,
|
|
1221
|
+
default: null
|
|
1222
|
+
},
|
|
1223
|
+
withCodeHighlightStyles: {
|
|
1224
|
+
type: Boolean,
|
|
1225
|
+
default: void 0
|
|
1226
|
+
},
|
|
1227
|
+
withTypographyStyles: {
|
|
1228
|
+
type: Boolean,
|
|
1229
|
+
default: void 0
|
|
1230
|
+
},
|
|
1231
|
+
onSourceCodeTextSwitch: {
|
|
1232
|
+
type: Function,
|
|
1233
|
+
default: void 0
|
|
1234
|
+
},
|
|
1235
|
+
labels: {
|
|
1236
|
+
type: Object,
|
|
1237
|
+
default: void 0
|
|
1238
|
+
},
|
|
1239
|
+
variant: {
|
|
1240
|
+
type: String,
|
|
1241
|
+
default: void 0
|
|
1242
|
+
},
|
|
1243
|
+
classNames: {
|
|
1244
|
+
type: [Object, Function],
|
|
1245
|
+
default: void 0
|
|
1246
|
+
},
|
|
1247
|
+
styles: {
|
|
1248
|
+
type: [Object, Function],
|
|
1249
|
+
default: void 0
|
|
1250
|
+
},
|
|
1251
|
+
vars: {
|
|
1252
|
+
type: [Object, Function],
|
|
1253
|
+
default: void 0
|
|
1254
|
+
},
|
|
1255
|
+
unstyled: {
|
|
1256
|
+
type: Boolean,
|
|
1257
|
+
default: false
|
|
1258
|
+
}
|
|
1259
|
+
},
|
|
1260
|
+
setup(rawProps, { attrs, slots }) {
|
|
1261
|
+
const props = (0, _mantine_vue_core.useProps)("RichTextEditor", defaultProps, rawProps);
|
|
1262
|
+
const getStyles = (0, _mantine_vue_core.useStyles)({
|
|
1263
|
+
name: "RichTextEditor",
|
|
1264
|
+
classes: RichTextEditor_module_default,
|
|
1265
|
+
props,
|
|
1266
|
+
className: attrs.class,
|
|
1267
|
+
style: attrs.style,
|
|
1268
|
+
classNames: props.classNames,
|
|
1269
|
+
styles: props.styles,
|
|
1270
|
+
vars: props.vars,
|
|
1271
|
+
unstyled: props.unstyled
|
|
1272
|
+
});
|
|
1273
|
+
const mergedLabels = (0, vue.computed)(() => ({
|
|
1274
|
+
...DEFAULT_LABELS,
|
|
1275
|
+
...props.labels
|
|
1276
|
+
}));
|
|
1277
|
+
provideRichTextEditorContext({
|
|
1278
|
+
get editor() {
|
|
1279
|
+
return props.editor;
|
|
1280
|
+
},
|
|
1281
|
+
getStyles,
|
|
1282
|
+
get labels() {
|
|
1283
|
+
return mergedLabels.value;
|
|
1284
|
+
},
|
|
1285
|
+
get withCodeHighlightStyles() {
|
|
1286
|
+
return props.withCodeHighlightStyles;
|
|
1287
|
+
},
|
|
1288
|
+
get withTypographyStyles() {
|
|
1289
|
+
return props.withTypographyStyles;
|
|
1290
|
+
},
|
|
1291
|
+
get onSourceCodeTextSwitch() {
|
|
1292
|
+
return props.onSourceCodeTextSwitch;
|
|
1293
|
+
},
|
|
1294
|
+
get unstyled() {
|
|
1295
|
+
return props.unstyled;
|
|
1296
|
+
},
|
|
1297
|
+
get variant() {
|
|
1298
|
+
return props.variant;
|
|
1299
|
+
}
|
|
1300
|
+
});
|
|
1301
|
+
return () => (0, vue.h)(_mantine_vue_core.Box, {
|
|
1302
|
+
...attrs,
|
|
1303
|
+
...getStyles("root")
|
|
1304
|
+
}, slots);
|
|
1305
|
+
}
|
|
1306
|
+
});
|
|
1307
|
+
var RichTextEditor = Object.assign(RichTextEditorBase, {
|
|
1308
|
+
classes: RichTextEditor_module_default,
|
|
1309
|
+
Content: RichTextEditorContent,
|
|
1310
|
+
Control: RichTextEditorControl,
|
|
1311
|
+
Toolbar: RichTextEditorToolbar,
|
|
1312
|
+
ControlsGroup: RichTextEditorControlsGroup,
|
|
1313
|
+
Bold: BoldControl,
|
|
1314
|
+
Italic: ItalicControl,
|
|
1315
|
+
Strikethrough: StrikeThroughControl,
|
|
1316
|
+
Underline: UnderlineControl,
|
|
1317
|
+
ClearFormatting: ClearFormattingControl,
|
|
1318
|
+
H1: H1Control,
|
|
1319
|
+
H2: H2Control,
|
|
1320
|
+
H3: H3Control,
|
|
1321
|
+
H4: H4Control,
|
|
1322
|
+
H5: H5Control,
|
|
1323
|
+
H6: H6Control,
|
|
1324
|
+
BulletList: BulletListControl,
|
|
1325
|
+
OrderedList: OrderedListControl,
|
|
1326
|
+
Link: RichTextEditorLinkControl,
|
|
1327
|
+
Unlink: UnlinkControl,
|
|
1328
|
+
Blockquote: BlockquoteControl,
|
|
1329
|
+
AlignLeft: AlignLeftControl,
|
|
1330
|
+
AlignRight: AlignRightControl,
|
|
1331
|
+
AlignCenter: AlignCenterControl,
|
|
1332
|
+
AlignJustify: AlignJustifyControl,
|
|
1333
|
+
Superscript: SuperscriptControl,
|
|
1334
|
+
Subscript: SubscriptControl,
|
|
1335
|
+
Code: CodeControl,
|
|
1336
|
+
CodeBlock: CodeBlockControl,
|
|
1337
|
+
ColorPicker: RichTextEditorColorPickerControl,
|
|
1338
|
+
Color: RichTextEditorColorControl,
|
|
1339
|
+
Highlight: HighlightControl,
|
|
1340
|
+
Hr: HrControl,
|
|
1341
|
+
UnsetColor: UnsetColorControl,
|
|
1342
|
+
Undo: UndoControl,
|
|
1343
|
+
Redo: RedoControl,
|
|
1344
|
+
TaskList: TaskListControl,
|
|
1345
|
+
TaskListSink: TaskListSinkControl,
|
|
1346
|
+
TaskListLift: TaskListLiftControl,
|
|
1347
|
+
SourceCode: RichTextEditorSourceCodeControl
|
|
1348
|
+
});
|
|
1349
|
+
//#endregion
|
|
1350
|
+
//#region src/extensions/Link.ts
|
|
1351
|
+
var Link = _tiptap_extension_link.default.extend({ addKeyboardShortcuts: () => ({ "Mod-k": () => {
|
|
1352
|
+
window.dispatchEvent(new Event("edit-link"));
|
|
1353
|
+
return true;
|
|
1354
|
+
} }) }).configure({ openOnClick: false });
|
|
1355
|
+
//#endregion
|
|
1356
|
+
//#region src/extensions/TaskList.ts
|
|
1357
|
+
var getTaskListExtension = (TipTapTaskList) => TipTapTaskList.extend({ addKeyboardShortcuts: () => ({
|
|
1358
|
+
"Mod-[": ({ editor }) => {
|
|
1359
|
+
editor.chain().focus().liftListItem("taskItem").run();
|
|
1360
|
+
return true;
|
|
1361
|
+
},
|
|
1362
|
+
"Mod-]": ({ editor }) => {
|
|
1363
|
+
editor.chain().focus().sinkListItem("taskItem").run();
|
|
1364
|
+
return true;
|
|
1365
|
+
}
|
|
1366
|
+
}) }).configure({ HTMLAttributes: { class: `${RichTextEditor_module_default.taskList} mantine-RichTextEditor-taskList` } });
|
|
1367
|
+
//#endregion
|
|
1368
|
+
exports.AlignCenterControl = AlignCenterControl;
|
|
1369
|
+
exports.AlignJustifyControl = AlignJustifyControl;
|
|
1370
|
+
exports.AlignLeftControl = AlignLeftControl;
|
|
1371
|
+
exports.AlignRightControl = AlignRightControl;
|
|
1372
|
+
exports.BlockquoteControl = BlockquoteControl;
|
|
1373
|
+
exports.BoldControl = BoldControl;
|
|
1374
|
+
exports.BulletListControl = BulletListControl;
|
|
1375
|
+
exports.ClearFormattingControl = ClearFormattingControl;
|
|
1376
|
+
exports.CodeBlockControl = CodeBlockControl;
|
|
1377
|
+
exports.CodeControl = CodeControl;
|
|
1378
|
+
exports.DEFAULT_LABELS = DEFAULT_LABELS;
|
|
1379
|
+
exports.H1Control = H1Control;
|
|
1380
|
+
exports.H2Control = H2Control;
|
|
1381
|
+
exports.H3Control = H3Control;
|
|
1382
|
+
exports.H4Control = H4Control;
|
|
1383
|
+
exports.H5Control = H5Control;
|
|
1384
|
+
exports.H6Control = H6Control;
|
|
1385
|
+
exports.HighlightControl = HighlightControl;
|
|
1386
|
+
exports.HrControl = HrControl;
|
|
1387
|
+
exports.ItalicControl = ItalicControl;
|
|
1388
|
+
exports.Link = Link;
|
|
1389
|
+
exports.OrderedListControl = OrderedListControl;
|
|
1390
|
+
exports.RedoControl = RedoControl;
|
|
1391
|
+
exports.RichTextEditor = RichTextEditor;
|
|
1392
|
+
exports.RichTextEditorColorControl = RichTextEditorColorControl;
|
|
1393
|
+
exports.RichTextEditorColorPickerControl = RichTextEditorColorPickerControl;
|
|
1394
|
+
exports.RichTextEditorControl = RichTextEditorControl;
|
|
1395
|
+
exports.RichTextEditorControlBase = RichTextEditorControlBase;
|
|
1396
|
+
exports.RichTextEditorLinkControl = RichTextEditorLinkControl;
|
|
1397
|
+
exports.RichTextEditorSourceCodeControl = RichTextEditorSourceCodeControl;
|
|
1398
|
+
exports.StrikeThroughControl = StrikeThroughControl;
|
|
1399
|
+
exports.SubscriptControl = SubscriptControl;
|
|
1400
|
+
exports.SuperscriptControl = SuperscriptControl;
|
|
1401
|
+
exports.TaskListControl = TaskListControl;
|
|
1402
|
+
exports.TaskListLiftControl = TaskListLiftControl;
|
|
1403
|
+
exports.TaskListSinkControl = TaskListSinkControl;
|
|
1404
|
+
exports.UnderlineControl = UnderlineControl;
|
|
1405
|
+
exports.UndoControl = UndoControl;
|
|
1406
|
+
exports.UnlinkControl = UnlinkControl;
|
|
1407
|
+
exports.UnsetColorControl = UnsetColorControl;
|
|
1408
|
+
exports.createControl = createControl;
|
|
1409
|
+
exports.getTaskListExtension = getTaskListExtension;
|
|
1410
|
+
exports.renderControlIcon = renderControlIcon;
|
|
1411
|
+
exports.useRichTextEditorContext = useRichTextEditorContext;
|
|
1412
|
+
|
|
1413
|
+
//# sourceMappingURL=index.cjs.map
|