rte-builder 2.0.0 → 2.0.4
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/dist/index.css +27 -0
- package/dist/index.css.map +1 -1
- package/dist/index.js +953 -2559
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1009 -2581
- package/dist/index.mjs.map +1 -1
- package/package.json +5 -3
package/dist/index.mjs
CHANGED
|
@@ -39,2150 +39,12 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
39
39
|
));
|
|
40
40
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
41
41
|
|
|
42
|
-
// node_modules/@tiptap/core/dist/index.js
|
|
43
|
-
import { Plugin, PluginKey, TextSelection, Selection, AllSelection, NodeSelection, EditorState } from "@tiptap/pm/state";
|
|
44
|
-
import { EditorView } from "@tiptap/pm/view";
|
|
45
|
-
import { keymap } from "@tiptap/pm/keymap";
|
|
46
|
-
import { Schema, DOMSerializer, Fragment, Node as Node$1, DOMParser as DOMParser2, Slice } from "@tiptap/pm/model";
|
|
47
|
-
import { liftTarget, ReplaceStep, ReplaceAroundStep, joinPoint, Transform, canSplit, canJoin, findWrapping } from "@tiptap/pm/transform";
|
|
48
|
-
import { createParagraphNear as createParagraphNear$1, deleteSelection as deleteSelection$1, exitCode as exitCode$1, joinUp as joinUp$1, joinDown as joinDown$1, joinBackward as joinBackward$1, joinForward as joinForward$1, joinTextblockBackward as joinTextblockBackward$1, joinTextblockForward as joinTextblockForward$1, lift as lift$1, liftEmptyBlock as liftEmptyBlock$1, newlineInCode as newlineInCode$1, selectNodeBackward as selectNodeBackward$1, selectNodeForward as selectNodeForward$1, selectParentNode as selectParentNode$1, selectTextblockEnd as selectTextblockEnd$1, selectTextblockStart as selectTextblockStart$1, setBlockType, wrapIn as wrapIn$1 } from "@tiptap/pm/commands";
|
|
49
|
-
import { liftListItem as liftListItem$1, sinkListItem as sinkListItem$1, wrapInList as wrapInList$1 } from "@tiptap/pm/schema-list";
|
|
50
|
-
function createChainableState(config) {
|
|
51
|
-
const { state, transaction } = config;
|
|
52
|
-
let { selection } = transaction;
|
|
53
|
-
let { doc } = transaction;
|
|
54
|
-
let { storedMarks } = transaction;
|
|
55
|
-
return {
|
|
56
|
-
...state,
|
|
57
|
-
apply: state.apply.bind(state),
|
|
58
|
-
applyTransaction: state.applyTransaction.bind(state),
|
|
59
|
-
plugins: state.plugins,
|
|
60
|
-
schema: state.schema,
|
|
61
|
-
reconfigure: state.reconfigure.bind(state),
|
|
62
|
-
toJSON: state.toJSON.bind(state),
|
|
63
|
-
get storedMarks() {
|
|
64
|
-
return storedMarks;
|
|
65
|
-
},
|
|
66
|
-
get selection() {
|
|
67
|
-
return selection;
|
|
68
|
-
},
|
|
69
|
-
get doc() {
|
|
70
|
-
return doc;
|
|
71
|
-
},
|
|
72
|
-
get tr() {
|
|
73
|
-
selection = transaction.selection;
|
|
74
|
-
doc = transaction.doc;
|
|
75
|
-
storedMarks = transaction.storedMarks;
|
|
76
|
-
return transaction;
|
|
77
|
-
}
|
|
78
|
-
};
|
|
79
|
-
}
|
|
80
|
-
function getExtensionField(extension, field, context) {
|
|
81
|
-
if (extension.config[field] === void 0 && extension.parent) {
|
|
82
|
-
return getExtensionField(extension.parent, field, context);
|
|
83
|
-
}
|
|
84
|
-
if (typeof extension.config[field] === "function") {
|
|
85
|
-
const value = extension.config[field].bind({
|
|
86
|
-
...context,
|
|
87
|
-
parent: extension.parent ? getExtensionField(extension.parent, field, context) : null
|
|
88
|
-
});
|
|
89
|
-
return value;
|
|
90
|
-
}
|
|
91
|
-
return extension.config[field];
|
|
92
|
-
}
|
|
93
|
-
function splitExtensions(extensions) {
|
|
94
|
-
const baseExtensions = extensions.filter((extension) => extension.type === "extension");
|
|
95
|
-
const nodeExtensions = extensions.filter((extension) => extension.type === "node");
|
|
96
|
-
const markExtensions = extensions.filter((extension) => extension.type === "mark");
|
|
97
|
-
return {
|
|
98
|
-
baseExtensions,
|
|
99
|
-
nodeExtensions,
|
|
100
|
-
markExtensions
|
|
101
|
-
};
|
|
102
|
-
}
|
|
103
|
-
function getNodeType(nameOrType, schema) {
|
|
104
|
-
if (typeof nameOrType === "string") {
|
|
105
|
-
if (!schema.nodes[nameOrType]) {
|
|
106
|
-
throw Error(`There is no node type named '${nameOrType}'. Maybe you forgot to add the extension?`);
|
|
107
|
-
}
|
|
108
|
-
return schema.nodes[nameOrType];
|
|
109
|
-
}
|
|
110
|
-
return nameOrType;
|
|
111
|
-
}
|
|
112
|
-
function mergeAttributes(...objects) {
|
|
113
|
-
return objects.filter((item) => !!item).reduce((items, item) => {
|
|
114
|
-
const mergedAttributes = { ...items };
|
|
115
|
-
Object.entries(item).forEach(([key, value]) => {
|
|
116
|
-
const exists = mergedAttributes[key];
|
|
117
|
-
if (!exists) {
|
|
118
|
-
mergedAttributes[key] = value;
|
|
119
|
-
return;
|
|
120
|
-
}
|
|
121
|
-
if (key === "class") {
|
|
122
|
-
const valueClasses = value ? String(value).split(" ") : [];
|
|
123
|
-
const existingClasses = mergedAttributes[key] ? mergedAttributes[key].split(" ") : [];
|
|
124
|
-
const insertClasses = valueClasses.filter((valueClass) => !existingClasses.includes(valueClass));
|
|
125
|
-
mergedAttributes[key] = [...existingClasses, ...insertClasses].join(" ");
|
|
126
|
-
} else if (key === "style") {
|
|
127
|
-
const newStyles = value ? value.split(";").map((style) => style.trim()).filter(Boolean) : [];
|
|
128
|
-
const existingStyles = mergedAttributes[key] ? mergedAttributes[key].split(";").map((style) => style.trim()).filter(Boolean) : [];
|
|
129
|
-
const styleMap = /* @__PURE__ */ new Map();
|
|
130
|
-
existingStyles.forEach((style) => {
|
|
131
|
-
const [property, val] = style.split(":").map((part) => part.trim());
|
|
132
|
-
styleMap.set(property, val);
|
|
133
|
-
});
|
|
134
|
-
newStyles.forEach((style) => {
|
|
135
|
-
const [property, val] = style.split(":").map((part) => part.trim());
|
|
136
|
-
styleMap.set(property, val);
|
|
137
|
-
});
|
|
138
|
-
mergedAttributes[key] = Array.from(styleMap.entries()).map(([property, val]) => `${property}: ${val}`).join("; ");
|
|
139
|
-
} else {
|
|
140
|
-
mergedAttributes[key] = value;
|
|
141
|
-
}
|
|
142
|
-
});
|
|
143
|
-
return mergedAttributes;
|
|
144
|
-
}, {});
|
|
145
|
-
}
|
|
146
|
-
function isFunction(value) {
|
|
147
|
-
return typeof value === "function";
|
|
148
|
-
}
|
|
149
|
-
function callOrReturn(value, context = void 0, ...props) {
|
|
150
|
-
if (isFunction(value)) {
|
|
151
|
-
if (context) {
|
|
152
|
-
return value.bind(context)(...props);
|
|
153
|
-
}
|
|
154
|
-
return value(...props);
|
|
155
|
-
}
|
|
156
|
-
return value;
|
|
157
|
-
}
|
|
158
|
-
function isRegExp(value) {
|
|
159
|
-
return Object.prototype.toString.call(value) === "[object RegExp]";
|
|
160
|
-
}
|
|
161
|
-
function getType(value) {
|
|
162
|
-
return Object.prototype.toString.call(value).slice(8, -1);
|
|
163
|
-
}
|
|
164
|
-
function isPlainObject(value) {
|
|
165
|
-
if (getType(value) !== "Object") {
|
|
166
|
-
return false;
|
|
167
|
-
}
|
|
168
|
-
return value.constructor === Object && Object.getPrototypeOf(value) === Object.prototype;
|
|
169
|
-
}
|
|
170
|
-
function mergeDeep(target, source) {
|
|
171
|
-
const output = { ...target };
|
|
172
|
-
if (isPlainObject(target) && isPlainObject(source)) {
|
|
173
|
-
Object.keys(source).forEach((key) => {
|
|
174
|
-
if (isPlainObject(source[key]) && isPlainObject(target[key])) {
|
|
175
|
-
output[key] = mergeDeep(target[key], source[key]);
|
|
176
|
-
} else {
|
|
177
|
-
output[key] = source[key];
|
|
178
|
-
}
|
|
179
|
-
});
|
|
180
|
-
}
|
|
181
|
-
return output;
|
|
182
|
-
}
|
|
183
|
-
function getTextBetween(startNode, range, options) {
|
|
184
|
-
const { from, to } = range;
|
|
185
|
-
const { blockSeparator = "\n\n", textSerializers = {} } = options || {};
|
|
186
|
-
let text = "";
|
|
187
|
-
startNode.nodesBetween(from, to, (node, pos, parent, index) => {
|
|
188
|
-
var _a;
|
|
189
|
-
if (node.isBlock && pos > from) {
|
|
190
|
-
text += blockSeparator;
|
|
191
|
-
}
|
|
192
|
-
const textSerializer = textSerializers === null || textSerializers === void 0 ? void 0 : textSerializers[node.type.name];
|
|
193
|
-
if (textSerializer) {
|
|
194
|
-
if (parent) {
|
|
195
|
-
text += textSerializer({
|
|
196
|
-
node,
|
|
197
|
-
pos,
|
|
198
|
-
parent,
|
|
199
|
-
index,
|
|
200
|
-
range
|
|
201
|
-
});
|
|
202
|
-
}
|
|
203
|
-
return false;
|
|
204
|
-
}
|
|
205
|
-
if (node.isText) {
|
|
206
|
-
text += (_a = node === null || node === void 0 ? void 0 : node.text) === null || _a === void 0 ? void 0 : _a.slice(Math.max(from, pos) - pos, to - pos);
|
|
207
|
-
}
|
|
208
|
-
});
|
|
209
|
-
return text;
|
|
210
|
-
}
|
|
211
|
-
function getTextSerializersFromSchema(schema) {
|
|
212
|
-
return Object.fromEntries(Object.entries(schema.nodes).filter(([, node]) => node.spec.toText).map(([name, node]) => [name, node.spec.toText]));
|
|
213
|
-
}
|
|
214
|
-
function objectIncludes(object1, object2, options = { strict: true }) {
|
|
215
|
-
const keys = Object.keys(object2);
|
|
216
|
-
if (!keys.length) {
|
|
217
|
-
return true;
|
|
218
|
-
}
|
|
219
|
-
return keys.every((key) => {
|
|
220
|
-
if (options.strict) {
|
|
221
|
-
return object2[key] === object1[key];
|
|
222
|
-
}
|
|
223
|
-
if (isRegExp(object2[key])) {
|
|
224
|
-
return object2[key].test(object1[key]);
|
|
225
|
-
}
|
|
226
|
-
return object2[key] === object1[key];
|
|
227
|
-
});
|
|
228
|
-
}
|
|
229
|
-
function findMarkInSet(marks, type, attributes = {}) {
|
|
230
|
-
return marks.find((item) => {
|
|
231
|
-
return item.type === type && objectIncludes(
|
|
232
|
-
// Only check equality for the attributes that are provided
|
|
233
|
-
Object.fromEntries(Object.keys(attributes).map((k) => [k, item.attrs[k]])),
|
|
234
|
-
attributes
|
|
235
|
-
);
|
|
236
|
-
});
|
|
237
|
-
}
|
|
238
|
-
function isMarkInSet(marks, type, attributes = {}) {
|
|
239
|
-
return !!findMarkInSet(marks, type, attributes);
|
|
240
|
-
}
|
|
241
|
-
function getMarkRange($pos, type, attributes) {
|
|
242
|
-
var _a;
|
|
243
|
-
if (!$pos || !type) {
|
|
244
|
-
return;
|
|
245
|
-
}
|
|
246
|
-
let start = $pos.parent.childAfter($pos.parentOffset);
|
|
247
|
-
if (!start.node || !start.node.marks.some((mark2) => mark2.type === type)) {
|
|
248
|
-
start = $pos.parent.childBefore($pos.parentOffset);
|
|
249
|
-
}
|
|
250
|
-
if (!start.node || !start.node.marks.some((mark2) => mark2.type === type)) {
|
|
251
|
-
return;
|
|
252
|
-
}
|
|
253
|
-
attributes = attributes || ((_a = start.node.marks[0]) === null || _a === void 0 ? void 0 : _a.attrs);
|
|
254
|
-
const mark = findMarkInSet([...start.node.marks], type, attributes);
|
|
255
|
-
if (!mark) {
|
|
256
|
-
return;
|
|
257
|
-
}
|
|
258
|
-
let startIndex = start.index;
|
|
259
|
-
let startPos = $pos.start() + start.offset;
|
|
260
|
-
let endIndex = startIndex + 1;
|
|
261
|
-
let endPos = startPos + start.node.nodeSize;
|
|
262
|
-
while (startIndex > 0 && isMarkInSet([...$pos.parent.child(startIndex - 1).marks], type, attributes)) {
|
|
263
|
-
startIndex -= 1;
|
|
264
|
-
startPos -= $pos.parent.child(startIndex).nodeSize;
|
|
265
|
-
}
|
|
266
|
-
while (endIndex < $pos.parent.childCount && isMarkInSet([...$pos.parent.child(endIndex).marks], type, attributes)) {
|
|
267
|
-
endPos += $pos.parent.child(endIndex).nodeSize;
|
|
268
|
-
endIndex += 1;
|
|
269
|
-
}
|
|
270
|
-
return {
|
|
271
|
-
from: startPos,
|
|
272
|
-
to: endPos
|
|
273
|
-
};
|
|
274
|
-
}
|
|
275
|
-
function getMarkType(nameOrType, schema) {
|
|
276
|
-
if (typeof nameOrType === "string") {
|
|
277
|
-
if (!schema.marks[nameOrType]) {
|
|
278
|
-
throw Error(`There is no mark type named '${nameOrType}'. Maybe you forgot to add the extension?`);
|
|
279
|
-
}
|
|
280
|
-
return schema.marks[nameOrType];
|
|
281
|
-
}
|
|
282
|
-
return nameOrType;
|
|
283
|
-
}
|
|
284
|
-
function isTextSelection(value) {
|
|
285
|
-
return value instanceof TextSelection;
|
|
286
|
-
}
|
|
287
|
-
function minMax(value = 0, min = 0, max = 0) {
|
|
288
|
-
return Math.min(Math.max(value, min), max);
|
|
289
|
-
}
|
|
290
|
-
function resolveFocusPosition(doc, position = null) {
|
|
291
|
-
if (!position) {
|
|
292
|
-
return null;
|
|
293
|
-
}
|
|
294
|
-
const selectionAtStart = Selection.atStart(doc);
|
|
295
|
-
const selectionAtEnd = Selection.atEnd(doc);
|
|
296
|
-
if (position === "start" || position === true) {
|
|
297
|
-
return selectionAtStart;
|
|
298
|
-
}
|
|
299
|
-
if (position === "end") {
|
|
300
|
-
return selectionAtEnd;
|
|
301
|
-
}
|
|
302
|
-
const minPos = selectionAtStart.from;
|
|
303
|
-
const maxPos = selectionAtEnd.to;
|
|
304
|
-
if (position === "all") {
|
|
305
|
-
return TextSelection.create(doc, minMax(0, minPos, maxPos), minMax(doc.content.size, minPos, maxPos));
|
|
306
|
-
}
|
|
307
|
-
return TextSelection.create(doc, minMax(position, minPos, maxPos), minMax(position, minPos, maxPos));
|
|
308
|
-
}
|
|
309
|
-
function isAndroid() {
|
|
310
|
-
return navigator.platform === "Android" || /android/i.test(navigator.userAgent);
|
|
311
|
-
}
|
|
312
|
-
function isiOS() {
|
|
313
|
-
return [
|
|
314
|
-
"iPad Simulator",
|
|
315
|
-
"iPhone Simulator",
|
|
316
|
-
"iPod Simulator",
|
|
317
|
-
"iPad",
|
|
318
|
-
"iPhone",
|
|
319
|
-
"iPod"
|
|
320
|
-
].includes(navigator.platform) || navigator.userAgent.includes("Mac") && "ontouchend" in document;
|
|
321
|
-
}
|
|
322
|
-
function isSafari() {
|
|
323
|
-
return typeof navigator !== "undefined" ? /^((?!chrome|android).)*safari/i.test(navigator.userAgent) : false;
|
|
324
|
-
}
|
|
325
|
-
function elementFromString(value) {
|
|
326
|
-
const wrappedValue = `<body>${value}</body>`;
|
|
327
|
-
const html = new window.DOMParser().parseFromString(wrappedValue, "text/html").body;
|
|
328
|
-
return removeWhitespaces(html);
|
|
329
|
-
}
|
|
330
|
-
function createNodeFromContent(content, schema, options) {
|
|
331
|
-
if (content instanceof Node$1 || content instanceof Fragment) {
|
|
332
|
-
return content;
|
|
333
|
-
}
|
|
334
|
-
options = {
|
|
335
|
-
slice: true,
|
|
336
|
-
parseOptions: {},
|
|
337
|
-
...options
|
|
338
|
-
};
|
|
339
|
-
const isJSONContent = typeof content === "object" && content !== null;
|
|
340
|
-
const isTextContent = typeof content === "string";
|
|
341
|
-
if (isJSONContent) {
|
|
342
|
-
try {
|
|
343
|
-
const isArrayContent = Array.isArray(content) && content.length > 0;
|
|
344
|
-
if (isArrayContent) {
|
|
345
|
-
return Fragment.fromArray(content.map((item) => schema.nodeFromJSON(item)));
|
|
346
|
-
}
|
|
347
|
-
const node = schema.nodeFromJSON(content);
|
|
348
|
-
if (options.errorOnInvalidContent) {
|
|
349
|
-
node.check();
|
|
350
|
-
}
|
|
351
|
-
return node;
|
|
352
|
-
} catch (error) {
|
|
353
|
-
if (options.errorOnInvalidContent) {
|
|
354
|
-
throw new Error("[tiptap error]: Invalid JSON content", { cause: error });
|
|
355
|
-
}
|
|
356
|
-
console.warn("[tiptap warn]: Invalid content.", "Passed value:", content, "Error:", error);
|
|
357
|
-
return createNodeFromContent("", schema, options);
|
|
358
|
-
}
|
|
359
|
-
}
|
|
360
|
-
if (isTextContent) {
|
|
361
|
-
if (options.errorOnInvalidContent) {
|
|
362
|
-
let hasInvalidContent = false;
|
|
363
|
-
let invalidContent = "";
|
|
364
|
-
const contentCheckSchema = new Schema({
|
|
365
|
-
topNode: schema.spec.topNode,
|
|
366
|
-
marks: schema.spec.marks,
|
|
367
|
-
// Prosemirror's schemas are executed such that: the last to execute, matches last
|
|
368
|
-
// This means that we can add a catch-all node at the end of the schema to catch any content that we don't know how to handle
|
|
369
|
-
nodes: schema.spec.nodes.append({
|
|
370
|
-
__tiptap__private__unknown__catch__all__node: {
|
|
371
|
-
content: "inline*",
|
|
372
|
-
group: "block",
|
|
373
|
-
parseDOM: [
|
|
374
|
-
{
|
|
375
|
-
tag: "*",
|
|
376
|
-
getAttrs: (e) => {
|
|
377
|
-
hasInvalidContent = true;
|
|
378
|
-
invalidContent = typeof e === "string" ? e : e.outerHTML;
|
|
379
|
-
return null;
|
|
380
|
-
}
|
|
381
|
-
}
|
|
382
|
-
]
|
|
383
|
-
}
|
|
384
|
-
})
|
|
385
|
-
});
|
|
386
|
-
if (options.slice) {
|
|
387
|
-
DOMParser2.fromSchema(contentCheckSchema).parseSlice(elementFromString(content), options.parseOptions);
|
|
388
|
-
} else {
|
|
389
|
-
DOMParser2.fromSchema(contentCheckSchema).parse(elementFromString(content), options.parseOptions);
|
|
390
|
-
}
|
|
391
|
-
if (options.errorOnInvalidContent && hasInvalidContent) {
|
|
392
|
-
throw new Error("[tiptap error]: Invalid HTML content", { cause: new Error(`Invalid element found: ${invalidContent}`) });
|
|
393
|
-
}
|
|
394
|
-
}
|
|
395
|
-
const parser = DOMParser2.fromSchema(schema);
|
|
396
|
-
if (options.slice) {
|
|
397
|
-
return parser.parseSlice(elementFromString(content), options.parseOptions).content;
|
|
398
|
-
}
|
|
399
|
-
return parser.parse(elementFromString(content), options.parseOptions);
|
|
400
|
-
}
|
|
401
|
-
return createNodeFromContent("", schema, options);
|
|
402
|
-
}
|
|
403
|
-
function selectionToInsertionEnd(tr, startLen, bias) {
|
|
404
|
-
const last = tr.steps.length - 1;
|
|
405
|
-
if (last < startLen) {
|
|
406
|
-
return;
|
|
407
|
-
}
|
|
408
|
-
const step = tr.steps[last];
|
|
409
|
-
if (!(step instanceof ReplaceStep || step instanceof ReplaceAroundStep)) {
|
|
410
|
-
return;
|
|
411
|
-
}
|
|
412
|
-
const map = tr.mapping.maps[last];
|
|
413
|
-
let end = 0;
|
|
414
|
-
map.forEach((_from, _to, _newFrom, newTo) => {
|
|
415
|
-
if (end === 0) {
|
|
416
|
-
end = newTo;
|
|
417
|
-
}
|
|
418
|
-
});
|
|
419
|
-
tr.setSelection(Selection.near(tr.doc.resolve(end), bias));
|
|
420
|
-
}
|
|
421
|
-
function isMacOS() {
|
|
422
|
-
return typeof navigator !== "undefined" ? /Mac/.test(navigator.platform) : false;
|
|
423
|
-
}
|
|
424
|
-
function normalizeKeyName(name) {
|
|
425
|
-
const parts = name.split(/-(?!$)/);
|
|
426
|
-
let result = parts[parts.length - 1];
|
|
427
|
-
if (result === "Space") {
|
|
428
|
-
result = " ";
|
|
429
|
-
}
|
|
430
|
-
let alt;
|
|
431
|
-
let ctrl;
|
|
432
|
-
let shift;
|
|
433
|
-
let meta;
|
|
434
|
-
for (let i = 0; i < parts.length - 1; i += 1) {
|
|
435
|
-
const mod = parts[i];
|
|
436
|
-
if (/^(cmd|meta|m)$/i.test(mod)) {
|
|
437
|
-
meta = true;
|
|
438
|
-
} else if (/^a(lt)?$/i.test(mod)) {
|
|
439
|
-
alt = true;
|
|
440
|
-
} else if (/^(c|ctrl|control)$/i.test(mod)) {
|
|
441
|
-
ctrl = true;
|
|
442
|
-
} else if (/^s(hift)?$/i.test(mod)) {
|
|
443
|
-
shift = true;
|
|
444
|
-
} else if (/^mod$/i.test(mod)) {
|
|
445
|
-
if (isiOS() || isMacOS()) {
|
|
446
|
-
meta = true;
|
|
447
|
-
} else {
|
|
448
|
-
ctrl = true;
|
|
449
|
-
}
|
|
450
|
-
} else {
|
|
451
|
-
throw new Error(`Unrecognized modifier name: ${mod}`);
|
|
452
|
-
}
|
|
453
|
-
}
|
|
454
|
-
if (alt) {
|
|
455
|
-
result = `Alt-${result}`;
|
|
456
|
-
}
|
|
457
|
-
if (ctrl) {
|
|
458
|
-
result = `Ctrl-${result}`;
|
|
459
|
-
}
|
|
460
|
-
if (meta) {
|
|
461
|
-
result = `Meta-${result}`;
|
|
462
|
-
}
|
|
463
|
-
if (shift) {
|
|
464
|
-
result = `Shift-${result}`;
|
|
465
|
-
}
|
|
466
|
-
return result;
|
|
467
|
-
}
|
|
468
|
-
function isNodeActive(state, typeOrName, attributes = {}) {
|
|
469
|
-
const { from, to, empty } = state.selection;
|
|
470
|
-
const type = typeOrName ? getNodeType(typeOrName, state.schema) : null;
|
|
471
|
-
const nodeRanges = [];
|
|
472
|
-
state.doc.nodesBetween(from, to, (node, pos) => {
|
|
473
|
-
if (node.isText) {
|
|
474
|
-
return;
|
|
475
|
-
}
|
|
476
|
-
const relativeFrom = Math.max(from, pos);
|
|
477
|
-
const relativeTo = Math.min(to, pos + node.nodeSize);
|
|
478
|
-
nodeRanges.push({
|
|
479
|
-
node,
|
|
480
|
-
from: relativeFrom,
|
|
481
|
-
to: relativeTo
|
|
482
|
-
});
|
|
483
|
-
});
|
|
484
|
-
const selectionRange = to - from;
|
|
485
|
-
const matchedNodeRanges = nodeRanges.filter((nodeRange) => {
|
|
486
|
-
if (!type) {
|
|
487
|
-
return true;
|
|
488
|
-
}
|
|
489
|
-
return type.name === nodeRange.node.type.name;
|
|
490
|
-
}).filter((nodeRange) => objectIncludes(nodeRange.node.attrs, attributes, { strict: false }));
|
|
491
|
-
if (empty) {
|
|
492
|
-
return !!matchedNodeRanges.length;
|
|
493
|
-
}
|
|
494
|
-
const range = matchedNodeRanges.reduce((sum, nodeRange) => sum + nodeRange.to - nodeRange.from, 0);
|
|
495
|
-
return range >= selectionRange;
|
|
496
|
-
}
|
|
497
|
-
function getSchemaTypeNameByName(name, schema) {
|
|
498
|
-
if (schema.nodes[name]) {
|
|
499
|
-
return "node";
|
|
500
|
-
}
|
|
501
|
-
if (schema.marks[name]) {
|
|
502
|
-
return "mark";
|
|
503
|
-
}
|
|
504
|
-
return null;
|
|
505
|
-
}
|
|
506
|
-
function deleteProps(obj, propOrProps) {
|
|
507
|
-
const props = typeof propOrProps === "string" ? [propOrProps] : propOrProps;
|
|
508
|
-
return Object.keys(obj).reduce((newObj, prop) => {
|
|
509
|
-
if (!props.includes(prop)) {
|
|
510
|
-
newObj[prop] = obj[prop];
|
|
511
|
-
}
|
|
512
|
-
return newObj;
|
|
513
|
-
}, {});
|
|
514
|
-
}
|
|
515
|
-
function createDocument(content, schema, parseOptions = {}, options = {}) {
|
|
516
|
-
return createNodeFromContent(content, schema, {
|
|
517
|
-
slice: false,
|
|
518
|
-
parseOptions,
|
|
519
|
-
errorOnInvalidContent: options.errorOnInvalidContent
|
|
520
|
-
});
|
|
521
|
-
}
|
|
522
|
-
function getMarkAttributes(state, typeOrName) {
|
|
523
|
-
const type = getMarkType(typeOrName, state.schema);
|
|
524
|
-
const { from, to, empty } = state.selection;
|
|
525
|
-
const marks = [];
|
|
526
|
-
if (empty) {
|
|
527
|
-
if (state.storedMarks) {
|
|
528
|
-
marks.push(...state.storedMarks);
|
|
529
|
-
}
|
|
530
|
-
marks.push(...state.selection.$head.marks());
|
|
531
|
-
} else {
|
|
532
|
-
state.doc.nodesBetween(from, to, (node) => {
|
|
533
|
-
marks.push(...node.marks);
|
|
534
|
-
});
|
|
535
|
-
}
|
|
536
|
-
const mark = marks.find((markItem) => markItem.type.name === type.name);
|
|
537
|
-
if (!mark) {
|
|
538
|
-
return {};
|
|
539
|
-
}
|
|
540
|
-
return { ...mark.attrs };
|
|
541
|
-
}
|
|
542
|
-
function defaultBlockAt(match) {
|
|
543
|
-
for (let i = 0; i < match.edgeCount; i += 1) {
|
|
544
|
-
const { type } = match.edge(i);
|
|
545
|
-
if (type.isTextblock && !type.hasRequiredAttrs()) {
|
|
546
|
-
return type;
|
|
547
|
-
}
|
|
548
|
-
}
|
|
549
|
-
return null;
|
|
550
|
-
}
|
|
551
|
-
function findParentNodeClosestToPos($pos, predicate) {
|
|
552
|
-
for (let i = $pos.depth; i > 0; i -= 1) {
|
|
553
|
-
const node = $pos.node(i);
|
|
554
|
-
if (predicate(node)) {
|
|
555
|
-
return {
|
|
556
|
-
pos: i > 0 ? $pos.before(i) : 0,
|
|
557
|
-
start: $pos.start(i),
|
|
558
|
-
depth: i,
|
|
559
|
-
node
|
|
560
|
-
};
|
|
561
|
-
}
|
|
562
|
-
}
|
|
563
|
-
}
|
|
564
|
-
function findParentNode(predicate) {
|
|
565
|
-
return (selection) => findParentNodeClosestToPos(selection.$from, predicate);
|
|
566
|
-
}
|
|
567
|
-
function getSplittedAttributes(extensionAttributes, typeName, attributes) {
|
|
568
|
-
return Object.fromEntries(Object.entries(attributes).filter(([name]) => {
|
|
569
|
-
const extensionAttribute = extensionAttributes.find((item) => {
|
|
570
|
-
return item.type === typeName && item.name === name;
|
|
571
|
-
});
|
|
572
|
-
if (!extensionAttribute) {
|
|
573
|
-
return false;
|
|
574
|
-
}
|
|
575
|
-
return extensionAttribute.attribute.keepOnSplit;
|
|
576
|
-
}));
|
|
577
|
-
}
|
|
578
|
-
function isMarkActive(state, typeOrName, attributes = {}) {
|
|
579
|
-
const { empty, ranges } = state.selection;
|
|
580
|
-
const type = typeOrName ? getMarkType(typeOrName, state.schema) : null;
|
|
581
|
-
if (empty) {
|
|
582
|
-
return !!(state.storedMarks || state.selection.$from.marks()).filter((mark) => {
|
|
583
|
-
if (!type) {
|
|
584
|
-
return true;
|
|
585
|
-
}
|
|
586
|
-
return type.name === mark.type.name;
|
|
587
|
-
}).find((mark) => objectIncludes(mark.attrs, attributes, { strict: false }));
|
|
588
|
-
}
|
|
589
|
-
let selectionRange = 0;
|
|
590
|
-
const markRanges = [];
|
|
591
|
-
ranges.forEach(({ $from, $to }) => {
|
|
592
|
-
const from = $from.pos;
|
|
593
|
-
const to = $to.pos;
|
|
594
|
-
state.doc.nodesBetween(from, to, (node, pos) => {
|
|
595
|
-
if (!node.isText && !node.marks.length) {
|
|
596
|
-
return;
|
|
597
|
-
}
|
|
598
|
-
const relativeFrom = Math.max(from, pos);
|
|
599
|
-
const relativeTo = Math.min(to, pos + node.nodeSize);
|
|
600
|
-
const range2 = relativeTo - relativeFrom;
|
|
601
|
-
selectionRange += range2;
|
|
602
|
-
markRanges.push(...node.marks.map((mark) => ({
|
|
603
|
-
mark,
|
|
604
|
-
from: relativeFrom,
|
|
605
|
-
to: relativeTo
|
|
606
|
-
})));
|
|
607
|
-
});
|
|
608
|
-
});
|
|
609
|
-
if (selectionRange === 0) {
|
|
610
|
-
return false;
|
|
611
|
-
}
|
|
612
|
-
const matchedRange = markRanges.filter((markRange) => {
|
|
613
|
-
if (!type) {
|
|
614
|
-
return true;
|
|
615
|
-
}
|
|
616
|
-
return type.name === markRange.mark.type.name;
|
|
617
|
-
}).filter((markRange) => objectIncludes(markRange.mark.attrs, attributes, { strict: false })).reduce((sum, markRange) => sum + markRange.to - markRange.from, 0);
|
|
618
|
-
const excludedRange = markRanges.filter((markRange) => {
|
|
619
|
-
if (!type) {
|
|
620
|
-
return true;
|
|
621
|
-
}
|
|
622
|
-
return markRange.mark.type !== type && markRange.mark.type.excludes(type);
|
|
623
|
-
}).reduce((sum, markRange) => sum + markRange.to - markRange.from, 0);
|
|
624
|
-
const range = matchedRange > 0 ? matchedRange + excludedRange : matchedRange;
|
|
625
|
-
return range >= selectionRange;
|
|
626
|
-
}
|
|
627
|
-
function isList(name, extensions) {
|
|
628
|
-
const { nodeExtensions } = splitExtensions(extensions);
|
|
629
|
-
const extension = nodeExtensions.find((item) => item.name === name);
|
|
630
|
-
if (!extension) {
|
|
631
|
-
return false;
|
|
632
|
-
}
|
|
633
|
-
const context = {
|
|
634
|
-
name: extension.name,
|
|
635
|
-
options: extension.options,
|
|
636
|
-
storage: extension.storage
|
|
637
|
-
};
|
|
638
|
-
const group = callOrReturn(getExtensionField(extension, "group", context));
|
|
639
|
-
if (typeof group !== "string") {
|
|
640
|
-
return false;
|
|
641
|
-
}
|
|
642
|
-
return group.split(" ").includes("list");
|
|
643
|
-
}
|
|
644
|
-
function isNodeEmpty(node, { checkChildren = true, ignoreWhitespace = false } = {}) {
|
|
645
|
-
var _a;
|
|
646
|
-
if (ignoreWhitespace) {
|
|
647
|
-
if (node.type.name === "hardBreak") {
|
|
648
|
-
return true;
|
|
649
|
-
}
|
|
650
|
-
if (node.isText) {
|
|
651
|
-
return /^\s*$/m.test((_a = node.text) !== null && _a !== void 0 ? _a : "");
|
|
652
|
-
}
|
|
653
|
-
}
|
|
654
|
-
if (node.isText) {
|
|
655
|
-
return !node.text;
|
|
656
|
-
}
|
|
657
|
-
if (node.isAtom || node.isLeaf) {
|
|
658
|
-
return false;
|
|
659
|
-
}
|
|
660
|
-
if (node.content.childCount === 0) {
|
|
661
|
-
return true;
|
|
662
|
-
}
|
|
663
|
-
if (checkChildren) {
|
|
664
|
-
let isContentEmpty = true;
|
|
665
|
-
node.content.forEach((childNode) => {
|
|
666
|
-
if (isContentEmpty === false) {
|
|
667
|
-
return;
|
|
668
|
-
}
|
|
669
|
-
if (!isNodeEmpty(childNode, { ignoreWhitespace, checkChildren })) {
|
|
670
|
-
isContentEmpty = false;
|
|
671
|
-
}
|
|
672
|
-
});
|
|
673
|
-
return isContentEmpty;
|
|
674
|
-
}
|
|
675
|
-
return false;
|
|
676
|
-
}
|
|
677
|
-
function canSetMark(state, tr, newMarkType) {
|
|
678
|
-
var _a;
|
|
679
|
-
const { selection } = tr;
|
|
680
|
-
let cursor = null;
|
|
681
|
-
if (isTextSelection(selection)) {
|
|
682
|
-
cursor = selection.$cursor;
|
|
683
|
-
}
|
|
684
|
-
if (cursor) {
|
|
685
|
-
const currentMarks = (_a = state.storedMarks) !== null && _a !== void 0 ? _a : cursor.marks();
|
|
686
|
-
return !!newMarkType.isInSet(currentMarks) || !currentMarks.some((mark) => mark.type.excludes(newMarkType));
|
|
687
|
-
}
|
|
688
|
-
const { ranges } = selection;
|
|
689
|
-
return ranges.some(({ $from, $to }) => {
|
|
690
|
-
let someNodeSupportsMark = $from.depth === 0 ? state.doc.inlineContent && state.doc.type.allowsMarkType(newMarkType) : false;
|
|
691
|
-
state.doc.nodesBetween($from.pos, $to.pos, (node, _pos, parent) => {
|
|
692
|
-
if (someNodeSupportsMark) {
|
|
693
|
-
return false;
|
|
694
|
-
}
|
|
695
|
-
if (node.isInline) {
|
|
696
|
-
const parentAllowsMarkType = !parent || parent.type.allowsMarkType(newMarkType);
|
|
697
|
-
const currentMarksAllowMarkType = !!newMarkType.isInSet(node.marks) || !node.marks.some((otherMark) => otherMark.type.excludes(newMarkType));
|
|
698
|
-
someNodeSupportsMark = parentAllowsMarkType && currentMarksAllowMarkType;
|
|
699
|
-
}
|
|
700
|
-
return !someNodeSupportsMark;
|
|
701
|
-
});
|
|
702
|
-
return someNodeSupportsMark;
|
|
703
|
-
});
|
|
704
|
-
}
|
|
705
|
-
function ensureMarks(state, splittableMarks) {
|
|
706
|
-
const marks = state.storedMarks || state.selection.$to.parentOffset && state.selection.$from.marks();
|
|
707
|
-
if (marks) {
|
|
708
|
-
const filteredMarks = marks.filter((mark) => splittableMarks === null || splittableMarks === void 0 ? void 0 : splittableMarks.includes(mark.type.name));
|
|
709
|
-
state.tr.ensureMarks(filteredMarks);
|
|
710
|
-
}
|
|
711
|
-
}
|
|
712
|
-
var CommandManager, Extension, ClipboardTextSerializer, blur, clearContent, clearNodes, command, createParagraphNear, cut, deleteCurrentNode, deleteNode, deleteRange, deleteSelection, enter, exitCode, extendMarkRange, first, focus, forEach, insertContent, removeWhitespaces, isFragment, insertContentAt, joinUp, joinDown, joinBackward, joinForward, joinItemBackward, joinItemForward, joinTextblockBackward, joinTextblockForward, keyboardShortcut, lift, liftEmptyBlock, liftListItem, newlineInCode, resetAttributes, scrollIntoView, selectAll, selectNodeBackward, selectNodeForward, selectParentNode, selectTextblockEnd, selectTextblockStart, setContent, setMark, setMeta, setNode, setNodeSelection, setTextSelection, sinkListItem, splitBlock, splitListItem, joinListBackwards, joinListForwards, toggleList, toggleMark, toggleNode, toggleWrap, undoInputRule, unsetAllMarks, unsetMark, updateAttributes, wrapIn, wrapInList, commands, Commands, Drop, Editable, focusEventsPluginKey, FocusEvents, Keymap, Paste, Tabindex, Node;
|
|
713
|
-
var init_dist = __esm({
|
|
714
|
-
"node_modules/@tiptap/core/dist/index.js"() {
|
|
715
|
-
"use strict";
|
|
716
|
-
CommandManager = class {
|
|
717
|
-
constructor(props) {
|
|
718
|
-
this.editor = props.editor;
|
|
719
|
-
this.rawCommands = this.editor.extensionManager.commands;
|
|
720
|
-
this.customState = props.state;
|
|
721
|
-
}
|
|
722
|
-
get hasCustomState() {
|
|
723
|
-
return !!this.customState;
|
|
724
|
-
}
|
|
725
|
-
get state() {
|
|
726
|
-
return this.customState || this.editor.state;
|
|
727
|
-
}
|
|
728
|
-
get commands() {
|
|
729
|
-
const { rawCommands, editor, state } = this;
|
|
730
|
-
const { view } = editor;
|
|
731
|
-
const { tr } = state;
|
|
732
|
-
const props = this.buildProps(tr);
|
|
733
|
-
return Object.fromEntries(Object.entries(rawCommands).map(([name, command2]) => {
|
|
734
|
-
const method = (...args) => {
|
|
735
|
-
const callback = command2(...args)(props);
|
|
736
|
-
if (!tr.getMeta("preventDispatch") && !this.hasCustomState) {
|
|
737
|
-
view.dispatch(tr);
|
|
738
|
-
}
|
|
739
|
-
return callback;
|
|
740
|
-
};
|
|
741
|
-
return [name, method];
|
|
742
|
-
}));
|
|
743
|
-
}
|
|
744
|
-
get chain() {
|
|
745
|
-
return () => this.createChain();
|
|
746
|
-
}
|
|
747
|
-
get can() {
|
|
748
|
-
return () => this.createCan();
|
|
749
|
-
}
|
|
750
|
-
createChain(startTr, shouldDispatch = true) {
|
|
751
|
-
const { rawCommands, editor, state } = this;
|
|
752
|
-
const { view } = editor;
|
|
753
|
-
const callbacks = [];
|
|
754
|
-
const hasStartTransaction = !!startTr;
|
|
755
|
-
const tr = startTr || state.tr;
|
|
756
|
-
const run = () => {
|
|
757
|
-
if (!hasStartTransaction && shouldDispatch && !tr.getMeta("preventDispatch") && !this.hasCustomState) {
|
|
758
|
-
view.dispatch(tr);
|
|
759
|
-
}
|
|
760
|
-
return callbacks.every((callback) => callback === true);
|
|
761
|
-
};
|
|
762
|
-
const chain = {
|
|
763
|
-
...Object.fromEntries(Object.entries(rawCommands).map(([name, command2]) => {
|
|
764
|
-
const chainedCommand = (...args) => {
|
|
765
|
-
const props = this.buildProps(tr, shouldDispatch);
|
|
766
|
-
const callback = command2(...args)(props);
|
|
767
|
-
callbacks.push(callback);
|
|
768
|
-
return chain;
|
|
769
|
-
};
|
|
770
|
-
return [name, chainedCommand];
|
|
771
|
-
})),
|
|
772
|
-
run
|
|
773
|
-
};
|
|
774
|
-
return chain;
|
|
775
|
-
}
|
|
776
|
-
createCan(startTr) {
|
|
777
|
-
const { rawCommands, state } = this;
|
|
778
|
-
const dispatch = false;
|
|
779
|
-
const tr = startTr || state.tr;
|
|
780
|
-
const props = this.buildProps(tr, dispatch);
|
|
781
|
-
const formattedCommands = Object.fromEntries(Object.entries(rawCommands).map(([name, command2]) => {
|
|
782
|
-
return [name, (...args) => command2(...args)({ ...props, dispatch: void 0 })];
|
|
783
|
-
}));
|
|
784
|
-
return {
|
|
785
|
-
...formattedCommands,
|
|
786
|
-
chain: () => this.createChain(tr, dispatch)
|
|
787
|
-
};
|
|
788
|
-
}
|
|
789
|
-
buildProps(tr, shouldDispatch = true) {
|
|
790
|
-
const { rawCommands, editor, state } = this;
|
|
791
|
-
const { view } = editor;
|
|
792
|
-
const props = {
|
|
793
|
-
tr,
|
|
794
|
-
editor,
|
|
795
|
-
view,
|
|
796
|
-
state: createChainableState({
|
|
797
|
-
state,
|
|
798
|
-
transaction: tr
|
|
799
|
-
}),
|
|
800
|
-
dispatch: shouldDispatch ? () => void 0 : void 0,
|
|
801
|
-
chain: () => this.createChain(tr, shouldDispatch),
|
|
802
|
-
can: () => this.createCan(tr),
|
|
803
|
-
get commands() {
|
|
804
|
-
return Object.fromEntries(Object.entries(rawCommands).map(([name, command2]) => {
|
|
805
|
-
return [name, (...args) => command2(...args)(props)];
|
|
806
|
-
}));
|
|
807
|
-
}
|
|
808
|
-
};
|
|
809
|
-
return props;
|
|
810
|
-
}
|
|
811
|
-
};
|
|
812
|
-
Extension = class _Extension {
|
|
813
|
-
constructor(config = {}) {
|
|
814
|
-
this.type = "extension";
|
|
815
|
-
this.name = "extension";
|
|
816
|
-
this.parent = null;
|
|
817
|
-
this.child = null;
|
|
818
|
-
this.config = {
|
|
819
|
-
name: this.name,
|
|
820
|
-
defaultOptions: {}
|
|
821
|
-
};
|
|
822
|
-
this.config = {
|
|
823
|
-
...this.config,
|
|
824
|
-
...config
|
|
825
|
-
};
|
|
826
|
-
this.name = this.config.name;
|
|
827
|
-
if (config.defaultOptions && Object.keys(config.defaultOptions).length > 0) {
|
|
828
|
-
console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`);
|
|
829
|
-
}
|
|
830
|
-
this.options = this.config.defaultOptions;
|
|
831
|
-
if (this.config.addOptions) {
|
|
832
|
-
this.options = callOrReturn(getExtensionField(this, "addOptions", {
|
|
833
|
-
name: this.name
|
|
834
|
-
}));
|
|
835
|
-
}
|
|
836
|
-
this.storage = callOrReturn(getExtensionField(this, "addStorage", {
|
|
837
|
-
name: this.name,
|
|
838
|
-
options: this.options
|
|
839
|
-
})) || {};
|
|
840
|
-
}
|
|
841
|
-
static create(config = {}) {
|
|
842
|
-
return new _Extension(config);
|
|
843
|
-
}
|
|
844
|
-
configure(options = {}) {
|
|
845
|
-
const extension = this.extend({
|
|
846
|
-
...this.config,
|
|
847
|
-
addOptions: () => {
|
|
848
|
-
return mergeDeep(this.options, options);
|
|
849
|
-
}
|
|
850
|
-
});
|
|
851
|
-
extension.name = this.name;
|
|
852
|
-
extension.parent = this.parent;
|
|
853
|
-
return extension;
|
|
854
|
-
}
|
|
855
|
-
extend(extendedConfig = {}) {
|
|
856
|
-
const extension = new _Extension({ ...this.config, ...extendedConfig });
|
|
857
|
-
extension.parent = this;
|
|
858
|
-
this.child = extension;
|
|
859
|
-
extension.name = extendedConfig.name ? extendedConfig.name : extension.parent.name;
|
|
860
|
-
if (extendedConfig.defaultOptions && Object.keys(extendedConfig.defaultOptions).length > 0) {
|
|
861
|
-
console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${extension.name}".`);
|
|
862
|
-
}
|
|
863
|
-
extension.options = callOrReturn(getExtensionField(extension, "addOptions", {
|
|
864
|
-
name: extension.name
|
|
865
|
-
}));
|
|
866
|
-
extension.storage = callOrReturn(getExtensionField(extension, "addStorage", {
|
|
867
|
-
name: extension.name,
|
|
868
|
-
options: extension.options
|
|
869
|
-
}));
|
|
870
|
-
return extension;
|
|
871
|
-
}
|
|
872
|
-
};
|
|
873
|
-
ClipboardTextSerializer = Extension.create({
|
|
874
|
-
name: "clipboardTextSerializer",
|
|
875
|
-
addOptions() {
|
|
876
|
-
return {
|
|
877
|
-
blockSeparator: void 0
|
|
878
|
-
};
|
|
879
|
-
},
|
|
880
|
-
addProseMirrorPlugins() {
|
|
881
|
-
return [
|
|
882
|
-
new Plugin({
|
|
883
|
-
key: new PluginKey("clipboardTextSerializer"),
|
|
884
|
-
props: {
|
|
885
|
-
clipboardTextSerializer: () => {
|
|
886
|
-
const { editor } = this;
|
|
887
|
-
const { state, schema } = editor;
|
|
888
|
-
const { doc, selection } = state;
|
|
889
|
-
const { ranges } = selection;
|
|
890
|
-
const from = Math.min(...ranges.map((range2) => range2.$from.pos));
|
|
891
|
-
const to = Math.max(...ranges.map((range2) => range2.$to.pos));
|
|
892
|
-
const textSerializers = getTextSerializersFromSchema(schema);
|
|
893
|
-
const range = { from, to };
|
|
894
|
-
return getTextBetween(doc, range, {
|
|
895
|
-
...this.options.blockSeparator !== void 0 ? { blockSeparator: this.options.blockSeparator } : {},
|
|
896
|
-
textSerializers
|
|
897
|
-
});
|
|
898
|
-
}
|
|
899
|
-
}
|
|
900
|
-
})
|
|
901
|
-
];
|
|
902
|
-
}
|
|
903
|
-
});
|
|
904
|
-
blur = () => ({ editor, view }) => {
|
|
905
|
-
requestAnimationFrame(() => {
|
|
906
|
-
var _a;
|
|
907
|
-
if (!editor.isDestroyed) {
|
|
908
|
-
view.dom.blur();
|
|
909
|
-
(_a = window === null || window === void 0 ? void 0 : window.getSelection()) === null || _a === void 0 ? void 0 : _a.removeAllRanges();
|
|
910
|
-
}
|
|
911
|
-
});
|
|
912
|
-
return true;
|
|
913
|
-
};
|
|
914
|
-
clearContent = (emitUpdate = false) => ({ commands: commands2 }) => {
|
|
915
|
-
return commands2.setContent("", emitUpdate);
|
|
916
|
-
};
|
|
917
|
-
clearNodes = () => ({ state, tr, dispatch }) => {
|
|
918
|
-
const { selection } = tr;
|
|
919
|
-
const { ranges } = selection;
|
|
920
|
-
if (!dispatch) {
|
|
921
|
-
return true;
|
|
922
|
-
}
|
|
923
|
-
ranges.forEach(({ $from, $to }) => {
|
|
924
|
-
state.doc.nodesBetween($from.pos, $to.pos, (node, pos) => {
|
|
925
|
-
if (node.type.isText) {
|
|
926
|
-
return;
|
|
927
|
-
}
|
|
928
|
-
const { doc, mapping } = tr;
|
|
929
|
-
const $mappedFrom = doc.resolve(mapping.map(pos));
|
|
930
|
-
const $mappedTo = doc.resolve(mapping.map(pos + node.nodeSize));
|
|
931
|
-
const nodeRange = $mappedFrom.blockRange($mappedTo);
|
|
932
|
-
if (!nodeRange) {
|
|
933
|
-
return;
|
|
934
|
-
}
|
|
935
|
-
const targetLiftDepth = liftTarget(nodeRange);
|
|
936
|
-
if (node.type.isTextblock) {
|
|
937
|
-
const { defaultType } = $mappedFrom.parent.contentMatchAt($mappedFrom.index());
|
|
938
|
-
tr.setNodeMarkup(nodeRange.start, defaultType);
|
|
939
|
-
}
|
|
940
|
-
if (targetLiftDepth || targetLiftDepth === 0) {
|
|
941
|
-
tr.lift(nodeRange, targetLiftDepth);
|
|
942
|
-
}
|
|
943
|
-
});
|
|
944
|
-
});
|
|
945
|
-
return true;
|
|
946
|
-
};
|
|
947
|
-
command = (fn) => (props) => {
|
|
948
|
-
return fn(props);
|
|
949
|
-
};
|
|
950
|
-
createParagraphNear = () => ({ state, dispatch }) => {
|
|
951
|
-
return createParagraphNear$1(state, dispatch);
|
|
952
|
-
};
|
|
953
|
-
cut = (originRange, targetPos) => ({ editor, tr }) => {
|
|
954
|
-
const { state } = editor;
|
|
955
|
-
const contentSlice = state.doc.slice(originRange.from, originRange.to);
|
|
956
|
-
tr.deleteRange(originRange.from, originRange.to);
|
|
957
|
-
const newPos = tr.mapping.map(targetPos);
|
|
958
|
-
tr.insert(newPos, contentSlice.content);
|
|
959
|
-
tr.setSelection(new TextSelection(tr.doc.resolve(Math.max(newPos - 1, 0))));
|
|
960
|
-
return true;
|
|
961
|
-
};
|
|
962
|
-
deleteCurrentNode = () => ({ tr, dispatch }) => {
|
|
963
|
-
const { selection } = tr;
|
|
964
|
-
const currentNode = selection.$anchor.node();
|
|
965
|
-
if (currentNode.content.size > 0) {
|
|
966
|
-
return false;
|
|
967
|
-
}
|
|
968
|
-
const $pos = tr.selection.$anchor;
|
|
969
|
-
for (let depth = $pos.depth; depth > 0; depth -= 1) {
|
|
970
|
-
const node = $pos.node(depth);
|
|
971
|
-
if (node.type === currentNode.type) {
|
|
972
|
-
if (dispatch) {
|
|
973
|
-
const from = $pos.before(depth);
|
|
974
|
-
const to = $pos.after(depth);
|
|
975
|
-
tr.delete(from, to).scrollIntoView();
|
|
976
|
-
}
|
|
977
|
-
return true;
|
|
978
|
-
}
|
|
979
|
-
}
|
|
980
|
-
return false;
|
|
981
|
-
};
|
|
982
|
-
deleteNode = (typeOrName) => ({ tr, state, dispatch }) => {
|
|
983
|
-
const type = getNodeType(typeOrName, state.schema);
|
|
984
|
-
const $pos = tr.selection.$anchor;
|
|
985
|
-
for (let depth = $pos.depth; depth > 0; depth -= 1) {
|
|
986
|
-
const node = $pos.node(depth);
|
|
987
|
-
if (node.type === type) {
|
|
988
|
-
if (dispatch) {
|
|
989
|
-
const from = $pos.before(depth);
|
|
990
|
-
const to = $pos.after(depth);
|
|
991
|
-
tr.delete(from, to).scrollIntoView();
|
|
992
|
-
}
|
|
993
|
-
return true;
|
|
994
|
-
}
|
|
995
|
-
}
|
|
996
|
-
return false;
|
|
997
|
-
};
|
|
998
|
-
deleteRange = (range) => ({ tr, dispatch }) => {
|
|
999
|
-
const { from, to } = range;
|
|
1000
|
-
if (dispatch) {
|
|
1001
|
-
tr.delete(from, to);
|
|
1002
|
-
}
|
|
1003
|
-
return true;
|
|
1004
|
-
};
|
|
1005
|
-
deleteSelection = () => ({ state, dispatch }) => {
|
|
1006
|
-
return deleteSelection$1(state, dispatch);
|
|
1007
|
-
};
|
|
1008
|
-
enter = () => ({ commands: commands2 }) => {
|
|
1009
|
-
return commands2.keyboardShortcut("Enter");
|
|
1010
|
-
};
|
|
1011
|
-
exitCode = () => ({ state, dispatch }) => {
|
|
1012
|
-
return exitCode$1(state, dispatch);
|
|
1013
|
-
};
|
|
1014
|
-
extendMarkRange = (typeOrName, attributes = {}) => ({ tr, state, dispatch }) => {
|
|
1015
|
-
const type = getMarkType(typeOrName, state.schema);
|
|
1016
|
-
const { doc, selection } = tr;
|
|
1017
|
-
const { $from, from, to } = selection;
|
|
1018
|
-
if (dispatch) {
|
|
1019
|
-
const range = getMarkRange($from, type, attributes);
|
|
1020
|
-
if (range && range.from <= from && range.to >= to) {
|
|
1021
|
-
const newSelection = TextSelection.create(doc, range.from, range.to);
|
|
1022
|
-
tr.setSelection(newSelection);
|
|
1023
|
-
}
|
|
1024
|
-
}
|
|
1025
|
-
return true;
|
|
1026
|
-
};
|
|
1027
|
-
first = (commands2) => (props) => {
|
|
1028
|
-
const items = typeof commands2 === "function" ? commands2(props) : commands2;
|
|
1029
|
-
for (let i = 0; i < items.length; i += 1) {
|
|
1030
|
-
if (items[i](props)) {
|
|
1031
|
-
return true;
|
|
1032
|
-
}
|
|
1033
|
-
}
|
|
1034
|
-
return false;
|
|
1035
|
-
};
|
|
1036
|
-
focus = (position = null, options = {}) => ({ editor, view, tr, dispatch }) => {
|
|
1037
|
-
options = {
|
|
1038
|
-
scrollIntoView: true,
|
|
1039
|
-
...options
|
|
1040
|
-
};
|
|
1041
|
-
const delayedFocus = () => {
|
|
1042
|
-
if (isiOS() || isAndroid()) {
|
|
1043
|
-
view.dom.focus();
|
|
1044
|
-
}
|
|
1045
|
-
requestAnimationFrame(() => {
|
|
1046
|
-
if (!editor.isDestroyed) {
|
|
1047
|
-
view.focus();
|
|
1048
|
-
if (isSafari() && !isiOS() && !isAndroid()) {
|
|
1049
|
-
view.dom.focus({ preventScroll: true });
|
|
1050
|
-
}
|
|
1051
|
-
}
|
|
1052
|
-
});
|
|
1053
|
-
};
|
|
1054
|
-
if (view.hasFocus() && position === null || position === false) {
|
|
1055
|
-
return true;
|
|
1056
|
-
}
|
|
1057
|
-
if (dispatch && position === null && !isTextSelection(editor.state.selection)) {
|
|
1058
|
-
delayedFocus();
|
|
1059
|
-
return true;
|
|
1060
|
-
}
|
|
1061
|
-
const selection = resolveFocusPosition(tr.doc, position) || editor.state.selection;
|
|
1062
|
-
const isSameSelection = editor.state.selection.eq(selection);
|
|
1063
|
-
if (dispatch) {
|
|
1064
|
-
if (!isSameSelection) {
|
|
1065
|
-
tr.setSelection(selection);
|
|
1066
|
-
}
|
|
1067
|
-
if (isSameSelection && tr.storedMarks) {
|
|
1068
|
-
tr.setStoredMarks(tr.storedMarks);
|
|
1069
|
-
}
|
|
1070
|
-
delayedFocus();
|
|
1071
|
-
}
|
|
1072
|
-
return true;
|
|
1073
|
-
};
|
|
1074
|
-
forEach = (items, fn) => (props) => {
|
|
1075
|
-
return items.every((item, index) => fn(item, { ...props, index }));
|
|
1076
|
-
};
|
|
1077
|
-
insertContent = (value, options) => ({ tr, commands: commands2 }) => {
|
|
1078
|
-
return commands2.insertContentAt({ from: tr.selection.from, to: tr.selection.to }, value, options);
|
|
1079
|
-
};
|
|
1080
|
-
removeWhitespaces = (node) => {
|
|
1081
|
-
const children = node.childNodes;
|
|
1082
|
-
for (let i = children.length - 1; i >= 0; i -= 1) {
|
|
1083
|
-
const child = children[i];
|
|
1084
|
-
if (child.nodeType === 3 && child.nodeValue && /^(\n\s\s|\n)$/.test(child.nodeValue)) {
|
|
1085
|
-
node.removeChild(child);
|
|
1086
|
-
} else if (child.nodeType === 1) {
|
|
1087
|
-
removeWhitespaces(child);
|
|
1088
|
-
}
|
|
1089
|
-
}
|
|
1090
|
-
return node;
|
|
1091
|
-
};
|
|
1092
|
-
isFragment = (nodeOrFragment) => {
|
|
1093
|
-
return !("type" in nodeOrFragment);
|
|
1094
|
-
};
|
|
1095
|
-
insertContentAt = (position, value, options) => ({ tr, dispatch, editor }) => {
|
|
1096
|
-
var _a;
|
|
1097
|
-
if (dispatch) {
|
|
1098
|
-
options = {
|
|
1099
|
-
parseOptions: editor.options.parseOptions,
|
|
1100
|
-
updateSelection: true,
|
|
1101
|
-
applyInputRules: false,
|
|
1102
|
-
applyPasteRules: false,
|
|
1103
|
-
...options
|
|
1104
|
-
};
|
|
1105
|
-
let content;
|
|
1106
|
-
const emitContentError = (error) => {
|
|
1107
|
-
editor.emit("contentError", {
|
|
1108
|
-
editor,
|
|
1109
|
-
error,
|
|
1110
|
-
disableCollaboration: () => {
|
|
1111
|
-
if (editor.storage.collaboration) {
|
|
1112
|
-
editor.storage.collaboration.isDisabled = true;
|
|
1113
|
-
}
|
|
1114
|
-
}
|
|
1115
|
-
});
|
|
1116
|
-
};
|
|
1117
|
-
const parseOptions = {
|
|
1118
|
-
preserveWhitespace: "full",
|
|
1119
|
-
...options.parseOptions
|
|
1120
|
-
};
|
|
1121
|
-
if (!options.errorOnInvalidContent && !editor.options.enableContentCheck && editor.options.emitContentError) {
|
|
1122
|
-
try {
|
|
1123
|
-
createNodeFromContent(value, editor.schema, {
|
|
1124
|
-
parseOptions,
|
|
1125
|
-
errorOnInvalidContent: true
|
|
1126
|
-
});
|
|
1127
|
-
} catch (e) {
|
|
1128
|
-
emitContentError(e);
|
|
1129
|
-
}
|
|
1130
|
-
}
|
|
1131
|
-
try {
|
|
1132
|
-
content = createNodeFromContent(value, editor.schema, {
|
|
1133
|
-
parseOptions,
|
|
1134
|
-
errorOnInvalidContent: (_a = options.errorOnInvalidContent) !== null && _a !== void 0 ? _a : editor.options.enableContentCheck
|
|
1135
|
-
});
|
|
1136
|
-
} catch (e) {
|
|
1137
|
-
emitContentError(e);
|
|
1138
|
-
return false;
|
|
1139
|
-
}
|
|
1140
|
-
let { from, to } = typeof position === "number" ? { from: position, to: position } : { from: position.from, to: position.to };
|
|
1141
|
-
let isOnlyTextContent = true;
|
|
1142
|
-
let isOnlyBlockContent = true;
|
|
1143
|
-
const nodes = isFragment(content) ? content : [content];
|
|
1144
|
-
nodes.forEach((node) => {
|
|
1145
|
-
node.check();
|
|
1146
|
-
isOnlyTextContent = isOnlyTextContent ? node.isText && node.marks.length === 0 : false;
|
|
1147
|
-
isOnlyBlockContent = isOnlyBlockContent ? node.isBlock : false;
|
|
1148
|
-
});
|
|
1149
|
-
if (from === to && isOnlyBlockContent) {
|
|
1150
|
-
const { parent } = tr.doc.resolve(from);
|
|
1151
|
-
const isEmptyTextBlock = parent.isTextblock && !parent.type.spec.code && !parent.childCount;
|
|
1152
|
-
if (isEmptyTextBlock) {
|
|
1153
|
-
from -= 1;
|
|
1154
|
-
to += 1;
|
|
1155
|
-
}
|
|
1156
|
-
}
|
|
1157
|
-
let newContent;
|
|
1158
|
-
if (isOnlyTextContent) {
|
|
1159
|
-
if (Array.isArray(value)) {
|
|
1160
|
-
newContent = value.map((v) => v.text || "").join("");
|
|
1161
|
-
} else if (value instanceof Fragment) {
|
|
1162
|
-
let text = "";
|
|
1163
|
-
value.forEach((node) => {
|
|
1164
|
-
if (node.text) {
|
|
1165
|
-
text += node.text;
|
|
1166
|
-
}
|
|
1167
|
-
});
|
|
1168
|
-
newContent = text;
|
|
1169
|
-
} else if (typeof value === "object" && !!value && !!value.text) {
|
|
1170
|
-
newContent = value.text;
|
|
1171
|
-
} else {
|
|
1172
|
-
newContent = value;
|
|
1173
|
-
}
|
|
1174
|
-
tr.insertText(newContent, from, to);
|
|
1175
|
-
} else {
|
|
1176
|
-
newContent = content;
|
|
1177
|
-
tr.replaceWith(from, to, newContent);
|
|
1178
|
-
}
|
|
1179
|
-
if (options.updateSelection) {
|
|
1180
|
-
selectionToInsertionEnd(tr, tr.steps.length - 1, -1);
|
|
1181
|
-
}
|
|
1182
|
-
if (options.applyInputRules) {
|
|
1183
|
-
tr.setMeta("applyInputRules", { from, text: newContent });
|
|
1184
|
-
}
|
|
1185
|
-
if (options.applyPasteRules) {
|
|
1186
|
-
tr.setMeta("applyPasteRules", { from, text: newContent });
|
|
1187
|
-
}
|
|
1188
|
-
}
|
|
1189
|
-
return true;
|
|
1190
|
-
};
|
|
1191
|
-
joinUp = () => ({ state, dispatch }) => {
|
|
1192
|
-
return joinUp$1(state, dispatch);
|
|
1193
|
-
};
|
|
1194
|
-
joinDown = () => ({ state, dispatch }) => {
|
|
1195
|
-
return joinDown$1(state, dispatch);
|
|
1196
|
-
};
|
|
1197
|
-
joinBackward = () => ({ state, dispatch }) => {
|
|
1198
|
-
return joinBackward$1(state, dispatch);
|
|
1199
|
-
};
|
|
1200
|
-
joinForward = () => ({ state, dispatch }) => {
|
|
1201
|
-
return joinForward$1(state, dispatch);
|
|
1202
|
-
};
|
|
1203
|
-
joinItemBackward = () => ({ state, dispatch, tr }) => {
|
|
1204
|
-
try {
|
|
1205
|
-
const point = joinPoint(state.doc, state.selection.$from.pos, -1);
|
|
1206
|
-
if (point === null || point === void 0) {
|
|
1207
|
-
return false;
|
|
1208
|
-
}
|
|
1209
|
-
tr.join(point, 2);
|
|
1210
|
-
if (dispatch) {
|
|
1211
|
-
dispatch(tr);
|
|
1212
|
-
}
|
|
1213
|
-
return true;
|
|
1214
|
-
} catch {
|
|
1215
|
-
return false;
|
|
1216
|
-
}
|
|
1217
|
-
};
|
|
1218
|
-
joinItemForward = () => ({ state, dispatch, tr }) => {
|
|
1219
|
-
try {
|
|
1220
|
-
const point = joinPoint(state.doc, state.selection.$from.pos, 1);
|
|
1221
|
-
if (point === null || point === void 0) {
|
|
1222
|
-
return false;
|
|
1223
|
-
}
|
|
1224
|
-
tr.join(point, 2);
|
|
1225
|
-
if (dispatch) {
|
|
1226
|
-
dispatch(tr);
|
|
1227
|
-
}
|
|
1228
|
-
return true;
|
|
1229
|
-
} catch {
|
|
1230
|
-
return false;
|
|
1231
|
-
}
|
|
1232
|
-
};
|
|
1233
|
-
joinTextblockBackward = () => ({ state, dispatch }) => {
|
|
1234
|
-
return joinTextblockBackward$1(state, dispatch);
|
|
1235
|
-
};
|
|
1236
|
-
joinTextblockForward = () => ({ state, dispatch }) => {
|
|
1237
|
-
return joinTextblockForward$1(state, dispatch);
|
|
1238
|
-
};
|
|
1239
|
-
keyboardShortcut = (name) => ({ editor, view, tr, dispatch }) => {
|
|
1240
|
-
const keys = normalizeKeyName(name).split(/-(?!$)/);
|
|
1241
|
-
const key = keys.find((item) => !["Alt", "Ctrl", "Meta", "Shift"].includes(item));
|
|
1242
|
-
const event = new KeyboardEvent("keydown", {
|
|
1243
|
-
key: key === "Space" ? " " : key,
|
|
1244
|
-
altKey: keys.includes("Alt"),
|
|
1245
|
-
ctrlKey: keys.includes("Ctrl"),
|
|
1246
|
-
metaKey: keys.includes("Meta"),
|
|
1247
|
-
shiftKey: keys.includes("Shift"),
|
|
1248
|
-
bubbles: true,
|
|
1249
|
-
cancelable: true
|
|
1250
|
-
});
|
|
1251
|
-
const capturedTransaction = editor.captureTransaction(() => {
|
|
1252
|
-
view.someProp("handleKeyDown", (f) => f(view, event));
|
|
1253
|
-
});
|
|
1254
|
-
capturedTransaction === null || capturedTransaction === void 0 ? void 0 : capturedTransaction.steps.forEach((step) => {
|
|
1255
|
-
const newStep = step.map(tr.mapping);
|
|
1256
|
-
if (newStep && dispatch) {
|
|
1257
|
-
tr.maybeStep(newStep);
|
|
1258
|
-
}
|
|
1259
|
-
});
|
|
1260
|
-
return true;
|
|
1261
|
-
};
|
|
1262
|
-
lift = (typeOrName, attributes = {}) => ({ state, dispatch }) => {
|
|
1263
|
-
const type = getNodeType(typeOrName, state.schema);
|
|
1264
|
-
const isActive = isNodeActive(state, type, attributes);
|
|
1265
|
-
if (!isActive) {
|
|
1266
|
-
return false;
|
|
1267
|
-
}
|
|
1268
|
-
return lift$1(state, dispatch);
|
|
1269
|
-
};
|
|
1270
|
-
liftEmptyBlock = () => ({ state, dispatch }) => {
|
|
1271
|
-
return liftEmptyBlock$1(state, dispatch);
|
|
1272
|
-
};
|
|
1273
|
-
liftListItem = (typeOrName) => ({ state, dispatch }) => {
|
|
1274
|
-
const type = getNodeType(typeOrName, state.schema);
|
|
1275
|
-
return liftListItem$1(type)(state, dispatch);
|
|
1276
|
-
};
|
|
1277
|
-
newlineInCode = () => ({ state, dispatch }) => {
|
|
1278
|
-
return newlineInCode$1(state, dispatch);
|
|
1279
|
-
};
|
|
1280
|
-
resetAttributes = (typeOrName, attributes) => ({ tr, state, dispatch }) => {
|
|
1281
|
-
let nodeType = null;
|
|
1282
|
-
let markType = null;
|
|
1283
|
-
const schemaType = getSchemaTypeNameByName(typeof typeOrName === "string" ? typeOrName : typeOrName.name, state.schema);
|
|
1284
|
-
if (!schemaType) {
|
|
1285
|
-
return false;
|
|
1286
|
-
}
|
|
1287
|
-
if (schemaType === "node") {
|
|
1288
|
-
nodeType = getNodeType(typeOrName, state.schema);
|
|
1289
|
-
}
|
|
1290
|
-
if (schemaType === "mark") {
|
|
1291
|
-
markType = getMarkType(typeOrName, state.schema);
|
|
1292
|
-
}
|
|
1293
|
-
if (dispatch) {
|
|
1294
|
-
tr.selection.ranges.forEach((range) => {
|
|
1295
|
-
state.doc.nodesBetween(range.$from.pos, range.$to.pos, (node, pos) => {
|
|
1296
|
-
if (nodeType && nodeType === node.type) {
|
|
1297
|
-
tr.setNodeMarkup(pos, void 0, deleteProps(node.attrs, attributes));
|
|
1298
|
-
}
|
|
1299
|
-
if (markType && node.marks.length) {
|
|
1300
|
-
node.marks.forEach((mark) => {
|
|
1301
|
-
if (markType === mark.type) {
|
|
1302
|
-
tr.addMark(pos, pos + node.nodeSize, markType.create(deleteProps(mark.attrs, attributes)));
|
|
1303
|
-
}
|
|
1304
|
-
});
|
|
1305
|
-
}
|
|
1306
|
-
});
|
|
1307
|
-
});
|
|
1308
|
-
}
|
|
1309
|
-
return true;
|
|
1310
|
-
};
|
|
1311
|
-
scrollIntoView = () => ({ tr, dispatch }) => {
|
|
1312
|
-
if (dispatch) {
|
|
1313
|
-
tr.scrollIntoView();
|
|
1314
|
-
}
|
|
1315
|
-
return true;
|
|
1316
|
-
};
|
|
1317
|
-
selectAll = () => ({ tr, dispatch }) => {
|
|
1318
|
-
if (dispatch) {
|
|
1319
|
-
const selection = new AllSelection(tr.doc);
|
|
1320
|
-
tr.setSelection(selection);
|
|
1321
|
-
}
|
|
1322
|
-
return true;
|
|
1323
|
-
};
|
|
1324
|
-
selectNodeBackward = () => ({ state, dispatch }) => {
|
|
1325
|
-
return selectNodeBackward$1(state, dispatch);
|
|
1326
|
-
};
|
|
1327
|
-
selectNodeForward = () => ({ state, dispatch }) => {
|
|
1328
|
-
return selectNodeForward$1(state, dispatch);
|
|
1329
|
-
};
|
|
1330
|
-
selectParentNode = () => ({ state, dispatch }) => {
|
|
1331
|
-
return selectParentNode$1(state, dispatch);
|
|
1332
|
-
};
|
|
1333
|
-
selectTextblockEnd = () => ({ state, dispatch }) => {
|
|
1334
|
-
return selectTextblockEnd$1(state, dispatch);
|
|
1335
|
-
};
|
|
1336
|
-
selectTextblockStart = () => ({ state, dispatch }) => {
|
|
1337
|
-
return selectTextblockStart$1(state, dispatch);
|
|
1338
|
-
};
|
|
1339
|
-
setContent = (content, emitUpdate = false, parseOptions = {}, options = {}) => ({ editor, tr, dispatch, commands: commands2 }) => {
|
|
1340
|
-
var _a, _b;
|
|
1341
|
-
const { doc } = tr;
|
|
1342
|
-
if (parseOptions.preserveWhitespace !== "full") {
|
|
1343
|
-
const document2 = createDocument(content, editor.schema, parseOptions, {
|
|
1344
|
-
errorOnInvalidContent: (_a = options.errorOnInvalidContent) !== null && _a !== void 0 ? _a : editor.options.enableContentCheck
|
|
1345
|
-
});
|
|
1346
|
-
if (dispatch) {
|
|
1347
|
-
tr.replaceWith(0, doc.content.size, document2).setMeta("preventUpdate", !emitUpdate);
|
|
1348
|
-
}
|
|
1349
|
-
return true;
|
|
1350
|
-
}
|
|
1351
|
-
if (dispatch) {
|
|
1352
|
-
tr.setMeta("preventUpdate", !emitUpdate);
|
|
1353
|
-
}
|
|
1354
|
-
return commands2.insertContentAt({ from: 0, to: doc.content.size }, content, {
|
|
1355
|
-
parseOptions,
|
|
1356
|
-
errorOnInvalidContent: (_b = options.errorOnInvalidContent) !== null && _b !== void 0 ? _b : editor.options.enableContentCheck
|
|
1357
|
-
});
|
|
1358
|
-
};
|
|
1359
|
-
setMark = (typeOrName, attributes = {}) => ({ tr, state, dispatch }) => {
|
|
1360
|
-
const { selection } = tr;
|
|
1361
|
-
const { empty, ranges } = selection;
|
|
1362
|
-
const type = getMarkType(typeOrName, state.schema);
|
|
1363
|
-
if (dispatch) {
|
|
1364
|
-
if (empty) {
|
|
1365
|
-
const oldAttributes = getMarkAttributes(state, type);
|
|
1366
|
-
tr.addStoredMark(type.create({
|
|
1367
|
-
...oldAttributes,
|
|
1368
|
-
...attributes
|
|
1369
|
-
}));
|
|
1370
|
-
} else {
|
|
1371
|
-
ranges.forEach((range) => {
|
|
1372
|
-
const from = range.$from.pos;
|
|
1373
|
-
const to = range.$to.pos;
|
|
1374
|
-
state.doc.nodesBetween(from, to, (node, pos) => {
|
|
1375
|
-
const trimmedFrom = Math.max(pos, from);
|
|
1376
|
-
const trimmedTo = Math.min(pos + node.nodeSize, to);
|
|
1377
|
-
const someHasMark = node.marks.find((mark) => mark.type === type);
|
|
1378
|
-
if (someHasMark) {
|
|
1379
|
-
node.marks.forEach((mark) => {
|
|
1380
|
-
if (type === mark.type) {
|
|
1381
|
-
tr.addMark(trimmedFrom, trimmedTo, type.create({
|
|
1382
|
-
...mark.attrs,
|
|
1383
|
-
...attributes
|
|
1384
|
-
}));
|
|
1385
|
-
}
|
|
1386
|
-
});
|
|
1387
|
-
} else {
|
|
1388
|
-
tr.addMark(trimmedFrom, trimmedTo, type.create(attributes));
|
|
1389
|
-
}
|
|
1390
|
-
});
|
|
1391
|
-
});
|
|
1392
|
-
}
|
|
1393
|
-
}
|
|
1394
|
-
return canSetMark(state, tr, type);
|
|
1395
|
-
};
|
|
1396
|
-
setMeta = (key, value) => ({ tr }) => {
|
|
1397
|
-
tr.setMeta(key, value);
|
|
1398
|
-
return true;
|
|
1399
|
-
};
|
|
1400
|
-
setNode = (typeOrName, attributes = {}) => ({ state, dispatch, chain }) => {
|
|
1401
|
-
const type = getNodeType(typeOrName, state.schema);
|
|
1402
|
-
let attributesToCopy;
|
|
1403
|
-
if (state.selection.$anchor.sameParent(state.selection.$head)) {
|
|
1404
|
-
attributesToCopy = state.selection.$anchor.parent.attrs;
|
|
1405
|
-
}
|
|
1406
|
-
if (!type.isTextblock) {
|
|
1407
|
-
console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.');
|
|
1408
|
-
return false;
|
|
1409
|
-
}
|
|
1410
|
-
return chain().command(({ commands: commands2 }) => {
|
|
1411
|
-
const canSetBlock = setBlockType(type, { ...attributesToCopy, ...attributes })(state);
|
|
1412
|
-
if (canSetBlock) {
|
|
1413
|
-
return true;
|
|
1414
|
-
}
|
|
1415
|
-
return commands2.clearNodes();
|
|
1416
|
-
}).command(({ state: updatedState }) => {
|
|
1417
|
-
return setBlockType(type, { ...attributesToCopy, ...attributes })(updatedState, dispatch);
|
|
1418
|
-
}).run();
|
|
1419
|
-
};
|
|
1420
|
-
setNodeSelection = (position) => ({ tr, dispatch }) => {
|
|
1421
|
-
if (dispatch) {
|
|
1422
|
-
const { doc } = tr;
|
|
1423
|
-
const from = minMax(position, 0, doc.content.size);
|
|
1424
|
-
const selection = NodeSelection.create(doc, from);
|
|
1425
|
-
tr.setSelection(selection);
|
|
1426
|
-
}
|
|
1427
|
-
return true;
|
|
1428
|
-
};
|
|
1429
|
-
setTextSelection = (position) => ({ tr, dispatch }) => {
|
|
1430
|
-
if (dispatch) {
|
|
1431
|
-
const { doc } = tr;
|
|
1432
|
-
const { from, to } = typeof position === "number" ? { from: position, to: position } : position;
|
|
1433
|
-
const minPos = TextSelection.atStart(doc).from;
|
|
1434
|
-
const maxPos = TextSelection.atEnd(doc).to;
|
|
1435
|
-
const resolvedFrom = minMax(from, minPos, maxPos);
|
|
1436
|
-
const resolvedEnd = minMax(to, minPos, maxPos);
|
|
1437
|
-
const selection = TextSelection.create(doc, resolvedFrom, resolvedEnd);
|
|
1438
|
-
tr.setSelection(selection);
|
|
1439
|
-
}
|
|
1440
|
-
return true;
|
|
1441
|
-
};
|
|
1442
|
-
sinkListItem = (typeOrName) => ({ state, dispatch }) => {
|
|
1443
|
-
const type = getNodeType(typeOrName, state.schema);
|
|
1444
|
-
return sinkListItem$1(type)(state, dispatch);
|
|
1445
|
-
};
|
|
1446
|
-
splitBlock = ({ keepMarks = true } = {}) => ({ tr, state, dispatch, editor }) => {
|
|
1447
|
-
const { selection, doc } = tr;
|
|
1448
|
-
const { $from, $to } = selection;
|
|
1449
|
-
const extensionAttributes = editor.extensionManager.attributes;
|
|
1450
|
-
const newAttributes = getSplittedAttributes(extensionAttributes, $from.node().type.name, $from.node().attrs);
|
|
1451
|
-
if (selection instanceof NodeSelection && selection.node.isBlock) {
|
|
1452
|
-
if (!$from.parentOffset || !canSplit(doc, $from.pos)) {
|
|
1453
|
-
return false;
|
|
1454
|
-
}
|
|
1455
|
-
if (dispatch) {
|
|
1456
|
-
if (keepMarks) {
|
|
1457
|
-
ensureMarks(state, editor.extensionManager.splittableMarks);
|
|
1458
|
-
}
|
|
1459
|
-
tr.split($from.pos).scrollIntoView();
|
|
1460
|
-
}
|
|
1461
|
-
return true;
|
|
1462
|
-
}
|
|
1463
|
-
if (!$from.parent.isBlock) {
|
|
1464
|
-
return false;
|
|
1465
|
-
}
|
|
1466
|
-
const atEnd = $to.parentOffset === $to.parent.content.size;
|
|
1467
|
-
const deflt = $from.depth === 0 ? void 0 : defaultBlockAt($from.node(-1).contentMatchAt($from.indexAfter(-1)));
|
|
1468
|
-
let types = atEnd && deflt ? [
|
|
1469
|
-
{
|
|
1470
|
-
type: deflt,
|
|
1471
|
-
attrs: newAttributes
|
|
1472
|
-
}
|
|
1473
|
-
] : void 0;
|
|
1474
|
-
let can = canSplit(tr.doc, tr.mapping.map($from.pos), 1, types);
|
|
1475
|
-
if (!types && !can && canSplit(tr.doc, tr.mapping.map($from.pos), 1, deflt ? [{ type: deflt }] : void 0)) {
|
|
1476
|
-
can = true;
|
|
1477
|
-
types = deflt ? [
|
|
1478
|
-
{
|
|
1479
|
-
type: deflt,
|
|
1480
|
-
attrs: newAttributes
|
|
1481
|
-
}
|
|
1482
|
-
] : void 0;
|
|
1483
|
-
}
|
|
1484
|
-
if (dispatch) {
|
|
1485
|
-
if (can) {
|
|
1486
|
-
if (selection instanceof TextSelection) {
|
|
1487
|
-
tr.deleteSelection();
|
|
1488
|
-
}
|
|
1489
|
-
tr.split(tr.mapping.map($from.pos), 1, types);
|
|
1490
|
-
if (deflt && !atEnd && !$from.parentOffset && $from.parent.type !== deflt) {
|
|
1491
|
-
const first2 = tr.mapping.map($from.before());
|
|
1492
|
-
const $first = tr.doc.resolve(first2);
|
|
1493
|
-
if ($from.node(-1).canReplaceWith($first.index(), $first.index() + 1, deflt)) {
|
|
1494
|
-
tr.setNodeMarkup(tr.mapping.map($from.before()), deflt);
|
|
1495
|
-
}
|
|
1496
|
-
}
|
|
1497
|
-
}
|
|
1498
|
-
if (keepMarks) {
|
|
1499
|
-
ensureMarks(state, editor.extensionManager.splittableMarks);
|
|
1500
|
-
}
|
|
1501
|
-
tr.scrollIntoView();
|
|
1502
|
-
}
|
|
1503
|
-
return can;
|
|
1504
|
-
};
|
|
1505
|
-
splitListItem = (typeOrName, overrideAttrs = {}) => ({ tr, state, dispatch, editor }) => {
|
|
1506
|
-
var _a;
|
|
1507
|
-
const type = getNodeType(typeOrName, state.schema);
|
|
1508
|
-
const { $from, $to } = state.selection;
|
|
1509
|
-
const node = state.selection.node;
|
|
1510
|
-
if (node && node.isBlock || $from.depth < 2 || !$from.sameParent($to)) {
|
|
1511
|
-
return false;
|
|
1512
|
-
}
|
|
1513
|
-
const grandParent = $from.node(-1);
|
|
1514
|
-
if (grandParent.type !== type) {
|
|
1515
|
-
return false;
|
|
1516
|
-
}
|
|
1517
|
-
const extensionAttributes = editor.extensionManager.attributes;
|
|
1518
|
-
if ($from.parent.content.size === 0 && $from.node(-1).childCount === $from.indexAfter(-1)) {
|
|
1519
|
-
if ($from.depth === 2 || $from.node(-3).type !== type || $from.index(-2) !== $from.node(-2).childCount - 1) {
|
|
1520
|
-
return false;
|
|
1521
|
-
}
|
|
1522
|
-
if (dispatch) {
|
|
1523
|
-
let wrap = Fragment.empty;
|
|
1524
|
-
const depthBefore = $from.index(-1) ? 1 : $from.index(-2) ? 2 : 3;
|
|
1525
|
-
for (let d = $from.depth - depthBefore; d >= $from.depth - 3; d -= 1) {
|
|
1526
|
-
wrap = Fragment.from($from.node(d).copy(wrap));
|
|
1527
|
-
}
|
|
1528
|
-
const depthAfter = $from.indexAfter(-1) < $from.node(-2).childCount ? 1 : $from.indexAfter(-2) < $from.node(-3).childCount ? 2 : 3;
|
|
1529
|
-
const newNextTypeAttributes2 = {
|
|
1530
|
-
...getSplittedAttributes(extensionAttributes, $from.node().type.name, $from.node().attrs),
|
|
1531
|
-
...overrideAttrs
|
|
1532
|
-
};
|
|
1533
|
-
const nextType2 = ((_a = type.contentMatch.defaultType) === null || _a === void 0 ? void 0 : _a.createAndFill(newNextTypeAttributes2)) || void 0;
|
|
1534
|
-
wrap = wrap.append(Fragment.from(type.createAndFill(null, nextType2) || void 0));
|
|
1535
|
-
const start = $from.before($from.depth - (depthBefore - 1));
|
|
1536
|
-
tr.replace(start, $from.after(-depthAfter), new Slice(wrap, 4 - depthBefore, 0));
|
|
1537
|
-
let sel = -1;
|
|
1538
|
-
tr.doc.nodesBetween(start, tr.doc.content.size, (n, pos) => {
|
|
1539
|
-
if (sel > -1) {
|
|
1540
|
-
return false;
|
|
1541
|
-
}
|
|
1542
|
-
if (n.isTextblock && n.content.size === 0) {
|
|
1543
|
-
sel = pos + 1;
|
|
1544
|
-
}
|
|
1545
|
-
});
|
|
1546
|
-
if (sel > -1) {
|
|
1547
|
-
tr.setSelection(TextSelection.near(tr.doc.resolve(sel)));
|
|
1548
|
-
}
|
|
1549
|
-
tr.scrollIntoView();
|
|
1550
|
-
}
|
|
1551
|
-
return true;
|
|
1552
|
-
}
|
|
1553
|
-
const nextType = $to.pos === $from.end() ? grandParent.contentMatchAt(0).defaultType : null;
|
|
1554
|
-
const newTypeAttributes = {
|
|
1555
|
-
...getSplittedAttributes(extensionAttributes, grandParent.type.name, grandParent.attrs),
|
|
1556
|
-
...overrideAttrs
|
|
1557
|
-
};
|
|
1558
|
-
const newNextTypeAttributes = {
|
|
1559
|
-
...getSplittedAttributes(extensionAttributes, $from.node().type.name, $from.node().attrs),
|
|
1560
|
-
...overrideAttrs
|
|
1561
|
-
};
|
|
1562
|
-
tr.delete($from.pos, $to.pos);
|
|
1563
|
-
const types = nextType ? [
|
|
1564
|
-
{ type, attrs: newTypeAttributes },
|
|
1565
|
-
{ type: nextType, attrs: newNextTypeAttributes }
|
|
1566
|
-
] : [{ type, attrs: newTypeAttributes }];
|
|
1567
|
-
if (!canSplit(tr.doc, $from.pos, 2)) {
|
|
1568
|
-
return false;
|
|
1569
|
-
}
|
|
1570
|
-
if (dispatch) {
|
|
1571
|
-
const { selection, storedMarks } = state;
|
|
1572
|
-
const { splittableMarks } = editor.extensionManager;
|
|
1573
|
-
const marks = storedMarks || selection.$to.parentOffset && selection.$from.marks();
|
|
1574
|
-
tr.split($from.pos, 2, types).scrollIntoView();
|
|
1575
|
-
if (!marks || !dispatch) {
|
|
1576
|
-
return true;
|
|
1577
|
-
}
|
|
1578
|
-
const filteredMarks = marks.filter((mark) => splittableMarks.includes(mark.type.name));
|
|
1579
|
-
tr.ensureMarks(filteredMarks);
|
|
1580
|
-
}
|
|
1581
|
-
return true;
|
|
1582
|
-
};
|
|
1583
|
-
joinListBackwards = (tr, listType) => {
|
|
1584
|
-
const list = findParentNode((node) => node.type === listType)(tr.selection);
|
|
1585
|
-
if (!list) {
|
|
1586
|
-
return true;
|
|
1587
|
-
}
|
|
1588
|
-
const before = tr.doc.resolve(Math.max(0, list.pos - 1)).before(list.depth);
|
|
1589
|
-
if (before === void 0) {
|
|
1590
|
-
return true;
|
|
1591
|
-
}
|
|
1592
|
-
const nodeBefore = tr.doc.nodeAt(before);
|
|
1593
|
-
const canJoinBackwards = list.node.type === (nodeBefore === null || nodeBefore === void 0 ? void 0 : nodeBefore.type) && canJoin(tr.doc, list.pos);
|
|
1594
|
-
if (!canJoinBackwards) {
|
|
1595
|
-
return true;
|
|
1596
|
-
}
|
|
1597
|
-
tr.join(list.pos);
|
|
1598
|
-
return true;
|
|
1599
|
-
};
|
|
1600
|
-
joinListForwards = (tr, listType) => {
|
|
1601
|
-
const list = findParentNode((node) => node.type === listType)(tr.selection);
|
|
1602
|
-
if (!list) {
|
|
1603
|
-
return true;
|
|
1604
|
-
}
|
|
1605
|
-
const after = tr.doc.resolve(list.start).after(list.depth);
|
|
1606
|
-
if (after === void 0) {
|
|
1607
|
-
return true;
|
|
1608
|
-
}
|
|
1609
|
-
const nodeAfter = tr.doc.nodeAt(after);
|
|
1610
|
-
const canJoinForwards = list.node.type === (nodeAfter === null || nodeAfter === void 0 ? void 0 : nodeAfter.type) && canJoin(tr.doc, after);
|
|
1611
|
-
if (!canJoinForwards) {
|
|
1612
|
-
return true;
|
|
1613
|
-
}
|
|
1614
|
-
tr.join(after);
|
|
1615
|
-
return true;
|
|
1616
|
-
};
|
|
1617
|
-
toggleList = (listTypeOrName, itemTypeOrName, keepMarks, attributes = {}) => ({ editor, tr, state, dispatch, chain, commands: commands2, can }) => {
|
|
1618
|
-
const { extensions, splittableMarks } = editor.extensionManager;
|
|
1619
|
-
const listType = getNodeType(listTypeOrName, state.schema);
|
|
1620
|
-
const itemType = getNodeType(itemTypeOrName, state.schema);
|
|
1621
|
-
const { selection, storedMarks } = state;
|
|
1622
|
-
const { $from, $to } = selection;
|
|
1623
|
-
const range = $from.blockRange($to);
|
|
1624
|
-
const marks = storedMarks || selection.$to.parentOffset && selection.$from.marks();
|
|
1625
|
-
if (!range) {
|
|
1626
|
-
return false;
|
|
1627
|
-
}
|
|
1628
|
-
const parentList = findParentNode((node) => isList(node.type.name, extensions))(selection);
|
|
1629
|
-
if (range.depth >= 1 && parentList && range.depth - parentList.depth <= 1) {
|
|
1630
|
-
if (parentList.node.type === listType) {
|
|
1631
|
-
return commands2.liftListItem(itemType);
|
|
1632
|
-
}
|
|
1633
|
-
if (isList(parentList.node.type.name, extensions) && listType.validContent(parentList.node.content) && dispatch) {
|
|
1634
|
-
return chain().command(() => {
|
|
1635
|
-
tr.setNodeMarkup(parentList.pos, listType);
|
|
1636
|
-
return true;
|
|
1637
|
-
}).command(() => joinListBackwards(tr, listType)).command(() => joinListForwards(tr, listType)).run();
|
|
1638
|
-
}
|
|
1639
|
-
}
|
|
1640
|
-
if (!keepMarks || !marks || !dispatch) {
|
|
1641
|
-
return chain().command(() => {
|
|
1642
|
-
const canWrapInList = can().wrapInList(listType, attributes);
|
|
1643
|
-
if (canWrapInList) {
|
|
1644
|
-
return true;
|
|
1645
|
-
}
|
|
1646
|
-
return commands2.clearNodes();
|
|
1647
|
-
}).wrapInList(listType, attributes).command(() => joinListBackwards(tr, listType)).command(() => joinListForwards(tr, listType)).run();
|
|
1648
|
-
}
|
|
1649
|
-
return chain().command(() => {
|
|
1650
|
-
const canWrapInList = can().wrapInList(listType, attributes);
|
|
1651
|
-
const filteredMarks = marks.filter((mark) => splittableMarks.includes(mark.type.name));
|
|
1652
|
-
tr.ensureMarks(filteredMarks);
|
|
1653
|
-
if (canWrapInList) {
|
|
1654
|
-
return true;
|
|
1655
|
-
}
|
|
1656
|
-
return commands2.clearNodes();
|
|
1657
|
-
}).wrapInList(listType, attributes).command(() => joinListBackwards(tr, listType)).command(() => joinListForwards(tr, listType)).run();
|
|
1658
|
-
};
|
|
1659
|
-
toggleMark = (typeOrName, attributes = {}, options = {}) => ({ state, commands: commands2 }) => {
|
|
1660
|
-
const { extendEmptyMarkRange = false } = options;
|
|
1661
|
-
const type = getMarkType(typeOrName, state.schema);
|
|
1662
|
-
const isActive = isMarkActive(state, type, attributes);
|
|
1663
|
-
if (isActive) {
|
|
1664
|
-
return commands2.unsetMark(type, { extendEmptyMarkRange });
|
|
1665
|
-
}
|
|
1666
|
-
return commands2.setMark(type, attributes);
|
|
1667
|
-
};
|
|
1668
|
-
toggleNode = (typeOrName, toggleTypeOrName, attributes = {}) => ({ state, commands: commands2 }) => {
|
|
1669
|
-
const type = getNodeType(typeOrName, state.schema);
|
|
1670
|
-
const toggleType = getNodeType(toggleTypeOrName, state.schema);
|
|
1671
|
-
const isActive = isNodeActive(state, type, attributes);
|
|
1672
|
-
let attributesToCopy;
|
|
1673
|
-
if (state.selection.$anchor.sameParent(state.selection.$head)) {
|
|
1674
|
-
attributesToCopy = state.selection.$anchor.parent.attrs;
|
|
1675
|
-
}
|
|
1676
|
-
if (isActive) {
|
|
1677
|
-
return commands2.setNode(toggleType, attributesToCopy);
|
|
1678
|
-
}
|
|
1679
|
-
return commands2.setNode(type, { ...attributesToCopy, ...attributes });
|
|
1680
|
-
};
|
|
1681
|
-
toggleWrap = (typeOrName, attributes = {}) => ({ state, commands: commands2 }) => {
|
|
1682
|
-
const type = getNodeType(typeOrName, state.schema);
|
|
1683
|
-
const isActive = isNodeActive(state, type, attributes);
|
|
1684
|
-
if (isActive) {
|
|
1685
|
-
return commands2.lift(type);
|
|
1686
|
-
}
|
|
1687
|
-
return commands2.wrapIn(type, attributes);
|
|
1688
|
-
};
|
|
1689
|
-
undoInputRule = () => ({ state, dispatch }) => {
|
|
1690
|
-
const plugins = state.plugins;
|
|
1691
|
-
for (let i = 0; i < plugins.length; i += 1) {
|
|
1692
|
-
const plugin = plugins[i];
|
|
1693
|
-
let undoable;
|
|
1694
|
-
if (plugin.spec.isInputRules && (undoable = plugin.getState(state))) {
|
|
1695
|
-
if (dispatch) {
|
|
1696
|
-
const tr = state.tr;
|
|
1697
|
-
const toUndo = undoable.transform;
|
|
1698
|
-
for (let j = toUndo.steps.length - 1; j >= 0; j -= 1) {
|
|
1699
|
-
tr.step(toUndo.steps[j].invert(toUndo.docs[j]));
|
|
1700
|
-
}
|
|
1701
|
-
if (undoable.text) {
|
|
1702
|
-
const marks = tr.doc.resolve(undoable.from).marks();
|
|
1703
|
-
tr.replaceWith(undoable.from, undoable.to, state.schema.text(undoable.text, marks));
|
|
1704
|
-
} else {
|
|
1705
|
-
tr.delete(undoable.from, undoable.to);
|
|
1706
|
-
}
|
|
1707
|
-
}
|
|
1708
|
-
return true;
|
|
1709
|
-
}
|
|
1710
|
-
}
|
|
1711
|
-
return false;
|
|
1712
|
-
};
|
|
1713
|
-
unsetAllMarks = () => ({ tr, dispatch }) => {
|
|
1714
|
-
const { selection } = tr;
|
|
1715
|
-
const { empty, ranges } = selection;
|
|
1716
|
-
if (empty) {
|
|
1717
|
-
return true;
|
|
1718
|
-
}
|
|
1719
|
-
if (dispatch) {
|
|
1720
|
-
ranges.forEach((range) => {
|
|
1721
|
-
tr.removeMark(range.$from.pos, range.$to.pos);
|
|
1722
|
-
});
|
|
1723
|
-
}
|
|
1724
|
-
return true;
|
|
1725
|
-
};
|
|
1726
|
-
unsetMark = (typeOrName, options = {}) => ({ tr, state, dispatch }) => {
|
|
1727
|
-
var _a;
|
|
1728
|
-
const { extendEmptyMarkRange = false } = options;
|
|
1729
|
-
const { selection } = tr;
|
|
1730
|
-
const type = getMarkType(typeOrName, state.schema);
|
|
1731
|
-
const { $from, empty, ranges } = selection;
|
|
1732
|
-
if (!dispatch) {
|
|
1733
|
-
return true;
|
|
1734
|
-
}
|
|
1735
|
-
if (empty && extendEmptyMarkRange) {
|
|
1736
|
-
let { from, to } = selection;
|
|
1737
|
-
const attrs = (_a = $from.marks().find((mark) => mark.type === type)) === null || _a === void 0 ? void 0 : _a.attrs;
|
|
1738
|
-
const range = getMarkRange($from, type, attrs);
|
|
1739
|
-
if (range) {
|
|
1740
|
-
from = range.from;
|
|
1741
|
-
to = range.to;
|
|
1742
|
-
}
|
|
1743
|
-
tr.removeMark(from, to, type);
|
|
1744
|
-
} else {
|
|
1745
|
-
ranges.forEach((range) => {
|
|
1746
|
-
tr.removeMark(range.$from.pos, range.$to.pos, type);
|
|
1747
|
-
});
|
|
1748
|
-
}
|
|
1749
|
-
tr.removeStoredMark(type);
|
|
1750
|
-
return true;
|
|
1751
|
-
};
|
|
1752
|
-
updateAttributes = (typeOrName, attributes = {}) => ({ tr, state, dispatch }) => {
|
|
1753
|
-
let nodeType = null;
|
|
1754
|
-
let markType = null;
|
|
1755
|
-
const schemaType = getSchemaTypeNameByName(typeof typeOrName === "string" ? typeOrName : typeOrName.name, state.schema);
|
|
1756
|
-
if (!schemaType) {
|
|
1757
|
-
return false;
|
|
1758
|
-
}
|
|
1759
|
-
if (schemaType === "node") {
|
|
1760
|
-
nodeType = getNodeType(typeOrName, state.schema);
|
|
1761
|
-
}
|
|
1762
|
-
if (schemaType === "mark") {
|
|
1763
|
-
markType = getMarkType(typeOrName, state.schema);
|
|
1764
|
-
}
|
|
1765
|
-
if (dispatch) {
|
|
1766
|
-
tr.selection.ranges.forEach((range) => {
|
|
1767
|
-
const from = range.$from.pos;
|
|
1768
|
-
const to = range.$to.pos;
|
|
1769
|
-
let lastPos;
|
|
1770
|
-
let lastNode;
|
|
1771
|
-
let trimmedFrom;
|
|
1772
|
-
let trimmedTo;
|
|
1773
|
-
if (tr.selection.empty) {
|
|
1774
|
-
state.doc.nodesBetween(from, to, (node, pos) => {
|
|
1775
|
-
if (nodeType && nodeType === node.type) {
|
|
1776
|
-
trimmedFrom = Math.max(pos, from);
|
|
1777
|
-
trimmedTo = Math.min(pos + node.nodeSize, to);
|
|
1778
|
-
lastPos = pos;
|
|
1779
|
-
lastNode = node;
|
|
1780
|
-
}
|
|
1781
|
-
});
|
|
1782
|
-
} else {
|
|
1783
|
-
state.doc.nodesBetween(from, to, (node, pos) => {
|
|
1784
|
-
if (pos < from && nodeType && nodeType === node.type) {
|
|
1785
|
-
trimmedFrom = Math.max(pos, from);
|
|
1786
|
-
trimmedTo = Math.min(pos + node.nodeSize, to);
|
|
1787
|
-
lastPos = pos;
|
|
1788
|
-
lastNode = node;
|
|
1789
|
-
}
|
|
1790
|
-
if (pos >= from && pos <= to) {
|
|
1791
|
-
if (nodeType && nodeType === node.type) {
|
|
1792
|
-
tr.setNodeMarkup(pos, void 0, {
|
|
1793
|
-
...node.attrs,
|
|
1794
|
-
...attributes
|
|
1795
|
-
});
|
|
1796
|
-
}
|
|
1797
|
-
if (markType && node.marks.length) {
|
|
1798
|
-
node.marks.forEach((mark) => {
|
|
1799
|
-
if (markType === mark.type) {
|
|
1800
|
-
const trimmedFrom2 = Math.max(pos, from);
|
|
1801
|
-
const trimmedTo2 = Math.min(pos + node.nodeSize, to);
|
|
1802
|
-
tr.addMark(trimmedFrom2, trimmedTo2, markType.create({
|
|
1803
|
-
...mark.attrs,
|
|
1804
|
-
...attributes
|
|
1805
|
-
}));
|
|
1806
|
-
}
|
|
1807
|
-
});
|
|
1808
|
-
}
|
|
1809
|
-
}
|
|
1810
|
-
});
|
|
1811
|
-
}
|
|
1812
|
-
if (lastNode) {
|
|
1813
|
-
if (lastPos !== void 0) {
|
|
1814
|
-
tr.setNodeMarkup(lastPos, void 0, {
|
|
1815
|
-
...lastNode.attrs,
|
|
1816
|
-
...attributes
|
|
1817
|
-
});
|
|
1818
|
-
}
|
|
1819
|
-
if (markType && lastNode.marks.length) {
|
|
1820
|
-
lastNode.marks.forEach((mark) => {
|
|
1821
|
-
if (markType === mark.type) {
|
|
1822
|
-
tr.addMark(trimmedFrom, trimmedTo, markType.create({
|
|
1823
|
-
...mark.attrs,
|
|
1824
|
-
...attributes
|
|
1825
|
-
}));
|
|
1826
|
-
}
|
|
1827
|
-
});
|
|
1828
|
-
}
|
|
1829
|
-
}
|
|
1830
|
-
});
|
|
1831
|
-
}
|
|
1832
|
-
return true;
|
|
1833
|
-
};
|
|
1834
|
-
wrapIn = (typeOrName, attributes = {}) => ({ state, dispatch }) => {
|
|
1835
|
-
const type = getNodeType(typeOrName, state.schema);
|
|
1836
|
-
return wrapIn$1(type, attributes)(state, dispatch);
|
|
1837
|
-
};
|
|
1838
|
-
wrapInList = (typeOrName, attributes = {}) => ({ state, dispatch }) => {
|
|
1839
|
-
const type = getNodeType(typeOrName, state.schema);
|
|
1840
|
-
return wrapInList$1(type, attributes)(state, dispatch);
|
|
1841
|
-
};
|
|
1842
|
-
commands = /* @__PURE__ */ Object.freeze({
|
|
1843
|
-
__proto__: null,
|
|
1844
|
-
blur,
|
|
1845
|
-
clearContent,
|
|
1846
|
-
clearNodes,
|
|
1847
|
-
command,
|
|
1848
|
-
createParagraphNear,
|
|
1849
|
-
cut,
|
|
1850
|
-
deleteCurrentNode,
|
|
1851
|
-
deleteNode,
|
|
1852
|
-
deleteRange,
|
|
1853
|
-
deleteSelection,
|
|
1854
|
-
enter,
|
|
1855
|
-
exitCode,
|
|
1856
|
-
extendMarkRange,
|
|
1857
|
-
first,
|
|
1858
|
-
focus,
|
|
1859
|
-
forEach,
|
|
1860
|
-
insertContent,
|
|
1861
|
-
insertContentAt,
|
|
1862
|
-
joinBackward,
|
|
1863
|
-
joinDown,
|
|
1864
|
-
joinForward,
|
|
1865
|
-
joinItemBackward,
|
|
1866
|
-
joinItemForward,
|
|
1867
|
-
joinTextblockBackward,
|
|
1868
|
-
joinTextblockForward,
|
|
1869
|
-
joinUp,
|
|
1870
|
-
keyboardShortcut,
|
|
1871
|
-
lift,
|
|
1872
|
-
liftEmptyBlock,
|
|
1873
|
-
liftListItem,
|
|
1874
|
-
newlineInCode,
|
|
1875
|
-
resetAttributes,
|
|
1876
|
-
scrollIntoView,
|
|
1877
|
-
selectAll,
|
|
1878
|
-
selectNodeBackward,
|
|
1879
|
-
selectNodeForward,
|
|
1880
|
-
selectParentNode,
|
|
1881
|
-
selectTextblockEnd,
|
|
1882
|
-
selectTextblockStart,
|
|
1883
|
-
setContent,
|
|
1884
|
-
setMark,
|
|
1885
|
-
setMeta,
|
|
1886
|
-
setNode,
|
|
1887
|
-
setNodeSelection,
|
|
1888
|
-
setTextSelection,
|
|
1889
|
-
sinkListItem,
|
|
1890
|
-
splitBlock,
|
|
1891
|
-
splitListItem,
|
|
1892
|
-
toggleList,
|
|
1893
|
-
toggleMark,
|
|
1894
|
-
toggleNode,
|
|
1895
|
-
toggleWrap,
|
|
1896
|
-
undoInputRule,
|
|
1897
|
-
unsetAllMarks,
|
|
1898
|
-
unsetMark,
|
|
1899
|
-
updateAttributes,
|
|
1900
|
-
wrapIn,
|
|
1901
|
-
wrapInList
|
|
1902
|
-
});
|
|
1903
|
-
Commands = Extension.create({
|
|
1904
|
-
name: "commands",
|
|
1905
|
-
addCommands() {
|
|
1906
|
-
return {
|
|
1907
|
-
...commands
|
|
1908
|
-
};
|
|
1909
|
-
}
|
|
1910
|
-
});
|
|
1911
|
-
Drop = Extension.create({
|
|
1912
|
-
name: "drop",
|
|
1913
|
-
addProseMirrorPlugins() {
|
|
1914
|
-
return [
|
|
1915
|
-
new Plugin({
|
|
1916
|
-
key: new PluginKey("tiptapDrop"),
|
|
1917
|
-
props: {
|
|
1918
|
-
handleDrop: (_, e, slice, moved) => {
|
|
1919
|
-
this.editor.emit("drop", {
|
|
1920
|
-
editor: this.editor,
|
|
1921
|
-
event: e,
|
|
1922
|
-
slice,
|
|
1923
|
-
moved
|
|
1924
|
-
});
|
|
1925
|
-
}
|
|
1926
|
-
}
|
|
1927
|
-
})
|
|
1928
|
-
];
|
|
1929
|
-
}
|
|
1930
|
-
});
|
|
1931
|
-
Editable = Extension.create({
|
|
1932
|
-
name: "editable",
|
|
1933
|
-
addProseMirrorPlugins() {
|
|
1934
|
-
return [
|
|
1935
|
-
new Plugin({
|
|
1936
|
-
key: new PluginKey("editable"),
|
|
1937
|
-
props: {
|
|
1938
|
-
editable: () => this.editor.options.editable
|
|
1939
|
-
}
|
|
1940
|
-
})
|
|
1941
|
-
];
|
|
1942
|
-
}
|
|
1943
|
-
});
|
|
1944
|
-
focusEventsPluginKey = new PluginKey("focusEvents");
|
|
1945
|
-
FocusEvents = Extension.create({
|
|
1946
|
-
name: "focusEvents",
|
|
1947
|
-
addProseMirrorPlugins() {
|
|
1948
|
-
const { editor } = this;
|
|
1949
|
-
return [
|
|
1950
|
-
new Plugin({
|
|
1951
|
-
key: focusEventsPluginKey,
|
|
1952
|
-
props: {
|
|
1953
|
-
handleDOMEvents: {
|
|
1954
|
-
focus: (view, event) => {
|
|
1955
|
-
editor.isFocused = true;
|
|
1956
|
-
const transaction = editor.state.tr.setMeta("focus", { event }).setMeta("addToHistory", false);
|
|
1957
|
-
view.dispatch(transaction);
|
|
1958
|
-
return false;
|
|
1959
|
-
},
|
|
1960
|
-
blur: (view, event) => {
|
|
1961
|
-
editor.isFocused = false;
|
|
1962
|
-
const transaction = editor.state.tr.setMeta("blur", { event }).setMeta("addToHistory", false);
|
|
1963
|
-
view.dispatch(transaction);
|
|
1964
|
-
return false;
|
|
1965
|
-
}
|
|
1966
|
-
}
|
|
1967
|
-
}
|
|
1968
|
-
})
|
|
1969
|
-
];
|
|
1970
|
-
}
|
|
1971
|
-
});
|
|
1972
|
-
Keymap = Extension.create({
|
|
1973
|
-
name: "keymap",
|
|
1974
|
-
addKeyboardShortcuts() {
|
|
1975
|
-
const handleBackspace = () => this.editor.commands.first(({ commands: commands2 }) => [
|
|
1976
|
-
() => commands2.undoInputRule(),
|
|
1977
|
-
// maybe convert first text block node to default node
|
|
1978
|
-
() => commands2.command(({ tr }) => {
|
|
1979
|
-
const { selection, doc } = tr;
|
|
1980
|
-
const { empty, $anchor } = selection;
|
|
1981
|
-
const { pos, parent } = $anchor;
|
|
1982
|
-
const $parentPos = $anchor.parent.isTextblock && pos > 0 ? tr.doc.resolve(pos - 1) : $anchor;
|
|
1983
|
-
const parentIsIsolating = $parentPos.parent.type.spec.isolating;
|
|
1984
|
-
const parentPos = $anchor.pos - $anchor.parentOffset;
|
|
1985
|
-
const isAtStart = parentIsIsolating && $parentPos.parent.childCount === 1 ? parentPos === $anchor.pos : Selection.atStart(doc).from === pos;
|
|
1986
|
-
if (!empty || !parent.type.isTextblock || parent.textContent.length || !isAtStart || isAtStart && $anchor.parent.type.name === "paragraph") {
|
|
1987
|
-
return false;
|
|
1988
|
-
}
|
|
1989
|
-
return commands2.clearNodes();
|
|
1990
|
-
}),
|
|
1991
|
-
() => commands2.deleteSelection(),
|
|
1992
|
-
() => commands2.joinBackward(),
|
|
1993
|
-
() => commands2.selectNodeBackward()
|
|
1994
|
-
]);
|
|
1995
|
-
const handleDelete = () => this.editor.commands.first(({ commands: commands2 }) => [
|
|
1996
|
-
() => commands2.deleteSelection(),
|
|
1997
|
-
() => commands2.deleteCurrentNode(),
|
|
1998
|
-
() => commands2.joinForward(),
|
|
1999
|
-
() => commands2.selectNodeForward()
|
|
2000
|
-
]);
|
|
2001
|
-
const handleEnter = () => this.editor.commands.first(({ commands: commands2 }) => [
|
|
2002
|
-
() => commands2.newlineInCode(),
|
|
2003
|
-
() => commands2.createParagraphNear(),
|
|
2004
|
-
() => commands2.liftEmptyBlock(),
|
|
2005
|
-
() => commands2.splitBlock()
|
|
2006
|
-
]);
|
|
2007
|
-
const baseKeymap = {
|
|
2008
|
-
Enter: handleEnter,
|
|
2009
|
-
"Mod-Enter": () => this.editor.commands.exitCode(),
|
|
2010
|
-
Backspace: handleBackspace,
|
|
2011
|
-
"Mod-Backspace": handleBackspace,
|
|
2012
|
-
"Shift-Backspace": handleBackspace,
|
|
2013
|
-
Delete: handleDelete,
|
|
2014
|
-
"Mod-Delete": handleDelete,
|
|
2015
|
-
"Mod-a": () => this.editor.commands.selectAll()
|
|
2016
|
-
};
|
|
2017
|
-
const pcKeymap = {
|
|
2018
|
-
...baseKeymap
|
|
2019
|
-
};
|
|
2020
|
-
const macKeymap = {
|
|
2021
|
-
...baseKeymap,
|
|
2022
|
-
"Ctrl-h": handleBackspace,
|
|
2023
|
-
"Alt-Backspace": handleBackspace,
|
|
2024
|
-
"Ctrl-d": handleDelete,
|
|
2025
|
-
"Ctrl-Alt-Backspace": handleDelete,
|
|
2026
|
-
"Alt-Delete": handleDelete,
|
|
2027
|
-
"Alt-d": handleDelete,
|
|
2028
|
-
"Ctrl-a": () => this.editor.commands.selectTextblockStart(),
|
|
2029
|
-
"Ctrl-e": () => this.editor.commands.selectTextblockEnd()
|
|
2030
|
-
};
|
|
2031
|
-
if (isiOS() || isMacOS()) {
|
|
2032
|
-
return macKeymap;
|
|
2033
|
-
}
|
|
2034
|
-
return pcKeymap;
|
|
2035
|
-
},
|
|
2036
|
-
addProseMirrorPlugins() {
|
|
2037
|
-
return [
|
|
2038
|
-
// With this plugin we check if the whole document was selected and deleted.
|
|
2039
|
-
// In this case we will additionally call `clearNodes()` to convert e.g. a heading
|
|
2040
|
-
// to a paragraph if necessary.
|
|
2041
|
-
// This is an alternative to ProseMirror's `AllSelection`, which doesn’t work well
|
|
2042
|
-
// with many other commands.
|
|
2043
|
-
new Plugin({
|
|
2044
|
-
key: new PluginKey("clearDocument"),
|
|
2045
|
-
appendTransaction: (transactions, oldState, newState) => {
|
|
2046
|
-
if (transactions.some((tr2) => tr2.getMeta("composition"))) {
|
|
2047
|
-
return;
|
|
2048
|
-
}
|
|
2049
|
-
const docChanges = transactions.some((transaction) => transaction.docChanged) && !oldState.doc.eq(newState.doc);
|
|
2050
|
-
const ignoreTr = transactions.some((transaction) => transaction.getMeta("preventClearDocument"));
|
|
2051
|
-
if (!docChanges || ignoreTr) {
|
|
2052
|
-
return;
|
|
2053
|
-
}
|
|
2054
|
-
const { empty, from, to } = oldState.selection;
|
|
2055
|
-
const allFrom = Selection.atStart(oldState.doc).from;
|
|
2056
|
-
const allEnd = Selection.atEnd(oldState.doc).to;
|
|
2057
|
-
const allWasSelected = from === allFrom && to === allEnd;
|
|
2058
|
-
if (empty || !allWasSelected) {
|
|
2059
|
-
return;
|
|
2060
|
-
}
|
|
2061
|
-
const isEmpty = isNodeEmpty(newState.doc);
|
|
2062
|
-
if (!isEmpty) {
|
|
2063
|
-
return;
|
|
2064
|
-
}
|
|
2065
|
-
const tr = newState.tr;
|
|
2066
|
-
const state = createChainableState({
|
|
2067
|
-
state: newState,
|
|
2068
|
-
transaction: tr
|
|
2069
|
-
});
|
|
2070
|
-
const { commands: commands2 } = new CommandManager({
|
|
2071
|
-
editor: this.editor,
|
|
2072
|
-
state
|
|
2073
|
-
});
|
|
2074
|
-
commands2.clearNodes();
|
|
2075
|
-
if (!tr.steps.length) {
|
|
2076
|
-
return;
|
|
2077
|
-
}
|
|
2078
|
-
return tr;
|
|
2079
|
-
}
|
|
2080
|
-
})
|
|
2081
|
-
];
|
|
2082
|
-
}
|
|
2083
|
-
});
|
|
2084
|
-
Paste = Extension.create({
|
|
2085
|
-
name: "paste",
|
|
2086
|
-
addProseMirrorPlugins() {
|
|
2087
|
-
return [
|
|
2088
|
-
new Plugin({
|
|
2089
|
-
key: new PluginKey("tiptapPaste"),
|
|
2090
|
-
props: {
|
|
2091
|
-
handlePaste: (_view, e, slice) => {
|
|
2092
|
-
this.editor.emit("paste", {
|
|
2093
|
-
editor: this.editor,
|
|
2094
|
-
event: e,
|
|
2095
|
-
slice
|
|
2096
|
-
});
|
|
2097
|
-
}
|
|
2098
|
-
}
|
|
2099
|
-
})
|
|
2100
|
-
];
|
|
2101
|
-
}
|
|
2102
|
-
});
|
|
2103
|
-
Tabindex = Extension.create({
|
|
2104
|
-
name: "tabindex",
|
|
2105
|
-
addProseMirrorPlugins() {
|
|
2106
|
-
return [
|
|
2107
|
-
new Plugin({
|
|
2108
|
-
key: new PluginKey("tabindex"),
|
|
2109
|
-
props: {
|
|
2110
|
-
attributes: () => this.editor.isEditable ? { tabindex: "0" } : {}
|
|
2111
|
-
}
|
|
2112
|
-
})
|
|
2113
|
-
];
|
|
2114
|
-
}
|
|
2115
|
-
});
|
|
2116
|
-
Node = class _Node {
|
|
2117
|
-
constructor(config = {}) {
|
|
2118
|
-
this.type = "node";
|
|
2119
|
-
this.name = "node";
|
|
2120
|
-
this.parent = null;
|
|
2121
|
-
this.child = null;
|
|
2122
|
-
this.config = {
|
|
2123
|
-
name: this.name,
|
|
2124
|
-
defaultOptions: {}
|
|
2125
|
-
};
|
|
2126
|
-
this.config = {
|
|
2127
|
-
...this.config,
|
|
2128
|
-
...config
|
|
2129
|
-
};
|
|
2130
|
-
this.name = this.config.name;
|
|
2131
|
-
if (config.defaultOptions && Object.keys(config.defaultOptions).length > 0) {
|
|
2132
|
-
console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`);
|
|
2133
|
-
}
|
|
2134
|
-
this.options = this.config.defaultOptions;
|
|
2135
|
-
if (this.config.addOptions) {
|
|
2136
|
-
this.options = callOrReturn(getExtensionField(this, "addOptions", {
|
|
2137
|
-
name: this.name
|
|
2138
|
-
}));
|
|
2139
|
-
}
|
|
2140
|
-
this.storage = callOrReturn(getExtensionField(this, "addStorage", {
|
|
2141
|
-
name: this.name,
|
|
2142
|
-
options: this.options
|
|
2143
|
-
})) || {};
|
|
2144
|
-
}
|
|
2145
|
-
static create(config = {}) {
|
|
2146
|
-
return new _Node(config);
|
|
2147
|
-
}
|
|
2148
|
-
configure(options = {}) {
|
|
2149
|
-
const extension = this.extend({
|
|
2150
|
-
...this.config,
|
|
2151
|
-
addOptions: () => {
|
|
2152
|
-
return mergeDeep(this.options, options);
|
|
2153
|
-
}
|
|
2154
|
-
});
|
|
2155
|
-
extension.name = this.name;
|
|
2156
|
-
extension.parent = this.parent;
|
|
2157
|
-
return extension;
|
|
2158
|
-
}
|
|
2159
|
-
extend(extendedConfig = {}) {
|
|
2160
|
-
const extension = new _Node(extendedConfig);
|
|
2161
|
-
extension.parent = this;
|
|
2162
|
-
this.child = extension;
|
|
2163
|
-
extension.name = extendedConfig.name ? extendedConfig.name : extension.parent.name;
|
|
2164
|
-
if (extendedConfig.defaultOptions && Object.keys(extendedConfig.defaultOptions).length > 0) {
|
|
2165
|
-
console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${extension.name}".`);
|
|
2166
|
-
}
|
|
2167
|
-
extension.options = callOrReturn(getExtensionField(extension, "addOptions", {
|
|
2168
|
-
name: extension.name
|
|
2169
|
-
}));
|
|
2170
|
-
extension.storage = callOrReturn(getExtensionField(extension, "addStorage", {
|
|
2171
|
-
name: extension.name,
|
|
2172
|
-
options: extension.options
|
|
2173
|
-
}));
|
|
2174
|
-
return extension;
|
|
2175
|
-
}
|
|
2176
|
-
};
|
|
2177
|
-
}
|
|
2178
|
-
});
|
|
2179
|
-
|
|
2180
42
|
// src/extensions/FontSize.ts
|
|
43
|
+
import { Extension } from "@tiptap/core";
|
|
2181
44
|
var FontSize;
|
|
2182
45
|
var init_FontSize = __esm({
|
|
2183
46
|
"src/extensions/FontSize.ts"() {
|
|
2184
47
|
"use strict";
|
|
2185
|
-
init_dist();
|
|
2186
48
|
FontSize = Extension.create({
|
|
2187
49
|
name: "fontSize",
|
|
2188
50
|
addOptions() {
|
|
@@ -2226,12 +88,12 @@ var init_FontSize = __esm({
|
|
|
2226
88
|
});
|
|
2227
89
|
|
|
2228
90
|
// src/extensions/LineHeight.ts
|
|
91
|
+
import { Extension as Extension2 } from "@tiptap/core";
|
|
2229
92
|
var LineHeight;
|
|
2230
93
|
var init_LineHeight = __esm({
|
|
2231
94
|
"src/extensions/LineHeight.ts"() {
|
|
2232
95
|
"use strict";
|
|
2233
|
-
|
|
2234
|
-
LineHeight = Extension.create({
|
|
96
|
+
LineHeight = Extension2.create({
|
|
2235
97
|
name: "lineHeight",
|
|
2236
98
|
addOptions() {
|
|
2237
99
|
return {
|
|
@@ -2262,14 +124,14 @@ var init_LineHeight = __esm({
|
|
|
2262
124
|
},
|
|
2263
125
|
addCommands() {
|
|
2264
126
|
return {
|
|
2265
|
-
setLineHeight: (lineHeight) => ({ commands
|
|
127
|
+
setLineHeight: (lineHeight) => ({ commands }) => {
|
|
2266
128
|
return this.options.types.every(
|
|
2267
|
-
(type) =>
|
|
129
|
+
(type) => commands.updateAttributes(type, { lineHeight })
|
|
2268
130
|
);
|
|
2269
131
|
},
|
|
2270
|
-
unsetLineHeight: () => ({ commands
|
|
132
|
+
unsetLineHeight: () => ({ commands }) => {
|
|
2271
133
|
return this.options.types.every(
|
|
2272
|
-
(type) =>
|
|
134
|
+
(type) => commands.resetAttributes(type, "lineHeight")
|
|
2273
135
|
);
|
|
2274
136
|
}
|
|
2275
137
|
};
|
|
@@ -2279,11 +141,11 @@ var init_LineHeight = __esm({
|
|
|
2279
141
|
});
|
|
2280
142
|
|
|
2281
143
|
// src/extensions/Video.ts
|
|
144
|
+
import { Node, mergeAttributes } from "@tiptap/core";
|
|
2282
145
|
var Video;
|
|
2283
146
|
var init_Video = __esm({
|
|
2284
147
|
"src/extensions/Video.ts"() {
|
|
2285
148
|
"use strict";
|
|
2286
|
-
init_dist();
|
|
2287
149
|
Video = Node.create({
|
|
2288
150
|
name: "video",
|
|
2289
151
|
addOptions() {
|
|
@@ -2338,8 +200,8 @@ var init_Video = __esm({
|
|
|
2338
200
|
},
|
|
2339
201
|
addCommands() {
|
|
2340
202
|
return {
|
|
2341
|
-
setVideo: (options) => ({ commands
|
|
2342
|
-
return
|
|
203
|
+
setVideo: (options) => ({ commands }) => {
|
|
204
|
+
return commands.insertContent({
|
|
2343
205
|
type: this.name,
|
|
2344
206
|
attrs: options
|
|
2345
207
|
});
|
|
@@ -2351,11 +213,11 @@ var init_Video = __esm({
|
|
|
2351
213
|
});
|
|
2352
214
|
|
|
2353
215
|
// src/extensions/Emoji.ts
|
|
216
|
+
import { Extension as Extension3 } from "@tiptap/core";
|
|
2354
217
|
var EMOJI_CATEGORIES, Emoji;
|
|
2355
218
|
var init_Emoji = __esm({
|
|
2356
219
|
"src/extensions/Emoji.ts"() {
|
|
2357
220
|
"use strict";
|
|
2358
|
-
init_dist();
|
|
2359
221
|
EMOJI_CATEGORIES = {
|
|
2360
222
|
smileys: {
|
|
2361
223
|
label: "Smileys & People",
|
|
@@ -3364,7 +1226,7 @@ var init_Emoji = __esm({
|
|
|
3364
1226
|
]
|
|
3365
1227
|
}
|
|
3366
1228
|
};
|
|
3367
|
-
Emoji =
|
|
1229
|
+
Emoji = Extension3.create({
|
|
3368
1230
|
name: "emoji",
|
|
3369
1231
|
addOptions() {
|
|
3370
1232
|
return {
|
|
@@ -3373,8 +1235,8 @@ var init_Emoji = __esm({
|
|
|
3373
1235
|
},
|
|
3374
1236
|
addCommands() {
|
|
3375
1237
|
return {
|
|
3376
|
-
insertEmoji: (emoji) => ({ commands
|
|
3377
|
-
return
|
|
1238
|
+
insertEmoji: (emoji) => ({ commands }) => {
|
|
1239
|
+
return commands.insertContent(emoji);
|
|
3378
1240
|
}
|
|
3379
1241
|
};
|
|
3380
1242
|
}
|
|
@@ -3383,12 +1245,12 @@ var init_Emoji = __esm({
|
|
|
3383
1245
|
});
|
|
3384
1246
|
|
|
3385
1247
|
// src/extensions/Fullscreen.ts
|
|
1248
|
+
import { Extension as Extension4 } from "@tiptap/core";
|
|
3386
1249
|
var Fullscreen;
|
|
3387
1250
|
var init_Fullscreen = __esm({
|
|
3388
1251
|
"src/extensions/Fullscreen.ts"() {
|
|
3389
1252
|
"use strict";
|
|
3390
|
-
|
|
3391
|
-
Fullscreen = Extension.create({
|
|
1253
|
+
Fullscreen = Extension4.create({
|
|
3392
1254
|
name: "fullscreen",
|
|
3393
1255
|
addOptions() {
|
|
3394
1256
|
return {
|
|
@@ -3454,11 +1316,11 @@ var init_Fullscreen = __esm({
|
|
|
3454
1316
|
});
|
|
3455
1317
|
|
|
3456
1318
|
// src/extensions/Print.ts
|
|
1319
|
+
import { Extension as Extension5 } from "@tiptap/core";
|
|
3457
1320
|
var defaultPrintStyles, Print;
|
|
3458
1321
|
var init_Print = __esm({
|
|
3459
1322
|
"src/extensions/Print.ts"() {
|
|
3460
1323
|
"use strict";
|
|
3461
|
-
init_dist();
|
|
3462
1324
|
defaultPrintStyles = `
|
|
3463
1325
|
body {
|
|
3464
1326
|
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
|
|
@@ -3574,7 +1436,7 @@ var init_Print = __esm({
|
|
|
3574
1436
|
}
|
|
3575
1437
|
}
|
|
3576
1438
|
`;
|
|
3577
|
-
Print =
|
|
1439
|
+
Print = Extension5.create({
|
|
3578
1440
|
name: "print",
|
|
3579
1441
|
addOptions() {
|
|
3580
1442
|
return {
|
|
@@ -3632,12 +1494,12 @@ var init_Print = __esm({
|
|
|
3632
1494
|
});
|
|
3633
1495
|
|
|
3634
1496
|
// src/extensions/Indent.ts
|
|
1497
|
+
import { Extension as Extension6 } from "@tiptap/core";
|
|
3635
1498
|
var Indent;
|
|
3636
1499
|
var init_Indent = __esm({
|
|
3637
1500
|
"src/extensions/Indent.ts"() {
|
|
3638
1501
|
"use strict";
|
|
3639
|
-
|
|
3640
|
-
Indent = Extension.create({
|
|
1502
|
+
Indent = Extension6.create({
|
|
3641
1503
|
name: "indent",
|
|
3642
1504
|
addOptions() {
|
|
3643
1505
|
return {
|
|
@@ -3851,7 +1713,7 @@ var init_TipTapToolbar = __esm({
|
|
|
3851
1713
|
onClick: () => editor.chain().focus().toggleBold().run(),
|
|
3852
1714
|
active: editor.isActive("bold"),
|
|
3853
1715
|
title: "Bold (Ctrl+B)",
|
|
3854
|
-
children: /* @__PURE__ */ jsx("
|
|
1716
|
+
children: /* @__PURE__ */ jsx("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ jsx("path", { d: "M15.6 10.79c.97-.67 1.65-1.77 1.65-2.79 0-2.26-1.75-4-4-4H7v14h7.04c2.09 0 3.71-1.7 3.71-3.79 0-1.52-.86-2.82-2.15-3.42zM10 6.5h3c.83 0 1.5.67 1.5 1.5s-.67 1.5-1.5 1.5h-3v-3zm3.5 9H10v-3h3.5c.83 0 1.5.67 1.5 1.5s-.67 1.5-1.5 1.5z" }) })
|
|
3855
1717
|
},
|
|
3856
1718
|
"bold"
|
|
3857
1719
|
);
|
|
@@ -3862,7 +1724,7 @@ var init_TipTapToolbar = __esm({
|
|
|
3862
1724
|
onClick: () => editor.chain().focus().toggleItalic().run(),
|
|
3863
1725
|
active: editor.isActive("italic"),
|
|
3864
1726
|
title: "Italic (Ctrl+I)",
|
|
3865
|
-
children: /* @__PURE__ */ jsx("
|
|
1727
|
+
children: /* @__PURE__ */ jsx("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ jsx("path", { d: "M10 4v3h2.21l-3.42 8H6v3h8v-3h-2.21l3.42-8H18V4z" }) })
|
|
3866
1728
|
},
|
|
3867
1729
|
"italic"
|
|
3868
1730
|
);
|
|
@@ -3873,7 +1735,7 @@ var init_TipTapToolbar = __esm({
|
|
|
3873
1735
|
onClick: () => editor.chain().focus().toggleUnderline().run(),
|
|
3874
1736
|
active: editor.isActive("underline"),
|
|
3875
1737
|
title: "Underline (Ctrl+U)",
|
|
3876
|
-
children: /* @__PURE__ */ jsx("
|
|
1738
|
+
children: /* @__PURE__ */ jsx("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ jsx("path", { d: "M12 17c3.31 0 6-2.69 6-6V3h-2.5v8c0 1.93-1.57 3.5-3.5 3.5S8.5 12.93 8.5 11V3H6v8c0 3.31 2.69 6 6 6zm-7 2v2h14v-2H5z" }) })
|
|
3877
1739
|
},
|
|
3878
1740
|
"underline"
|
|
3879
1741
|
);
|
|
@@ -3884,7 +1746,7 @@ var init_TipTapToolbar = __esm({
|
|
|
3884
1746
|
onClick: () => editor.chain().focus().toggleStrike().run(),
|
|
3885
1747
|
active: editor.isActive("strike"),
|
|
3886
1748
|
title: "Strikethrough",
|
|
3887
|
-
children: /* @__PURE__ */ jsx("
|
|
1749
|
+
children: /* @__PURE__ */ jsx("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ jsx("path", { d: "M10 19h4v-3h-4v3zM5 4v3h5v3h4V7h5V4H5zM3 14h18v-2H3v2z" }) })
|
|
3888
1750
|
},
|
|
3889
1751
|
"strike"
|
|
3890
1752
|
);
|
|
@@ -3895,7 +1757,23 @@ var init_TipTapToolbar = __esm({
|
|
|
3895
1757
|
onClick: () => editor.chain().focus().toggleCode().run(),
|
|
3896
1758
|
active: editor.isActive("code"),
|
|
3897
1759
|
title: "Inline Code",
|
|
3898
|
-
children:
|
|
1760
|
+
children: /* @__PURE__ */ jsxs(
|
|
1761
|
+
"svg",
|
|
1762
|
+
{
|
|
1763
|
+
width: "18",
|
|
1764
|
+
height: "18",
|
|
1765
|
+
viewBox: "0 0 24 24",
|
|
1766
|
+
fill: "none",
|
|
1767
|
+
stroke: "currentColor",
|
|
1768
|
+
strokeWidth: "2",
|
|
1769
|
+
strokeLinecap: "round",
|
|
1770
|
+
strokeLinejoin: "round",
|
|
1771
|
+
children: [
|
|
1772
|
+
/* @__PURE__ */ jsx("polyline", { points: "16 18 22 12 16 6" }),
|
|
1773
|
+
/* @__PURE__ */ jsx("polyline", { points: "8 6 2 12 8 18" })
|
|
1774
|
+
]
|
|
1775
|
+
}
|
|
1776
|
+
)
|
|
3899
1777
|
},
|
|
3900
1778
|
"code"
|
|
3901
1779
|
);
|
|
@@ -3906,35 +1784,46 @@ var init_TipTapToolbar = __esm({
|
|
|
3906
1784
|
onClick: () => editor.chain().focus().toggleCodeBlock().run(),
|
|
3907
1785
|
active: editor.isActive("codeBlock"),
|
|
3908
1786
|
title: "Code Block",
|
|
3909
|
-
children:
|
|
1787
|
+
children: /* @__PURE__ */ jsxs(
|
|
1788
|
+
"svg",
|
|
1789
|
+
{
|
|
1790
|
+
width: "18",
|
|
1791
|
+
height: "18",
|
|
1792
|
+
viewBox: "0 0 24 24",
|
|
1793
|
+
fill: "none",
|
|
1794
|
+
stroke: "currentColor",
|
|
1795
|
+
strokeWidth: "2",
|
|
1796
|
+
strokeLinecap: "round",
|
|
1797
|
+
strokeLinejoin: "round",
|
|
1798
|
+
children: [
|
|
1799
|
+
/* @__PURE__ */ jsx("rect", { x: "3", y: "3", width: "18", height: "18", rx: "2", ry: "2" }),
|
|
1800
|
+
/* @__PURE__ */ jsx("polyline", { points: "9 8 5 12 9 16" }),
|
|
1801
|
+
/* @__PURE__ */ jsx("polyline", { points: "15 8 19 12 15 16" })
|
|
1802
|
+
]
|
|
1803
|
+
}
|
|
1804
|
+
)
|
|
3910
1805
|
},
|
|
3911
1806
|
"codeBlock"
|
|
3912
1807
|
);
|
|
3913
1808
|
case "subscript":
|
|
3914
|
-
return /* @__PURE__ */
|
|
1809
|
+
return /* @__PURE__ */ jsx(
|
|
3915
1810
|
ToolbarButton3,
|
|
3916
1811
|
{
|
|
3917
1812
|
onClick: () => editor.chain().focus().toggleSubscript().run(),
|
|
3918
1813
|
active: editor.isActive("subscript"),
|
|
3919
1814
|
title: "Subscript",
|
|
3920
|
-
children:
|
|
3921
|
-
"X",
|
|
3922
|
-
/* @__PURE__ */ jsx("sub", { children: "2" })
|
|
3923
|
-
]
|
|
1815
|
+
children: /* @__PURE__ */ jsx("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ jsx("path", { d: "M22 18h-2v1h3v1h-4v-2.5a.5.5 0 01.5-.5h2a.5.5 0 00.5-.5v-.5H18v-1h4v2.5a.5.5 0 01-.5.5h-2a.5.5 0 00-.5.5v.5zM5.88 5h2.66l3.4 5.42h.12L15.5 5h2.62l-4.87 7.38L18.22 20h-2.66l-3.62-5.63h-.12l-3.62 5.63H5.56l4.92-7.62L5.88 5z" }) })
|
|
3924
1816
|
},
|
|
3925
1817
|
"subscript"
|
|
3926
1818
|
);
|
|
3927
1819
|
case "superscript":
|
|
3928
|
-
return /* @__PURE__ */
|
|
1820
|
+
return /* @__PURE__ */ jsx(
|
|
3929
1821
|
ToolbarButton3,
|
|
3930
1822
|
{
|
|
3931
1823
|
onClick: () => editor.chain().focus().toggleSuperscript().run(),
|
|
3932
1824
|
active: editor.isActive("superscript"),
|
|
3933
1825
|
title: "Superscript",
|
|
3934
|
-
children:
|
|
3935
|
-
"X",
|
|
3936
|
-
/* @__PURE__ */ jsx("sup", { children: "2" })
|
|
3937
|
-
]
|
|
1826
|
+
children: /* @__PURE__ */ jsx("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ jsx("path", { d: "M22 7h-2v1h3v1h-4V6.5a.5.5 0 01.5-.5h2a.5.5 0 00.5-.5v-.5H18V4h4v2.5a.5.5 0 01-.5.5h-2a.5.5 0 00-.5.5v.5zM5.88 5h2.66l3.4 5.42h.12L15.5 5h2.62l-4.87 7.38L18.22 20h-2.66l-3.62-5.63h-.12l-3.62 5.63H5.56l4.92-7.62L5.88 5z" }) })
|
|
3938
1827
|
},
|
|
3939
1828
|
"superscript"
|
|
3940
1829
|
);
|
|
@@ -3944,7 +1833,7 @@ var init_TipTapToolbar = __esm({
|
|
|
3944
1833
|
{
|
|
3945
1834
|
onClick: () => editor.chain().focus().clearNodes().unsetAllMarks().run(),
|
|
3946
1835
|
title: "Clear Formatting",
|
|
3947
|
-
children: "
|
|
1836
|
+
children: /* @__PURE__ */ jsx("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ jsx("path", { d: "M3.27 5L2 6.27l6.97 6.97L6.5 19h3l1.57-3.66L16.73 21 18 19.73 3.55 5.27 3.27 5zM6 5v.18L8.82 8h2.4l-.72 1.68 2.1 2.1L14.21 8H20V5H6z" }) })
|
|
3948
1837
|
},
|
|
3949
1838
|
"clearFormatting"
|
|
3950
1839
|
);
|
|
@@ -4010,29 +1899,85 @@ var init_TipTapToolbar = __esm({
|
|
|
4010
1899
|
"lineHeight"
|
|
4011
1900
|
);
|
|
4012
1901
|
case "textColor":
|
|
4013
|
-
|
|
4014
|
-
|
|
4015
|
-
/* @__PURE__ */ jsx(
|
|
4016
|
-
"
|
|
1902
|
+
const textPresetColors = ["#11a161", "#85144b", "#ff851b", "#b10dc9"];
|
|
1903
|
+
return /* @__PURE__ */ jsxs("span", { className: "rte-builder-toolbar-color-group", children: [
|
|
1904
|
+
textPresetColors.map((color) => /* @__PURE__ */ jsx(
|
|
1905
|
+
"button",
|
|
4017
1906
|
{
|
|
4018
|
-
|
|
4019
|
-
|
|
4020
|
-
|
|
4021
|
-
|
|
4022
|
-
|
|
4023
|
-
|
|
1907
|
+
className: "rte-builder-color-preset",
|
|
1908
|
+
style: { backgroundColor: color },
|
|
1909
|
+
onClick: () => editor.chain().focus().setColor(color).run(),
|
|
1910
|
+
title: `Text Color: ${color}`,
|
|
1911
|
+
type: "button"
|
|
1912
|
+
},
|
|
1913
|
+
`text-${color}`
|
|
1914
|
+
)),
|
|
1915
|
+
/* @__PURE__ */ jsx("span", { className: "rte-builder-toolbar-color", children: /* @__PURE__ */ jsxs("label", { title: "Custom Text Color", children: [
|
|
1916
|
+
/* @__PURE__ */ jsx(
|
|
1917
|
+
"svg",
|
|
1918
|
+
{
|
|
1919
|
+
width: "14",
|
|
1920
|
+
height: "14",
|
|
1921
|
+
viewBox: "0 0 24 24",
|
|
1922
|
+
fill: "currentColor",
|
|
1923
|
+
children: /* @__PURE__ */ jsx("path", { d: "M12 3c-4.97 0-9 4.03-9 9s4.03 9 9 9c.83 0 1.5-.67 1.5-1.5 0-.39-.15-.74-.39-1.01-.23-.26-.38-.61-.38-.99 0-.83.67-1.5 1.5-1.5H16c2.76 0 5-2.24 5-5 0-4.42-4.03-8-9-8zm-5.5 9c-.83 0-1.5-.67-1.5-1.5S5.67 9 6.5 9 8 9.67 8 10.5 7.33 12 6.5 12zm3-4C8.67 8 8 7.33 8 6.5S8.67 5 9.5 5s1.5.67 1.5 1.5S10.33 8 9.5 8zm5 0c-.83 0-1.5-.67-1.5-1.5S13.67 5 14.5 5s1.5.67 1.5 1.5S15.33 8 14.5 8zm3 4c-.83 0-1.5-.67-1.5-1.5S16.67 9 17.5 9s1.5.67 1.5 1.5-.67 1.5-1.5 1.5z" })
|
|
1924
|
+
}
|
|
1925
|
+
),
|
|
1926
|
+
/* @__PURE__ */ jsx(
|
|
1927
|
+
"input",
|
|
1928
|
+
{
|
|
1929
|
+
type: "color",
|
|
1930
|
+
onChange: (e) => editor.chain().focus().setColor(e.target.value).run(),
|
|
1931
|
+
value: editor.getAttributes("textStyle").color || "#000000"
|
|
1932
|
+
}
|
|
1933
|
+
)
|
|
1934
|
+
] }) })
|
|
1935
|
+
] }, "textColor");
|
|
4024
1936
|
case "backgroundColor":
|
|
4025
|
-
|
|
4026
|
-
|
|
4027
|
-
|
|
4028
|
-
|
|
4029
|
-
|
|
4030
|
-
|
|
4031
|
-
|
|
4032
|
-
|
|
4033
|
-
|
|
4034
|
-
|
|
4035
|
-
|
|
1937
|
+
const bgPresetColors = ["#11a161", "#85144b", "#ff851b", "#b10dc9"];
|
|
1938
|
+
return /* @__PURE__ */ jsxs(
|
|
1939
|
+
"span",
|
|
1940
|
+
{
|
|
1941
|
+
className: "rte-builder-toolbar-color-group",
|
|
1942
|
+
children: [
|
|
1943
|
+
bgPresetColors.map((color) => /* @__PURE__ */ jsx(
|
|
1944
|
+
"button",
|
|
1945
|
+
{
|
|
1946
|
+
className: "rte-builder-color-preset rte-builder-color-preset-bg",
|
|
1947
|
+
style: { backgroundColor: color },
|
|
1948
|
+
onClick: () => editor.chain().focus().toggleHighlight({ color }).run(),
|
|
1949
|
+
title: `Highlight Color: ${color}`,
|
|
1950
|
+
type: "button"
|
|
1951
|
+
},
|
|
1952
|
+
`bg-${color}`
|
|
1953
|
+
)),
|
|
1954
|
+
/* @__PURE__ */ jsx("span", { className: "rte-builder-toolbar-color", children: /* @__PURE__ */ jsxs("label", { title: "Custom Background Color", children: [
|
|
1955
|
+
/* @__PURE__ */ jsxs(
|
|
1956
|
+
"svg",
|
|
1957
|
+
{
|
|
1958
|
+
width: "14",
|
|
1959
|
+
height: "14",
|
|
1960
|
+
viewBox: "0 0 24 24",
|
|
1961
|
+
fill: "currentColor",
|
|
1962
|
+
children: [
|
|
1963
|
+
/* @__PURE__ */ jsx("path", { d: "M16.56 8.94L7.62 0 6.21 1.41l2.38 2.38-5.15 5.15c-.59.59-.59 1.54 0 2.12l5.5 5.5c.29.29.68.44 1.06.44s.77-.15 1.06-.44l5.5-5.5c.59-.58.59-1.53 0-2.12zM5.21 10L10 5.21 14.79 10H5.21zM19 11.5s-2 2.17-2 3.5c0 1.1.9 2 2 2s2-.9 2-2c0-1.33-2-3.5-2-3.5z" }),
|
|
1964
|
+
/* @__PURE__ */ jsx("path", { d: "M2 20h20v4H2z", fillOpacity: ".36" })
|
|
1965
|
+
]
|
|
1966
|
+
}
|
|
1967
|
+
),
|
|
1968
|
+
/* @__PURE__ */ jsx(
|
|
1969
|
+
"input",
|
|
1970
|
+
{
|
|
1971
|
+
type: "color",
|
|
1972
|
+
onChange: (e) => editor.chain().focus().toggleHighlight({ color: e.target.value }).run(),
|
|
1973
|
+
value: editor.getAttributes("highlight").color || "#ffff00"
|
|
1974
|
+
}
|
|
1975
|
+
)
|
|
1976
|
+
] }) })
|
|
1977
|
+
]
|
|
1978
|
+
},
|
|
1979
|
+
"backgroundColor"
|
|
1980
|
+
);
|
|
4036
1981
|
case "alignLeft":
|
|
4037
1982
|
return /* @__PURE__ */ jsx(
|
|
4038
1983
|
ToolbarButton3,
|
|
@@ -4040,7 +1985,7 @@ var init_TipTapToolbar = __esm({
|
|
|
4040
1985
|
onClick: () => editor.chain().focus().setTextAlign("left").run(),
|
|
4041
1986
|
active: editor.isActive({ textAlign: "left" }),
|
|
4042
1987
|
title: "Align Left",
|
|
4043
|
-
children: "
|
|
1988
|
+
children: /* @__PURE__ */ jsx("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ jsx("path", { d: "M15 15H3v2h12v-2zm0-8H3v2h12V7zM3 13h18v-2H3v2zm0 8h18v-2H3v2zM3 3v2h18V3H3z" }) })
|
|
4044
1989
|
},
|
|
4045
1990
|
"alignLeft"
|
|
4046
1991
|
);
|
|
@@ -4051,7 +1996,7 @@ var init_TipTapToolbar = __esm({
|
|
|
4051
1996
|
onClick: () => editor.chain().focus().setTextAlign("center").run(),
|
|
4052
1997
|
active: editor.isActive({ textAlign: "center" }),
|
|
4053
1998
|
title: "Align Center",
|
|
4054
|
-
children: "
|
|
1999
|
+
children: /* @__PURE__ */ jsx("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ jsx("path", { d: "M7 15v2h10v-2H7zm-4 6h18v-2H3v2zm0-8h18v-2H3v2zm4-6v2h10V7H7zM3 3v2h18V3H3z" }) })
|
|
4055
2000
|
},
|
|
4056
2001
|
"alignCenter"
|
|
4057
2002
|
);
|
|
@@ -4062,7 +2007,7 @@ var init_TipTapToolbar = __esm({
|
|
|
4062
2007
|
onClick: () => editor.chain().focus().setTextAlign("right").run(),
|
|
4063
2008
|
active: editor.isActive({ textAlign: "right" }),
|
|
4064
2009
|
title: "Align Right",
|
|
4065
|
-
children: "
|
|
2010
|
+
children: /* @__PURE__ */ jsx("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ jsx("path", { d: "M3 21h18v-2H3v2zm6-4h12v-2H9v2zm-6-4h18v-2H3v2zm6-4h12V7H9v2zM3 3v2h18V3H3z" }) })
|
|
4066
2011
|
},
|
|
4067
2012
|
"alignRight"
|
|
4068
2013
|
);
|
|
@@ -4073,7 +2018,7 @@ var init_TipTapToolbar = __esm({
|
|
|
4073
2018
|
onClick: () => editor.chain().focus().setTextAlign("justify").run(),
|
|
4074
2019
|
active: editor.isActive({ textAlign: "justify" }),
|
|
4075
2020
|
title: "Justify",
|
|
4076
|
-
children: "
|
|
2021
|
+
children: /* @__PURE__ */ jsx("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ jsx("path", { d: "M3 21h18v-2H3v2zm0-4h18v-2H3v2zm0-4h18v-2H3v2zm0-4h18V7H3v2zM3 3v2h18V3H3z" }) })
|
|
4077
2022
|
},
|
|
4078
2023
|
"alignJustify"
|
|
4079
2024
|
);
|
|
@@ -4083,7 +2028,7 @@ var init_TipTapToolbar = __esm({
|
|
|
4083
2028
|
{
|
|
4084
2029
|
onClick: () => editor.chain().focus().indent().run(),
|
|
4085
2030
|
title: "Indent (Tab)",
|
|
4086
|
-
children: "
|
|
2031
|
+
children: /* @__PURE__ */ jsx("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ jsx("path", { d: "M3 21h18v-2H3v2zM3 8v8l4-4-4-4zm8 9h10v-2H11v2zM3 3v2h18V3H3zm8 6h10V7H11v2zm0 4h10v-2H11v2z" }) })
|
|
4087
2032
|
},
|
|
4088
2033
|
"indent"
|
|
4089
2034
|
);
|
|
@@ -4093,7 +2038,7 @@ var init_TipTapToolbar = __esm({
|
|
|
4093
2038
|
{
|
|
4094
2039
|
onClick: () => editor.chain().focus().outdent().run(),
|
|
4095
2040
|
title: "Outdent (Shift+Tab)",
|
|
4096
|
-
children: "
|
|
2041
|
+
children: /* @__PURE__ */ jsx("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ jsx("path", { d: "M11 17h10v-2H11v2zm-8-5l4 4V8l-4 4zm0 9h18v-2H3v2zM3 3v2h18V3H3zm8 6h10V7H11v2zm0 4h10v-2H11v2z" }) })
|
|
4097
2042
|
},
|
|
4098
2043
|
"outdent"
|
|
4099
2044
|
);
|
|
@@ -4104,7 +2049,7 @@ var init_TipTapToolbar = __esm({
|
|
|
4104
2049
|
onClick: () => editor.chain().focus().toggleBulletList().run(),
|
|
4105
2050
|
active: editor.isActive("bulletList"),
|
|
4106
2051
|
title: "Bullet List",
|
|
4107
|
-
children: "
|
|
2052
|
+
children: /* @__PURE__ */ jsx("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ jsx("path", { d: "M4 10.5c-.83 0-1.5.67-1.5 1.5s.67 1.5 1.5 1.5 1.5-.67 1.5-1.5-.67-1.5-1.5-1.5zm0-6c-.83 0-1.5.67-1.5 1.5S3.17 7.5 4 7.5 5.5 6.83 5.5 6 4.83 4.5 4 4.5zm0 12c-.83 0-1.5.68-1.5 1.5s.68 1.5 1.5 1.5 1.5-.68 1.5-1.5-.67-1.5-1.5-1.5zM7 19h14v-2H7v2zm0-6h14v-2H7v2zm0-8v2h14V5H7z" }) })
|
|
4108
2053
|
},
|
|
4109
2054
|
"bulletList"
|
|
4110
2055
|
);
|
|
@@ -4115,7 +2060,7 @@ var init_TipTapToolbar = __esm({
|
|
|
4115
2060
|
onClick: () => editor.chain().focus().toggleOrderedList().run(),
|
|
4116
2061
|
active: editor.isActive("orderedList"),
|
|
4117
2062
|
title: "Numbered List",
|
|
4118
|
-
children: "1."
|
|
2063
|
+
children: /* @__PURE__ */ jsx("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ jsx("path", { d: "M2 17h2v.5H3v1h1v.5H2v1h3v-4H2v1zm1-9h1V4H2v1h1v3zm-1 3h1.8L2 13.1v.9h3v-1H3.2L5 10.9V10H2v1zm5-6v2h14V5H7zm0 14h14v-2H7v2zm0-6h14v-2H7v2z" }) })
|
|
4119
2064
|
},
|
|
4120
2065
|
"orderedList"
|
|
4121
2066
|
);
|
|
@@ -4126,16 +2071,21 @@ var init_TipTapToolbar = __esm({
|
|
|
4126
2071
|
case "heading5":
|
|
4127
2072
|
case "heading6":
|
|
4128
2073
|
const level = parseInt(button.replace("heading", ""));
|
|
4129
|
-
|
|
2074
|
+
const headingIcons = {
|
|
2075
|
+
1: /* @__PURE__ */ jsx("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ jsx("path", { d: "M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-5 14h-2V9h-2V7h4v10z" }) }),
|
|
2076
|
+
2: /* @__PURE__ */ jsx("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ jsx("path", { d: "M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-4 8c0 1.1-.9 2-2 2h-2v2h4v2H9v-4c0-1.1.9-2 2-2h2V9H9V7h4c1.1 0 2 .9 2 2v2z" }) }),
|
|
2077
|
+
3: /* @__PURE__ */ jsx("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ jsx("path", { d: "M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-4 8c0 1.1-.9 2-2 2v0c1.1 0 2 .9 2 2v0c0 1.1-.9 2-2 2H9v-2h4v-2h-2v-2h2V9H9V7h4c1.1 0 2 .9 2 2v2z" }) }),
|
|
2078
|
+
4: /* @__PURE__ */ jsx("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ jsx("path", { d: "M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-4 14h-2v-4H9V7h2v4h2V7h2v10z" }) }),
|
|
2079
|
+
5: /* @__PURE__ */ jsx("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ jsx("path", { d: "M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-4 6h-4v2h2c1.1 0 2 .9 2 2v2c0 1.1-.9 2-2 2H9v-2h4v-2H9V7h6v2z" }) }),
|
|
2080
|
+
6: /* @__PURE__ */ jsx("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ jsx("path", { d: "M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-4 8c0 1.1-.9 2-2 2h-2v-2h2V9H9v6h4c1.1 0 2-.9 2-2v-2c0-1.1-.9-2-2-2h-2V7h2c1.1 0 2 .9 2 2v2z" }) })
|
|
2081
|
+
};
|
|
2082
|
+
return /* @__PURE__ */ jsx(
|
|
4130
2083
|
ToolbarButton3,
|
|
4131
2084
|
{
|
|
4132
2085
|
onClick: () => editor.chain().focus().toggleHeading({ level }).run(),
|
|
4133
2086
|
active: editor.isActive("heading", { level }),
|
|
4134
2087
|
title: `Heading ${level}`,
|
|
4135
|
-
children: [
|
|
4136
|
-
"H",
|
|
4137
|
-
level
|
|
4138
|
-
]
|
|
2088
|
+
children: headingIcons[level]
|
|
4139
2089
|
},
|
|
4140
2090
|
button
|
|
4141
2091
|
);
|
|
@@ -4146,7 +2096,7 @@ var init_TipTapToolbar = __esm({
|
|
|
4146
2096
|
onClick: () => editor.chain().focus().toggleBlockquote().run(),
|
|
4147
2097
|
active: editor.isActive("blockquote"),
|
|
4148
2098
|
title: "Blockquote",
|
|
4149
|
-
children:
|
|
2099
|
+
children: /* @__PURE__ */ jsx("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ jsx("path", { d: "M6 17h3l2-4V7H5v6h3zm8 0h3l2-4V7h-6v6h3z" }) })
|
|
4150
2100
|
},
|
|
4151
2101
|
"blockquote"
|
|
4152
2102
|
);
|
|
@@ -4156,7 +2106,7 @@ var init_TipTapToolbar = __esm({
|
|
|
4156
2106
|
{
|
|
4157
2107
|
onClick: () => editor.chain().focus().setHorizontalRule().run(),
|
|
4158
2108
|
title: "Horizontal Rule",
|
|
4159
|
-
children: "
|
|
2109
|
+
children: /* @__PURE__ */ jsx("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ jsx("path", { d: "M4 11h16v2H4z" }) })
|
|
4160
2110
|
},
|
|
4161
2111
|
"horizontalRule"
|
|
4162
2112
|
);
|
|
@@ -4172,7 +2122,7 @@ var init_TipTapToolbar = __esm({
|
|
|
4172
2122
|
},
|
|
4173
2123
|
active: editor.isActive("link"),
|
|
4174
2124
|
title: "Insert Link",
|
|
4175
|
-
children: "
|
|
2125
|
+
children: /* @__PURE__ */ jsx("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ jsx("path", { d: "M3.9 12c0-1.71 1.39-3.1 3.1-3.1h4V7H7c-2.76 0-5 2.24-5 5s2.24 5 5 5h4v-1.9H7c-1.71 0-3.1-1.39-3.1-3.1zM8 13h8v-2H8v2zm9-6h-4v1.9h4c1.71 0 3.1 1.39 3.1 3.1s-1.39 3.1-3.1 3.1h-4V17h4c2.76 0 5-2.24 5-5s-2.24-5-5-5z" }) })
|
|
4176
2126
|
},
|
|
4177
2127
|
"link"
|
|
4178
2128
|
);
|
|
@@ -4183,7 +2133,7 @@ var init_TipTapToolbar = __esm({
|
|
|
4183
2133
|
onClick: () => editor.chain().focus().unsetLink().run(),
|
|
4184
2134
|
disabled: !editor.isActive("link"),
|
|
4185
2135
|
title: "Remove Link",
|
|
4186
|
-
children: "
|
|
2136
|
+
children: /* @__PURE__ */ jsx("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ jsx("path", { d: "M17 7h-4v1.9h4c1.71 0 3.1 1.39 3.1 3.1 0 1.43-.98 2.63-2.31 2.98l1.46 1.46C20.88 15.61 22 13.95 22 12c0-2.76-2.24-5-5-5zm-1 4h-2.19l2 2H16v-2zM2 4.27l3.11 3.11C3.29 8.12 2 9.91 2 12c0 2.76 2.24 5 5 5h4v-1.9H7c-1.71 0-3.1-1.39-3.1-3.1 0-1.59 1.21-2.9 2.76-3.07L8.73 11H8v2h2.73L13 15.27V17h1.73l4.01 4L20 19.74 3.27 3 2 4.27z" }) })
|
|
4187
2137
|
},
|
|
4188
2138
|
"unlink"
|
|
4189
2139
|
);
|
|
@@ -4202,7 +2152,7 @@ var init_TipTapToolbar = __esm({
|
|
|
4202
2152
|
}
|
|
4203
2153
|
},
|
|
4204
2154
|
title: "Insert Image",
|
|
4205
|
-
children: "
|
|
2155
|
+
children: /* @__PURE__ */ jsx("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ jsx("path", { d: "M21 19V5c0-1.1-.9-2-2-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2zM8.5 13.5l2.5 3.01L14.5 12l4.5 6H5l3.5-4.5z" }) })
|
|
4206
2156
|
},
|
|
4207
2157
|
"image"
|
|
4208
2158
|
);
|
|
@@ -4221,7 +2171,7 @@ var init_TipTapToolbar = __esm({
|
|
|
4221
2171
|
}
|
|
4222
2172
|
},
|
|
4223
2173
|
title: "Insert Video",
|
|
4224
|
-
children: "
|
|
2174
|
+
children: /* @__PURE__ */ jsx("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ jsx("path", { d: "M17 10.5V7c0-.55-.45-1-1-1H4c-.55 0-1 .45-1 1v10c0 .55.45 1 1 1h12c.55 0 1-.45 1-1v-3.5l4 4v-11l-4 4z" }) })
|
|
4225
2175
|
},
|
|
4226
2176
|
"video"
|
|
4227
2177
|
);
|
|
@@ -4231,7 +2181,7 @@ var init_TipTapToolbar = __esm({
|
|
|
4231
2181
|
{
|
|
4232
2182
|
onClick: () => editor.chain().focus().insertTable({ rows: 3, cols: 3, withHeaderRow: true }).run(),
|
|
4233
2183
|
title: "Insert Table",
|
|
4234
|
-
children: "
|
|
2184
|
+
children: /* @__PURE__ */ jsx("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ jsx("path", { d: "M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 2v4H5V5h14zm0 6v4h-6v-4h6zM5 15v-4h6v4H5zm0 2h6v2H5v-2zm8 2v-2h6v2h-6z" }) })
|
|
4235
2185
|
},
|
|
4236
2186
|
"table"
|
|
4237
2187
|
);
|
|
@@ -4244,7 +2194,16 @@ var init_TipTapToolbar = __esm({
|
|
|
4244
2194
|
onClick: () => setShowEmojiPicker(!showEmojiPicker),
|
|
4245
2195
|
active: showEmojiPicker,
|
|
4246
2196
|
title: "Insert Emoji",
|
|
4247
|
-
children:
|
|
2197
|
+
children: /* @__PURE__ */ jsx(
|
|
2198
|
+
"svg",
|
|
2199
|
+
{
|
|
2200
|
+
width: "16",
|
|
2201
|
+
height: "16",
|
|
2202
|
+
viewBox: "0 0 24 24",
|
|
2203
|
+
fill: "currentColor",
|
|
2204
|
+
children: /* @__PURE__ */ jsx("path", { d: "M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zM12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8zm3.5-9c.83 0 1.5-.67 1.5-1.5S16.33 8 15.5 8 14 8.67 14 9.5s.67 1.5 1.5 1.5zm-7 0c.83 0 1.5-.67 1.5-1.5S9.33 8 8.5 8 7 8.67 7 9.5 7.67 11 8.5 11zm3.5 6.5c2.33 0 4.31-1.46 5.11-3.5H6.89c.8 2.04 2.78 3.5 5.11 3.5z" })
|
|
2205
|
+
}
|
|
2206
|
+
)
|
|
4248
2207
|
}
|
|
4249
2208
|
),
|
|
4250
2209
|
showEmojiPicker && /* @__PURE__ */ jsx(
|
|
@@ -4263,7 +2222,25 @@ var init_TipTapToolbar = __esm({
|
|
|
4263
2222
|
onClick: () => editor.chain().focus().toggleFullscreen().run(),
|
|
4264
2223
|
active: isFullscreen,
|
|
4265
2224
|
title: isFullscreen ? "Exit Fullscreen (Esc)" : "Fullscreen (Ctrl+Shift+F)",
|
|
4266
|
-
children: isFullscreen ?
|
|
2225
|
+
children: isFullscreen ? /* @__PURE__ */ jsx(
|
|
2226
|
+
"svg",
|
|
2227
|
+
{
|
|
2228
|
+
width: "16",
|
|
2229
|
+
height: "16",
|
|
2230
|
+
viewBox: "0 0 24 24",
|
|
2231
|
+
fill: "currentColor",
|
|
2232
|
+
children: /* @__PURE__ */ jsx("path", { d: "M5 16h3v3h2v-5H5v2zm3-8H5v2h5V5H8v3zm6 11h2v-3h3v-2h-5v5zm2-11V5h-2v5h5V8h-3z" })
|
|
2233
|
+
}
|
|
2234
|
+
) : /* @__PURE__ */ jsx(
|
|
2235
|
+
"svg",
|
|
2236
|
+
{
|
|
2237
|
+
width: "16",
|
|
2238
|
+
height: "16",
|
|
2239
|
+
viewBox: "0 0 24 24",
|
|
2240
|
+
fill: "currentColor",
|
|
2241
|
+
children: /* @__PURE__ */ jsx("path", { d: "M7 14H5v5h5v-2H7v-3zm-2-4h2V7h3V5H5v5zm12 7h-3v2h5v-5h-2v3zM14 5v2h3v3h2V5h-5z" })
|
|
2242
|
+
}
|
|
2243
|
+
)
|
|
4267
2244
|
},
|
|
4268
2245
|
"fullscreen"
|
|
4269
2246
|
);
|
|
@@ -4273,7 +2250,7 @@ var init_TipTapToolbar = __esm({
|
|
|
4273
2250
|
{
|
|
4274
2251
|
onClick: () => editor.chain().focus().print().run(),
|
|
4275
2252
|
title: "Print (Ctrl+P)",
|
|
4276
|
-
children: "
|
|
2253
|
+
children: /* @__PURE__ */ jsx("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ jsx("path", { d: "M19 8H5c-1.66 0-3 1.34-3 3v6h4v4h12v-4h4v-6c0-1.66-1.34-3-3-3zm-3 11H8v-5h8v5zm3-7c-.55 0-1-.45-1-1s.45-1 1-1 1 .45 1 1-.45 1-1 1zm-1-9H6v4h12V3z" }) })
|
|
4277
2254
|
},
|
|
4278
2255
|
"print"
|
|
4279
2256
|
);
|
|
@@ -4284,7 +2261,7 @@ var init_TipTapToolbar = __esm({
|
|
|
4284
2261
|
onClick: () => editor.chain().focus().undo().run(),
|
|
4285
2262
|
disabled: !editor.can().undo(),
|
|
4286
2263
|
title: "Undo (Ctrl+Z)",
|
|
4287
|
-
children: "
|
|
2264
|
+
children: /* @__PURE__ */ jsx("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ jsx("path", { d: "M12.5 8c-2.65 0-5.05.99-6.9 2.6L2 7v9h9l-3.62-3.62c1.39-1.16 3.16-1.88 5.12-1.88 3.54 0 6.55 2.31 7.6 5.5l2.37-.78C21.08 11.03 17.15 8 12.5 8z" }) })
|
|
4288
2265
|
},
|
|
4289
2266
|
"undo"
|
|
4290
2267
|
);
|
|
@@ -4295,7 +2272,7 @@ var init_TipTapToolbar = __esm({
|
|
|
4295
2272
|
onClick: () => editor.chain().focus().redo().run(),
|
|
4296
2273
|
disabled: !editor.can().redo(),
|
|
4297
2274
|
title: "Redo (Ctrl+Y)",
|
|
4298
|
-
children: "
|
|
2275
|
+
children: /* @__PURE__ */ jsx("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ jsx("path", { d: "M18.4 10.6C16.55 8.99 14.15 8 11.5 8c-4.65 0-8.58 3.03-9.96 7.22L3.9 16c1.05-3.19 4.05-5.5 7.6-5.5 1.95 0 3.73.72 5.12 1.88L13 16h9V7l-3.6 3.6z" }) })
|
|
4299
2276
|
},
|
|
4300
2277
|
"redo"
|
|
4301
2278
|
);
|
|
@@ -4838,43 +2815,253 @@ var init_SlateToolbar = __esm({
|
|
|
4838
2815
|
}
|
|
4839
2816
|
);
|
|
4840
2817
|
icons = {
|
|
4841
|
-
bold: /* @__PURE__ */ jsx3("svg", { viewBox: "0 0 24 24", width: "16", height: "16", children: /* @__PURE__ */ jsx3(
|
|
4842
|
-
|
|
4843
|
-
|
|
4844
|
-
|
|
4845
|
-
|
|
4846
|
-
|
|
4847
|
-
|
|
4848
|
-
|
|
4849
|
-
|
|
4850
|
-
|
|
4851
|
-
|
|
4852
|
-
|
|
4853
|
-
|
|
4854
|
-
|
|
4855
|
-
|
|
4856
|
-
|
|
4857
|
-
|
|
4858
|
-
|
|
4859
|
-
|
|
4860
|
-
|
|
4861
|
-
|
|
4862
|
-
|
|
4863
|
-
|
|
4864
|
-
|
|
4865
|
-
|
|
2818
|
+
bold: /* @__PURE__ */ jsx3("svg", { viewBox: "0 0 24 24", width: "16", height: "16", children: /* @__PURE__ */ jsx3(
|
|
2819
|
+
"path",
|
|
2820
|
+
{
|
|
2821
|
+
fill: "currentColor",
|
|
2822
|
+
d: "M15.6 10.79c.97-.67 1.65-1.77 1.65-2.79 0-2.26-1.75-4-4-4H7v14h7.04c2.09 0 3.71-1.7 3.71-3.79 0-1.52-.86-2.82-2.15-3.42zM10 6.5h3c.83 0 1.5.67 1.5 1.5s-.67 1.5-1.5 1.5h-3v-3zm3.5 9H10v-3h3.5c.83 0 1.5.67 1.5 1.5s-.67 1.5-1.5 1.5z"
|
|
2823
|
+
}
|
|
2824
|
+
) }),
|
|
2825
|
+
italic: /* @__PURE__ */ jsx3("svg", { viewBox: "0 0 24 24", width: "16", height: "16", children: /* @__PURE__ */ jsx3(
|
|
2826
|
+
"path",
|
|
2827
|
+
{
|
|
2828
|
+
fill: "currentColor",
|
|
2829
|
+
d: "M10 4v3h2.21l-3.42 8H6v3h8v-3h-2.21l3.42-8H18V4z"
|
|
2830
|
+
}
|
|
2831
|
+
) }),
|
|
2832
|
+
underline: /* @__PURE__ */ jsx3("svg", { viewBox: "0 0 24 24", width: "16", height: "16", children: /* @__PURE__ */ jsx3(
|
|
2833
|
+
"path",
|
|
2834
|
+
{
|
|
2835
|
+
fill: "currentColor",
|
|
2836
|
+
d: "M12 17c3.31 0 6-2.69 6-6V3h-2.5v8c0 1.93-1.57 3.5-3.5 3.5S8.5 12.93 8.5 11V3H6v8c0 3.31 2.69 6 6 6zm-7 2v2h14v-2H5z"
|
|
2837
|
+
}
|
|
2838
|
+
) }),
|
|
2839
|
+
strike: /* @__PURE__ */ jsx3("svg", { viewBox: "0 0 24 24", width: "16", height: "16", children: /* @__PURE__ */ jsx3(
|
|
2840
|
+
"path",
|
|
2841
|
+
{
|
|
2842
|
+
fill: "currentColor",
|
|
2843
|
+
d: "M10 19h4v-3h-4v3zM5 4v3h5v3h4V7h5V4H5zM3 14h18v-2H3v2z"
|
|
2844
|
+
}
|
|
2845
|
+
) }),
|
|
2846
|
+
code: /* @__PURE__ */ jsx3("svg", { viewBox: "0 0 24 24", width: "16", height: "16", children: /* @__PURE__ */ jsx3(
|
|
2847
|
+
"path",
|
|
2848
|
+
{
|
|
2849
|
+
fill: "currentColor",
|
|
2850
|
+
d: "M9.4 16.6L4.8 12l4.6-4.6L8 6l-6 6 6 6 1.4-1.4zm5.2 0l4.6-4.6-4.6-4.6L16 6l6 6-6 6-1.4-1.4z"
|
|
2851
|
+
}
|
|
2852
|
+
) }),
|
|
2853
|
+
codeBlock: /* @__PURE__ */ jsx3("svg", { viewBox: "0 0 24 24", width: "16", height: "16", children: /* @__PURE__ */ jsx3(
|
|
2854
|
+
"path",
|
|
2855
|
+
{
|
|
2856
|
+
fill: "currentColor",
|
|
2857
|
+
d: "M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-9.5 8.5L7 14l2.5 2.5L8 18l-4-4 4-4 1.5 1.5zm7 5L15 18l4-4-4-4 1.5-1.5L19 11l-2.5 2.5z"
|
|
2858
|
+
}
|
|
2859
|
+
) }),
|
|
2860
|
+
subscript: /* @__PURE__ */ jsx3("svg", { viewBox: "0 0 24 24", width: "16", height: "16", children: /* @__PURE__ */ jsx3(
|
|
2861
|
+
"path",
|
|
2862
|
+
{
|
|
2863
|
+
fill: "currentColor",
|
|
2864
|
+
d: "M22 18h-2v1h3v1h-4v-2.5a.5.5 0 01.5-.5h2a.5.5 0 00.5-.5v-.5H18v-1h4v2.5a.5.5 0 01-.5.5h-2a.5.5 0 00-.5.5v.5zM5.88 5h2.66l3.4 5.42h.12L15.5 5h2.62l-4.87 7.38L18.22 20h-2.66l-3.62-5.63h-.12l-3.62 5.63H5.56l4.92-7.62L5.88 5z"
|
|
2865
|
+
}
|
|
2866
|
+
) }),
|
|
2867
|
+
superscript: /* @__PURE__ */ jsx3("svg", { viewBox: "0 0 24 24", width: "16", height: "16", children: /* @__PURE__ */ jsx3(
|
|
2868
|
+
"path",
|
|
2869
|
+
{
|
|
2870
|
+
fill: "currentColor",
|
|
2871
|
+
d: "M22 7h-2v1h3v1h-4V6.5a.5.5 0 01.5-.5h2a.5.5 0 00.5-.5v-.5H18V4h4v2.5a.5.5 0 01-.5.5h-2a.5.5 0 00-.5.5v.5zM5.88 5h2.66l3.4 5.42h.12L15.5 5h2.62l-4.87 7.38L18.22 20h-2.66l-3.62-5.63h-.12l-3.62 5.63H5.56l4.92-7.62L5.88 5z"
|
|
2872
|
+
}
|
|
2873
|
+
) }),
|
|
2874
|
+
clearFormatting: /* @__PURE__ */ jsx3("svg", { viewBox: "0 0 24 24", width: "16", height: "16", children: /* @__PURE__ */ jsx3(
|
|
2875
|
+
"path",
|
|
2876
|
+
{
|
|
2877
|
+
fill: "currentColor",
|
|
2878
|
+
d: "M3.27 5L2 6.27l6.97 6.97L6.5 19h3l1.57-3.66L16.73 21 18 19.73 3.55 5.27 3.27 5zM6 5v.18L8.82 8h2.4l-.72 1.68 2.1 2.1L14.21 8H20V5H6z"
|
|
2879
|
+
}
|
|
2880
|
+
) }),
|
|
2881
|
+
fontFamily: /* @__PURE__ */ jsx3("svg", { viewBox: "0 0 24 24", width: "16", height: "16", children: /* @__PURE__ */ jsx3(
|
|
2882
|
+
"path",
|
|
2883
|
+
{
|
|
2884
|
+
fill: "currentColor",
|
|
2885
|
+
d: "M9.93 13.5h4.14L12 7.98 9.93 13.5zM20 2H4c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm-4.05 16.5l-1.14-3H9.17l-1.12 3H5.96l5.11-13h1.86l5.11 13h-2.09z"
|
|
2886
|
+
}
|
|
2887
|
+
) }),
|
|
2888
|
+
fontSize: /* @__PURE__ */ jsx3("svg", { viewBox: "0 0 24 24", width: "16", height: "16", children: /* @__PURE__ */ jsx3(
|
|
2889
|
+
"path",
|
|
2890
|
+
{
|
|
2891
|
+
fill: "currentColor",
|
|
2892
|
+
d: "M9 4v3h5v12h3V7h5V4H9zm-6 8h3v7h3v-7h3v-3H3v3z"
|
|
2893
|
+
}
|
|
2894
|
+
) }),
|
|
2895
|
+
lineHeight: /* @__PURE__ */ jsx3("svg", { viewBox: "0 0 24 24", width: "16", height: "16", children: /* @__PURE__ */ jsx3(
|
|
2896
|
+
"path",
|
|
2897
|
+
{
|
|
2898
|
+
fill: "currentColor",
|
|
2899
|
+
d: "M6 7h2.5L5 3.5 1.5 7H4v10H1.5L5 20.5 8.5 17H6V7zm4-2v2h12V5H10zm0 14h12v-2H10v2zm0-6h12v-2H10v2z"
|
|
2900
|
+
}
|
|
2901
|
+
) }),
|
|
2902
|
+
textColor: /* @__PURE__ */ jsx3("svg", { viewBox: "0 0 24 24", width: "16", height: "16", children: /* @__PURE__ */ jsx3(
|
|
2903
|
+
"path",
|
|
2904
|
+
{
|
|
2905
|
+
fill: "currentColor",
|
|
2906
|
+
d: "M11 3L5.5 17h2.25l1.12-3h6.25l1.12 3h2.25L13 3h-2zm-1.38 9L12 5.67 14.38 12H9.62z"
|
|
2907
|
+
}
|
|
2908
|
+
) }),
|
|
2909
|
+
backgroundColor: /* @__PURE__ */ jsx3("svg", { viewBox: "0 0 24 24", width: "16", height: "16", children: /* @__PURE__ */ jsx3(
|
|
2910
|
+
"path",
|
|
2911
|
+
{
|
|
2912
|
+
fill: "currentColor",
|
|
2913
|
+
d: "M16.56 8.94L7.62 0 6.21 1.41l2.38 2.38-5.15 5.15c-.59.59-.59 1.54 0 2.12l5.5 5.5c.29.29.68.44 1.06.44s.77-.15 1.06-.44l5.5-5.5c.59-.58.59-1.53 0-2.12zM5.21 10L10 5.21 14.79 10H5.21zM19 11.5s-2 2.17-2 3.5c0 1.1.9 2 2 2s2-.9 2-2c0-1.33-2-3.5-2-3.5zM2 20h20v4H2v-4z"
|
|
2914
|
+
}
|
|
2915
|
+
) }),
|
|
2916
|
+
alignLeft: /* @__PURE__ */ jsx3("svg", { viewBox: "0 0 24 24", width: "16", height: "16", children: /* @__PURE__ */ jsx3(
|
|
2917
|
+
"path",
|
|
2918
|
+
{
|
|
2919
|
+
fill: "currentColor",
|
|
2920
|
+
d: "M15 15H3v2h12v-2zm0-8H3v2h12V7zM3 13h18v-2H3v2zm0 8h18v-2H3v2zM3 3v2h18V3H3z"
|
|
2921
|
+
}
|
|
2922
|
+
) }),
|
|
2923
|
+
alignCenter: /* @__PURE__ */ jsx3("svg", { viewBox: "0 0 24 24", width: "16", height: "16", children: /* @__PURE__ */ jsx3(
|
|
2924
|
+
"path",
|
|
2925
|
+
{
|
|
2926
|
+
fill: "currentColor",
|
|
2927
|
+
d: "M7 15v2h10v-2H7zm-4 6h18v-2H3v2zm0-8h18v-2H3v2zm4-6v2h10V7H7zM3 3v2h18V3H3z"
|
|
2928
|
+
}
|
|
2929
|
+
) }),
|
|
2930
|
+
alignRight: /* @__PURE__ */ jsx3("svg", { viewBox: "0 0 24 24", width: "16", height: "16", children: /* @__PURE__ */ jsx3(
|
|
2931
|
+
"path",
|
|
2932
|
+
{
|
|
2933
|
+
fill: "currentColor",
|
|
2934
|
+
d: "M3 21h18v-2H3v2zm6-4h12v-2H9v2zm-6-4h18v-2H3v2zm6-4h12V7H9v2zM3 3v2h18V3H3z"
|
|
2935
|
+
}
|
|
2936
|
+
) }),
|
|
2937
|
+
alignJustify: /* @__PURE__ */ jsx3("svg", { viewBox: "0 0 24 24", width: "16", height: "16", children: /* @__PURE__ */ jsx3(
|
|
2938
|
+
"path",
|
|
2939
|
+
{
|
|
2940
|
+
fill: "currentColor",
|
|
2941
|
+
d: "M3 21h18v-2H3v2zm0-4h18v-2H3v2zm0-4h18v-2H3v2zm0-4h18V7H3v2zm0-6v2h18V3H3z"
|
|
2942
|
+
}
|
|
2943
|
+
) }),
|
|
2944
|
+
indent: /* @__PURE__ */ jsx3("svg", { viewBox: "0 0 24 24", width: "16", height: "16", children: /* @__PURE__ */ jsx3(
|
|
2945
|
+
"path",
|
|
2946
|
+
{
|
|
2947
|
+
fill: "currentColor",
|
|
2948
|
+
d: "M3 21h18v-2H3v2zM3 8v8l4-4-4-4zm8 9h10v-2H11v2zM3 3v2h18V3H3zm8 6h10V7H11v2zm0 4h10v-2H11v2z"
|
|
2949
|
+
}
|
|
2950
|
+
) }),
|
|
2951
|
+
outdent: /* @__PURE__ */ jsx3("svg", { viewBox: "0 0 24 24", width: "16", height: "16", children: /* @__PURE__ */ jsx3(
|
|
2952
|
+
"path",
|
|
2953
|
+
{
|
|
2954
|
+
fill: "currentColor",
|
|
2955
|
+
d: "M11 17h10v-2H11v2zm-8-5l4 4V8l-4 4zm0 9h18v-2H3v2zM3 3v2h18V3H3zm8 6h10V7H11v2zm0 4h10v-2H11v2z"
|
|
2956
|
+
}
|
|
2957
|
+
) }),
|
|
2958
|
+
bulletList: /* @__PURE__ */ jsx3("svg", { viewBox: "0 0 24 24", width: "16", height: "16", children: /* @__PURE__ */ jsx3(
|
|
2959
|
+
"path",
|
|
2960
|
+
{
|
|
2961
|
+
fill: "currentColor",
|
|
2962
|
+
d: "M4 10.5c-.83 0-1.5.67-1.5 1.5s.67 1.5 1.5 1.5 1.5-.67 1.5-1.5-.67-1.5-1.5-1.5zm0-6c-.83 0-1.5.67-1.5 1.5S3.17 7.5 4 7.5 5.5 6.83 5.5 6 4.83 4.5 4 4.5zm0 12c-.83 0-1.5.68-1.5 1.5s.68 1.5 1.5 1.5 1.5-.68 1.5-1.5-.67-1.5-1.5-1.5zM7 19h14v-2H7v2zm0-6h14v-2H7v2zm0-8v2h14V5H7z"
|
|
2963
|
+
}
|
|
2964
|
+
) }),
|
|
2965
|
+
orderedList: /* @__PURE__ */ jsx3("svg", { viewBox: "0 0 24 24", width: "16", height: "16", children: /* @__PURE__ */ jsx3(
|
|
2966
|
+
"path",
|
|
2967
|
+
{
|
|
2968
|
+
fill: "currentColor",
|
|
2969
|
+
d: "M2 17h2v.5H3v1h1v.5H2v1h3v-4H2v1zm1-9h1V4H2v1h1v3zm-1 3h1.8L2 13.1v.9h3v-1H3.2L5 10.9V10H2v1zm5-6v2h14V5H7zm0 14h14v-2H7v2zm0-6h14v-2H7v2z"
|
|
2970
|
+
}
|
|
2971
|
+
) }),
|
|
2972
|
+
heading1: /* @__PURE__ */ jsx3("svg", { viewBox: "0 0 24 24", width: "16", height: "16", children: /* @__PURE__ */ jsx3(
|
|
2973
|
+
"path",
|
|
2974
|
+
{
|
|
2975
|
+
fill: "currentColor",
|
|
2976
|
+
d: "M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-5 14h-2V9h-2V7h4v10z"
|
|
2977
|
+
}
|
|
2978
|
+
) }),
|
|
2979
|
+
heading2: /* @__PURE__ */ jsx3("svg", { viewBox: "0 0 24 24", width: "16", height: "16", children: /* @__PURE__ */ jsx3(
|
|
2980
|
+
"path",
|
|
2981
|
+
{
|
|
2982
|
+
fill: "currentColor",
|
|
2983
|
+
d: "M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-4 8c0 1.1-.9 2-2 2h-2v2h4v2H9v-4c0-1.1.9-2 2-2h2V9H9V7h4c1.1 0 2 .9 2 2v2z"
|
|
2984
|
+
}
|
|
2985
|
+
) }),
|
|
2986
|
+
heading3: /* @__PURE__ */ jsx3("svg", { viewBox: "0 0 24 24", width: "16", height: "16", children: /* @__PURE__ */ jsx3(
|
|
2987
|
+
"path",
|
|
2988
|
+
{
|
|
2989
|
+
fill: "currentColor",
|
|
2990
|
+
d: "M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-4 8c0 1.1-.9 2-2 2v0c1.1 0 2 .9 2 2v1c0 1.1-.9 2-2 2H9v-2h4v-2h-2v-2h2V9H9V7h4c1.1 0 2 .9 2 2v2z"
|
|
2991
|
+
}
|
|
2992
|
+
) }),
|
|
4866
2993
|
blockquote: /* @__PURE__ */ jsx3("svg", { viewBox: "0 0 24 24", width: "16", height: "16", children: /* @__PURE__ */ jsx3("path", { fill: "currentColor", d: "M6 17h3l2-4V7H5v6h3zm8 0h3l2-4V7h-6v6h3z" }) }),
|
|
4867
2994
|
horizontalRule: /* @__PURE__ */ jsx3("svg", { viewBox: "0 0 24 24", width: "16", height: "16", children: /* @__PURE__ */ jsx3("path", { fill: "currentColor", d: "M4 11h16v2H4z" }) }),
|
|
4868
|
-
link: /* @__PURE__ */ jsx3("svg", { viewBox: "0 0 24 24", width: "16", height: "16", children: /* @__PURE__ */ jsx3(
|
|
4869
|
-
|
|
4870
|
-
|
|
4871
|
-
|
|
4872
|
-
|
|
4873
|
-
|
|
4874
|
-
|
|
4875
|
-
|
|
4876
|
-
|
|
4877
|
-
|
|
2995
|
+
link: /* @__PURE__ */ jsx3("svg", { viewBox: "0 0 24 24", width: "16", height: "16", children: /* @__PURE__ */ jsx3(
|
|
2996
|
+
"path",
|
|
2997
|
+
{
|
|
2998
|
+
fill: "currentColor",
|
|
2999
|
+
d: "M3.9 12c0-1.71 1.39-3.1 3.1-3.1h4V7H7c-2.76 0-5 2.24-5 5s2.24 5 5 5h4v-1.9H7c-1.71 0-3.1-1.39-3.1-3.1zM8 13h8v-2H8v2zm9-6h-4v1.9h4c1.71 0 3.1 1.39 3.1 3.1s-1.39 3.1-3.1 3.1h-4V17h4c2.76 0 5-2.24 5-5s-2.24-5-5-5z"
|
|
3000
|
+
}
|
|
3001
|
+
) }),
|
|
3002
|
+
unlink: /* @__PURE__ */ jsx3("svg", { viewBox: "0 0 24 24", width: "16", height: "16", children: /* @__PURE__ */ jsx3(
|
|
3003
|
+
"path",
|
|
3004
|
+
{
|
|
3005
|
+
fill: "currentColor",
|
|
3006
|
+
d: "M17 7h-4v1.9h4c1.71 0 3.1 1.39 3.1 3.1 0 1.43-.98 2.63-2.31 2.98l1.46 1.46C20.88 15.61 22 13.95 22 12c0-2.76-2.24-5-5-5zm-1 4h-2.19l2 2H16v-2zM2 4.27l3.11 3.11A4.991 4.991 0 002 12c0 2.76 2.24 5 5 5h4v-1.9H7c-1.71 0-3.1-1.39-3.1-3.1 0-1.59 1.21-2.9 2.76-3.07L8.73 11H8v2h2.73L13 15.27V17h1.73l4.01 4L20 19.74 3.27 3 2 4.27z"
|
|
3007
|
+
}
|
|
3008
|
+
) }),
|
|
3009
|
+
image: /* @__PURE__ */ jsx3("svg", { viewBox: "0 0 24 24", width: "16", height: "16", children: /* @__PURE__ */ jsx3(
|
|
3010
|
+
"path",
|
|
3011
|
+
{
|
|
3012
|
+
fill: "currentColor",
|
|
3013
|
+
d: "M21 19V5c0-1.1-.9-2-2-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2zM8.5 13.5l2.5 3.01L14.5 12l4.5 6H5l3.5-4.5z"
|
|
3014
|
+
}
|
|
3015
|
+
) }),
|
|
3016
|
+
video: /* @__PURE__ */ jsx3("svg", { viewBox: "0 0 24 24", width: "16", height: "16", children: /* @__PURE__ */ jsx3(
|
|
3017
|
+
"path",
|
|
3018
|
+
{
|
|
3019
|
+
fill: "currentColor",
|
|
3020
|
+
d: "M17 10.5V7c0-.55-.45-1-1-1H4c-.55 0-1 .45-1 1v10c0 .55.45 1 1 1h12c.55 0 1-.45 1-1v-3.5l4 4v-11l-4 4z"
|
|
3021
|
+
}
|
|
3022
|
+
) }),
|
|
3023
|
+
table: /* @__PURE__ */ jsx3("svg", { viewBox: "0 0 24 24", width: "16", height: "16", children: /* @__PURE__ */ jsx3(
|
|
3024
|
+
"path",
|
|
3025
|
+
{
|
|
3026
|
+
fill: "currentColor",
|
|
3027
|
+
d: "M20 2H4c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zM8 20H4v-4h4v4zm0-6H4v-4h4v4zm0-6H4V4h4v4zm6 12h-4v-4h4v4zm0-6h-4v-4h4v4zm0-6h-4V4h4v4zm6 12h-4v-4h4v4zm0-6h-4v-4h4v4zm0-6h-4V4h4v4z"
|
|
3028
|
+
}
|
|
3029
|
+
) }),
|
|
3030
|
+
emoji: /* @__PURE__ */ jsx3("svg", { viewBox: "0 0 24 24", width: "16", height: "16", children: /* @__PURE__ */ jsx3(
|
|
3031
|
+
"path",
|
|
3032
|
+
{
|
|
3033
|
+
fill: "currentColor",
|
|
3034
|
+
d: "M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zM12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8zm3.5-9c.83 0 1.5-.67 1.5-1.5S16.33 8 15.5 8 14 8.67 14 9.5s.67 1.5 1.5 1.5zm-7 0c.83 0 1.5-.67 1.5-1.5S9.33 8 8.5 8 7 8.67 7 9.5 7.67 11 8.5 11zm3.5 6.5c2.33 0 4.31-1.46 5.11-3.5H6.89c.8 2.04 2.78 3.5 5.11 3.5z"
|
|
3035
|
+
}
|
|
3036
|
+
) }),
|
|
3037
|
+
undo: /* @__PURE__ */ jsx3("svg", { viewBox: "0 0 24 24", width: "16", height: "16", children: /* @__PURE__ */ jsx3(
|
|
3038
|
+
"path",
|
|
3039
|
+
{
|
|
3040
|
+
fill: "currentColor",
|
|
3041
|
+
d: "M12.5 8c-2.65 0-5.05 1.04-6.83 2.73L3 8v9h9l-3.01-3c1.37-1.12 3.11-1.8 5.01-1.8 3.33 0 6.17 2.11 7.22 5.06l1.98-.65C21.79 12.58 17.54 8 12.5 8z"
|
|
3042
|
+
}
|
|
3043
|
+
) }),
|
|
3044
|
+
redo: /* @__PURE__ */ jsx3("svg", { viewBox: "0 0 24 24", width: "16", height: "16", children: /* @__PURE__ */ jsx3(
|
|
3045
|
+
"path",
|
|
3046
|
+
{
|
|
3047
|
+
fill: "currentColor",
|
|
3048
|
+
d: "M18.4 10.6C16.55 8.99 14.15 8 11.5 8c-4.65 0-8.58 3.03-9.96 7.22l1.98.65c1.05-3.19 4.05-5.47 7.98-5.47 1.9 0 3.64.68 5.01 1.8L13.5 15h9V6l-4.1 4.6z"
|
|
3049
|
+
}
|
|
3050
|
+
) }),
|
|
3051
|
+
fullscreen: /* @__PURE__ */ jsx3("svg", { viewBox: "0 0 24 24", width: "16", height: "16", children: /* @__PURE__ */ jsx3(
|
|
3052
|
+
"path",
|
|
3053
|
+
{
|
|
3054
|
+
fill: "currentColor",
|
|
3055
|
+
d: "M7 14H5v5h5v-2H7v-3zm-2-4h2V7h3V5H5v5zm12 7h-3v2h5v-5h-2v3zM14 5v2h3v3h2V5h-5z"
|
|
3056
|
+
}
|
|
3057
|
+
) }),
|
|
3058
|
+
print: /* @__PURE__ */ jsx3("svg", { viewBox: "0 0 24 24", width: "16", height: "16", children: /* @__PURE__ */ jsx3(
|
|
3059
|
+
"path",
|
|
3060
|
+
{
|
|
3061
|
+
fill: "currentColor",
|
|
3062
|
+
d: "M19 8H5c-1.66 0-3 1.34-3 3v6h4v4h12v-4h4v-6c0-1.66-1.34-3-3-3zm-3 11H8v-5h8v5zm3-7c-.55 0-1-.45-1-1s.45-1 1-1 1 .45 1 1-.45 1-1 1zm-1-9H6v4h12V3z"
|
|
3063
|
+
}
|
|
3064
|
+
) })
|
|
4878
3065
|
};
|
|
4879
3066
|
SlateToolbar = ({
|
|
4880
3067
|
editor,
|
|
@@ -4884,9 +3071,9 @@ var init_SlateToolbar = __esm({
|
|
|
4884
3071
|
onToggleFullscreen,
|
|
4885
3072
|
onPrint,
|
|
4886
3073
|
isFullscreen = false,
|
|
4887
|
-
toggleMark:
|
|
3074
|
+
toggleMark: toggleMark2,
|
|
4888
3075
|
toggleBlock: toggleBlock2,
|
|
4889
|
-
isMarkActive:
|
|
3076
|
+
isMarkActive: isMarkActive2,
|
|
4890
3077
|
isBlockActive: isBlockActive2
|
|
4891
3078
|
}) => {
|
|
4892
3079
|
const [showEmojiPicker, setShowEmojiPicker] = useState2(false);
|
|
@@ -4895,7 +3082,9 @@ var init_SlateToolbar = __esm({
|
|
|
4895
3082
|
const [showLinkDialog, setShowLinkDialog] = useState2(false);
|
|
4896
3083
|
const [linkUrl, setLinkUrl] = useState2("");
|
|
4897
3084
|
const linkDialogRef = useRef2(null);
|
|
4898
|
-
const [showColorPicker, setShowColorPicker] = useState2(
|
|
3085
|
+
const [showColorPicker, setShowColorPicker] = useState2(
|
|
3086
|
+
null
|
|
3087
|
+
);
|
|
4899
3088
|
const colorPickerRef = useRef2(null);
|
|
4900
3089
|
useEffect3(() => {
|
|
4901
3090
|
const handleClickOutside = (event) => {
|
|
@@ -4941,7 +3130,10 @@ var init_SlateToolbar = __esm({
|
|
|
4941
3130
|
const insertHorizontalRule = useCallback2(() => {
|
|
4942
3131
|
const hr = { type: "horizontal-rule", children: [{ text: "" }] };
|
|
4943
3132
|
Transforms.insertNodes(editor, hr);
|
|
4944
|
-
Transforms.insertNodes(editor, {
|
|
3133
|
+
Transforms.insertNodes(editor, {
|
|
3134
|
+
type: "paragraph",
|
|
3135
|
+
children: [{ text: "" }]
|
|
3136
|
+
});
|
|
4945
3137
|
}, [editor]);
|
|
4946
3138
|
const insertTable = useCallback2(() => {
|
|
4947
3139
|
const table = {
|
|
@@ -5020,8 +3212,8 @@ var init_SlateToolbar = __esm({
|
|
|
5020
3212
|
return /* @__PURE__ */ jsx3(
|
|
5021
3213
|
ToolbarButton,
|
|
5022
3214
|
{
|
|
5023
|
-
active:
|
|
5024
|
-
onClick: () =>
|
|
3215
|
+
active: isMarkActive2(editor, "bold"),
|
|
3216
|
+
onClick: () => toggleMark2(editor, "bold"),
|
|
5025
3217
|
title: "Bold (Ctrl+B)",
|
|
5026
3218
|
children: icons.bold
|
|
5027
3219
|
},
|
|
@@ -5031,8 +3223,8 @@ var init_SlateToolbar = __esm({
|
|
|
5031
3223
|
return /* @__PURE__ */ jsx3(
|
|
5032
3224
|
ToolbarButton,
|
|
5033
3225
|
{
|
|
5034
|
-
active:
|
|
5035
|
-
onClick: () =>
|
|
3226
|
+
active: isMarkActive2(editor, "italic"),
|
|
3227
|
+
onClick: () => toggleMark2(editor, "italic"),
|
|
5036
3228
|
title: "Italic (Ctrl+I)",
|
|
5037
3229
|
children: icons.italic
|
|
5038
3230
|
},
|
|
@@ -5042,8 +3234,8 @@ var init_SlateToolbar = __esm({
|
|
|
5042
3234
|
return /* @__PURE__ */ jsx3(
|
|
5043
3235
|
ToolbarButton,
|
|
5044
3236
|
{
|
|
5045
|
-
active:
|
|
5046
|
-
onClick: () =>
|
|
3237
|
+
active: isMarkActive2(editor, "underline"),
|
|
3238
|
+
onClick: () => toggleMark2(editor, "underline"),
|
|
5047
3239
|
title: "Underline (Ctrl+U)",
|
|
5048
3240
|
children: icons.underline
|
|
5049
3241
|
},
|
|
@@ -5053,8 +3245,8 @@ var init_SlateToolbar = __esm({
|
|
|
5053
3245
|
return /* @__PURE__ */ jsx3(
|
|
5054
3246
|
ToolbarButton,
|
|
5055
3247
|
{
|
|
5056
|
-
active:
|
|
5057
|
-
onClick: () =>
|
|
3248
|
+
active: isMarkActive2(editor, "strikethrough"),
|
|
3249
|
+
onClick: () => toggleMark2(editor, "strikethrough"),
|
|
5058
3250
|
title: "Strikethrough",
|
|
5059
3251
|
children: icons.strike
|
|
5060
3252
|
},
|
|
@@ -5064,8 +3256,8 @@ var init_SlateToolbar = __esm({
|
|
|
5064
3256
|
return /* @__PURE__ */ jsx3(
|
|
5065
3257
|
ToolbarButton,
|
|
5066
3258
|
{
|
|
5067
|
-
active:
|
|
5068
|
-
onClick: () =>
|
|
3259
|
+
active: isMarkActive2(editor, "code"),
|
|
3260
|
+
onClick: () => toggleMark2(editor, "code"),
|
|
5069
3261
|
title: "Code",
|
|
5070
3262
|
children: icons.code
|
|
5071
3263
|
},
|
|
@@ -5086,8 +3278,8 @@ var init_SlateToolbar = __esm({
|
|
|
5086
3278
|
return /* @__PURE__ */ jsx3(
|
|
5087
3279
|
ToolbarButton,
|
|
5088
3280
|
{
|
|
5089
|
-
active:
|
|
5090
|
-
onClick: () =>
|
|
3281
|
+
active: isMarkActive2(editor, "subscript"),
|
|
3282
|
+
onClick: () => toggleMark2(editor, "subscript"),
|
|
5091
3283
|
title: "Subscript",
|
|
5092
3284
|
children: icons.subscript
|
|
5093
3285
|
},
|
|
@@ -5097,8 +3289,8 @@ var init_SlateToolbar = __esm({
|
|
|
5097
3289
|
return /* @__PURE__ */ jsx3(
|
|
5098
3290
|
ToolbarButton,
|
|
5099
3291
|
{
|
|
5100
|
-
active:
|
|
5101
|
-
onClick: () =>
|
|
3292
|
+
active: isMarkActive2(editor, "superscript"),
|
|
3293
|
+
onClick: () => toggleMark2(editor, "superscript"),
|
|
5102
3294
|
title: "Superscript",
|
|
5103
3295
|
children: icons.superscript
|
|
5104
3296
|
},
|
|
@@ -5258,45 +3450,45 @@ var init_SlateToolbar = __esm({
|
|
|
5258
3450
|
);
|
|
5259
3451
|
// Links
|
|
5260
3452
|
case "link":
|
|
5261
|
-
return /* @__PURE__ */ jsxs3(
|
|
5262
|
-
|
|
5263
|
-
ToolbarButton,
|
|
5264
|
-
{
|
|
5265
|
-
onClick: () => setShowLinkDialog(!showLinkDialog),
|
|
5266
|
-
title: "Insert Link",
|
|
5267
|
-
children: icons.link
|
|
5268
|
-
}
|
|
5269
|
-
),
|
|
5270
|
-
showLinkDialog && /* @__PURE__ */ jsxs3("div", { className: "rte-builder-toolbar-dropdown-content", children: [
|
|
5271
|
-
/* @__PURE__ */ jsx3(
|
|
5272
|
-
"input",
|
|
5273
|
-
{
|
|
5274
|
-
type: "url",
|
|
5275
|
-
placeholder: "Enter URL...",
|
|
5276
|
-
value: linkUrl,
|
|
5277
|
-
onChange: (e) => setLinkUrl(e.target.value),
|
|
5278
|
-
onKeyDown: (e) => {
|
|
5279
|
-
if (e.key === "Enter") {
|
|
5280
|
-
e.preventDefault();
|
|
5281
|
-
insertLink();
|
|
5282
|
-
}
|
|
5283
|
-
},
|
|
5284
|
-
autoFocus: true
|
|
5285
|
-
}
|
|
5286
|
-
),
|
|
5287
|
-
/* @__PURE__ */ jsx3("button", { onClick: insertLink, children: "Insert" })
|
|
5288
|
-
] })
|
|
5289
|
-
] }, button);
|
|
5290
|
-
case "unlink":
|
|
5291
|
-
return /* @__PURE__ */ jsx3(
|
|
5292
|
-
ToolbarButton,
|
|
3453
|
+
return /* @__PURE__ */ jsxs3(
|
|
3454
|
+
"div",
|
|
5293
3455
|
{
|
|
5294
|
-
|
|
5295
|
-
|
|
5296
|
-
children:
|
|
3456
|
+
className: "rte-builder-toolbar-dropdown",
|
|
3457
|
+
ref: linkDialogRef,
|
|
3458
|
+
children: [
|
|
3459
|
+
/* @__PURE__ */ jsx3(
|
|
3460
|
+
ToolbarButton,
|
|
3461
|
+
{
|
|
3462
|
+
onClick: () => setShowLinkDialog(!showLinkDialog),
|
|
3463
|
+
title: "Insert Link",
|
|
3464
|
+
children: icons.link
|
|
3465
|
+
}
|
|
3466
|
+
),
|
|
3467
|
+
showLinkDialog && /* @__PURE__ */ jsxs3("div", { className: "rte-builder-toolbar-dropdown-content", children: [
|
|
3468
|
+
/* @__PURE__ */ jsx3(
|
|
3469
|
+
"input",
|
|
3470
|
+
{
|
|
3471
|
+
type: "url",
|
|
3472
|
+
placeholder: "Enter URL...",
|
|
3473
|
+
value: linkUrl,
|
|
3474
|
+
onChange: (e) => setLinkUrl(e.target.value),
|
|
3475
|
+
onKeyDown: (e) => {
|
|
3476
|
+
if (e.key === "Enter") {
|
|
3477
|
+
e.preventDefault();
|
|
3478
|
+
insertLink();
|
|
3479
|
+
}
|
|
3480
|
+
},
|
|
3481
|
+
autoFocus: true
|
|
3482
|
+
}
|
|
3483
|
+
),
|
|
3484
|
+
/* @__PURE__ */ jsx3("button", { onClick: insertLink, children: "Insert" })
|
|
3485
|
+
] })
|
|
3486
|
+
]
|
|
5297
3487
|
},
|
|
5298
3488
|
button
|
|
5299
3489
|
);
|
|
3490
|
+
case "unlink":
|
|
3491
|
+
return /* @__PURE__ */ jsx3(ToolbarButton, { onClick: removeLink, title: "Remove Link", children: icons.unlink }, button);
|
|
5300
3492
|
// Media
|
|
5301
3493
|
case "image":
|
|
5302
3494
|
return /* @__PURE__ */ jsx3(
|
|
@@ -5334,82 +3526,104 @@ var init_SlateToolbar = __esm({
|
|
|
5334
3526
|
);
|
|
5335
3527
|
// Colors
|
|
5336
3528
|
case "textColor":
|
|
5337
|
-
return /* @__PURE__ */ jsxs3(
|
|
5338
|
-
|
|
5339
|
-
|
|
5340
|
-
|
|
5341
|
-
|
|
5342
|
-
|
|
5343
|
-
|
|
5344
|
-
|
|
5345
|
-
|
|
5346
|
-
|
|
5347
|
-
|
|
5348
|
-
|
|
5349
|
-
|
|
5350
|
-
|
|
5351
|
-
|
|
5352
|
-
|
|
5353
|
-
|
|
5354
|
-
|
|
5355
|
-
|
|
5356
|
-
|
|
3529
|
+
return /* @__PURE__ */ jsxs3(
|
|
3530
|
+
"div",
|
|
3531
|
+
{
|
|
3532
|
+
className: "rte-builder-toolbar-dropdown",
|
|
3533
|
+
ref: colorPickerRef,
|
|
3534
|
+
children: [
|
|
3535
|
+
/* @__PURE__ */ jsx3(
|
|
3536
|
+
ToolbarButton,
|
|
3537
|
+
{
|
|
3538
|
+
onClick: () => setShowColorPicker(showColorPicker === "text" ? null : "text"),
|
|
3539
|
+
title: "Text Color",
|
|
3540
|
+
children: icons.textColor
|
|
3541
|
+
}
|
|
3542
|
+
),
|
|
3543
|
+
showColorPicker === "text" && /* @__PURE__ */ jsx3("div", { className: "rte-builder-toolbar-dropdown-content rte-builder-color-picker", children: colors.map((color) => /* @__PURE__ */ jsx3(
|
|
3544
|
+
"button",
|
|
3545
|
+
{
|
|
3546
|
+
className: "rte-builder-color-swatch",
|
|
3547
|
+
style: { backgroundColor: color },
|
|
3548
|
+
onClick: () => setColor(color, "text"),
|
|
3549
|
+
title: color
|
|
3550
|
+
},
|
|
3551
|
+
color
|
|
3552
|
+
)) })
|
|
3553
|
+
]
|
|
3554
|
+
},
|
|
3555
|
+
button
|
|
3556
|
+
);
|
|
5357
3557
|
case "backgroundColor":
|
|
5358
|
-
return /* @__PURE__ */ jsxs3(
|
|
5359
|
-
|
|
5360
|
-
|
|
5361
|
-
|
|
5362
|
-
|
|
5363
|
-
|
|
5364
|
-
|
|
5365
|
-
|
|
5366
|
-
|
|
5367
|
-
|
|
5368
|
-
|
|
5369
|
-
|
|
5370
|
-
|
|
5371
|
-
|
|
5372
|
-
|
|
5373
|
-
title: color
|
|
5374
|
-
},
|
|
5375
|
-
color
|
|
5376
|
-
)) })
|
|
5377
|
-
] }, button);
|
|
5378
|
-
// Emoji
|
|
5379
|
-
case "emoji":
|
|
5380
|
-
return /* @__PURE__ */ jsxs3("div", { className: "rte-builder-toolbar-dropdown", ref: emojiPickerRef, children: [
|
|
5381
|
-
/* @__PURE__ */ jsx3(
|
|
5382
|
-
ToolbarButton,
|
|
5383
|
-
{
|
|
5384
|
-
onClick: () => setShowEmojiPicker(!showEmojiPicker),
|
|
5385
|
-
title: "Insert Emoji",
|
|
5386
|
-
children: icons.emoji
|
|
5387
|
-
}
|
|
5388
|
-
),
|
|
5389
|
-
showEmojiPicker && /* @__PURE__ */ jsxs3("div", { className: "rte-builder-emoji-picker", children: [
|
|
5390
|
-
/* @__PURE__ */ jsx3("div", { className: "rte-builder-emoji-categories", children: Object.entries(EMOJI_CATEGORIES).map(([key, category]) => /* @__PURE__ */ jsx3(
|
|
5391
|
-
"button",
|
|
5392
|
-
{
|
|
5393
|
-
className: `rte-builder-emoji-category-btn ${selectedEmojiCategory === key ? "active" : ""}`,
|
|
5394
|
-
onClick: () => setSelectedEmojiCategory(key),
|
|
5395
|
-
title: category.label,
|
|
5396
|
-
children: category.emojis[0]
|
|
5397
|
-
},
|
|
5398
|
-
key
|
|
5399
|
-
)) }),
|
|
5400
|
-
/* @__PURE__ */ jsx3("div", { className: "rte-builder-emoji-grid", children: EMOJI_CATEGORIES[selectedEmojiCategory]?.emojis.map(
|
|
5401
|
-
(emoji, idx) => /* @__PURE__ */ jsx3(
|
|
3558
|
+
return /* @__PURE__ */ jsxs3(
|
|
3559
|
+
"div",
|
|
3560
|
+
{
|
|
3561
|
+
className: "rte-builder-toolbar-dropdown",
|
|
3562
|
+
ref: colorPickerRef,
|
|
3563
|
+
children: [
|
|
3564
|
+
/* @__PURE__ */ jsx3(
|
|
3565
|
+
ToolbarButton,
|
|
3566
|
+
{
|
|
3567
|
+
onClick: () => setShowColorPicker(showColorPicker === "bg" ? null : "bg"),
|
|
3568
|
+
title: "Background Color",
|
|
3569
|
+
children: icons.backgroundColor
|
|
3570
|
+
}
|
|
3571
|
+
),
|
|
3572
|
+
showColorPicker === "bg" && /* @__PURE__ */ jsx3("div", { className: "rte-builder-toolbar-dropdown-content rte-builder-color-picker", children: colors.map((color) => /* @__PURE__ */ jsx3(
|
|
5402
3573
|
"button",
|
|
5403
3574
|
{
|
|
5404
|
-
className: "rte-builder-
|
|
5405
|
-
|
|
5406
|
-
|
|
3575
|
+
className: "rte-builder-color-swatch",
|
|
3576
|
+
style: { backgroundColor: color },
|
|
3577
|
+
onClick: () => setColor(color, "bg"),
|
|
3578
|
+
title: color
|
|
5407
3579
|
},
|
|
5408
|
-
|
|
5409
|
-
)
|
|
5410
|
-
|
|
5411
|
-
|
|
5412
|
-
|
|
3580
|
+
color
|
|
3581
|
+
)) })
|
|
3582
|
+
]
|
|
3583
|
+
},
|
|
3584
|
+
button
|
|
3585
|
+
);
|
|
3586
|
+
// Emoji
|
|
3587
|
+
case "emoji":
|
|
3588
|
+
return /* @__PURE__ */ jsxs3(
|
|
3589
|
+
"div",
|
|
3590
|
+
{
|
|
3591
|
+
className: "rte-builder-toolbar-dropdown",
|
|
3592
|
+
ref: emojiPickerRef,
|
|
3593
|
+
children: [
|
|
3594
|
+
/* @__PURE__ */ jsx3(
|
|
3595
|
+
ToolbarButton,
|
|
3596
|
+
{
|
|
3597
|
+
onClick: () => setShowEmojiPicker(!showEmojiPicker),
|
|
3598
|
+
title: "Insert Emoji",
|
|
3599
|
+
children: icons.emoji
|
|
3600
|
+
}
|
|
3601
|
+
),
|
|
3602
|
+
showEmojiPicker && /* @__PURE__ */ jsxs3("div", { className: "rte-builder-emoji-picker", children: [
|
|
3603
|
+
/* @__PURE__ */ jsx3("div", { className: "rte-builder-emoji-categories", children: Object.entries(EMOJI_CATEGORIES).map(([key, category]) => /* @__PURE__ */ jsx3(
|
|
3604
|
+
"button",
|
|
3605
|
+
{
|
|
3606
|
+
className: `rte-builder-emoji-category-btn ${selectedEmojiCategory === key ? "active" : ""}`,
|
|
3607
|
+
onClick: () => setSelectedEmojiCategory(key),
|
|
3608
|
+
title: category.label,
|
|
3609
|
+
children: category.emojis[0]
|
|
3610
|
+
},
|
|
3611
|
+
key
|
|
3612
|
+
)) }),
|
|
3613
|
+
/* @__PURE__ */ jsx3("div", { className: "rte-builder-emoji-grid", children: EMOJI_CATEGORIES[selectedEmojiCategory]?.emojis.map((emoji, idx) => /* @__PURE__ */ jsx3(
|
|
3614
|
+
"button",
|
|
3615
|
+
{
|
|
3616
|
+
className: "rte-builder-emoji-btn",
|
|
3617
|
+
onClick: () => insertEmoji(emoji),
|
|
3618
|
+
children: emoji
|
|
3619
|
+
},
|
|
3620
|
+
idx
|
|
3621
|
+
)) })
|
|
3622
|
+
] })
|
|
3623
|
+
]
|
|
3624
|
+
},
|
|
3625
|
+
button
|
|
3626
|
+
);
|
|
5413
3627
|
// Actions
|
|
5414
3628
|
case "undo":
|
|
5415
3629
|
return /* @__PURE__ */ jsx3(
|
|
@@ -5479,10 +3693,10 @@ import {
|
|
|
5479
3693
|
useRef as useRef3
|
|
5480
3694
|
} from "react";
|
|
5481
3695
|
import { createEditor, Editor as Editor2, Transforms as Transforms2, Text as Text2, Element as SlateElement2, Node as Node2 } from "slate";
|
|
5482
|
-
import { Slate, Editable
|
|
3696
|
+
import { Slate, Editable, withReact, ReactEditor as ReactEditor2 } from "slate-react";
|
|
5483
3697
|
import { withHistory, HistoryEditor } from "slate-history";
|
|
5484
3698
|
import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
5485
|
-
var import_is_hotkey, HOTKEYS, LIST_TYPES, TEXT_ALIGN_TYPES,
|
|
3699
|
+
var import_is_hotkey, HOTKEYS, LIST_TYPES, TEXT_ALIGN_TYPES, isMarkActive, isBlockActive, toggleMark, toggleBlock, serializeToHtml, serializeNode, escapeHtml, deserializeFromHtml, deserializeElement, renderElement, renderLeaf, withInlines, SlateEditorComponent, SlateEditorComponent_default;
|
|
5486
3700
|
var init_SlateEditorComponent = __esm({
|
|
5487
3701
|
"src/adapters/slate/SlateEditorComponent.tsx"() {
|
|
5488
3702
|
"use strict";
|
|
@@ -5497,7 +3711,7 @@ var init_SlateEditorComponent = __esm({
|
|
|
5497
3711
|
};
|
|
5498
3712
|
LIST_TYPES = ["numbered-list", "bulleted-list"];
|
|
5499
3713
|
TEXT_ALIGN_TYPES = ["left", "center", "right", "justify"];
|
|
5500
|
-
|
|
3714
|
+
isMarkActive = (editor, format) => {
|
|
5501
3715
|
const marks = Editor2.marks(editor);
|
|
5502
3716
|
return marks ? marks[format] === true : false;
|
|
5503
3717
|
};
|
|
@@ -5512,8 +3726,8 @@ var init_SlateEditorComponent = __esm({
|
|
|
5512
3726
|
);
|
|
5513
3727
|
return !!match;
|
|
5514
3728
|
};
|
|
5515
|
-
|
|
5516
|
-
const isActive =
|
|
3729
|
+
toggleMark = (editor, format) => {
|
|
3730
|
+
const isActive = isMarkActive(editor, format);
|
|
5517
3731
|
if (isActive) {
|
|
5518
3732
|
Editor2.removeMark(editor, format);
|
|
5519
3733
|
} else {
|
|
@@ -5526,7 +3740,7 @@ var init_SlateEditorComponent = __esm({
|
|
|
5526
3740
|
format,
|
|
5527
3741
|
TEXT_ALIGN_TYPES.includes(format) ? "align" : "type"
|
|
5528
3742
|
);
|
|
5529
|
-
const
|
|
3743
|
+
const isList = LIST_TYPES.includes(format);
|
|
5530
3744
|
Transforms2.unwrapNodes(editor, {
|
|
5531
3745
|
match: (n) => !Editor2.isEditor(n) && SlateElement2.isElement(n) && LIST_TYPES.includes(n.type) && !TEXT_ALIGN_TYPES.includes(format),
|
|
5532
3746
|
split: true
|
|
@@ -5538,11 +3752,11 @@ var init_SlateEditorComponent = __esm({
|
|
|
5538
3752
|
};
|
|
5539
3753
|
} else {
|
|
5540
3754
|
newProperties = {
|
|
5541
|
-
type: isActive ? "paragraph" :
|
|
3755
|
+
type: isActive ? "paragraph" : isList ? "list-item" : format
|
|
5542
3756
|
};
|
|
5543
3757
|
}
|
|
5544
3758
|
Transforms2.setNodes(editor, newProperties);
|
|
5545
|
-
if (!isActive &&
|
|
3759
|
+
if (!isActive && isList) {
|
|
5546
3760
|
const block = { type: format, children: [] };
|
|
5547
3761
|
Transforms2.wrapNodes(editor, block);
|
|
5548
3762
|
}
|
|
@@ -5829,7 +4043,7 @@ var init_SlateEditorComponent = __esm({
|
|
|
5829
4043
|
if ((0, import_is_hotkey.default)(hotkey, event)) {
|
|
5830
4044
|
event.preventDefault();
|
|
5831
4045
|
const mark = HOTKEYS[hotkey];
|
|
5832
|
-
|
|
4046
|
+
toggleMark(editor, mark);
|
|
5833
4047
|
}
|
|
5834
4048
|
}
|
|
5835
4049
|
},
|
|
@@ -5963,9 +4177,9 @@ var init_SlateEditorComponent = __esm({
|
|
|
5963
4177
|
onToggleFullscreen: handleToggleFullscreen,
|
|
5964
4178
|
onPrint: handlePrint,
|
|
5965
4179
|
isFullscreen,
|
|
5966
|
-
toggleMark
|
|
4180
|
+
toggleMark,
|
|
5967
4181
|
toggleBlock,
|
|
5968
|
-
isMarkActive
|
|
4182
|
+
isMarkActive,
|
|
5969
4183
|
isBlockActive
|
|
5970
4184
|
}
|
|
5971
4185
|
),
|
|
@@ -5980,7 +4194,7 @@ var init_SlateEditorComponent = __esm({
|
|
|
5980
4194
|
overflow: "auto"
|
|
5981
4195
|
},
|
|
5982
4196
|
children: /* @__PURE__ */ jsx4(
|
|
5983
|
-
|
|
4197
|
+
Editable,
|
|
5984
4198
|
{
|
|
5985
4199
|
className: "rte-builder-content",
|
|
5986
4200
|
renderElement,
|
|
@@ -6020,7 +4234,9 @@ import {
|
|
|
6020
4234
|
UNDO_COMMAND,
|
|
6021
4235
|
REDO_COMMAND
|
|
6022
4236
|
} from "lexical";
|
|
6023
|
-
import {
|
|
4237
|
+
import {
|
|
4238
|
+
$createHeadingNode
|
|
4239
|
+
} from "@lexical/rich-text";
|
|
6024
4240
|
import {
|
|
6025
4241
|
INSERT_ORDERED_LIST_COMMAND,
|
|
6026
4242
|
INSERT_UNORDERED_LIST_COMMAND
|
|
@@ -6030,9 +4246,7 @@ import { $setBlocksType } from "@lexical/selection";
|
|
|
6030
4246
|
import { $createQuoteNode } from "@lexical/rich-text";
|
|
6031
4247
|
import { $createCodeNode } from "@lexical/code";
|
|
6032
4248
|
import { INSERT_HORIZONTAL_RULE_COMMAND } from "@lexical/react/LexicalHorizontalRuleNode";
|
|
6033
|
-
import {
|
|
6034
|
-
INSERT_TABLE_COMMAND
|
|
6035
|
-
} from "@lexical/table";
|
|
4249
|
+
import { INSERT_TABLE_COMMAND } from "@lexical/table";
|
|
6036
4250
|
import { $createParagraphNode } from "lexical";
|
|
6037
4251
|
import { jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
6038
4252
|
var ToolbarButton2, icons2, LexicalToolbar;
|
|
@@ -6061,40 +4275,232 @@ var init_LexicalToolbar = __esm({
|
|
|
6061
4275
|
}
|
|
6062
4276
|
);
|
|
6063
4277
|
icons2 = {
|
|
6064
|
-
bold: /* @__PURE__ */ jsx5("svg", { viewBox: "0 0 24 24", width: "16", height: "16", children: /* @__PURE__ */ jsx5(
|
|
6065
|
-
|
|
6066
|
-
|
|
6067
|
-
|
|
6068
|
-
|
|
6069
|
-
|
|
6070
|
-
|
|
6071
|
-
|
|
6072
|
-
|
|
6073
|
-
|
|
6074
|
-
|
|
6075
|
-
|
|
6076
|
-
|
|
6077
|
-
|
|
6078
|
-
|
|
6079
|
-
|
|
6080
|
-
|
|
6081
|
-
|
|
6082
|
-
|
|
6083
|
-
|
|
4278
|
+
bold: /* @__PURE__ */ jsx5("svg", { viewBox: "0 0 24 24", width: "16", height: "16", children: /* @__PURE__ */ jsx5(
|
|
4279
|
+
"path",
|
|
4280
|
+
{
|
|
4281
|
+
fill: "currentColor",
|
|
4282
|
+
d: "M15.6 10.79c.97-.67 1.65-1.77 1.65-2.79 0-2.26-1.75-4-4-4H7v14h7.04c2.09 0 3.71-1.7 3.71-3.79 0-1.52-.86-2.82-2.15-3.42zM10 6.5h3c.83 0 1.5.67 1.5 1.5s-.67 1.5-1.5 1.5h-3v-3zm3.5 9H10v-3h3.5c.83 0 1.5.67 1.5 1.5s-.67 1.5-1.5 1.5z"
|
|
4283
|
+
}
|
|
4284
|
+
) }),
|
|
4285
|
+
italic: /* @__PURE__ */ jsx5("svg", { viewBox: "0 0 24 24", width: "16", height: "16", children: /* @__PURE__ */ jsx5(
|
|
4286
|
+
"path",
|
|
4287
|
+
{
|
|
4288
|
+
fill: "currentColor",
|
|
4289
|
+
d: "M10 4v3h2.21l-3.42 8H6v3h8v-3h-2.21l3.42-8H18V4z"
|
|
4290
|
+
}
|
|
4291
|
+
) }),
|
|
4292
|
+
underline: /* @__PURE__ */ jsx5("svg", { viewBox: "0 0 24 24", width: "16", height: "16", children: /* @__PURE__ */ jsx5(
|
|
4293
|
+
"path",
|
|
4294
|
+
{
|
|
4295
|
+
fill: "currentColor",
|
|
4296
|
+
d: "M12 17c3.31 0 6-2.69 6-6V3h-2.5v8c0 1.93-1.57 3.5-3.5 3.5S8.5 12.93 8.5 11V3H6v8c0 3.31 2.69 6 6 6zm-7 2v2h14v-2H5z"
|
|
4297
|
+
}
|
|
4298
|
+
) }),
|
|
4299
|
+
strike: /* @__PURE__ */ jsx5("svg", { viewBox: "0 0 24 24", width: "16", height: "16", children: /* @__PURE__ */ jsx5(
|
|
4300
|
+
"path",
|
|
4301
|
+
{
|
|
4302
|
+
fill: "currentColor",
|
|
4303
|
+
d: "M10 19h4v-3h-4v3zM5 4v3h5v3h4V7h5V4H5zM3 14h18v-2H3v2z"
|
|
4304
|
+
}
|
|
4305
|
+
) }),
|
|
4306
|
+
code: /* @__PURE__ */ jsx5("svg", { viewBox: "0 0 24 24", width: "16", height: "16", children: /* @__PURE__ */ jsx5(
|
|
4307
|
+
"path",
|
|
4308
|
+
{
|
|
4309
|
+
fill: "currentColor",
|
|
4310
|
+
d: "M9.4 16.6L4.8 12l4.6-4.6L8 6l-6 6 6 6 1.4-1.4zm5.2 0l4.6-4.6-4.6-4.6L16 6l6 6-6 6-1.4-1.4z"
|
|
4311
|
+
}
|
|
4312
|
+
) }),
|
|
4313
|
+
codeBlock: /* @__PURE__ */ jsx5("svg", { viewBox: "0 0 24 24", width: "16", height: "16", children: /* @__PURE__ */ jsx5(
|
|
4314
|
+
"path",
|
|
4315
|
+
{
|
|
4316
|
+
fill: "currentColor",
|
|
4317
|
+
d: "M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-9.5 8.5L7 14l2.5 2.5L8 18l-4-4 4-4 1.5 1.5zm7 5L15 18l4-4-4-4 1.5-1.5L19 11l-2.5 2.5z"
|
|
4318
|
+
}
|
|
4319
|
+
) }),
|
|
4320
|
+
subscript: /* @__PURE__ */ jsx5("svg", { viewBox: "0 0 24 24", width: "16", height: "16", children: /* @__PURE__ */ jsx5(
|
|
4321
|
+
"path",
|
|
4322
|
+
{
|
|
4323
|
+
fill: "currentColor",
|
|
4324
|
+
d: "M22 18h-2v1h3v1h-4v-2.5a.5.5 0 01.5-.5h2a.5.5 0 00.5-.5v-.5H18v-1h4v2.5a.5.5 0 01-.5.5h-2a.5.5 0 00-.5.5v.5zM5.88 5h2.66l3.4 5.42h.12L15.5 5h2.62l-4.87 7.38L18.22 20h-2.66l-3.62-5.63h-.12l-3.62 5.63H5.56l4.92-7.62L5.88 5z"
|
|
4325
|
+
}
|
|
4326
|
+
) }),
|
|
4327
|
+
superscript: /* @__PURE__ */ jsx5("svg", { viewBox: "0 0 24 24", width: "16", height: "16", children: /* @__PURE__ */ jsx5(
|
|
4328
|
+
"path",
|
|
4329
|
+
{
|
|
4330
|
+
fill: "currentColor",
|
|
4331
|
+
d: "M22 7h-2v1h3v1h-4V6.5a.5.5 0 01.5-.5h2a.5.5 0 00.5-.5v-.5H18V4h4v2.5a.5.5 0 01-.5.5h-2a.5.5 0 00-.5.5v.5zM5.88 5h2.66l3.4 5.42h.12L15.5 5h2.62l-4.87 7.38L18.22 20h-2.66l-3.62-5.63h-.12l-3.62 5.63H5.56l4.92-7.62L5.88 5z"
|
|
4332
|
+
}
|
|
4333
|
+
) }),
|
|
4334
|
+
clearFormatting: /* @__PURE__ */ jsx5("svg", { viewBox: "0 0 24 24", width: "16", height: "16", children: /* @__PURE__ */ jsx5(
|
|
4335
|
+
"path",
|
|
4336
|
+
{
|
|
4337
|
+
fill: "currentColor",
|
|
4338
|
+
d: "M3.27 5L2 6.27l6.97 6.97L6.5 19h3l1.57-3.66L16.73 21 18 19.73 3.55 5.27 3.27 5zM6 5v.18L8.82 8h2.4l-.72 1.68 2.1 2.1L14.21 8H20V5H6z"
|
|
4339
|
+
}
|
|
4340
|
+
) }),
|
|
4341
|
+
alignLeft: /* @__PURE__ */ jsx5("svg", { viewBox: "0 0 24 24", width: "16", height: "16", children: /* @__PURE__ */ jsx5(
|
|
4342
|
+
"path",
|
|
4343
|
+
{
|
|
4344
|
+
fill: "currentColor",
|
|
4345
|
+
d: "M15 15H3v2h12v-2zm0-8H3v2h12V7zM3 13h18v-2H3v2zm0 8h18v-2H3v2zM3 3v2h18V3H3z"
|
|
4346
|
+
}
|
|
4347
|
+
) }),
|
|
4348
|
+
alignCenter: /* @__PURE__ */ jsx5("svg", { viewBox: "0 0 24 24", width: "16", height: "16", children: /* @__PURE__ */ jsx5(
|
|
4349
|
+
"path",
|
|
4350
|
+
{
|
|
4351
|
+
fill: "currentColor",
|
|
4352
|
+
d: "M7 15v2h10v-2H7zm-4 6h18v-2H3v2zm0-8h18v-2H3v2zm4-6v2h10V7H7zM3 3v2h18V3H3z"
|
|
4353
|
+
}
|
|
4354
|
+
) }),
|
|
4355
|
+
alignRight: /* @__PURE__ */ jsx5("svg", { viewBox: "0 0 24 24", width: "16", height: "16", children: /* @__PURE__ */ jsx5(
|
|
4356
|
+
"path",
|
|
4357
|
+
{
|
|
4358
|
+
fill: "currentColor",
|
|
4359
|
+
d: "M3 21h18v-2H3v2zm6-4h12v-2H9v2zm-6-4h18v-2H3v2zm6-4h12V7H9v2zM3 3v2h18V3H3z"
|
|
4360
|
+
}
|
|
4361
|
+
) }),
|
|
4362
|
+
alignJustify: /* @__PURE__ */ jsx5("svg", { viewBox: "0 0 24 24", width: "16", height: "16", children: /* @__PURE__ */ jsx5(
|
|
4363
|
+
"path",
|
|
4364
|
+
{
|
|
4365
|
+
fill: "currentColor",
|
|
4366
|
+
d: "M3 21h18v-2H3v2zm0-4h18v-2H3v2zm0-4h18v-2H3v2zm0-4h18V7H3v2zm0-6v2h18V3H3z"
|
|
4367
|
+
}
|
|
4368
|
+
) }),
|
|
4369
|
+
indent: /* @__PURE__ */ jsx5("svg", { viewBox: "0 0 24 24", width: "16", height: "16", children: /* @__PURE__ */ jsx5(
|
|
4370
|
+
"path",
|
|
4371
|
+
{
|
|
4372
|
+
fill: "currentColor",
|
|
4373
|
+
d: "M3 21h18v-2H3v2zM3 8v8l4-4-4-4zm8 9h10v-2H11v2zM3 3v2h18V3H3zm8 6h10V7H11v2zm0 4h10v-2H11v2z"
|
|
4374
|
+
}
|
|
4375
|
+
) }),
|
|
4376
|
+
outdent: /* @__PURE__ */ jsx5("svg", { viewBox: "0 0 24 24", width: "16", height: "16", children: /* @__PURE__ */ jsx5(
|
|
4377
|
+
"path",
|
|
4378
|
+
{
|
|
4379
|
+
fill: "currentColor",
|
|
4380
|
+
d: "M11 17h10v-2H11v2zm-8-5l4 4V8l-4 4zm0 9h18v-2H3v2zM3 3v2h18V3H3zm8 6h10V7H11v2zm0 4h10v-2H11v2z"
|
|
4381
|
+
}
|
|
4382
|
+
) }),
|
|
4383
|
+
bulletList: /* @__PURE__ */ jsx5("svg", { viewBox: "0 0 24 24", width: "16", height: "16", children: /* @__PURE__ */ jsx5(
|
|
4384
|
+
"path",
|
|
4385
|
+
{
|
|
4386
|
+
fill: "currentColor",
|
|
4387
|
+
d: "M4 10.5c-.83 0-1.5.67-1.5 1.5s.67 1.5 1.5 1.5 1.5-.67 1.5-1.5-.67-1.5-1.5-1.5zm0-6c-.83 0-1.5.67-1.5 1.5S3.17 7.5 4 7.5 5.5 6.83 5.5 6 4.83 4.5 4 4.5zm0 12c-.83 0-1.5.68-1.5 1.5s.68 1.5 1.5 1.5 1.5-.68 1.5-1.5-.67-1.5-1.5-1.5zM7 19h14v-2H7v2zm0-6h14v-2H7v2zm0-8v2h14V5H7z"
|
|
4388
|
+
}
|
|
4389
|
+
) }),
|
|
4390
|
+
orderedList: /* @__PURE__ */ jsx5("svg", { viewBox: "0 0 24 24", width: "16", height: "16", children: /* @__PURE__ */ jsx5(
|
|
4391
|
+
"path",
|
|
4392
|
+
{
|
|
4393
|
+
fill: "currentColor",
|
|
4394
|
+
d: "M2 17h2v.5H3v1h1v.5H2v1h3v-4H2v1zm1-9h1V4H2v1h1v3zm-1 3h1.8L2 13.1v.9h3v-1H3.2L5 10.9V10H2v1zm5-6v2h14V5H7zm0 14h14v-2H7v2zm0-6h14v-2H7v2z"
|
|
4395
|
+
}
|
|
4396
|
+
) }),
|
|
4397
|
+
heading1: /* @__PURE__ */ jsx5("svg", { viewBox: "0 0 24 24", width: "16", height: "16", children: /* @__PURE__ */ jsx5(
|
|
4398
|
+
"path",
|
|
4399
|
+
{
|
|
4400
|
+
fill: "currentColor",
|
|
4401
|
+
d: "M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-5 14h-2V9h-2V7h4v10z"
|
|
4402
|
+
}
|
|
4403
|
+
) }),
|
|
4404
|
+
heading2: /* @__PURE__ */ jsx5("svg", { viewBox: "0 0 24 24", width: "16", height: "16", children: /* @__PURE__ */ jsx5(
|
|
4405
|
+
"path",
|
|
4406
|
+
{
|
|
4407
|
+
fill: "currentColor",
|
|
4408
|
+
d: "M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-4 8c0 1.1-.9 2-2 2h-2v2h4v2H9v-4c0-1.1.9-2 2-2h2V9H9V7h4c1.1 0 2 .9 2 2v2z"
|
|
4409
|
+
}
|
|
4410
|
+
) }),
|
|
4411
|
+
heading3: /* @__PURE__ */ jsx5("svg", { viewBox: "0 0 24 24", width: "16", height: "16", children: /* @__PURE__ */ jsx5(
|
|
4412
|
+
"path",
|
|
4413
|
+
{
|
|
4414
|
+
fill: "currentColor",
|
|
4415
|
+
d: "M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-4 8c0 1.1-.9 2-2 2v0c1.1 0 2 .9 2 2v1c0 1.1-.9 2-2 2H9v-2h4v-2h-2v-2h2V9H9V7h4c1.1 0 2 .9 2 2v2z"
|
|
4416
|
+
}
|
|
4417
|
+
) }),
|
|
6084
4418
|
blockquote: /* @__PURE__ */ jsx5("svg", { viewBox: "0 0 24 24", width: "16", height: "16", children: /* @__PURE__ */ jsx5("path", { fill: "currentColor", d: "M6 17h3l2-4V7H5v6h3zm8 0h3l2-4V7h-6v6h3z" }) }),
|
|
6085
4419
|
horizontalRule: /* @__PURE__ */ jsx5("svg", { viewBox: "0 0 24 24", width: "16", height: "16", children: /* @__PURE__ */ jsx5("path", { fill: "currentColor", d: "M4 11h16v2H4z" }) }),
|
|
6086
|
-
link: /* @__PURE__ */ jsx5("svg", { viewBox: "0 0 24 24", width: "16", height: "16", children: /* @__PURE__ */ jsx5(
|
|
6087
|
-
|
|
6088
|
-
|
|
6089
|
-
|
|
6090
|
-
|
|
6091
|
-
|
|
6092
|
-
|
|
6093
|
-
|
|
6094
|
-
|
|
6095
|
-
|
|
6096
|
-
|
|
6097
|
-
|
|
4420
|
+
link: /* @__PURE__ */ jsx5("svg", { viewBox: "0 0 24 24", width: "16", height: "16", children: /* @__PURE__ */ jsx5(
|
|
4421
|
+
"path",
|
|
4422
|
+
{
|
|
4423
|
+
fill: "currentColor",
|
|
4424
|
+
d: "M3.9 12c0-1.71 1.39-3.1 3.1-3.1h4V7H7c-2.76 0-5 2.24-5 5s2.24 5 5 5h4v-1.9H7c-1.71 0-3.1-1.39-3.1-3.1zM8 13h8v-2H8v2zm9-6h-4v1.9h4c1.71 0 3.1 1.39 3.1 3.1s-1.39 3.1-3.1 3.1h-4V17h4c2.76 0 5-2.24 5-5s-2.24-5-5-5z"
|
|
4425
|
+
}
|
|
4426
|
+
) }),
|
|
4427
|
+
unlink: /* @__PURE__ */ jsx5("svg", { viewBox: "0 0 24 24", width: "16", height: "16", children: /* @__PURE__ */ jsx5(
|
|
4428
|
+
"path",
|
|
4429
|
+
{
|
|
4430
|
+
fill: "currentColor",
|
|
4431
|
+
d: "M17 7h-4v1.9h4c1.71 0 3.1 1.39 3.1 3.1 0 1.43-.98 2.63-2.31 2.98l1.46 1.46C20.88 15.61 22 13.95 22 12c0-2.76-2.24-5-5-5zm-1 4h-2.19l2 2H16v-2zM2 4.27l3.11 3.11A4.991 4.991 0 002 12c0 2.76 2.24 5 5 5h4v-1.9H7c-1.71 0-3.1-1.39-3.1-3.1 0-1.59 1.21-2.9 2.76-3.07L8.73 11H8v2h2.73L13 15.27V17h1.73l4.01 4L20 19.74 3.27 3 2 4.27z"
|
|
4432
|
+
}
|
|
4433
|
+
) }),
|
|
4434
|
+
image: /* @__PURE__ */ jsx5("svg", { viewBox: "0 0 24 24", width: "16", height: "16", children: /* @__PURE__ */ jsx5(
|
|
4435
|
+
"path",
|
|
4436
|
+
{
|
|
4437
|
+
fill: "currentColor",
|
|
4438
|
+
d: "M21 19V5c0-1.1-.9-2-2-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2zM8.5 13.5l2.5 3.01L14.5 12l4.5 6H5l3.5-4.5z"
|
|
4439
|
+
}
|
|
4440
|
+
) }),
|
|
4441
|
+
video: /* @__PURE__ */ jsx5("svg", { viewBox: "0 0 24 24", width: "16", height: "16", children: /* @__PURE__ */ jsx5(
|
|
4442
|
+
"path",
|
|
4443
|
+
{
|
|
4444
|
+
fill: "currentColor",
|
|
4445
|
+
d: "M17 10.5V7c0-.55-.45-1-1-1H4c-.55 0-1 .45-1 1v10c0 .55.45 1 1 1h12c.55 0 1-.45 1-1v-3.5l4 4v-11l-4 4z"
|
|
4446
|
+
}
|
|
4447
|
+
) }),
|
|
4448
|
+
table: /* @__PURE__ */ jsx5("svg", { viewBox: "0 0 24 24", width: "16", height: "16", children: /* @__PURE__ */ jsx5(
|
|
4449
|
+
"path",
|
|
4450
|
+
{
|
|
4451
|
+
fill: "currentColor",
|
|
4452
|
+
d: "M20 2H4c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zM8 20H4v-4h4v4zm0-6H4v-4h4v4zm0-6H4V4h4v4zm6 12h-4v-4h4v4zm0-6h-4v-4h4v4zm0-6h-4V4h4v4zm6 12h-4v-4h4v4zm0-6h-4v-4h4v4zm0-6h-4V4h4v4z"
|
|
4453
|
+
}
|
|
4454
|
+
) }),
|
|
4455
|
+
emoji: /* @__PURE__ */ jsx5("svg", { viewBox: "0 0 24 24", width: "16", height: "16", children: /* @__PURE__ */ jsx5(
|
|
4456
|
+
"path",
|
|
4457
|
+
{
|
|
4458
|
+
fill: "currentColor",
|
|
4459
|
+
d: "M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zM12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8zm3.5-9c.83 0 1.5-.67 1.5-1.5S16.33 8 15.5 8 14 8.67 14 9.5s.67 1.5 1.5 1.5zm-7 0c.83 0 1.5-.67 1.5-1.5S9.33 8 8.5 8 7 8.67 7 9.5 7.67 11 8.5 11zm3.5 6.5c2.33 0 4.31-1.46 5.11-3.5H6.89c.8 2.04 2.78 3.5 5.11 3.5z"
|
|
4460
|
+
}
|
|
4461
|
+
) }),
|
|
4462
|
+
undo: /* @__PURE__ */ jsx5("svg", { viewBox: "0 0 24 24", width: "16", height: "16", children: /* @__PURE__ */ jsx5(
|
|
4463
|
+
"path",
|
|
4464
|
+
{
|
|
4465
|
+
fill: "currentColor",
|
|
4466
|
+
d: "M12.5 8c-2.65 0-5.05 1.04-6.83 2.73L3 8v9h9l-3.01-3c1.37-1.12 3.11-1.8 5.01-1.8 3.33 0 6.17 2.11 7.22 5.06l1.98-.65C21.79 12.58 17.54 8 12.5 8z"
|
|
4467
|
+
}
|
|
4468
|
+
) }),
|
|
4469
|
+
redo: /* @__PURE__ */ jsx5("svg", { viewBox: "0 0 24 24", width: "16", height: "16", children: /* @__PURE__ */ jsx5(
|
|
4470
|
+
"path",
|
|
4471
|
+
{
|
|
4472
|
+
fill: "currentColor",
|
|
4473
|
+
d: "M18.4 10.6C16.55 8.99 14.15 8 11.5 8c-4.65 0-8.58 3.03-9.96 7.22l1.98.65c1.05-3.19 4.05-5.47 7.98-5.47 1.9 0 3.64.68 5.01 1.8L13.5 15h9V6l-4.1 4.6z"
|
|
4474
|
+
}
|
|
4475
|
+
) }),
|
|
4476
|
+
fullscreen: /* @__PURE__ */ jsx5("svg", { viewBox: "0 0 24 24", width: "16", height: "16", children: /* @__PURE__ */ jsx5(
|
|
4477
|
+
"path",
|
|
4478
|
+
{
|
|
4479
|
+
fill: "currentColor",
|
|
4480
|
+
d: "M7 14H5v5h5v-2H7v-3zm-2-4h2V7h3V5H5v5zm12 7h-3v2h5v-5h-2v3zM14 5v2h3v3h2V5h-5z"
|
|
4481
|
+
}
|
|
4482
|
+
) }),
|
|
4483
|
+
print: /* @__PURE__ */ jsx5("svg", { viewBox: "0 0 24 24", width: "16", height: "16", children: /* @__PURE__ */ jsx5(
|
|
4484
|
+
"path",
|
|
4485
|
+
{
|
|
4486
|
+
fill: "currentColor",
|
|
4487
|
+
d: "M19 8H5c-1.66 0-3 1.34-3 3v6h4v4h12v-4h4v-6c0-1.66-1.34-3-3-3zm-3 11H8v-5h8v5zm3-7c-.55 0-1-.45-1-1s.45-1 1-1 1 .45 1 1-.45 1-1 1zm-1-9H6v4h12V3z"
|
|
4488
|
+
}
|
|
4489
|
+
) }),
|
|
4490
|
+
textColor: /* @__PURE__ */ jsx5("svg", { viewBox: "0 0 24 24", width: "16", height: "16", children: /* @__PURE__ */ jsx5(
|
|
4491
|
+
"path",
|
|
4492
|
+
{
|
|
4493
|
+
fill: "currentColor",
|
|
4494
|
+
d: "M11 3L5.5 17h2.25l1.12-3h6.25l1.12 3h2.25L13 3h-2zm-1.38 9L12 5.67 14.38 12H9.62z"
|
|
4495
|
+
}
|
|
4496
|
+
) }),
|
|
4497
|
+
backgroundColor: /* @__PURE__ */ jsx5("svg", { viewBox: "0 0 24 24", width: "16", height: "16", children: /* @__PURE__ */ jsx5(
|
|
4498
|
+
"path",
|
|
4499
|
+
{
|
|
4500
|
+
fill: "currentColor",
|
|
4501
|
+
d: "M16.56 8.94L7.62 0 6.21 1.41l2.38 2.38-5.15 5.15c-.59.59-.59 1.54 0 2.12l5.5 5.5c.29.29.68.44 1.06.44s.77-.15 1.06-.44l5.5-5.5c.59-.58.59-1.53 0-2.12zM5.21 10L10 5.21 14.79 10H5.21zM19 11.5s-2 2.17-2 3.5c0 1.1.9 2 2 2s2-.9 2-2c0-1.33-2-3.5-2-3.5zM2 20h20v4H2v-4z"
|
|
4502
|
+
}
|
|
4503
|
+
) })
|
|
6098
4504
|
};
|
|
6099
4505
|
LexicalToolbar = ({
|
|
6100
4506
|
editor,
|
|
@@ -6363,15 +4769,7 @@ var init_LexicalToolbar = __esm({
|
|
|
6363
4769
|
);
|
|
6364
4770
|
// Blocks
|
|
6365
4771
|
case "blockquote":
|
|
6366
|
-
return /* @__PURE__ */ jsx5(
|
|
6367
|
-
ToolbarButton2,
|
|
6368
|
-
{
|
|
6369
|
-
onClick: formatQuote,
|
|
6370
|
-
title: "Blockquote",
|
|
6371
|
-
children: icons2.blockquote
|
|
6372
|
-
},
|
|
6373
|
-
button
|
|
6374
|
-
);
|
|
4772
|
+
return /* @__PURE__ */ jsx5(ToolbarButton2, { onClick: formatQuote, title: "Blockquote", children: icons2.blockquote }, button);
|
|
6375
4773
|
case "horizontalRule":
|
|
6376
4774
|
return /* @__PURE__ */ jsx5(
|
|
6377
4775
|
ToolbarButton2,
|
|
@@ -6384,45 +4782,45 @@ var init_LexicalToolbar = __esm({
|
|
|
6384
4782
|
);
|
|
6385
4783
|
// Links
|
|
6386
4784
|
case "link":
|
|
6387
|
-
return /* @__PURE__ */ jsxs5(
|
|
6388
|
-
|
|
6389
|
-
ToolbarButton2,
|
|
6390
|
-
{
|
|
6391
|
-
onClick: () => setShowLinkDialog(!showLinkDialog),
|
|
6392
|
-
title: "Insert Link",
|
|
6393
|
-
children: icons2.link
|
|
6394
|
-
}
|
|
6395
|
-
),
|
|
6396
|
-
showLinkDialog && /* @__PURE__ */ jsxs5("div", { className: "rte-builder-toolbar-dropdown-content", children: [
|
|
6397
|
-
/* @__PURE__ */ jsx5(
|
|
6398
|
-
"input",
|
|
6399
|
-
{
|
|
6400
|
-
type: "url",
|
|
6401
|
-
placeholder: "Enter URL...",
|
|
6402
|
-
value: linkUrl,
|
|
6403
|
-
onChange: (e) => setLinkUrl(e.target.value),
|
|
6404
|
-
onKeyDown: (e) => {
|
|
6405
|
-
if (e.key === "Enter") {
|
|
6406
|
-
e.preventDefault();
|
|
6407
|
-
insertLink();
|
|
6408
|
-
}
|
|
6409
|
-
},
|
|
6410
|
-
autoFocus: true
|
|
6411
|
-
}
|
|
6412
|
-
),
|
|
6413
|
-
/* @__PURE__ */ jsx5("button", { onClick: insertLink, children: "Insert" })
|
|
6414
|
-
] })
|
|
6415
|
-
] }, button);
|
|
6416
|
-
case "unlink":
|
|
6417
|
-
return /* @__PURE__ */ jsx5(
|
|
6418
|
-
ToolbarButton2,
|
|
4785
|
+
return /* @__PURE__ */ jsxs5(
|
|
4786
|
+
"div",
|
|
6419
4787
|
{
|
|
6420
|
-
|
|
6421
|
-
|
|
6422
|
-
children:
|
|
4788
|
+
className: "rte-builder-toolbar-dropdown",
|
|
4789
|
+
ref: linkDialogRef,
|
|
4790
|
+
children: [
|
|
4791
|
+
/* @__PURE__ */ jsx5(
|
|
4792
|
+
ToolbarButton2,
|
|
4793
|
+
{
|
|
4794
|
+
onClick: () => setShowLinkDialog(!showLinkDialog),
|
|
4795
|
+
title: "Insert Link",
|
|
4796
|
+
children: icons2.link
|
|
4797
|
+
}
|
|
4798
|
+
),
|
|
4799
|
+
showLinkDialog && /* @__PURE__ */ jsxs5("div", { className: "rte-builder-toolbar-dropdown-content", children: [
|
|
4800
|
+
/* @__PURE__ */ jsx5(
|
|
4801
|
+
"input",
|
|
4802
|
+
{
|
|
4803
|
+
type: "url",
|
|
4804
|
+
placeholder: "Enter URL...",
|
|
4805
|
+
value: linkUrl,
|
|
4806
|
+
onChange: (e) => setLinkUrl(e.target.value),
|
|
4807
|
+
onKeyDown: (e) => {
|
|
4808
|
+
if (e.key === "Enter") {
|
|
4809
|
+
e.preventDefault();
|
|
4810
|
+
insertLink();
|
|
4811
|
+
}
|
|
4812
|
+
},
|
|
4813
|
+
autoFocus: true
|
|
4814
|
+
}
|
|
4815
|
+
),
|
|
4816
|
+
/* @__PURE__ */ jsx5("button", { onClick: insertLink, children: "Insert" })
|
|
4817
|
+
] })
|
|
4818
|
+
]
|
|
6423
4819
|
},
|
|
6424
4820
|
button
|
|
6425
4821
|
);
|
|
4822
|
+
case "unlink":
|
|
4823
|
+
return /* @__PURE__ */ jsx5(ToolbarButton2, { onClick: removeLink, title: "Remove Link", children: icons2.unlink }, button);
|
|
6426
4824
|
// Media
|
|
6427
4825
|
case "image":
|
|
6428
4826
|
return /* @__PURE__ */ jsx5(
|
|
@@ -6460,39 +4858,45 @@ var init_LexicalToolbar = __esm({
|
|
|
6460
4858
|
);
|
|
6461
4859
|
// Emoji
|
|
6462
4860
|
case "emoji":
|
|
6463
|
-
return /* @__PURE__ */ jsxs5(
|
|
6464
|
-
|
|
6465
|
-
|
|
6466
|
-
|
|
6467
|
-
|
|
6468
|
-
|
|
6469
|
-
|
|
6470
|
-
|
|
6471
|
-
),
|
|
6472
|
-
showEmojiPicker && /* @__PURE__ */ jsxs5("div", { className: "rte-builder-emoji-picker", children: [
|
|
6473
|
-
/* @__PURE__ */ jsx5("div", { className: "rte-builder-emoji-categories", children: Object.entries(EMOJI_CATEGORIES).map(([key, category]) => /* @__PURE__ */ jsx5(
|
|
6474
|
-
"button",
|
|
6475
|
-
{
|
|
6476
|
-
className: `rte-builder-emoji-category-btn ${selectedEmojiCategory === key ? "active" : ""}`,
|
|
6477
|
-
onClick: () => setSelectedEmojiCategory(key),
|
|
6478
|
-
title: category.label,
|
|
6479
|
-
children: category.emojis[0]
|
|
6480
|
-
},
|
|
6481
|
-
key
|
|
6482
|
-
)) }),
|
|
6483
|
-
/* @__PURE__ */ jsx5("div", { className: "rte-builder-emoji-grid", children: EMOJI_CATEGORIES[selectedEmojiCategory]?.emojis.map(
|
|
6484
|
-
(emoji, idx) => /* @__PURE__ */ jsx5(
|
|
6485
|
-
"button",
|
|
4861
|
+
return /* @__PURE__ */ jsxs5(
|
|
4862
|
+
"div",
|
|
4863
|
+
{
|
|
4864
|
+
className: "rte-builder-toolbar-dropdown",
|
|
4865
|
+
ref: emojiPickerRef,
|
|
4866
|
+
children: [
|
|
4867
|
+
/* @__PURE__ */ jsx5(
|
|
4868
|
+
ToolbarButton2,
|
|
6486
4869
|
{
|
|
6487
|
-
|
|
6488
|
-
|
|
6489
|
-
children: emoji
|
|
6490
|
-
}
|
|
6491
|
-
|
|
6492
|
-
|
|
6493
|
-
|
|
6494
|
-
|
|
6495
|
-
|
|
4870
|
+
onClick: () => setShowEmojiPicker(!showEmojiPicker),
|
|
4871
|
+
title: "Insert Emoji",
|
|
4872
|
+
children: icons2.emoji
|
|
4873
|
+
}
|
|
4874
|
+
),
|
|
4875
|
+
showEmojiPicker && /* @__PURE__ */ jsxs5("div", { className: "rte-builder-emoji-picker", children: [
|
|
4876
|
+
/* @__PURE__ */ jsx5("div", { className: "rte-builder-emoji-categories", children: Object.entries(EMOJI_CATEGORIES).map(([key, category]) => /* @__PURE__ */ jsx5(
|
|
4877
|
+
"button",
|
|
4878
|
+
{
|
|
4879
|
+
className: `rte-builder-emoji-category-btn ${selectedEmojiCategory === key ? "active" : ""}`,
|
|
4880
|
+
onClick: () => setSelectedEmojiCategory(key),
|
|
4881
|
+
title: category.label,
|
|
4882
|
+
children: category.emojis[0]
|
|
4883
|
+
},
|
|
4884
|
+
key
|
|
4885
|
+
)) }),
|
|
4886
|
+
/* @__PURE__ */ jsx5("div", { className: "rte-builder-emoji-grid", children: EMOJI_CATEGORIES[selectedEmojiCategory]?.emojis.map((emoji, idx) => /* @__PURE__ */ jsx5(
|
|
4887
|
+
"button",
|
|
4888
|
+
{
|
|
4889
|
+
className: "rte-builder-emoji-btn",
|
|
4890
|
+
onClick: () => insertEmoji(emoji),
|
|
4891
|
+
children: emoji
|
|
4892
|
+
},
|
|
4893
|
+
idx
|
|
4894
|
+
)) })
|
|
4895
|
+
] })
|
|
4896
|
+
]
|
|
4897
|
+
},
|
|
4898
|
+
button
|
|
4899
|
+
);
|
|
6496
4900
|
// Actions
|
|
6497
4901
|
case "undo":
|
|
6498
4902
|
return /* @__PURE__ */ jsx5(
|
|
@@ -6589,7 +4993,7 @@ import {
|
|
|
6589
4993
|
COMMAND_PRIORITY_CRITICAL
|
|
6590
4994
|
} from "lexical";
|
|
6591
4995
|
import { $generateHtmlFromNodes, $generateNodesFromDOM } from "@lexical/html";
|
|
6592
|
-
import { Fragment
|
|
4996
|
+
import { Fragment, jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
6593
4997
|
function onError(error) {
|
|
6594
4998
|
console.error("Lexical Error:", error);
|
|
6595
4999
|
}
|
|
@@ -6861,7 +5265,7 @@ var init_LexicalEditorComponent = __esm({
|
|
|
6861
5265
|
getNativeEditor: () => editor
|
|
6862
5266
|
}));
|
|
6863
5267
|
const characterLimit = charCounterMax > 0 ? charCounterMax : null;
|
|
6864
|
-
return /* @__PURE__ */ jsxs6(
|
|
5268
|
+
return /* @__PURE__ */ jsxs6(Fragment, { children: [
|
|
6865
5269
|
/* @__PURE__ */ jsx6(
|
|
6866
5270
|
LexicalToolbar,
|
|
6867
5271
|
{
|
|
@@ -7352,12 +5756,7 @@ var DEFAULT_FEATURES = {
|
|
|
7352
5756
|
|
|
7353
5757
|
// src/adapters/tiptap/TipTapAdapter.ts
|
|
7354
5758
|
function checkTipTapAvailable() {
|
|
7355
|
-
|
|
7356
|
-
__require("@tiptap/react");
|
|
7357
|
-
return true;
|
|
7358
|
-
} catch {
|
|
7359
|
-
return false;
|
|
7360
|
-
}
|
|
5759
|
+
return true;
|
|
7361
5760
|
}
|
|
7362
5761
|
var TIPTAP_FEATURES = {
|
|
7363
5762
|
...DEFAULT_FEATURES,
|
|
@@ -7749,28 +6148,28 @@ import { useEditor as useEditor2, EditorContent as EditorContent2 } from "@tipta
|
|
|
7749
6148
|
import { Document as Document2 } from "@tiptap/extension-document";
|
|
7750
6149
|
import { Paragraph as Paragraph2 } from "@tiptap/extension-paragraph";
|
|
7751
6150
|
import { Text as Text3 } from "@tiptap/extension-text";
|
|
7752
|
-
import { Bold as
|
|
7753
|
-
import { Italic as
|
|
7754
|
-
import { Underline as
|
|
6151
|
+
import { Bold as Bold3 } from "@tiptap/extension-bold";
|
|
6152
|
+
import { Italic as Italic3 } from "@tiptap/extension-italic";
|
|
6153
|
+
import { Underline as Underline3 } from "@tiptap/extension-underline";
|
|
7755
6154
|
import { Strike as Strike2 } from "@tiptap/extension-strike";
|
|
7756
|
-
import { Code as
|
|
6155
|
+
import { Code as Code3 } from "@tiptap/extension-code";
|
|
7757
6156
|
import { CodeBlockLowlight as CodeBlockLowlight2 } from "@tiptap/extension-code-block-lowlight";
|
|
7758
|
-
import { Subscript as
|
|
7759
|
-
import { Superscript as
|
|
6157
|
+
import { Subscript as Subscript3 } from "@tiptap/extension-subscript";
|
|
6158
|
+
import { Superscript as Superscript3 } from "@tiptap/extension-superscript";
|
|
7760
6159
|
import { TextStyle as TextStyle2 } from "@tiptap/extension-text-style";
|
|
7761
6160
|
import { FontFamily as FontFamily2 } from "@tiptap/extension-font-family";
|
|
7762
6161
|
import { Color as Color2 } from "@tiptap/extension-color";
|
|
7763
6162
|
import { Highlight as Highlight2 } from "@tiptap/extension-highlight";
|
|
7764
6163
|
import { TextAlign as TextAlign2 } from "@tiptap/extension-text-align";
|
|
7765
|
-
import { Heading as
|
|
6164
|
+
import { Heading as Heading3 } from "@tiptap/extension-heading";
|
|
7766
6165
|
import { BulletList as BulletList2 } from "@tiptap/extension-bullet-list";
|
|
7767
6166
|
import { OrderedList as OrderedList2 } from "@tiptap/extension-ordered-list";
|
|
7768
6167
|
import { ListItem as ListItem2 } from "@tiptap/extension-list-item";
|
|
7769
6168
|
import { Blockquote as Blockquote2 } from "@tiptap/extension-blockquote";
|
|
7770
6169
|
import { HorizontalRule as HorizontalRule2 } from "@tiptap/extension-horizontal-rule";
|
|
7771
|
-
import { Link as
|
|
7772
|
-
import { Image as
|
|
7773
|
-
import { Table as
|
|
6170
|
+
import { Link as Link3 } from "@tiptap/extension-link";
|
|
6171
|
+
import { Image as Image3 } from "@tiptap/extension-image";
|
|
6172
|
+
import { Table as Table3 } from "@tiptap/extension-table";
|
|
7774
6173
|
import { TableRow as TableRow2 } from "@tiptap/extension-table-row";
|
|
7775
6174
|
import { TableCell as TableCell2 } from "@tiptap/extension-table-cell";
|
|
7776
6175
|
import { TableHeader as TableHeader2 } from "@tiptap/extension-table-header";
|
|
@@ -7785,6 +6184,41 @@ import { common as common2, createLowlight as createLowlight2 } from "lowlight";
|
|
|
7785
6184
|
// src/components/Toolbar.tsx
|
|
7786
6185
|
init_Emoji();
|
|
7787
6186
|
import { useState as useState7, useRef as useRef7, useEffect as useEffect7 } from "react";
|
|
6187
|
+
import {
|
|
6188
|
+
Bold as Bold2,
|
|
6189
|
+
Italic as Italic2,
|
|
6190
|
+
Underline as Underline2,
|
|
6191
|
+
Strikethrough,
|
|
6192
|
+
Code as Code2,
|
|
6193
|
+
FileCode,
|
|
6194
|
+
Subscript as Subscript2,
|
|
6195
|
+
Superscript as Superscript2,
|
|
6196
|
+
RemoveFormatting,
|
|
6197
|
+
Type,
|
|
6198
|
+
Highlighter,
|
|
6199
|
+
AlignLeft,
|
|
6200
|
+
AlignCenter,
|
|
6201
|
+
AlignRight,
|
|
6202
|
+
AlignJustify,
|
|
6203
|
+
Indent as Indent2,
|
|
6204
|
+
Outdent,
|
|
6205
|
+
List,
|
|
6206
|
+
ListOrdered,
|
|
6207
|
+
Heading as Heading2,
|
|
6208
|
+
Quote,
|
|
6209
|
+
Minus,
|
|
6210
|
+
Link as Link2,
|
|
6211
|
+
Unlink,
|
|
6212
|
+
Image as Image2,
|
|
6213
|
+
Video as Video2,
|
|
6214
|
+
Table as Table2,
|
|
6215
|
+
Smile,
|
|
6216
|
+
Maximize,
|
|
6217
|
+
Minimize,
|
|
6218
|
+
Printer,
|
|
6219
|
+
Undo,
|
|
6220
|
+
Redo
|
|
6221
|
+
} from "lucide-react";
|
|
7788
6222
|
import { jsx as jsx8, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
7789
6223
|
var FONT_FAMILIES2 = [
|
|
7790
6224
|
{ value: "Arial", label: "Arial" },
|
|
@@ -7898,7 +6332,7 @@ var Toolbar = ({
|
|
|
7898
6332
|
onClick: () => editor.chain().focus().toggleBold().run(),
|
|
7899
6333
|
active: editor.isActive("bold"),
|
|
7900
6334
|
title: "Bold (Ctrl+B)",
|
|
7901
|
-
children: /* @__PURE__ */ jsx8(
|
|
6335
|
+
children: /* @__PURE__ */ jsx8(Bold2, { size: 18 })
|
|
7902
6336
|
},
|
|
7903
6337
|
"bold"
|
|
7904
6338
|
);
|
|
@@ -7909,7 +6343,7 @@ var Toolbar = ({
|
|
|
7909
6343
|
onClick: () => editor.chain().focus().toggleItalic().run(),
|
|
7910
6344
|
active: editor.isActive("italic"),
|
|
7911
6345
|
title: "Italic (Ctrl+I)",
|
|
7912
|
-
children: /* @__PURE__ */ jsx8(
|
|
6346
|
+
children: /* @__PURE__ */ jsx8(Italic2, { size: 18 })
|
|
7913
6347
|
},
|
|
7914
6348
|
"italic"
|
|
7915
6349
|
);
|
|
@@ -7920,7 +6354,7 @@ var Toolbar = ({
|
|
|
7920
6354
|
onClick: () => editor.chain().focus().toggleUnderline().run(),
|
|
7921
6355
|
active: editor.isActive("underline"),
|
|
7922
6356
|
title: "Underline (Ctrl+U)",
|
|
7923
|
-
children: /* @__PURE__ */ jsx8(
|
|
6357
|
+
children: /* @__PURE__ */ jsx8(Underline2, { size: 18 })
|
|
7924
6358
|
},
|
|
7925
6359
|
"underline"
|
|
7926
6360
|
);
|
|
@@ -7931,7 +6365,7 @@ var Toolbar = ({
|
|
|
7931
6365
|
onClick: () => editor.chain().focus().toggleStrike().run(),
|
|
7932
6366
|
active: editor.isActive("strike"),
|
|
7933
6367
|
title: "Strikethrough",
|
|
7934
|
-
children: /* @__PURE__ */ jsx8(
|
|
6368
|
+
children: /* @__PURE__ */ jsx8(Strikethrough, { size: 18 })
|
|
7935
6369
|
},
|
|
7936
6370
|
"strike"
|
|
7937
6371
|
);
|
|
@@ -7942,7 +6376,7 @@ var Toolbar = ({
|
|
|
7942
6376
|
onClick: () => editor.chain().focus().toggleCode().run(),
|
|
7943
6377
|
active: editor.isActive("code"),
|
|
7944
6378
|
title: "Inline Code",
|
|
7945
|
-
children:
|
|
6379
|
+
children: /* @__PURE__ */ jsx8(Code2, { size: 18 })
|
|
7946
6380
|
},
|
|
7947
6381
|
"code"
|
|
7948
6382
|
);
|
|
@@ -7953,35 +6387,29 @@ var Toolbar = ({
|
|
|
7953
6387
|
onClick: () => editor.chain().focus().toggleCodeBlock().run(),
|
|
7954
6388
|
active: editor.isActive("codeBlock"),
|
|
7955
6389
|
title: "Code Block",
|
|
7956
|
-
children:
|
|
6390
|
+
children: /* @__PURE__ */ jsx8(FileCode, { size: 18 })
|
|
7957
6391
|
},
|
|
7958
6392
|
"codeBlock"
|
|
7959
6393
|
);
|
|
7960
6394
|
case "subscript":
|
|
7961
|
-
return /* @__PURE__ */
|
|
6395
|
+
return /* @__PURE__ */ jsx8(
|
|
7962
6396
|
ToolbarButton3,
|
|
7963
6397
|
{
|
|
7964
6398
|
onClick: () => editor.chain().focus().toggleSubscript().run(),
|
|
7965
6399
|
active: editor.isActive("subscript"),
|
|
7966
6400
|
title: "Subscript",
|
|
7967
|
-
children:
|
|
7968
|
-
"X",
|
|
7969
|
-
/* @__PURE__ */ jsx8("sub", { children: "2" })
|
|
7970
|
-
]
|
|
6401
|
+
children: /* @__PURE__ */ jsx8(Subscript2, { size: 18 })
|
|
7971
6402
|
},
|
|
7972
6403
|
"subscript"
|
|
7973
6404
|
);
|
|
7974
6405
|
case "superscript":
|
|
7975
|
-
return /* @__PURE__ */
|
|
6406
|
+
return /* @__PURE__ */ jsx8(
|
|
7976
6407
|
ToolbarButton3,
|
|
7977
6408
|
{
|
|
7978
6409
|
onClick: () => editor.chain().focus().toggleSuperscript().run(),
|
|
7979
6410
|
active: editor.isActive("superscript"),
|
|
7980
6411
|
title: "Superscript",
|
|
7981
|
-
children:
|
|
7982
|
-
"X",
|
|
7983
|
-
/* @__PURE__ */ jsx8("sup", { children: "2" })
|
|
7984
|
-
]
|
|
6412
|
+
children: /* @__PURE__ */ jsx8(Superscript2, { size: 18 })
|
|
7985
6413
|
},
|
|
7986
6414
|
"superscript"
|
|
7987
6415
|
);
|
|
@@ -7991,7 +6419,7 @@ var Toolbar = ({
|
|
|
7991
6419
|
{
|
|
7992
6420
|
onClick: () => editor.chain().focus().clearNodes().unsetAllMarks().run(),
|
|
7993
6421
|
title: "Clear Formatting",
|
|
7994
|
-
children:
|
|
6422
|
+
children: /* @__PURE__ */ jsx8(RemoveFormatting, { size: 18 })
|
|
7995
6423
|
},
|
|
7996
6424
|
"clearFormatting"
|
|
7997
6425
|
);
|
|
@@ -8058,7 +6486,7 @@ var Toolbar = ({
|
|
|
8058
6486
|
);
|
|
8059
6487
|
case "textColor":
|
|
8060
6488
|
return /* @__PURE__ */ jsx8("span", { className: "rte-builder-toolbar-color", children: /* @__PURE__ */ jsxs8("label", { title: "Text Color", children: [
|
|
8061
|
-
|
|
6489
|
+
/* @__PURE__ */ jsx8(Type, { size: 18 }),
|
|
8062
6490
|
/* @__PURE__ */ jsx8(
|
|
8063
6491
|
"input",
|
|
8064
6492
|
{
|
|
@@ -8070,7 +6498,7 @@ var Toolbar = ({
|
|
|
8070
6498
|
] }) }, "textColor");
|
|
8071
6499
|
case "backgroundColor":
|
|
8072
6500
|
return /* @__PURE__ */ jsx8("span", { className: "rte-builder-toolbar-color", children: /* @__PURE__ */ jsxs8("label", { title: "Background Color", children: [
|
|
8073
|
-
|
|
6501
|
+
/* @__PURE__ */ jsx8(Highlighter, { size: 18 }),
|
|
8074
6502
|
/* @__PURE__ */ jsx8(
|
|
8075
6503
|
"input",
|
|
8076
6504
|
{
|
|
@@ -8087,7 +6515,7 @@ var Toolbar = ({
|
|
|
8087
6515
|
onClick: () => editor.chain().focus().setTextAlign("left").run(),
|
|
8088
6516
|
active: editor.isActive({ textAlign: "left" }),
|
|
8089
6517
|
title: "Align Left",
|
|
8090
|
-
children:
|
|
6518
|
+
children: /* @__PURE__ */ jsx8(AlignLeft, { size: 18 })
|
|
8091
6519
|
},
|
|
8092
6520
|
"alignLeft"
|
|
8093
6521
|
);
|
|
@@ -8098,7 +6526,7 @@ var Toolbar = ({
|
|
|
8098
6526
|
onClick: () => editor.chain().focus().setTextAlign("center").run(),
|
|
8099
6527
|
active: editor.isActive({ textAlign: "center" }),
|
|
8100
6528
|
title: "Align Center",
|
|
8101
|
-
children:
|
|
6529
|
+
children: /* @__PURE__ */ jsx8(AlignCenter, { size: 18 })
|
|
8102
6530
|
},
|
|
8103
6531
|
"alignCenter"
|
|
8104
6532
|
);
|
|
@@ -8109,7 +6537,7 @@ var Toolbar = ({
|
|
|
8109
6537
|
onClick: () => editor.chain().focus().setTextAlign("right").run(),
|
|
8110
6538
|
active: editor.isActive({ textAlign: "right" }),
|
|
8111
6539
|
title: "Align Right",
|
|
8112
|
-
children:
|
|
6540
|
+
children: /* @__PURE__ */ jsx8(AlignRight, { size: 18 })
|
|
8113
6541
|
},
|
|
8114
6542
|
"alignRight"
|
|
8115
6543
|
);
|
|
@@ -8120,7 +6548,7 @@ var Toolbar = ({
|
|
|
8120
6548
|
onClick: () => editor.chain().focus().setTextAlign("justify").run(),
|
|
8121
6549
|
active: editor.isActive({ textAlign: "justify" }),
|
|
8122
6550
|
title: "Justify",
|
|
8123
|
-
children:
|
|
6551
|
+
children: /* @__PURE__ */ jsx8(AlignJustify, { size: 18 })
|
|
8124
6552
|
},
|
|
8125
6553
|
"alignJustify"
|
|
8126
6554
|
);
|
|
@@ -8130,7 +6558,7 @@ var Toolbar = ({
|
|
|
8130
6558
|
{
|
|
8131
6559
|
onClick: () => editor.chain().focus().indent().run(),
|
|
8132
6560
|
title: "Indent (Tab)",
|
|
8133
|
-
children:
|
|
6561
|
+
children: /* @__PURE__ */ jsx8(Indent2, { size: 18 })
|
|
8134
6562
|
},
|
|
8135
6563
|
"indent"
|
|
8136
6564
|
);
|
|
@@ -8140,7 +6568,7 @@ var Toolbar = ({
|
|
|
8140
6568
|
{
|
|
8141
6569
|
onClick: () => editor.chain().focus().outdent().run(),
|
|
8142
6570
|
title: "Outdent (Shift+Tab)",
|
|
8143
|
-
children:
|
|
6571
|
+
children: /* @__PURE__ */ jsx8(Outdent, { size: 18 })
|
|
8144
6572
|
},
|
|
8145
6573
|
"outdent"
|
|
8146
6574
|
);
|
|
@@ -8151,7 +6579,7 @@ var Toolbar = ({
|
|
|
8151
6579
|
onClick: () => editor.chain().focus().toggleBulletList().run(),
|
|
8152
6580
|
active: editor.isActive("bulletList"),
|
|
8153
6581
|
title: "Bullet List",
|
|
8154
|
-
children:
|
|
6582
|
+
children: /* @__PURE__ */ jsx8(List, { size: 18 })
|
|
8155
6583
|
},
|
|
8156
6584
|
"bulletList"
|
|
8157
6585
|
);
|
|
@@ -8162,7 +6590,7 @@ var Toolbar = ({
|
|
|
8162
6590
|
onClick: () => editor.chain().focus().toggleOrderedList().run(),
|
|
8163
6591
|
active: editor.isActive("orderedList"),
|
|
8164
6592
|
title: "Numbered List",
|
|
8165
|
-
children:
|
|
6593
|
+
children: /* @__PURE__ */ jsx8(ListOrdered, { size: 18 })
|
|
8166
6594
|
},
|
|
8167
6595
|
"orderedList"
|
|
8168
6596
|
);
|
|
@@ -8173,16 +6601,16 @@ var Toolbar = ({
|
|
|
8173
6601
|
case "heading5":
|
|
8174
6602
|
case "heading6":
|
|
8175
6603
|
const level = parseInt(button.replace("heading", ""));
|
|
8176
|
-
return /* @__PURE__ */
|
|
6604
|
+
return /* @__PURE__ */ jsx8(
|
|
8177
6605
|
ToolbarButton3,
|
|
8178
6606
|
{
|
|
8179
6607
|
onClick: () => editor.chain().focus().toggleHeading({ level }).run(),
|
|
8180
6608
|
active: editor.isActive("heading", { level }),
|
|
8181
6609
|
title: `Heading ${level}`,
|
|
8182
|
-
children: [
|
|
8183
|
-
|
|
8184
|
-
level
|
|
8185
|
-
]
|
|
6610
|
+
children: /* @__PURE__ */ jsxs8("span", { style: { display: "flex", alignItems: "center", gap: "2px" }, children: [
|
|
6611
|
+
/* @__PURE__ */ jsx8(Heading2, { size: 18 }),
|
|
6612
|
+
/* @__PURE__ */ jsx8("span", { style: { fontSize: "11px", fontWeight: "bold" }, children: level })
|
|
6613
|
+
] })
|
|
8186
6614
|
},
|
|
8187
6615
|
button
|
|
8188
6616
|
);
|
|
@@ -8193,7 +6621,7 @@ var Toolbar = ({
|
|
|
8193
6621
|
onClick: () => editor.chain().focus().toggleBlockquote().run(),
|
|
8194
6622
|
active: editor.isActive("blockquote"),
|
|
8195
6623
|
title: "Blockquote",
|
|
8196
|
-
children:
|
|
6624
|
+
children: /* @__PURE__ */ jsx8(Quote, { size: 18 })
|
|
8197
6625
|
},
|
|
8198
6626
|
"blockquote"
|
|
8199
6627
|
);
|
|
@@ -8203,7 +6631,7 @@ var Toolbar = ({
|
|
|
8203
6631
|
{
|
|
8204
6632
|
onClick: () => editor.chain().focus().setHorizontalRule().run(),
|
|
8205
6633
|
title: "Horizontal Rule",
|
|
8206
|
-
children:
|
|
6634
|
+
children: /* @__PURE__ */ jsx8(Minus, { size: 18 })
|
|
8207
6635
|
},
|
|
8208
6636
|
"horizontalRule"
|
|
8209
6637
|
);
|
|
@@ -8219,7 +6647,7 @@ var Toolbar = ({
|
|
|
8219
6647
|
},
|
|
8220
6648
|
active: editor.isActive("link"),
|
|
8221
6649
|
title: "Insert Link",
|
|
8222
|
-
children:
|
|
6650
|
+
children: /* @__PURE__ */ jsx8(Link2, { size: 18 })
|
|
8223
6651
|
},
|
|
8224
6652
|
"link"
|
|
8225
6653
|
);
|
|
@@ -8230,7 +6658,7 @@ var Toolbar = ({
|
|
|
8230
6658
|
onClick: () => editor.chain().focus().unsetLink().run(),
|
|
8231
6659
|
disabled: !editor.isActive("link"),
|
|
8232
6660
|
title: "Remove Link",
|
|
8233
|
-
children:
|
|
6661
|
+
children: /* @__PURE__ */ jsx8(Unlink, { size: 18 })
|
|
8234
6662
|
},
|
|
8235
6663
|
"unlink"
|
|
8236
6664
|
);
|
|
@@ -8249,7 +6677,7 @@ var Toolbar = ({
|
|
|
8249
6677
|
}
|
|
8250
6678
|
},
|
|
8251
6679
|
title: "Insert Image",
|
|
8252
|
-
children:
|
|
6680
|
+
children: /* @__PURE__ */ jsx8(Image2, { size: 18 })
|
|
8253
6681
|
},
|
|
8254
6682
|
"image"
|
|
8255
6683
|
);
|
|
@@ -8268,7 +6696,7 @@ var Toolbar = ({
|
|
|
8268
6696
|
}
|
|
8269
6697
|
},
|
|
8270
6698
|
title: "Insert Video",
|
|
8271
|
-
children:
|
|
6699
|
+
children: /* @__PURE__ */ jsx8(Video2, { size: 18 })
|
|
8272
6700
|
},
|
|
8273
6701
|
"video"
|
|
8274
6702
|
);
|
|
@@ -8278,7 +6706,7 @@ var Toolbar = ({
|
|
|
8278
6706
|
{
|
|
8279
6707
|
onClick: () => editor.chain().focus().insertTable({ rows: 3, cols: 3, withHeaderRow: true }).run(),
|
|
8280
6708
|
title: "Insert Table",
|
|
8281
|
-
children:
|
|
6709
|
+
children: /* @__PURE__ */ jsx8(Table2, { size: 18 })
|
|
8282
6710
|
},
|
|
8283
6711
|
"table"
|
|
8284
6712
|
);
|
|
@@ -8291,7 +6719,7 @@ var Toolbar = ({
|
|
|
8291
6719
|
onClick: () => setShowEmojiPicker(!showEmojiPicker),
|
|
8292
6720
|
active: showEmojiPicker,
|
|
8293
6721
|
title: "Insert Emoji",
|
|
8294
|
-
children:
|
|
6722
|
+
children: /* @__PURE__ */ jsx8(Smile, { size: 18 })
|
|
8295
6723
|
}
|
|
8296
6724
|
),
|
|
8297
6725
|
showEmojiPicker && /* @__PURE__ */ jsx8(
|
|
@@ -8310,7 +6738,7 @@ var Toolbar = ({
|
|
|
8310
6738
|
onClick: () => editor.chain().focus().toggleFullscreen().run(),
|
|
8311
6739
|
active: isFullscreen,
|
|
8312
6740
|
title: isFullscreen ? "Exit Fullscreen (Esc)" : "Fullscreen (Ctrl+Shift+F)",
|
|
8313
|
-
children: isFullscreen ?
|
|
6741
|
+
children: isFullscreen ? /* @__PURE__ */ jsx8(Minimize, { size: 18 }) : /* @__PURE__ */ jsx8(Maximize, { size: 18 })
|
|
8314
6742
|
},
|
|
8315
6743
|
"fullscreen"
|
|
8316
6744
|
);
|
|
@@ -8320,7 +6748,7 @@ var Toolbar = ({
|
|
|
8320
6748
|
{
|
|
8321
6749
|
onClick: () => editor.chain().focus().print().run(),
|
|
8322
6750
|
title: "Print (Ctrl+P)",
|
|
8323
|
-
children:
|
|
6751
|
+
children: /* @__PURE__ */ jsx8(Printer, { size: 18 })
|
|
8324
6752
|
},
|
|
8325
6753
|
"print"
|
|
8326
6754
|
);
|
|
@@ -8331,7 +6759,7 @@ var Toolbar = ({
|
|
|
8331
6759
|
onClick: () => editor.chain().focus().undo().run(),
|
|
8332
6760
|
disabled: !editor.can().undo(),
|
|
8333
6761
|
title: "Undo (Ctrl+Z)",
|
|
8334
|
-
children:
|
|
6762
|
+
children: /* @__PURE__ */ jsx8(Undo, { size: 18 })
|
|
8335
6763
|
},
|
|
8336
6764
|
"undo"
|
|
8337
6765
|
);
|
|
@@ -8342,7 +6770,7 @@ var Toolbar = ({
|
|
|
8342
6770
|
onClick: () => editor.chain().focus().redo().run(),
|
|
8343
6771
|
disabled: !editor.can().redo(),
|
|
8344
6772
|
title: "Redo (Ctrl+Y)",
|
|
8345
|
-
children:
|
|
6773
|
+
children: /* @__PURE__ */ jsx8(Redo, { size: 18 })
|
|
8346
6774
|
},
|
|
8347
6775
|
"redo"
|
|
8348
6776
|
);
|
|
@@ -8483,19 +6911,19 @@ var RichTextEditor = forwardRef5(
|
|
|
8483
6911
|
Document2,
|
|
8484
6912
|
Paragraph2,
|
|
8485
6913
|
Text3,
|
|
8486
|
-
|
|
8487
|
-
|
|
8488
|
-
|
|
6914
|
+
Bold3,
|
|
6915
|
+
Italic3,
|
|
6916
|
+
Underline3,
|
|
8489
6917
|
Strike2,
|
|
8490
|
-
|
|
6918
|
+
Code3,
|
|
8491
6919
|
enableCodeHighlight ? CodeBlockLowlight2.configure({
|
|
8492
6920
|
lowlight: lowlight2,
|
|
8493
6921
|
defaultLanguage: defaultCodeLanguage
|
|
8494
6922
|
}) : CodeBlockLowlight2.configure({
|
|
8495
6923
|
lowlight: null
|
|
8496
6924
|
}),
|
|
8497
|
-
|
|
8498
|
-
|
|
6925
|
+
Subscript3,
|
|
6926
|
+
Superscript3,
|
|
8499
6927
|
TextStyle2,
|
|
8500
6928
|
FontFamily2,
|
|
8501
6929
|
FontSize,
|
|
@@ -8505,7 +6933,7 @@ var RichTextEditor = forwardRef5(
|
|
|
8505
6933
|
TextAlign2.configure({
|
|
8506
6934
|
types: ["heading", "paragraph"]
|
|
8507
6935
|
}),
|
|
8508
|
-
|
|
6936
|
+
Heading3.configure({
|
|
8509
6937
|
levels: [1, 2, 3, 4, 5, 6]
|
|
8510
6938
|
}),
|
|
8511
6939
|
BulletList2,
|
|
@@ -8513,19 +6941,19 @@ var RichTextEditor = forwardRef5(
|
|
|
8513
6941
|
ListItem2,
|
|
8514
6942
|
Blockquote2,
|
|
8515
6943
|
HorizontalRule2,
|
|
8516
|
-
|
|
6944
|
+
Link3.configure({
|
|
8517
6945
|
openOnClick: false,
|
|
8518
6946
|
HTMLAttributes: {
|
|
8519
6947
|
target: "_blank",
|
|
8520
6948
|
rel: "noopener noreferrer"
|
|
8521
6949
|
}
|
|
8522
6950
|
}),
|
|
8523
|
-
|
|
6951
|
+
Image3.configure({
|
|
8524
6952
|
inline: false,
|
|
8525
6953
|
allowBase64: true
|
|
8526
6954
|
}),
|
|
8527
6955
|
Video,
|
|
8528
|
-
|
|
6956
|
+
Table3.configure({
|
|
8529
6957
|
resizable: true
|
|
8530
6958
|
}),
|
|
8531
6959
|
TableRow2,
|
|
@@ -9233,7 +7661,7 @@ function useCommentsOptional() {
|
|
|
9233
7661
|
|
|
9234
7662
|
// src/comments/CommentsPanel.tsx
|
|
9235
7663
|
import { useState as useState8 } from "react";
|
|
9236
|
-
import { Fragment as
|
|
7664
|
+
import { Fragment as Fragment2, jsx as jsx13, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
9237
7665
|
function formatRelativeTime(timestamp) {
|
|
9238
7666
|
const now = Date.now();
|
|
9239
7667
|
const diff = now - timestamp;
|
|
@@ -9383,7 +7811,7 @@ function ThreadItem({ thread }) {
|
|
|
9383
7811
|
},
|
|
9384
7812
|
comment.id
|
|
9385
7813
|
)) }),
|
|
9386
|
-
thread.status === "open" && /* @__PURE__ */ jsx13("div", { className: "rte-thread-reply", children: showReply ? /* @__PURE__ */ jsxs11(
|
|
7814
|
+
thread.status === "open" && /* @__PURE__ */ jsx13("div", { className: "rte-thread-reply", children: showReply ? /* @__PURE__ */ jsxs11(Fragment2, { children: [
|
|
9387
7815
|
/* @__PURE__ */ jsx13(
|
|
9388
7816
|
"textarea",
|
|
9389
7817
|
{
|
|
@@ -9771,7 +8199,7 @@ function useVersionHistoryOptional() {
|
|
|
9771
8199
|
|
|
9772
8200
|
// src/history/VersionHistoryPanel.tsx
|
|
9773
8201
|
import { useState as useState9 } from "react";
|
|
9774
|
-
import { Fragment as
|
|
8202
|
+
import { Fragment as Fragment3, jsx as jsx15, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
9775
8203
|
function formatDate(timestamp) {
|
|
9776
8204
|
const date = new Date(timestamp);
|
|
9777
8205
|
const now = /* @__PURE__ */ new Date();
|
|
@@ -9994,7 +8422,7 @@ function VersionHistoryPanel({ position = "right", className = "" }) {
|
|
|
9994
8422
|
onClose: handleCancelCompare
|
|
9995
8423
|
}
|
|
9996
8424
|
),
|
|
9997
|
-
!state.isComparing && /* @__PURE__ */ jsx15("div", { className: "rte-version-list", children: state.versions.length === 0 ? /* @__PURE__ */ jsx15("div", { className: "rte-version-empty", children: "No versions saved yet. Changes will be auto-saved periodically." }) : /* @__PURE__ */ jsxs12(
|
|
8425
|
+
!state.isComparing && /* @__PURE__ */ jsx15("div", { className: "rte-version-list", children: state.versions.length === 0 ? /* @__PURE__ */ jsx15("div", { className: "rte-version-empty", children: "No versions saved yet. Changes will be auto-saved periodically." }) : /* @__PURE__ */ jsxs12(Fragment3, { children: [
|
|
9998
8426
|
state.versions.some((v) => v.isPinned) && /* @__PURE__ */ jsxs12("div", { className: "rte-version-section", children: [
|
|
9999
8427
|
/* @__PURE__ */ jsx15("div", { className: "rte-version-section-title", children: "\u{1F4CC} Pinned" }),
|
|
10000
8428
|
state.versions.filter((v) => v.isPinned).map((version) => /* @__PURE__ */ jsx15(
|