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.js
CHANGED
|
@@ -34,2151 +34,13 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
34
34
|
));
|
|
35
35
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
36
36
|
|
|
37
|
-
// node_modules/@tiptap/core/dist/index.js
|
|
38
|
-
function createChainableState(config) {
|
|
39
|
-
const { state, transaction } = config;
|
|
40
|
-
let { selection } = transaction;
|
|
41
|
-
let { doc } = transaction;
|
|
42
|
-
let { storedMarks } = transaction;
|
|
43
|
-
return {
|
|
44
|
-
...state,
|
|
45
|
-
apply: state.apply.bind(state),
|
|
46
|
-
applyTransaction: state.applyTransaction.bind(state),
|
|
47
|
-
plugins: state.plugins,
|
|
48
|
-
schema: state.schema,
|
|
49
|
-
reconfigure: state.reconfigure.bind(state),
|
|
50
|
-
toJSON: state.toJSON.bind(state),
|
|
51
|
-
get storedMarks() {
|
|
52
|
-
return storedMarks;
|
|
53
|
-
},
|
|
54
|
-
get selection() {
|
|
55
|
-
return selection;
|
|
56
|
-
},
|
|
57
|
-
get doc() {
|
|
58
|
-
return doc;
|
|
59
|
-
},
|
|
60
|
-
get tr() {
|
|
61
|
-
selection = transaction.selection;
|
|
62
|
-
doc = transaction.doc;
|
|
63
|
-
storedMarks = transaction.storedMarks;
|
|
64
|
-
return transaction;
|
|
65
|
-
}
|
|
66
|
-
};
|
|
67
|
-
}
|
|
68
|
-
function getExtensionField(extension, field, context) {
|
|
69
|
-
if (extension.config[field] === void 0 && extension.parent) {
|
|
70
|
-
return getExtensionField(extension.parent, field, context);
|
|
71
|
-
}
|
|
72
|
-
if (typeof extension.config[field] === "function") {
|
|
73
|
-
const value = extension.config[field].bind({
|
|
74
|
-
...context,
|
|
75
|
-
parent: extension.parent ? getExtensionField(extension.parent, field, context) : null
|
|
76
|
-
});
|
|
77
|
-
return value;
|
|
78
|
-
}
|
|
79
|
-
return extension.config[field];
|
|
80
|
-
}
|
|
81
|
-
function splitExtensions(extensions) {
|
|
82
|
-
const baseExtensions = extensions.filter((extension) => extension.type === "extension");
|
|
83
|
-
const nodeExtensions = extensions.filter((extension) => extension.type === "node");
|
|
84
|
-
const markExtensions = extensions.filter((extension) => extension.type === "mark");
|
|
85
|
-
return {
|
|
86
|
-
baseExtensions,
|
|
87
|
-
nodeExtensions,
|
|
88
|
-
markExtensions
|
|
89
|
-
};
|
|
90
|
-
}
|
|
91
|
-
function getNodeType(nameOrType, schema) {
|
|
92
|
-
if (typeof nameOrType === "string") {
|
|
93
|
-
if (!schema.nodes[nameOrType]) {
|
|
94
|
-
throw Error(`There is no node type named '${nameOrType}'. Maybe you forgot to add the extension?`);
|
|
95
|
-
}
|
|
96
|
-
return schema.nodes[nameOrType];
|
|
97
|
-
}
|
|
98
|
-
return nameOrType;
|
|
99
|
-
}
|
|
100
|
-
function mergeAttributes(...objects) {
|
|
101
|
-
return objects.filter((item) => !!item).reduce((items, item) => {
|
|
102
|
-
const mergedAttributes = { ...items };
|
|
103
|
-
Object.entries(item).forEach(([key, value]) => {
|
|
104
|
-
const exists = mergedAttributes[key];
|
|
105
|
-
if (!exists) {
|
|
106
|
-
mergedAttributes[key] = value;
|
|
107
|
-
return;
|
|
108
|
-
}
|
|
109
|
-
if (key === "class") {
|
|
110
|
-
const valueClasses = value ? String(value).split(" ") : [];
|
|
111
|
-
const existingClasses = mergedAttributes[key] ? mergedAttributes[key].split(" ") : [];
|
|
112
|
-
const insertClasses = valueClasses.filter((valueClass) => !existingClasses.includes(valueClass));
|
|
113
|
-
mergedAttributes[key] = [...existingClasses, ...insertClasses].join(" ");
|
|
114
|
-
} else if (key === "style") {
|
|
115
|
-
const newStyles = value ? value.split(";").map((style) => style.trim()).filter(Boolean) : [];
|
|
116
|
-
const existingStyles = mergedAttributes[key] ? mergedAttributes[key].split(";").map((style) => style.trim()).filter(Boolean) : [];
|
|
117
|
-
const styleMap = /* @__PURE__ */ new Map();
|
|
118
|
-
existingStyles.forEach((style) => {
|
|
119
|
-
const [property, val] = style.split(":").map((part) => part.trim());
|
|
120
|
-
styleMap.set(property, val);
|
|
121
|
-
});
|
|
122
|
-
newStyles.forEach((style) => {
|
|
123
|
-
const [property, val] = style.split(":").map((part) => part.trim());
|
|
124
|
-
styleMap.set(property, val);
|
|
125
|
-
});
|
|
126
|
-
mergedAttributes[key] = Array.from(styleMap.entries()).map(([property, val]) => `${property}: ${val}`).join("; ");
|
|
127
|
-
} else {
|
|
128
|
-
mergedAttributes[key] = value;
|
|
129
|
-
}
|
|
130
|
-
});
|
|
131
|
-
return mergedAttributes;
|
|
132
|
-
}, {});
|
|
133
|
-
}
|
|
134
|
-
function isFunction(value) {
|
|
135
|
-
return typeof value === "function";
|
|
136
|
-
}
|
|
137
|
-
function callOrReturn(value, context = void 0, ...props) {
|
|
138
|
-
if (isFunction(value)) {
|
|
139
|
-
if (context) {
|
|
140
|
-
return value.bind(context)(...props);
|
|
141
|
-
}
|
|
142
|
-
return value(...props);
|
|
143
|
-
}
|
|
144
|
-
return value;
|
|
145
|
-
}
|
|
146
|
-
function isRegExp(value) {
|
|
147
|
-
return Object.prototype.toString.call(value) === "[object RegExp]";
|
|
148
|
-
}
|
|
149
|
-
function getType(value) {
|
|
150
|
-
return Object.prototype.toString.call(value).slice(8, -1);
|
|
151
|
-
}
|
|
152
|
-
function isPlainObject(value) {
|
|
153
|
-
if (getType(value) !== "Object") {
|
|
154
|
-
return false;
|
|
155
|
-
}
|
|
156
|
-
return value.constructor === Object && Object.getPrototypeOf(value) === Object.prototype;
|
|
157
|
-
}
|
|
158
|
-
function mergeDeep(target, source) {
|
|
159
|
-
const output = { ...target };
|
|
160
|
-
if (isPlainObject(target) && isPlainObject(source)) {
|
|
161
|
-
Object.keys(source).forEach((key) => {
|
|
162
|
-
if (isPlainObject(source[key]) && isPlainObject(target[key])) {
|
|
163
|
-
output[key] = mergeDeep(target[key], source[key]);
|
|
164
|
-
} else {
|
|
165
|
-
output[key] = source[key];
|
|
166
|
-
}
|
|
167
|
-
});
|
|
168
|
-
}
|
|
169
|
-
return output;
|
|
170
|
-
}
|
|
171
|
-
function getTextBetween(startNode, range, options) {
|
|
172
|
-
const { from, to } = range;
|
|
173
|
-
const { blockSeparator = "\n\n", textSerializers = {} } = options || {};
|
|
174
|
-
let text = "";
|
|
175
|
-
startNode.nodesBetween(from, to, (node, pos, parent, index) => {
|
|
176
|
-
var _a;
|
|
177
|
-
if (node.isBlock && pos > from) {
|
|
178
|
-
text += blockSeparator;
|
|
179
|
-
}
|
|
180
|
-
const textSerializer = textSerializers === null || textSerializers === void 0 ? void 0 : textSerializers[node.type.name];
|
|
181
|
-
if (textSerializer) {
|
|
182
|
-
if (parent) {
|
|
183
|
-
text += textSerializer({
|
|
184
|
-
node,
|
|
185
|
-
pos,
|
|
186
|
-
parent,
|
|
187
|
-
index,
|
|
188
|
-
range
|
|
189
|
-
});
|
|
190
|
-
}
|
|
191
|
-
return false;
|
|
192
|
-
}
|
|
193
|
-
if (node.isText) {
|
|
194
|
-
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);
|
|
195
|
-
}
|
|
196
|
-
});
|
|
197
|
-
return text;
|
|
198
|
-
}
|
|
199
|
-
function getTextSerializersFromSchema(schema) {
|
|
200
|
-
return Object.fromEntries(Object.entries(schema.nodes).filter(([, node]) => node.spec.toText).map(([name, node]) => [name, node.spec.toText]));
|
|
201
|
-
}
|
|
202
|
-
function objectIncludes(object1, object2, options = { strict: true }) {
|
|
203
|
-
const keys = Object.keys(object2);
|
|
204
|
-
if (!keys.length) {
|
|
205
|
-
return true;
|
|
206
|
-
}
|
|
207
|
-
return keys.every((key) => {
|
|
208
|
-
if (options.strict) {
|
|
209
|
-
return object2[key] === object1[key];
|
|
210
|
-
}
|
|
211
|
-
if (isRegExp(object2[key])) {
|
|
212
|
-
return object2[key].test(object1[key]);
|
|
213
|
-
}
|
|
214
|
-
return object2[key] === object1[key];
|
|
215
|
-
});
|
|
216
|
-
}
|
|
217
|
-
function findMarkInSet(marks, type, attributes = {}) {
|
|
218
|
-
return marks.find((item) => {
|
|
219
|
-
return item.type === type && objectIncludes(
|
|
220
|
-
// Only check equality for the attributes that are provided
|
|
221
|
-
Object.fromEntries(Object.keys(attributes).map((k) => [k, item.attrs[k]])),
|
|
222
|
-
attributes
|
|
223
|
-
);
|
|
224
|
-
});
|
|
225
|
-
}
|
|
226
|
-
function isMarkInSet(marks, type, attributes = {}) {
|
|
227
|
-
return !!findMarkInSet(marks, type, attributes);
|
|
228
|
-
}
|
|
229
|
-
function getMarkRange($pos, type, attributes) {
|
|
230
|
-
var _a;
|
|
231
|
-
if (!$pos || !type) {
|
|
232
|
-
return;
|
|
233
|
-
}
|
|
234
|
-
let start = $pos.parent.childAfter($pos.parentOffset);
|
|
235
|
-
if (!start.node || !start.node.marks.some((mark2) => mark2.type === type)) {
|
|
236
|
-
start = $pos.parent.childBefore($pos.parentOffset);
|
|
237
|
-
}
|
|
238
|
-
if (!start.node || !start.node.marks.some((mark2) => mark2.type === type)) {
|
|
239
|
-
return;
|
|
240
|
-
}
|
|
241
|
-
attributes = attributes || ((_a = start.node.marks[0]) === null || _a === void 0 ? void 0 : _a.attrs);
|
|
242
|
-
const mark = findMarkInSet([...start.node.marks], type, attributes);
|
|
243
|
-
if (!mark) {
|
|
244
|
-
return;
|
|
245
|
-
}
|
|
246
|
-
let startIndex = start.index;
|
|
247
|
-
let startPos = $pos.start() + start.offset;
|
|
248
|
-
let endIndex = startIndex + 1;
|
|
249
|
-
let endPos = startPos + start.node.nodeSize;
|
|
250
|
-
while (startIndex > 0 && isMarkInSet([...$pos.parent.child(startIndex - 1).marks], type, attributes)) {
|
|
251
|
-
startIndex -= 1;
|
|
252
|
-
startPos -= $pos.parent.child(startIndex).nodeSize;
|
|
253
|
-
}
|
|
254
|
-
while (endIndex < $pos.parent.childCount && isMarkInSet([...$pos.parent.child(endIndex).marks], type, attributes)) {
|
|
255
|
-
endPos += $pos.parent.child(endIndex).nodeSize;
|
|
256
|
-
endIndex += 1;
|
|
257
|
-
}
|
|
258
|
-
return {
|
|
259
|
-
from: startPos,
|
|
260
|
-
to: endPos
|
|
261
|
-
};
|
|
262
|
-
}
|
|
263
|
-
function getMarkType(nameOrType, schema) {
|
|
264
|
-
if (typeof nameOrType === "string") {
|
|
265
|
-
if (!schema.marks[nameOrType]) {
|
|
266
|
-
throw Error(`There is no mark type named '${nameOrType}'. Maybe you forgot to add the extension?`);
|
|
267
|
-
}
|
|
268
|
-
return schema.marks[nameOrType];
|
|
269
|
-
}
|
|
270
|
-
return nameOrType;
|
|
271
|
-
}
|
|
272
|
-
function isTextSelection(value) {
|
|
273
|
-
return value instanceof import_state.TextSelection;
|
|
274
|
-
}
|
|
275
|
-
function minMax(value = 0, min = 0, max = 0) {
|
|
276
|
-
return Math.min(Math.max(value, min), max);
|
|
277
|
-
}
|
|
278
|
-
function resolveFocusPosition(doc, position = null) {
|
|
279
|
-
if (!position) {
|
|
280
|
-
return null;
|
|
281
|
-
}
|
|
282
|
-
const selectionAtStart = import_state.Selection.atStart(doc);
|
|
283
|
-
const selectionAtEnd = import_state.Selection.atEnd(doc);
|
|
284
|
-
if (position === "start" || position === true) {
|
|
285
|
-
return selectionAtStart;
|
|
286
|
-
}
|
|
287
|
-
if (position === "end") {
|
|
288
|
-
return selectionAtEnd;
|
|
289
|
-
}
|
|
290
|
-
const minPos = selectionAtStart.from;
|
|
291
|
-
const maxPos = selectionAtEnd.to;
|
|
292
|
-
if (position === "all") {
|
|
293
|
-
return import_state.TextSelection.create(doc, minMax(0, minPos, maxPos), minMax(doc.content.size, minPos, maxPos));
|
|
294
|
-
}
|
|
295
|
-
return import_state.TextSelection.create(doc, minMax(position, minPos, maxPos), minMax(position, minPos, maxPos));
|
|
296
|
-
}
|
|
297
|
-
function isAndroid() {
|
|
298
|
-
return navigator.platform === "Android" || /android/i.test(navigator.userAgent);
|
|
299
|
-
}
|
|
300
|
-
function isiOS() {
|
|
301
|
-
return [
|
|
302
|
-
"iPad Simulator",
|
|
303
|
-
"iPhone Simulator",
|
|
304
|
-
"iPod Simulator",
|
|
305
|
-
"iPad",
|
|
306
|
-
"iPhone",
|
|
307
|
-
"iPod"
|
|
308
|
-
].includes(navigator.platform) || navigator.userAgent.includes("Mac") && "ontouchend" in document;
|
|
309
|
-
}
|
|
310
|
-
function isSafari() {
|
|
311
|
-
return typeof navigator !== "undefined" ? /^((?!chrome|android).)*safari/i.test(navigator.userAgent) : false;
|
|
312
|
-
}
|
|
313
|
-
function elementFromString(value) {
|
|
314
|
-
const wrappedValue = `<body>${value}</body>`;
|
|
315
|
-
const html = new window.DOMParser().parseFromString(wrappedValue, "text/html").body;
|
|
316
|
-
return removeWhitespaces(html);
|
|
317
|
-
}
|
|
318
|
-
function createNodeFromContent(content, schema, options) {
|
|
319
|
-
if (content instanceof import_model.Node || content instanceof import_model.Fragment) {
|
|
320
|
-
return content;
|
|
321
|
-
}
|
|
322
|
-
options = {
|
|
323
|
-
slice: true,
|
|
324
|
-
parseOptions: {},
|
|
325
|
-
...options
|
|
326
|
-
};
|
|
327
|
-
const isJSONContent = typeof content === "object" && content !== null;
|
|
328
|
-
const isTextContent = typeof content === "string";
|
|
329
|
-
if (isJSONContent) {
|
|
330
|
-
try {
|
|
331
|
-
const isArrayContent = Array.isArray(content) && content.length > 0;
|
|
332
|
-
if (isArrayContent) {
|
|
333
|
-
return import_model.Fragment.fromArray(content.map((item) => schema.nodeFromJSON(item)));
|
|
334
|
-
}
|
|
335
|
-
const node = schema.nodeFromJSON(content);
|
|
336
|
-
if (options.errorOnInvalidContent) {
|
|
337
|
-
node.check();
|
|
338
|
-
}
|
|
339
|
-
return node;
|
|
340
|
-
} catch (error) {
|
|
341
|
-
if (options.errorOnInvalidContent) {
|
|
342
|
-
throw new Error("[tiptap error]: Invalid JSON content", { cause: error });
|
|
343
|
-
}
|
|
344
|
-
console.warn("[tiptap warn]: Invalid content.", "Passed value:", content, "Error:", error);
|
|
345
|
-
return createNodeFromContent("", schema, options);
|
|
346
|
-
}
|
|
347
|
-
}
|
|
348
|
-
if (isTextContent) {
|
|
349
|
-
if (options.errorOnInvalidContent) {
|
|
350
|
-
let hasInvalidContent = false;
|
|
351
|
-
let invalidContent = "";
|
|
352
|
-
const contentCheckSchema = new import_model.Schema({
|
|
353
|
-
topNode: schema.spec.topNode,
|
|
354
|
-
marks: schema.spec.marks,
|
|
355
|
-
// Prosemirror's schemas are executed such that: the last to execute, matches last
|
|
356
|
-
// 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
|
|
357
|
-
nodes: schema.spec.nodes.append({
|
|
358
|
-
__tiptap__private__unknown__catch__all__node: {
|
|
359
|
-
content: "inline*",
|
|
360
|
-
group: "block",
|
|
361
|
-
parseDOM: [
|
|
362
|
-
{
|
|
363
|
-
tag: "*",
|
|
364
|
-
getAttrs: (e) => {
|
|
365
|
-
hasInvalidContent = true;
|
|
366
|
-
invalidContent = typeof e === "string" ? e : e.outerHTML;
|
|
367
|
-
return null;
|
|
368
|
-
}
|
|
369
|
-
}
|
|
370
|
-
]
|
|
371
|
-
}
|
|
372
|
-
})
|
|
373
|
-
});
|
|
374
|
-
if (options.slice) {
|
|
375
|
-
import_model.DOMParser.fromSchema(contentCheckSchema).parseSlice(elementFromString(content), options.parseOptions);
|
|
376
|
-
} else {
|
|
377
|
-
import_model.DOMParser.fromSchema(contentCheckSchema).parse(elementFromString(content), options.parseOptions);
|
|
378
|
-
}
|
|
379
|
-
if (options.errorOnInvalidContent && hasInvalidContent) {
|
|
380
|
-
throw new Error("[tiptap error]: Invalid HTML content", { cause: new Error(`Invalid element found: ${invalidContent}`) });
|
|
381
|
-
}
|
|
382
|
-
}
|
|
383
|
-
const parser = import_model.DOMParser.fromSchema(schema);
|
|
384
|
-
if (options.slice) {
|
|
385
|
-
return parser.parseSlice(elementFromString(content), options.parseOptions).content;
|
|
386
|
-
}
|
|
387
|
-
return parser.parse(elementFromString(content), options.parseOptions);
|
|
388
|
-
}
|
|
389
|
-
return createNodeFromContent("", schema, options);
|
|
390
|
-
}
|
|
391
|
-
function selectionToInsertionEnd(tr, startLen, bias) {
|
|
392
|
-
const last = tr.steps.length - 1;
|
|
393
|
-
if (last < startLen) {
|
|
394
|
-
return;
|
|
395
|
-
}
|
|
396
|
-
const step = tr.steps[last];
|
|
397
|
-
if (!(step instanceof import_transform.ReplaceStep || step instanceof import_transform.ReplaceAroundStep)) {
|
|
398
|
-
return;
|
|
399
|
-
}
|
|
400
|
-
const map = tr.mapping.maps[last];
|
|
401
|
-
let end = 0;
|
|
402
|
-
map.forEach((_from, _to, _newFrom, newTo) => {
|
|
403
|
-
if (end === 0) {
|
|
404
|
-
end = newTo;
|
|
405
|
-
}
|
|
406
|
-
});
|
|
407
|
-
tr.setSelection(import_state.Selection.near(tr.doc.resolve(end), bias));
|
|
408
|
-
}
|
|
409
|
-
function isMacOS() {
|
|
410
|
-
return typeof navigator !== "undefined" ? /Mac/.test(navigator.platform) : false;
|
|
411
|
-
}
|
|
412
|
-
function normalizeKeyName(name) {
|
|
413
|
-
const parts = name.split(/-(?!$)/);
|
|
414
|
-
let result = parts[parts.length - 1];
|
|
415
|
-
if (result === "Space") {
|
|
416
|
-
result = " ";
|
|
417
|
-
}
|
|
418
|
-
let alt;
|
|
419
|
-
let ctrl;
|
|
420
|
-
let shift;
|
|
421
|
-
let meta;
|
|
422
|
-
for (let i = 0; i < parts.length - 1; i += 1) {
|
|
423
|
-
const mod = parts[i];
|
|
424
|
-
if (/^(cmd|meta|m)$/i.test(mod)) {
|
|
425
|
-
meta = true;
|
|
426
|
-
} else if (/^a(lt)?$/i.test(mod)) {
|
|
427
|
-
alt = true;
|
|
428
|
-
} else if (/^(c|ctrl|control)$/i.test(mod)) {
|
|
429
|
-
ctrl = true;
|
|
430
|
-
} else if (/^s(hift)?$/i.test(mod)) {
|
|
431
|
-
shift = true;
|
|
432
|
-
} else if (/^mod$/i.test(mod)) {
|
|
433
|
-
if (isiOS() || isMacOS()) {
|
|
434
|
-
meta = true;
|
|
435
|
-
} else {
|
|
436
|
-
ctrl = true;
|
|
437
|
-
}
|
|
438
|
-
} else {
|
|
439
|
-
throw new Error(`Unrecognized modifier name: ${mod}`);
|
|
440
|
-
}
|
|
441
|
-
}
|
|
442
|
-
if (alt) {
|
|
443
|
-
result = `Alt-${result}`;
|
|
444
|
-
}
|
|
445
|
-
if (ctrl) {
|
|
446
|
-
result = `Ctrl-${result}`;
|
|
447
|
-
}
|
|
448
|
-
if (meta) {
|
|
449
|
-
result = `Meta-${result}`;
|
|
450
|
-
}
|
|
451
|
-
if (shift) {
|
|
452
|
-
result = `Shift-${result}`;
|
|
453
|
-
}
|
|
454
|
-
return result;
|
|
455
|
-
}
|
|
456
|
-
function isNodeActive(state, typeOrName, attributes = {}) {
|
|
457
|
-
const { from, to, empty } = state.selection;
|
|
458
|
-
const type = typeOrName ? getNodeType(typeOrName, state.schema) : null;
|
|
459
|
-
const nodeRanges = [];
|
|
460
|
-
state.doc.nodesBetween(from, to, (node, pos) => {
|
|
461
|
-
if (node.isText) {
|
|
462
|
-
return;
|
|
463
|
-
}
|
|
464
|
-
const relativeFrom = Math.max(from, pos);
|
|
465
|
-
const relativeTo = Math.min(to, pos + node.nodeSize);
|
|
466
|
-
nodeRanges.push({
|
|
467
|
-
node,
|
|
468
|
-
from: relativeFrom,
|
|
469
|
-
to: relativeTo
|
|
470
|
-
});
|
|
471
|
-
});
|
|
472
|
-
const selectionRange = to - from;
|
|
473
|
-
const matchedNodeRanges = nodeRanges.filter((nodeRange) => {
|
|
474
|
-
if (!type) {
|
|
475
|
-
return true;
|
|
476
|
-
}
|
|
477
|
-
return type.name === nodeRange.node.type.name;
|
|
478
|
-
}).filter((nodeRange) => objectIncludes(nodeRange.node.attrs, attributes, { strict: false }));
|
|
479
|
-
if (empty) {
|
|
480
|
-
return !!matchedNodeRanges.length;
|
|
481
|
-
}
|
|
482
|
-
const range = matchedNodeRanges.reduce((sum, nodeRange) => sum + nodeRange.to - nodeRange.from, 0);
|
|
483
|
-
return range >= selectionRange;
|
|
484
|
-
}
|
|
485
|
-
function getSchemaTypeNameByName(name, schema) {
|
|
486
|
-
if (schema.nodes[name]) {
|
|
487
|
-
return "node";
|
|
488
|
-
}
|
|
489
|
-
if (schema.marks[name]) {
|
|
490
|
-
return "mark";
|
|
491
|
-
}
|
|
492
|
-
return null;
|
|
493
|
-
}
|
|
494
|
-
function deleteProps(obj, propOrProps) {
|
|
495
|
-
const props = typeof propOrProps === "string" ? [propOrProps] : propOrProps;
|
|
496
|
-
return Object.keys(obj).reduce((newObj, prop) => {
|
|
497
|
-
if (!props.includes(prop)) {
|
|
498
|
-
newObj[prop] = obj[prop];
|
|
499
|
-
}
|
|
500
|
-
return newObj;
|
|
501
|
-
}, {});
|
|
502
|
-
}
|
|
503
|
-
function createDocument(content, schema, parseOptions = {}, options = {}) {
|
|
504
|
-
return createNodeFromContent(content, schema, {
|
|
505
|
-
slice: false,
|
|
506
|
-
parseOptions,
|
|
507
|
-
errorOnInvalidContent: options.errorOnInvalidContent
|
|
508
|
-
});
|
|
509
|
-
}
|
|
510
|
-
function getMarkAttributes(state, typeOrName) {
|
|
511
|
-
const type = getMarkType(typeOrName, state.schema);
|
|
512
|
-
const { from, to, empty } = state.selection;
|
|
513
|
-
const marks = [];
|
|
514
|
-
if (empty) {
|
|
515
|
-
if (state.storedMarks) {
|
|
516
|
-
marks.push(...state.storedMarks);
|
|
517
|
-
}
|
|
518
|
-
marks.push(...state.selection.$head.marks());
|
|
519
|
-
} else {
|
|
520
|
-
state.doc.nodesBetween(from, to, (node) => {
|
|
521
|
-
marks.push(...node.marks);
|
|
522
|
-
});
|
|
523
|
-
}
|
|
524
|
-
const mark = marks.find((markItem) => markItem.type.name === type.name);
|
|
525
|
-
if (!mark) {
|
|
526
|
-
return {};
|
|
527
|
-
}
|
|
528
|
-
return { ...mark.attrs };
|
|
529
|
-
}
|
|
530
|
-
function defaultBlockAt(match) {
|
|
531
|
-
for (let i = 0; i < match.edgeCount; i += 1) {
|
|
532
|
-
const { type } = match.edge(i);
|
|
533
|
-
if (type.isTextblock && !type.hasRequiredAttrs()) {
|
|
534
|
-
return type;
|
|
535
|
-
}
|
|
536
|
-
}
|
|
537
|
-
return null;
|
|
538
|
-
}
|
|
539
|
-
function findParentNodeClosestToPos($pos, predicate) {
|
|
540
|
-
for (let i = $pos.depth; i > 0; i -= 1) {
|
|
541
|
-
const node = $pos.node(i);
|
|
542
|
-
if (predicate(node)) {
|
|
543
|
-
return {
|
|
544
|
-
pos: i > 0 ? $pos.before(i) : 0,
|
|
545
|
-
start: $pos.start(i),
|
|
546
|
-
depth: i,
|
|
547
|
-
node
|
|
548
|
-
};
|
|
549
|
-
}
|
|
550
|
-
}
|
|
551
|
-
}
|
|
552
|
-
function findParentNode(predicate) {
|
|
553
|
-
return (selection) => findParentNodeClosestToPos(selection.$from, predicate);
|
|
554
|
-
}
|
|
555
|
-
function getSplittedAttributes(extensionAttributes, typeName, attributes) {
|
|
556
|
-
return Object.fromEntries(Object.entries(attributes).filter(([name]) => {
|
|
557
|
-
const extensionAttribute = extensionAttributes.find((item) => {
|
|
558
|
-
return item.type === typeName && item.name === name;
|
|
559
|
-
});
|
|
560
|
-
if (!extensionAttribute) {
|
|
561
|
-
return false;
|
|
562
|
-
}
|
|
563
|
-
return extensionAttribute.attribute.keepOnSplit;
|
|
564
|
-
}));
|
|
565
|
-
}
|
|
566
|
-
function isMarkActive(state, typeOrName, attributes = {}) {
|
|
567
|
-
const { empty, ranges } = state.selection;
|
|
568
|
-
const type = typeOrName ? getMarkType(typeOrName, state.schema) : null;
|
|
569
|
-
if (empty) {
|
|
570
|
-
return !!(state.storedMarks || state.selection.$from.marks()).filter((mark) => {
|
|
571
|
-
if (!type) {
|
|
572
|
-
return true;
|
|
573
|
-
}
|
|
574
|
-
return type.name === mark.type.name;
|
|
575
|
-
}).find((mark) => objectIncludes(mark.attrs, attributes, { strict: false }));
|
|
576
|
-
}
|
|
577
|
-
let selectionRange = 0;
|
|
578
|
-
const markRanges = [];
|
|
579
|
-
ranges.forEach(({ $from, $to }) => {
|
|
580
|
-
const from = $from.pos;
|
|
581
|
-
const to = $to.pos;
|
|
582
|
-
state.doc.nodesBetween(from, to, (node, pos) => {
|
|
583
|
-
if (!node.isText && !node.marks.length) {
|
|
584
|
-
return;
|
|
585
|
-
}
|
|
586
|
-
const relativeFrom = Math.max(from, pos);
|
|
587
|
-
const relativeTo = Math.min(to, pos + node.nodeSize);
|
|
588
|
-
const range2 = relativeTo - relativeFrom;
|
|
589
|
-
selectionRange += range2;
|
|
590
|
-
markRanges.push(...node.marks.map((mark) => ({
|
|
591
|
-
mark,
|
|
592
|
-
from: relativeFrom,
|
|
593
|
-
to: relativeTo
|
|
594
|
-
})));
|
|
595
|
-
});
|
|
596
|
-
});
|
|
597
|
-
if (selectionRange === 0) {
|
|
598
|
-
return false;
|
|
599
|
-
}
|
|
600
|
-
const matchedRange = markRanges.filter((markRange) => {
|
|
601
|
-
if (!type) {
|
|
602
|
-
return true;
|
|
603
|
-
}
|
|
604
|
-
return type.name === markRange.mark.type.name;
|
|
605
|
-
}).filter((markRange) => objectIncludes(markRange.mark.attrs, attributes, { strict: false })).reduce((sum, markRange) => sum + markRange.to - markRange.from, 0);
|
|
606
|
-
const excludedRange = markRanges.filter((markRange) => {
|
|
607
|
-
if (!type) {
|
|
608
|
-
return true;
|
|
609
|
-
}
|
|
610
|
-
return markRange.mark.type !== type && markRange.mark.type.excludes(type);
|
|
611
|
-
}).reduce((sum, markRange) => sum + markRange.to - markRange.from, 0);
|
|
612
|
-
const range = matchedRange > 0 ? matchedRange + excludedRange : matchedRange;
|
|
613
|
-
return range >= selectionRange;
|
|
614
|
-
}
|
|
615
|
-
function isList(name, extensions) {
|
|
616
|
-
const { nodeExtensions } = splitExtensions(extensions);
|
|
617
|
-
const extension = nodeExtensions.find((item) => item.name === name);
|
|
618
|
-
if (!extension) {
|
|
619
|
-
return false;
|
|
620
|
-
}
|
|
621
|
-
const context = {
|
|
622
|
-
name: extension.name,
|
|
623
|
-
options: extension.options,
|
|
624
|
-
storage: extension.storage
|
|
625
|
-
};
|
|
626
|
-
const group = callOrReturn(getExtensionField(extension, "group", context));
|
|
627
|
-
if (typeof group !== "string") {
|
|
628
|
-
return false;
|
|
629
|
-
}
|
|
630
|
-
return group.split(" ").includes("list");
|
|
631
|
-
}
|
|
632
|
-
function isNodeEmpty(node, { checkChildren = true, ignoreWhitespace = false } = {}) {
|
|
633
|
-
var _a;
|
|
634
|
-
if (ignoreWhitespace) {
|
|
635
|
-
if (node.type.name === "hardBreak") {
|
|
636
|
-
return true;
|
|
637
|
-
}
|
|
638
|
-
if (node.isText) {
|
|
639
|
-
return /^\s*$/m.test((_a = node.text) !== null && _a !== void 0 ? _a : "");
|
|
640
|
-
}
|
|
641
|
-
}
|
|
642
|
-
if (node.isText) {
|
|
643
|
-
return !node.text;
|
|
644
|
-
}
|
|
645
|
-
if (node.isAtom || node.isLeaf) {
|
|
646
|
-
return false;
|
|
647
|
-
}
|
|
648
|
-
if (node.content.childCount === 0) {
|
|
649
|
-
return true;
|
|
650
|
-
}
|
|
651
|
-
if (checkChildren) {
|
|
652
|
-
let isContentEmpty = true;
|
|
653
|
-
node.content.forEach((childNode) => {
|
|
654
|
-
if (isContentEmpty === false) {
|
|
655
|
-
return;
|
|
656
|
-
}
|
|
657
|
-
if (!isNodeEmpty(childNode, { ignoreWhitespace, checkChildren })) {
|
|
658
|
-
isContentEmpty = false;
|
|
659
|
-
}
|
|
660
|
-
});
|
|
661
|
-
return isContentEmpty;
|
|
662
|
-
}
|
|
663
|
-
return false;
|
|
664
|
-
}
|
|
665
|
-
function canSetMark(state, tr, newMarkType) {
|
|
666
|
-
var _a;
|
|
667
|
-
const { selection } = tr;
|
|
668
|
-
let cursor = null;
|
|
669
|
-
if (isTextSelection(selection)) {
|
|
670
|
-
cursor = selection.$cursor;
|
|
671
|
-
}
|
|
672
|
-
if (cursor) {
|
|
673
|
-
const currentMarks = (_a = state.storedMarks) !== null && _a !== void 0 ? _a : cursor.marks();
|
|
674
|
-
return !!newMarkType.isInSet(currentMarks) || !currentMarks.some((mark) => mark.type.excludes(newMarkType));
|
|
675
|
-
}
|
|
676
|
-
const { ranges } = selection;
|
|
677
|
-
return ranges.some(({ $from, $to }) => {
|
|
678
|
-
let someNodeSupportsMark = $from.depth === 0 ? state.doc.inlineContent && state.doc.type.allowsMarkType(newMarkType) : false;
|
|
679
|
-
state.doc.nodesBetween($from.pos, $to.pos, (node, _pos, parent) => {
|
|
680
|
-
if (someNodeSupportsMark) {
|
|
681
|
-
return false;
|
|
682
|
-
}
|
|
683
|
-
if (node.isInline) {
|
|
684
|
-
const parentAllowsMarkType = !parent || parent.type.allowsMarkType(newMarkType);
|
|
685
|
-
const currentMarksAllowMarkType = !!newMarkType.isInSet(node.marks) || !node.marks.some((otherMark) => otherMark.type.excludes(newMarkType));
|
|
686
|
-
someNodeSupportsMark = parentAllowsMarkType && currentMarksAllowMarkType;
|
|
687
|
-
}
|
|
688
|
-
return !someNodeSupportsMark;
|
|
689
|
-
});
|
|
690
|
-
return someNodeSupportsMark;
|
|
691
|
-
});
|
|
692
|
-
}
|
|
693
|
-
function ensureMarks(state, splittableMarks) {
|
|
694
|
-
const marks = state.storedMarks || state.selection.$to.parentOffset && state.selection.$from.marks();
|
|
695
|
-
if (marks) {
|
|
696
|
-
const filteredMarks = marks.filter((mark) => splittableMarks === null || splittableMarks === void 0 ? void 0 : splittableMarks.includes(mark.type.name));
|
|
697
|
-
state.tr.ensureMarks(filteredMarks);
|
|
698
|
-
}
|
|
699
|
-
}
|
|
700
|
-
var import_state, import_view, import_keymap, import_model, import_transform, import_commands, import_schema_list, 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;
|
|
701
|
-
var init_dist = __esm({
|
|
702
|
-
"node_modules/@tiptap/core/dist/index.js"() {
|
|
703
|
-
"use strict";
|
|
704
|
-
import_state = require("@tiptap/pm/state");
|
|
705
|
-
import_view = require("@tiptap/pm/view");
|
|
706
|
-
import_keymap = require("@tiptap/pm/keymap");
|
|
707
|
-
import_model = require("@tiptap/pm/model");
|
|
708
|
-
import_transform = require("@tiptap/pm/transform");
|
|
709
|
-
import_commands = require("@tiptap/pm/commands");
|
|
710
|
-
import_schema_list = require("@tiptap/pm/schema-list");
|
|
711
|
-
CommandManager = class {
|
|
712
|
-
constructor(props) {
|
|
713
|
-
this.editor = props.editor;
|
|
714
|
-
this.rawCommands = this.editor.extensionManager.commands;
|
|
715
|
-
this.customState = props.state;
|
|
716
|
-
}
|
|
717
|
-
get hasCustomState() {
|
|
718
|
-
return !!this.customState;
|
|
719
|
-
}
|
|
720
|
-
get state() {
|
|
721
|
-
return this.customState || this.editor.state;
|
|
722
|
-
}
|
|
723
|
-
get commands() {
|
|
724
|
-
const { rawCommands, editor, state } = this;
|
|
725
|
-
const { view } = editor;
|
|
726
|
-
const { tr } = state;
|
|
727
|
-
const props = this.buildProps(tr);
|
|
728
|
-
return Object.fromEntries(Object.entries(rawCommands).map(([name, command2]) => {
|
|
729
|
-
const method = (...args) => {
|
|
730
|
-
const callback = command2(...args)(props);
|
|
731
|
-
if (!tr.getMeta("preventDispatch") && !this.hasCustomState) {
|
|
732
|
-
view.dispatch(tr);
|
|
733
|
-
}
|
|
734
|
-
return callback;
|
|
735
|
-
};
|
|
736
|
-
return [name, method];
|
|
737
|
-
}));
|
|
738
|
-
}
|
|
739
|
-
get chain() {
|
|
740
|
-
return () => this.createChain();
|
|
741
|
-
}
|
|
742
|
-
get can() {
|
|
743
|
-
return () => this.createCan();
|
|
744
|
-
}
|
|
745
|
-
createChain(startTr, shouldDispatch = true) {
|
|
746
|
-
const { rawCommands, editor, state } = this;
|
|
747
|
-
const { view } = editor;
|
|
748
|
-
const callbacks = [];
|
|
749
|
-
const hasStartTransaction = !!startTr;
|
|
750
|
-
const tr = startTr || state.tr;
|
|
751
|
-
const run = () => {
|
|
752
|
-
if (!hasStartTransaction && shouldDispatch && !tr.getMeta("preventDispatch") && !this.hasCustomState) {
|
|
753
|
-
view.dispatch(tr);
|
|
754
|
-
}
|
|
755
|
-
return callbacks.every((callback) => callback === true);
|
|
756
|
-
};
|
|
757
|
-
const chain = {
|
|
758
|
-
...Object.fromEntries(Object.entries(rawCommands).map(([name, command2]) => {
|
|
759
|
-
const chainedCommand = (...args) => {
|
|
760
|
-
const props = this.buildProps(tr, shouldDispatch);
|
|
761
|
-
const callback = command2(...args)(props);
|
|
762
|
-
callbacks.push(callback);
|
|
763
|
-
return chain;
|
|
764
|
-
};
|
|
765
|
-
return [name, chainedCommand];
|
|
766
|
-
})),
|
|
767
|
-
run
|
|
768
|
-
};
|
|
769
|
-
return chain;
|
|
770
|
-
}
|
|
771
|
-
createCan(startTr) {
|
|
772
|
-
const { rawCommands, state } = this;
|
|
773
|
-
const dispatch = false;
|
|
774
|
-
const tr = startTr || state.tr;
|
|
775
|
-
const props = this.buildProps(tr, dispatch);
|
|
776
|
-
const formattedCommands = Object.fromEntries(Object.entries(rawCommands).map(([name, command2]) => {
|
|
777
|
-
return [name, (...args) => command2(...args)({ ...props, dispatch: void 0 })];
|
|
778
|
-
}));
|
|
779
|
-
return {
|
|
780
|
-
...formattedCommands,
|
|
781
|
-
chain: () => this.createChain(tr, dispatch)
|
|
782
|
-
};
|
|
783
|
-
}
|
|
784
|
-
buildProps(tr, shouldDispatch = true) {
|
|
785
|
-
const { rawCommands, editor, state } = this;
|
|
786
|
-
const { view } = editor;
|
|
787
|
-
const props = {
|
|
788
|
-
tr,
|
|
789
|
-
editor,
|
|
790
|
-
view,
|
|
791
|
-
state: createChainableState({
|
|
792
|
-
state,
|
|
793
|
-
transaction: tr
|
|
794
|
-
}),
|
|
795
|
-
dispatch: shouldDispatch ? () => void 0 : void 0,
|
|
796
|
-
chain: () => this.createChain(tr, shouldDispatch),
|
|
797
|
-
can: () => this.createCan(tr),
|
|
798
|
-
get commands() {
|
|
799
|
-
return Object.fromEntries(Object.entries(rawCommands).map(([name, command2]) => {
|
|
800
|
-
return [name, (...args) => command2(...args)(props)];
|
|
801
|
-
}));
|
|
802
|
-
}
|
|
803
|
-
};
|
|
804
|
-
return props;
|
|
805
|
-
}
|
|
806
|
-
};
|
|
807
|
-
Extension = class _Extension {
|
|
808
|
-
constructor(config = {}) {
|
|
809
|
-
this.type = "extension";
|
|
810
|
-
this.name = "extension";
|
|
811
|
-
this.parent = null;
|
|
812
|
-
this.child = null;
|
|
813
|
-
this.config = {
|
|
814
|
-
name: this.name,
|
|
815
|
-
defaultOptions: {}
|
|
816
|
-
};
|
|
817
|
-
this.config = {
|
|
818
|
-
...this.config,
|
|
819
|
-
...config
|
|
820
|
-
};
|
|
821
|
-
this.name = this.config.name;
|
|
822
|
-
if (config.defaultOptions && Object.keys(config.defaultOptions).length > 0) {
|
|
823
|
-
console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`);
|
|
824
|
-
}
|
|
825
|
-
this.options = this.config.defaultOptions;
|
|
826
|
-
if (this.config.addOptions) {
|
|
827
|
-
this.options = callOrReturn(getExtensionField(this, "addOptions", {
|
|
828
|
-
name: this.name
|
|
829
|
-
}));
|
|
830
|
-
}
|
|
831
|
-
this.storage = callOrReturn(getExtensionField(this, "addStorage", {
|
|
832
|
-
name: this.name,
|
|
833
|
-
options: this.options
|
|
834
|
-
})) || {};
|
|
835
|
-
}
|
|
836
|
-
static create(config = {}) {
|
|
837
|
-
return new _Extension(config);
|
|
838
|
-
}
|
|
839
|
-
configure(options = {}) {
|
|
840
|
-
const extension = this.extend({
|
|
841
|
-
...this.config,
|
|
842
|
-
addOptions: () => {
|
|
843
|
-
return mergeDeep(this.options, options);
|
|
844
|
-
}
|
|
845
|
-
});
|
|
846
|
-
extension.name = this.name;
|
|
847
|
-
extension.parent = this.parent;
|
|
848
|
-
return extension;
|
|
849
|
-
}
|
|
850
|
-
extend(extendedConfig = {}) {
|
|
851
|
-
const extension = new _Extension({ ...this.config, ...extendedConfig });
|
|
852
|
-
extension.parent = this;
|
|
853
|
-
this.child = extension;
|
|
854
|
-
extension.name = extendedConfig.name ? extendedConfig.name : extension.parent.name;
|
|
855
|
-
if (extendedConfig.defaultOptions && Object.keys(extendedConfig.defaultOptions).length > 0) {
|
|
856
|
-
console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${extension.name}".`);
|
|
857
|
-
}
|
|
858
|
-
extension.options = callOrReturn(getExtensionField(extension, "addOptions", {
|
|
859
|
-
name: extension.name
|
|
860
|
-
}));
|
|
861
|
-
extension.storage = callOrReturn(getExtensionField(extension, "addStorage", {
|
|
862
|
-
name: extension.name,
|
|
863
|
-
options: extension.options
|
|
864
|
-
}));
|
|
865
|
-
return extension;
|
|
866
|
-
}
|
|
867
|
-
};
|
|
868
|
-
ClipboardTextSerializer = Extension.create({
|
|
869
|
-
name: "clipboardTextSerializer",
|
|
870
|
-
addOptions() {
|
|
871
|
-
return {
|
|
872
|
-
blockSeparator: void 0
|
|
873
|
-
};
|
|
874
|
-
},
|
|
875
|
-
addProseMirrorPlugins() {
|
|
876
|
-
return [
|
|
877
|
-
new import_state.Plugin({
|
|
878
|
-
key: new import_state.PluginKey("clipboardTextSerializer"),
|
|
879
|
-
props: {
|
|
880
|
-
clipboardTextSerializer: () => {
|
|
881
|
-
const { editor } = this;
|
|
882
|
-
const { state, schema } = editor;
|
|
883
|
-
const { doc, selection } = state;
|
|
884
|
-
const { ranges } = selection;
|
|
885
|
-
const from = Math.min(...ranges.map((range2) => range2.$from.pos));
|
|
886
|
-
const to = Math.max(...ranges.map((range2) => range2.$to.pos));
|
|
887
|
-
const textSerializers = getTextSerializersFromSchema(schema);
|
|
888
|
-
const range = { from, to };
|
|
889
|
-
return getTextBetween(doc, range, {
|
|
890
|
-
...this.options.blockSeparator !== void 0 ? { blockSeparator: this.options.blockSeparator } : {},
|
|
891
|
-
textSerializers
|
|
892
|
-
});
|
|
893
|
-
}
|
|
894
|
-
}
|
|
895
|
-
})
|
|
896
|
-
];
|
|
897
|
-
}
|
|
898
|
-
});
|
|
899
|
-
blur = () => ({ editor, view }) => {
|
|
900
|
-
requestAnimationFrame(() => {
|
|
901
|
-
var _a;
|
|
902
|
-
if (!editor.isDestroyed) {
|
|
903
|
-
view.dom.blur();
|
|
904
|
-
(_a = window === null || window === void 0 ? void 0 : window.getSelection()) === null || _a === void 0 ? void 0 : _a.removeAllRanges();
|
|
905
|
-
}
|
|
906
|
-
});
|
|
907
|
-
return true;
|
|
908
|
-
};
|
|
909
|
-
clearContent = (emitUpdate = false) => ({ commands: commands2 }) => {
|
|
910
|
-
return commands2.setContent("", emitUpdate);
|
|
911
|
-
};
|
|
912
|
-
clearNodes = () => ({ state, tr, dispatch }) => {
|
|
913
|
-
const { selection } = tr;
|
|
914
|
-
const { ranges } = selection;
|
|
915
|
-
if (!dispatch) {
|
|
916
|
-
return true;
|
|
917
|
-
}
|
|
918
|
-
ranges.forEach(({ $from, $to }) => {
|
|
919
|
-
state.doc.nodesBetween($from.pos, $to.pos, (node, pos) => {
|
|
920
|
-
if (node.type.isText) {
|
|
921
|
-
return;
|
|
922
|
-
}
|
|
923
|
-
const { doc, mapping } = tr;
|
|
924
|
-
const $mappedFrom = doc.resolve(mapping.map(pos));
|
|
925
|
-
const $mappedTo = doc.resolve(mapping.map(pos + node.nodeSize));
|
|
926
|
-
const nodeRange = $mappedFrom.blockRange($mappedTo);
|
|
927
|
-
if (!nodeRange) {
|
|
928
|
-
return;
|
|
929
|
-
}
|
|
930
|
-
const targetLiftDepth = (0, import_transform.liftTarget)(nodeRange);
|
|
931
|
-
if (node.type.isTextblock) {
|
|
932
|
-
const { defaultType } = $mappedFrom.parent.contentMatchAt($mappedFrom.index());
|
|
933
|
-
tr.setNodeMarkup(nodeRange.start, defaultType);
|
|
934
|
-
}
|
|
935
|
-
if (targetLiftDepth || targetLiftDepth === 0) {
|
|
936
|
-
tr.lift(nodeRange, targetLiftDepth);
|
|
937
|
-
}
|
|
938
|
-
});
|
|
939
|
-
});
|
|
940
|
-
return true;
|
|
941
|
-
};
|
|
942
|
-
command = (fn) => (props) => {
|
|
943
|
-
return fn(props);
|
|
944
|
-
};
|
|
945
|
-
createParagraphNear = () => ({ state, dispatch }) => {
|
|
946
|
-
return (0, import_commands.createParagraphNear)(state, dispatch);
|
|
947
|
-
};
|
|
948
|
-
cut = (originRange, targetPos) => ({ editor, tr }) => {
|
|
949
|
-
const { state } = editor;
|
|
950
|
-
const contentSlice = state.doc.slice(originRange.from, originRange.to);
|
|
951
|
-
tr.deleteRange(originRange.from, originRange.to);
|
|
952
|
-
const newPos = tr.mapping.map(targetPos);
|
|
953
|
-
tr.insert(newPos, contentSlice.content);
|
|
954
|
-
tr.setSelection(new import_state.TextSelection(tr.doc.resolve(Math.max(newPos - 1, 0))));
|
|
955
|
-
return true;
|
|
956
|
-
};
|
|
957
|
-
deleteCurrentNode = () => ({ tr, dispatch }) => {
|
|
958
|
-
const { selection } = tr;
|
|
959
|
-
const currentNode = selection.$anchor.node();
|
|
960
|
-
if (currentNode.content.size > 0) {
|
|
961
|
-
return false;
|
|
962
|
-
}
|
|
963
|
-
const $pos = tr.selection.$anchor;
|
|
964
|
-
for (let depth = $pos.depth; depth > 0; depth -= 1) {
|
|
965
|
-
const node = $pos.node(depth);
|
|
966
|
-
if (node.type === currentNode.type) {
|
|
967
|
-
if (dispatch) {
|
|
968
|
-
const from = $pos.before(depth);
|
|
969
|
-
const to = $pos.after(depth);
|
|
970
|
-
tr.delete(from, to).scrollIntoView();
|
|
971
|
-
}
|
|
972
|
-
return true;
|
|
973
|
-
}
|
|
974
|
-
}
|
|
975
|
-
return false;
|
|
976
|
-
};
|
|
977
|
-
deleteNode = (typeOrName) => ({ tr, state, dispatch }) => {
|
|
978
|
-
const type = getNodeType(typeOrName, state.schema);
|
|
979
|
-
const $pos = tr.selection.$anchor;
|
|
980
|
-
for (let depth = $pos.depth; depth > 0; depth -= 1) {
|
|
981
|
-
const node = $pos.node(depth);
|
|
982
|
-
if (node.type === type) {
|
|
983
|
-
if (dispatch) {
|
|
984
|
-
const from = $pos.before(depth);
|
|
985
|
-
const to = $pos.after(depth);
|
|
986
|
-
tr.delete(from, to).scrollIntoView();
|
|
987
|
-
}
|
|
988
|
-
return true;
|
|
989
|
-
}
|
|
990
|
-
}
|
|
991
|
-
return false;
|
|
992
|
-
};
|
|
993
|
-
deleteRange = (range) => ({ tr, dispatch }) => {
|
|
994
|
-
const { from, to } = range;
|
|
995
|
-
if (dispatch) {
|
|
996
|
-
tr.delete(from, to);
|
|
997
|
-
}
|
|
998
|
-
return true;
|
|
999
|
-
};
|
|
1000
|
-
deleteSelection = () => ({ state, dispatch }) => {
|
|
1001
|
-
return (0, import_commands.deleteSelection)(state, dispatch);
|
|
1002
|
-
};
|
|
1003
|
-
enter = () => ({ commands: commands2 }) => {
|
|
1004
|
-
return commands2.keyboardShortcut("Enter");
|
|
1005
|
-
};
|
|
1006
|
-
exitCode = () => ({ state, dispatch }) => {
|
|
1007
|
-
return (0, import_commands.exitCode)(state, dispatch);
|
|
1008
|
-
};
|
|
1009
|
-
extendMarkRange = (typeOrName, attributes = {}) => ({ tr, state, dispatch }) => {
|
|
1010
|
-
const type = getMarkType(typeOrName, state.schema);
|
|
1011
|
-
const { doc, selection } = tr;
|
|
1012
|
-
const { $from, from, to } = selection;
|
|
1013
|
-
if (dispatch) {
|
|
1014
|
-
const range = getMarkRange($from, type, attributes);
|
|
1015
|
-
if (range && range.from <= from && range.to >= to) {
|
|
1016
|
-
const newSelection = import_state.TextSelection.create(doc, range.from, range.to);
|
|
1017
|
-
tr.setSelection(newSelection);
|
|
1018
|
-
}
|
|
1019
|
-
}
|
|
1020
|
-
return true;
|
|
1021
|
-
};
|
|
1022
|
-
first = (commands2) => (props) => {
|
|
1023
|
-
const items = typeof commands2 === "function" ? commands2(props) : commands2;
|
|
1024
|
-
for (let i = 0; i < items.length; i += 1) {
|
|
1025
|
-
if (items[i](props)) {
|
|
1026
|
-
return true;
|
|
1027
|
-
}
|
|
1028
|
-
}
|
|
1029
|
-
return false;
|
|
1030
|
-
};
|
|
1031
|
-
focus = (position = null, options = {}) => ({ editor, view, tr, dispatch }) => {
|
|
1032
|
-
options = {
|
|
1033
|
-
scrollIntoView: true,
|
|
1034
|
-
...options
|
|
1035
|
-
};
|
|
1036
|
-
const delayedFocus = () => {
|
|
1037
|
-
if (isiOS() || isAndroid()) {
|
|
1038
|
-
view.dom.focus();
|
|
1039
|
-
}
|
|
1040
|
-
requestAnimationFrame(() => {
|
|
1041
|
-
if (!editor.isDestroyed) {
|
|
1042
|
-
view.focus();
|
|
1043
|
-
if (isSafari() && !isiOS() && !isAndroid()) {
|
|
1044
|
-
view.dom.focus({ preventScroll: true });
|
|
1045
|
-
}
|
|
1046
|
-
}
|
|
1047
|
-
});
|
|
1048
|
-
};
|
|
1049
|
-
if (view.hasFocus() && position === null || position === false) {
|
|
1050
|
-
return true;
|
|
1051
|
-
}
|
|
1052
|
-
if (dispatch && position === null && !isTextSelection(editor.state.selection)) {
|
|
1053
|
-
delayedFocus();
|
|
1054
|
-
return true;
|
|
1055
|
-
}
|
|
1056
|
-
const selection = resolveFocusPosition(tr.doc, position) || editor.state.selection;
|
|
1057
|
-
const isSameSelection = editor.state.selection.eq(selection);
|
|
1058
|
-
if (dispatch) {
|
|
1059
|
-
if (!isSameSelection) {
|
|
1060
|
-
tr.setSelection(selection);
|
|
1061
|
-
}
|
|
1062
|
-
if (isSameSelection && tr.storedMarks) {
|
|
1063
|
-
tr.setStoredMarks(tr.storedMarks);
|
|
1064
|
-
}
|
|
1065
|
-
delayedFocus();
|
|
1066
|
-
}
|
|
1067
|
-
return true;
|
|
1068
|
-
};
|
|
1069
|
-
forEach = (items, fn) => (props) => {
|
|
1070
|
-
return items.every((item, index) => fn(item, { ...props, index }));
|
|
1071
|
-
};
|
|
1072
|
-
insertContent = (value, options) => ({ tr, commands: commands2 }) => {
|
|
1073
|
-
return commands2.insertContentAt({ from: tr.selection.from, to: tr.selection.to }, value, options);
|
|
1074
|
-
};
|
|
1075
|
-
removeWhitespaces = (node) => {
|
|
1076
|
-
const children = node.childNodes;
|
|
1077
|
-
for (let i = children.length - 1; i >= 0; i -= 1) {
|
|
1078
|
-
const child = children[i];
|
|
1079
|
-
if (child.nodeType === 3 && child.nodeValue && /^(\n\s\s|\n)$/.test(child.nodeValue)) {
|
|
1080
|
-
node.removeChild(child);
|
|
1081
|
-
} else if (child.nodeType === 1) {
|
|
1082
|
-
removeWhitespaces(child);
|
|
1083
|
-
}
|
|
1084
|
-
}
|
|
1085
|
-
return node;
|
|
1086
|
-
};
|
|
1087
|
-
isFragment = (nodeOrFragment) => {
|
|
1088
|
-
return !("type" in nodeOrFragment);
|
|
1089
|
-
};
|
|
1090
|
-
insertContentAt = (position, value, options) => ({ tr, dispatch, editor }) => {
|
|
1091
|
-
var _a;
|
|
1092
|
-
if (dispatch) {
|
|
1093
|
-
options = {
|
|
1094
|
-
parseOptions: editor.options.parseOptions,
|
|
1095
|
-
updateSelection: true,
|
|
1096
|
-
applyInputRules: false,
|
|
1097
|
-
applyPasteRules: false,
|
|
1098
|
-
...options
|
|
1099
|
-
};
|
|
1100
|
-
let content;
|
|
1101
|
-
const emitContentError = (error) => {
|
|
1102
|
-
editor.emit("contentError", {
|
|
1103
|
-
editor,
|
|
1104
|
-
error,
|
|
1105
|
-
disableCollaboration: () => {
|
|
1106
|
-
if (editor.storage.collaboration) {
|
|
1107
|
-
editor.storage.collaboration.isDisabled = true;
|
|
1108
|
-
}
|
|
1109
|
-
}
|
|
1110
|
-
});
|
|
1111
|
-
};
|
|
1112
|
-
const parseOptions = {
|
|
1113
|
-
preserveWhitespace: "full",
|
|
1114
|
-
...options.parseOptions
|
|
1115
|
-
};
|
|
1116
|
-
if (!options.errorOnInvalidContent && !editor.options.enableContentCheck && editor.options.emitContentError) {
|
|
1117
|
-
try {
|
|
1118
|
-
createNodeFromContent(value, editor.schema, {
|
|
1119
|
-
parseOptions,
|
|
1120
|
-
errorOnInvalidContent: true
|
|
1121
|
-
});
|
|
1122
|
-
} catch (e) {
|
|
1123
|
-
emitContentError(e);
|
|
1124
|
-
}
|
|
1125
|
-
}
|
|
1126
|
-
try {
|
|
1127
|
-
content = createNodeFromContent(value, editor.schema, {
|
|
1128
|
-
parseOptions,
|
|
1129
|
-
errorOnInvalidContent: (_a = options.errorOnInvalidContent) !== null && _a !== void 0 ? _a : editor.options.enableContentCheck
|
|
1130
|
-
});
|
|
1131
|
-
} catch (e) {
|
|
1132
|
-
emitContentError(e);
|
|
1133
|
-
return false;
|
|
1134
|
-
}
|
|
1135
|
-
let { from, to } = typeof position === "number" ? { from: position, to: position } : { from: position.from, to: position.to };
|
|
1136
|
-
let isOnlyTextContent = true;
|
|
1137
|
-
let isOnlyBlockContent = true;
|
|
1138
|
-
const nodes = isFragment(content) ? content : [content];
|
|
1139
|
-
nodes.forEach((node) => {
|
|
1140
|
-
node.check();
|
|
1141
|
-
isOnlyTextContent = isOnlyTextContent ? node.isText && node.marks.length === 0 : false;
|
|
1142
|
-
isOnlyBlockContent = isOnlyBlockContent ? node.isBlock : false;
|
|
1143
|
-
});
|
|
1144
|
-
if (from === to && isOnlyBlockContent) {
|
|
1145
|
-
const { parent } = tr.doc.resolve(from);
|
|
1146
|
-
const isEmptyTextBlock = parent.isTextblock && !parent.type.spec.code && !parent.childCount;
|
|
1147
|
-
if (isEmptyTextBlock) {
|
|
1148
|
-
from -= 1;
|
|
1149
|
-
to += 1;
|
|
1150
|
-
}
|
|
1151
|
-
}
|
|
1152
|
-
let newContent;
|
|
1153
|
-
if (isOnlyTextContent) {
|
|
1154
|
-
if (Array.isArray(value)) {
|
|
1155
|
-
newContent = value.map((v) => v.text || "").join("");
|
|
1156
|
-
} else if (value instanceof import_model.Fragment) {
|
|
1157
|
-
let text = "";
|
|
1158
|
-
value.forEach((node) => {
|
|
1159
|
-
if (node.text) {
|
|
1160
|
-
text += node.text;
|
|
1161
|
-
}
|
|
1162
|
-
});
|
|
1163
|
-
newContent = text;
|
|
1164
|
-
} else if (typeof value === "object" && !!value && !!value.text) {
|
|
1165
|
-
newContent = value.text;
|
|
1166
|
-
} else {
|
|
1167
|
-
newContent = value;
|
|
1168
|
-
}
|
|
1169
|
-
tr.insertText(newContent, from, to);
|
|
1170
|
-
} else {
|
|
1171
|
-
newContent = content;
|
|
1172
|
-
tr.replaceWith(from, to, newContent);
|
|
1173
|
-
}
|
|
1174
|
-
if (options.updateSelection) {
|
|
1175
|
-
selectionToInsertionEnd(tr, tr.steps.length - 1, -1);
|
|
1176
|
-
}
|
|
1177
|
-
if (options.applyInputRules) {
|
|
1178
|
-
tr.setMeta("applyInputRules", { from, text: newContent });
|
|
1179
|
-
}
|
|
1180
|
-
if (options.applyPasteRules) {
|
|
1181
|
-
tr.setMeta("applyPasteRules", { from, text: newContent });
|
|
1182
|
-
}
|
|
1183
|
-
}
|
|
1184
|
-
return true;
|
|
1185
|
-
};
|
|
1186
|
-
joinUp = () => ({ state, dispatch }) => {
|
|
1187
|
-
return (0, import_commands.joinUp)(state, dispatch);
|
|
1188
|
-
};
|
|
1189
|
-
joinDown = () => ({ state, dispatch }) => {
|
|
1190
|
-
return (0, import_commands.joinDown)(state, dispatch);
|
|
1191
|
-
};
|
|
1192
|
-
joinBackward = () => ({ state, dispatch }) => {
|
|
1193
|
-
return (0, import_commands.joinBackward)(state, dispatch);
|
|
1194
|
-
};
|
|
1195
|
-
joinForward = () => ({ state, dispatch }) => {
|
|
1196
|
-
return (0, import_commands.joinForward)(state, dispatch);
|
|
1197
|
-
};
|
|
1198
|
-
joinItemBackward = () => ({ state, dispatch, tr }) => {
|
|
1199
|
-
try {
|
|
1200
|
-
const point = (0, import_transform.joinPoint)(state.doc, state.selection.$from.pos, -1);
|
|
1201
|
-
if (point === null || point === void 0) {
|
|
1202
|
-
return false;
|
|
1203
|
-
}
|
|
1204
|
-
tr.join(point, 2);
|
|
1205
|
-
if (dispatch) {
|
|
1206
|
-
dispatch(tr);
|
|
1207
|
-
}
|
|
1208
|
-
return true;
|
|
1209
|
-
} catch {
|
|
1210
|
-
return false;
|
|
1211
|
-
}
|
|
1212
|
-
};
|
|
1213
|
-
joinItemForward = () => ({ state, dispatch, tr }) => {
|
|
1214
|
-
try {
|
|
1215
|
-
const point = (0, import_transform.joinPoint)(state.doc, state.selection.$from.pos, 1);
|
|
1216
|
-
if (point === null || point === void 0) {
|
|
1217
|
-
return false;
|
|
1218
|
-
}
|
|
1219
|
-
tr.join(point, 2);
|
|
1220
|
-
if (dispatch) {
|
|
1221
|
-
dispatch(tr);
|
|
1222
|
-
}
|
|
1223
|
-
return true;
|
|
1224
|
-
} catch {
|
|
1225
|
-
return false;
|
|
1226
|
-
}
|
|
1227
|
-
};
|
|
1228
|
-
joinTextblockBackward = () => ({ state, dispatch }) => {
|
|
1229
|
-
return (0, import_commands.joinTextblockBackward)(state, dispatch);
|
|
1230
|
-
};
|
|
1231
|
-
joinTextblockForward = () => ({ state, dispatch }) => {
|
|
1232
|
-
return (0, import_commands.joinTextblockForward)(state, dispatch);
|
|
1233
|
-
};
|
|
1234
|
-
keyboardShortcut = (name) => ({ editor, view, tr, dispatch }) => {
|
|
1235
|
-
const keys = normalizeKeyName(name).split(/-(?!$)/);
|
|
1236
|
-
const key = keys.find((item) => !["Alt", "Ctrl", "Meta", "Shift"].includes(item));
|
|
1237
|
-
const event = new KeyboardEvent("keydown", {
|
|
1238
|
-
key: key === "Space" ? " " : key,
|
|
1239
|
-
altKey: keys.includes("Alt"),
|
|
1240
|
-
ctrlKey: keys.includes("Ctrl"),
|
|
1241
|
-
metaKey: keys.includes("Meta"),
|
|
1242
|
-
shiftKey: keys.includes("Shift"),
|
|
1243
|
-
bubbles: true,
|
|
1244
|
-
cancelable: true
|
|
1245
|
-
});
|
|
1246
|
-
const capturedTransaction = editor.captureTransaction(() => {
|
|
1247
|
-
view.someProp("handleKeyDown", (f) => f(view, event));
|
|
1248
|
-
});
|
|
1249
|
-
capturedTransaction === null || capturedTransaction === void 0 ? void 0 : capturedTransaction.steps.forEach((step) => {
|
|
1250
|
-
const newStep = step.map(tr.mapping);
|
|
1251
|
-
if (newStep && dispatch) {
|
|
1252
|
-
tr.maybeStep(newStep);
|
|
1253
|
-
}
|
|
1254
|
-
});
|
|
1255
|
-
return true;
|
|
1256
|
-
};
|
|
1257
|
-
lift = (typeOrName, attributes = {}) => ({ state, dispatch }) => {
|
|
1258
|
-
const type = getNodeType(typeOrName, state.schema);
|
|
1259
|
-
const isActive = isNodeActive(state, type, attributes);
|
|
1260
|
-
if (!isActive) {
|
|
1261
|
-
return false;
|
|
1262
|
-
}
|
|
1263
|
-
return (0, import_commands.lift)(state, dispatch);
|
|
1264
|
-
};
|
|
1265
|
-
liftEmptyBlock = () => ({ state, dispatch }) => {
|
|
1266
|
-
return (0, import_commands.liftEmptyBlock)(state, dispatch);
|
|
1267
|
-
};
|
|
1268
|
-
liftListItem = (typeOrName) => ({ state, dispatch }) => {
|
|
1269
|
-
const type = getNodeType(typeOrName, state.schema);
|
|
1270
|
-
return (0, import_schema_list.liftListItem)(type)(state, dispatch);
|
|
1271
|
-
};
|
|
1272
|
-
newlineInCode = () => ({ state, dispatch }) => {
|
|
1273
|
-
return (0, import_commands.newlineInCode)(state, dispatch);
|
|
1274
|
-
};
|
|
1275
|
-
resetAttributes = (typeOrName, attributes) => ({ tr, state, dispatch }) => {
|
|
1276
|
-
let nodeType = null;
|
|
1277
|
-
let markType = null;
|
|
1278
|
-
const schemaType = getSchemaTypeNameByName(typeof typeOrName === "string" ? typeOrName : typeOrName.name, state.schema);
|
|
1279
|
-
if (!schemaType) {
|
|
1280
|
-
return false;
|
|
1281
|
-
}
|
|
1282
|
-
if (schemaType === "node") {
|
|
1283
|
-
nodeType = getNodeType(typeOrName, state.schema);
|
|
1284
|
-
}
|
|
1285
|
-
if (schemaType === "mark") {
|
|
1286
|
-
markType = getMarkType(typeOrName, state.schema);
|
|
1287
|
-
}
|
|
1288
|
-
if (dispatch) {
|
|
1289
|
-
tr.selection.ranges.forEach((range) => {
|
|
1290
|
-
state.doc.nodesBetween(range.$from.pos, range.$to.pos, (node, pos) => {
|
|
1291
|
-
if (nodeType && nodeType === node.type) {
|
|
1292
|
-
tr.setNodeMarkup(pos, void 0, deleteProps(node.attrs, attributes));
|
|
1293
|
-
}
|
|
1294
|
-
if (markType && node.marks.length) {
|
|
1295
|
-
node.marks.forEach((mark) => {
|
|
1296
|
-
if (markType === mark.type) {
|
|
1297
|
-
tr.addMark(pos, pos + node.nodeSize, markType.create(deleteProps(mark.attrs, attributes)));
|
|
1298
|
-
}
|
|
1299
|
-
});
|
|
1300
|
-
}
|
|
1301
|
-
});
|
|
1302
|
-
});
|
|
1303
|
-
}
|
|
1304
|
-
return true;
|
|
1305
|
-
};
|
|
1306
|
-
scrollIntoView = () => ({ tr, dispatch }) => {
|
|
1307
|
-
if (dispatch) {
|
|
1308
|
-
tr.scrollIntoView();
|
|
1309
|
-
}
|
|
1310
|
-
return true;
|
|
1311
|
-
};
|
|
1312
|
-
selectAll = () => ({ tr, dispatch }) => {
|
|
1313
|
-
if (dispatch) {
|
|
1314
|
-
const selection = new import_state.AllSelection(tr.doc);
|
|
1315
|
-
tr.setSelection(selection);
|
|
1316
|
-
}
|
|
1317
|
-
return true;
|
|
1318
|
-
};
|
|
1319
|
-
selectNodeBackward = () => ({ state, dispatch }) => {
|
|
1320
|
-
return (0, import_commands.selectNodeBackward)(state, dispatch);
|
|
1321
|
-
};
|
|
1322
|
-
selectNodeForward = () => ({ state, dispatch }) => {
|
|
1323
|
-
return (0, import_commands.selectNodeForward)(state, dispatch);
|
|
1324
|
-
};
|
|
1325
|
-
selectParentNode = () => ({ state, dispatch }) => {
|
|
1326
|
-
return (0, import_commands.selectParentNode)(state, dispatch);
|
|
1327
|
-
};
|
|
1328
|
-
selectTextblockEnd = () => ({ state, dispatch }) => {
|
|
1329
|
-
return (0, import_commands.selectTextblockEnd)(state, dispatch);
|
|
1330
|
-
};
|
|
1331
|
-
selectTextblockStart = () => ({ state, dispatch }) => {
|
|
1332
|
-
return (0, import_commands.selectTextblockStart)(state, dispatch);
|
|
1333
|
-
};
|
|
1334
|
-
setContent = (content, emitUpdate = false, parseOptions = {}, options = {}) => ({ editor, tr, dispatch, commands: commands2 }) => {
|
|
1335
|
-
var _a, _b;
|
|
1336
|
-
const { doc } = tr;
|
|
1337
|
-
if (parseOptions.preserveWhitespace !== "full") {
|
|
1338
|
-
const document2 = createDocument(content, editor.schema, parseOptions, {
|
|
1339
|
-
errorOnInvalidContent: (_a = options.errorOnInvalidContent) !== null && _a !== void 0 ? _a : editor.options.enableContentCheck
|
|
1340
|
-
});
|
|
1341
|
-
if (dispatch) {
|
|
1342
|
-
tr.replaceWith(0, doc.content.size, document2).setMeta("preventUpdate", !emitUpdate);
|
|
1343
|
-
}
|
|
1344
|
-
return true;
|
|
1345
|
-
}
|
|
1346
|
-
if (dispatch) {
|
|
1347
|
-
tr.setMeta("preventUpdate", !emitUpdate);
|
|
1348
|
-
}
|
|
1349
|
-
return commands2.insertContentAt({ from: 0, to: doc.content.size }, content, {
|
|
1350
|
-
parseOptions,
|
|
1351
|
-
errorOnInvalidContent: (_b = options.errorOnInvalidContent) !== null && _b !== void 0 ? _b : editor.options.enableContentCheck
|
|
1352
|
-
});
|
|
1353
|
-
};
|
|
1354
|
-
setMark = (typeOrName, attributes = {}) => ({ tr, state, dispatch }) => {
|
|
1355
|
-
const { selection } = tr;
|
|
1356
|
-
const { empty, ranges } = selection;
|
|
1357
|
-
const type = getMarkType(typeOrName, state.schema);
|
|
1358
|
-
if (dispatch) {
|
|
1359
|
-
if (empty) {
|
|
1360
|
-
const oldAttributes = getMarkAttributes(state, type);
|
|
1361
|
-
tr.addStoredMark(type.create({
|
|
1362
|
-
...oldAttributes,
|
|
1363
|
-
...attributes
|
|
1364
|
-
}));
|
|
1365
|
-
} else {
|
|
1366
|
-
ranges.forEach((range) => {
|
|
1367
|
-
const from = range.$from.pos;
|
|
1368
|
-
const to = range.$to.pos;
|
|
1369
|
-
state.doc.nodesBetween(from, to, (node, pos) => {
|
|
1370
|
-
const trimmedFrom = Math.max(pos, from);
|
|
1371
|
-
const trimmedTo = Math.min(pos + node.nodeSize, to);
|
|
1372
|
-
const someHasMark = node.marks.find((mark) => mark.type === type);
|
|
1373
|
-
if (someHasMark) {
|
|
1374
|
-
node.marks.forEach((mark) => {
|
|
1375
|
-
if (type === mark.type) {
|
|
1376
|
-
tr.addMark(trimmedFrom, trimmedTo, type.create({
|
|
1377
|
-
...mark.attrs,
|
|
1378
|
-
...attributes
|
|
1379
|
-
}));
|
|
1380
|
-
}
|
|
1381
|
-
});
|
|
1382
|
-
} else {
|
|
1383
|
-
tr.addMark(trimmedFrom, trimmedTo, type.create(attributes));
|
|
1384
|
-
}
|
|
1385
|
-
});
|
|
1386
|
-
});
|
|
1387
|
-
}
|
|
1388
|
-
}
|
|
1389
|
-
return canSetMark(state, tr, type);
|
|
1390
|
-
};
|
|
1391
|
-
setMeta = (key, value) => ({ tr }) => {
|
|
1392
|
-
tr.setMeta(key, value);
|
|
1393
|
-
return true;
|
|
1394
|
-
};
|
|
1395
|
-
setNode = (typeOrName, attributes = {}) => ({ state, dispatch, chain }) => {
|
|
1396
|
-
const type = getNodeType(typeOrName, state.schema);
|
|
1397
|
-
let attributesToCopy;
|
|
1398
|
-
if (state.selection.$anchor.sameParent(state.selection.$head)) {
|
|
1399
|
-
attributesToCopy = state.selection.$anchor.parent.attrs;
|
|
1400
|
-
}
|
|
1401
|
-
if (!type.isTextblock) {
|
|
1402
|
-
console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.');
|
|
1403
|
-
return false;
|
|
1404
|
-
}
|
|
1405
|
-
return chain().command(({ commands: commands2 }) => {
|
|
1406
|
-
const canSetBlock = (0, import_commands.setBlockType)(type, { ...attributesToCopy, ...attributes })(state);
|
|
1407
|
-
if (canSetBlock) {
|
|
1408
|
-
return true;
|
|
1409
|
-
}
|
|
1410
|
-
return commands2.clearNodes();
|
|
1411
|
-
}).command(({ state: updatedState }) => {
|
|
1412
|
-
return (0, import_commands.setBlockType)(type, { ...attributesToCopy, ...attributes })(updatedState, dispatch);
|
|
1413
|
-
}).run();
|
|
1414
|
-
};
|
|
1415
|
-
setNodeSelection = (position) => ({ tr, dispatch }) => {
|
|
1416
|
-
if (dispatch) {
|
|
1417
|
-
const { doc } = tr;
|
|
1418
|
-
const from = minMax(position, 0, doc.content.size);
|
|
1419
|
-
const selection = import_state.NodeSelection.create(doc, from);
|
|
1420
|
-
tr.setSelection(selection);
|
|
1421
|
-
}
|
|
1422
|
-
return true;
|
|
1423
|
-
};
|
|
1424
|
-
setTextSelection = (position) => ({ tr, dispatch }) => {
|
|
1425
|
-
if (dispatch) {
|
|
1426
|
-
const { doc } = tr;
|
|
1427
|
-
const { from, to } = typeof position === "number" ? { from: position, to: position } : position;
|
|
1428
|
-
const minPos = import_state.TextSelection.atStart(doc).from;
|
|
1429
|
-
const maxPos = import_state.TextSelection.atEnd(doc).to;
|
|
1430
|
-
const resolvedFrom = minMax(from, minPos, maxPos);
|
|
1431
|
-
const resolvedEnd = minMax(to, minPos, maxPos);
|
|
1432
|
-
const selection = import_state.TextSelection.create(doc, resolvedFrom, resolvedEnd);
|
|
1433
|
-
tr.setSelection(selection);
|
|
1434
|
-
}
|
|
1435
|
-
return true;
|
|
1436
|
-
};
|
|
1437
|
-
sinkListItem = (typeOrName) => ({ state, dispatch }) => {
|
|
1438
|
-
const type = getNodeType(typeOrName, state.schema);
|
|
1439
|
-
return (0, import_schema_list.sinkListItem)(type)(state, dispatch);
|
|
1440
|
-
};
|
|
1441
|
-
splitBlock = ({ keepMarks = true } = {}) => ({ tr, state, dispatch, editor }) => {
|
|
1442
|
-
const { selection, doc } = tr;
|
|
1443
|
-
const { $from, $to } = selection;
|
|
1444
|
-
const extensionAttributes = editor.extensionManager.attributes;
|
|
1445
|
-
const newAttributes = getSplittedAttributes(extensionAttributes, $from.node().type.name, $from.node().attrs);
|
|
1446
|
-
if (selection instanceof import_state.NodeSelection && selection.node.isBlock) {
|
|
1447
|
-
if (!$from.parentOffset || !(0, import_transform.canSplit)(doc, $from.pos)) {
|
|
1448
|
-
return false;
|
|
1449
|
-
}
|
|
1450
|
-
if (dispatch) {
|
|
1451
|
-
if (keepMarks) {
|
|
1452
|
-
ensureMarks(state, editor.extensionManager.splittableMarks);
|
|
1453
|
-
}
|
|
1454
|
-
tr.split($from.pos).scrollIntoView();
|
|
1455
|
-
}
|
|
1456
|
-
return true;
|
|
1457
|
-
}
|
|
1458
|
-
if (!$from.parent.isBlock) {
|
|
1459
|
-
return false;
|
|
1460
|
-
}
|
|
1461
|
-
const atEnd = $to.parentOffset === $to.parent.content.size;
|
|
1462
|
-
const deflt = $from.depth === 0 ? void 0 : defaultBlockAt($from.node(-1).contentMatchAt($from.indexAfter(-1)));
|
|
1463
|
-
let types = atEnd && deflt ? [
|
|
1464
|
-
{
|
|
1465
|
-
type: deflt,
|
|
1466
|
-
attrs: newAttributes
|
|
1467
|
-
}
|
|
1468
|
-
] : void 0;
|
|
1469
|
-
let can = (0, import_transform.canSplit)(tr.doc, tr.mapping.map($from.pos), 1, types);
|
|
1470
|
-
if (!types && !can && (0, import_transform.canSplit)(tr.doc, tr.mapping.map($from.pos), 1, deflt ? [{ type: deflt }] : void 0)) {
|
|
1471
|
-
can = true;
|
|
1472
|
-
types = deflt ? [
|
|
1473
|
-
{
|
|
1474
|
-
type: deflt,
|
|
1475
|
-
attrs: newAttributes
|
|
1476
|
-
}
|
|
1477
|
-
] : void 0;
|
|
1478
|
-
}
|
|
1479
|
-
if (dispatch) {
|
|
1480
|
-
if (can) {
|
|
1481
|
-
if (selection instanceof import_state.TextSelection) {
|
|
1482
|
-
tr.deleteSelection();
|
|
1483
|
-
}
|
|
1484
|
-
tr.split(tr.mapping.map($from.pos), 1, types);
|
|
1485
|
-
if (deflt && !atEnd && !$from.parentOffset && $from.parent.type !== deflt) {
|
|
1486
|
-
const first2 = tr.mapping.map($from.before());
|
|
1487
|
-
const $first = tr.doc.resolve(first2);
|
|
1488
|
-
if ($from.node(-1).canReplaceWith($first.index(), $first.index() + 1, deflt)) {
|
|
1489
|
-
tr.setNodeMarkup(tr.mapping.map($from.before()), deflt);
|
|
1490
|
-
}
|
|
1491
|
-
}
|
|
1492
|
-
}
|
|
1493
|
-
if (keepMarks) {
|
|
1494
|
-
ensureMarks(state, editor.extensionManager.splittableMarks);
|
|
1495
|
-
}
|
|
1496
|
-
tr.scrollIntoView();
|
|
1497
|
-
}
|
|
1498
|
-
return can;
|
|
1499
|
-
};
|
|
1500
|
-
splitListItem = (typeOrName, overrideAttrs = {}) => ({ tr, state, dispatch, editor }) => {
|
|
1501
|
-
var _a;
|
|
1502
|
-
const type = getNodeType(typeOrName, state.schema);
|
|
1503
|
-
const { $from, $to } = state.selection;
|
|
1504
|
-
const node = state.selection.node;
|
|
1505
|
-
if (node && node.isBlock || $from.depth < 2 || !$from.sameParent($to)) {
|
|
1506
|
-
return false;
|
|
1507
|
-
}
|
|
1508
|
-
const grandParent = $from.node(-1);
|
|
1509
|
-
if (grandParent.type !== type) {
|
|
1510
|
-
return false;
|
|
1511
|
-
}
|
|
1512
|
-
const extensionAttributes = editor.extensionManager.attributes;
|
|
1513
|
-
if ($from.parent.content.size === 0 && $from.node(-1).childCount === $from.indexAfter(-1)) {
|
|
1514
|
-
if ($from.depth === 2 || $from.node(-3).type !== type || $from.index(-2) !== $from.node(-2).childCount - 1) {
|
|
1515
|
-
return false;
|
|
1516
|
-
}
|
|
1517
|
-
if (dispatch) {
|
|
1518
|
-
let wrap = import_model.Fragment.empty;
|
|
1519
|
-
const depthBefore = $from.index(-1) ? 1 : $from.index(-2) ? 2 : 3;
|
|
1520
|
-
for (let d = $from.depth - depthBefore; d >= $from.depth - 3; d -= 1) {
|
|
1521
|
-
wrap = import_model.Fragment.from($from.node(d).copy(wrap));
|
|
1522
|
-
}
|
|
1523
|
-
const depthAfter = $from.indexAfter(-1) < $from.node(-2).childCount ? 1 : $from.indexAfter(-2) < $from.node(-3).childCount ? 2 : 3;
|
|
1524
|
-
const newNextTypeAttributes2 = {
|
|
1525
|
-
...getSplittedAttributes(extensionAttributes, $from.node().type.name, $from.node().attrs),
|
|
1526
|
-
...overrideAttrs
|
|
1527
|
-
};
|
|
1528
|
-
const nextType2 = ((_a = type.contentMatch.defaultType) === null || _a === void 0 ? void 0 : _a.createAndFill(newNextTypeAttributes2)) || void 0;
|
|
1529
|
-
wrap = wrap.append(import_model.Fragment.from(type.createAndFill(null, nextType2) || void 0));
|
|
1530
|
-
const start = $from.before($from.depth - (depthBefore - 1));
|
|
1531
|
-
tr.replace(start, $from.after(-depthAfter), new import_model.Slice(wrap, 4 - depthBefore, 0));
|
|
1532
|
-
let sel = -1;
|
|
1533
|
-
tr.doc.nodesBetween(start, tr.doc.content.size, (n, pos) => {
|
|
1534
|
-
if (sel > -1) {
|
|
1535
|
-
return false;
|
|
1536
|
-
}
|
|
1537
|
-
if (n.isTextblock && n.content.size === 0) {
|
|
1538
|
-
sel = pos + 1;
|
|
1539
|
-
}
|
|
1540
|
-
});
|
|
1541
|
-
if (sel > -1) {
|
|
1542
|
-
tr.setSelection(import_state.TextSelection.near(tr.doc.resolve(sel)));
|
|
1543
|
-
}
|
|
1544
|
-
tr.scrollIntoView();
|
|
1545
|
-
}
|
|
1546
|
-
return true;
|
|
1547
|
-
}
|
|
1548
|
-
const nextType = $to.pos === $from.end() ? grandParent.contentMatchAt(0).defaultType : null;
|
|
1549
|
-
const newTypeAttributes = {
|
|
1550
|
-
...getSplittedAttributes(extensionAttributes, grandParent.type.name, grandParent.attrs),
|
|
1551
|
-
...overrideAttrs
|
|
1552
|
-
};
|
|
1553
|
-
const newNextTypeAttributes = {
|
|
1554
|
-
...getSplittedAttributes(extensionAttributes, $from.node().type.name, $from.node().attrs),
|
|
1555
|
-
...overrideAttrs
|
|
1556
|
-
};
|
|
1557
|
-
tr.delete($from.pos, $to.pos);
|
|
1558
|
-
const types = nextType ? [
|
|
1559
|
-
{ type, attrs: newTypeAttributes },
|
|
1560
|
-
{ type: nextType, attrs: newNextTypeAttributes }
|
|
1561
|
-
] : [{ type, attrs: newTypeAttributes }];
|
|
1562
|
-
if (!(0, import_transform.canSplit)(tr.doc, $from.pos, 2)) {
|
|
1563
|
-
return false;
|
|
1564
|
-
}
|
|
1565
|
-
if (dispatch) {
|
|
1566
|
-
const { selection, storedMarks } = state;
|
|
1567
|
-
const { splittableMarks } = editor.extensionManager;
|
|
1568
|
-
const marks = storedMarks || selection.$to.parentOffset && selection.$from.marks();
|
|
1569
|
-
tr.split($from.pos, 2, types).scrollIntoView();
|
|
1570
|
-
if (!marks || !dispatch) {
|
|
1571
|
-
return true;
|
|
1572
|
-
}
|
|
1573
|
-
const filteredMarks = marks.filter((mark) => splittableMarks.includes(mark.type.name));
|
|
1574
|
-
tr.ensureMarks(filteredMarks);
|
|
1575
|
-
}
|
|
1576
|
-
return true;
|
|
1577
|
-
};
|
|
1578
|
-
joinListBackwards = (tr, listType) => {
|
|
1579
|
-
const list = findParentNode((node) => node.type === listType)(tr.selection);
|
|
1580
|
-
if (!list) {
|
|
1581
|
-
return true;
|
|
1582
|
-
}
|
|
1583
|
-
const before = tr.doc.resolve(Math.max(0, list.pos - 1)).before(list.depth);
|
|
1584
|
-
if (before === void 0) {
|
|
1585
|
-
return true;
|
|
1586
|
-
}
|
|
1587
|
-
const nodeBefore = tr.doc.nodeAt(before);
|
|
1588
|
-
const canJoinBackwards = list.node.type === (nodeBefore === null || nodeBefore === void 0 ? void 0 : nodeBefore.type) && (0, import_transform.canJoin)(tr.doc, list.pos);
|
|
1589
|
-
if (!canJoinBackwards) {
|
|
1590
|
-
return true;
|
|
1591
|
-
}
|
|
1592
|
-
tr.join(list.pos);
|
|
1593
|
-
return true;
|
|
1594
|
-
};
|
|
1595
|
-
joinListForwards = (tr, listType) => {
|
|
1596
|
-
const list = findParentNode((node) => node.type === listType)(tr.selection);
|
|
1597
|
-
if (!list) {
|
|
1598
|
-
return true;
|
|
1599
|
-
}
|
|
1600
|
-
const after = tr.doc.resolve(list.start).after(list.depth);
|
|
1601
|
-
if (after === void 0) {
|
|
1602
|
-
return true;
|
|
1603
|
-
}
|
|
1604
|
-
const nodeAfter = tr.doc.nodeAt(after);
|
|
1605
|
-
const canJoinForwards = list.node.type === (nodeAfter === null || nodeAfter === void 0 ? void 0 : nodeAfter.type) && (0, import_transform.canJoin)(tr.doc, after);
|
|
1606
|
-
if (!canJoinForwards) {
|
|
1607
|
-
return true;
|
|
1608
|
-
}
|
|
1609
|
-
tr.join(after);
|
|
1610
|
-
return true;
|
|
1611
|
-
};
|
|
1612
|
-
toggleList = (listTypeOrName, itemTypeOrName, keepMarks, attributes = {}) => ({ editor, tr, state, dispatch, chain, commands: commands2, can }) => {
|
|
1613
|
-
const { extensions, splittableMarks } = editor.extensionManager;
|
|
1614
|
-
const listType = getNodeType(listTypeOrName, state.schema);
|
|
1615
|
-
const itemType = getNodeType(itemTypeOrName, state.schema);
|
|
1616
|
-
const { selection, storedMarks } = state;
|
|
1617
|
-
const { $from, $to } = selection;
|
|
1618
|
-
const range = $from.blockRange($to);
|
|
1619
|
-
const marks = storedMarks || selection.$to.parentOffset && selection.$from.marks();
|
|
1620
|
-
if (!range) {
|
|
1621
|
-
return false;
|
|
1622
|
-
}
|
|
1623
|
-
const parentList = findParentNode((node) => isList(node.type.name, extensions))(selection);
|
|
1624
|
-
if (range.depth >= 1 && parentList && range.depth - parentList.depth <= 1) {
|
|
1625
|
-
if (parentList.node.type === listType) {
|
|
1626
|
-
return commands2.liftListItem(itemType);
|
|
1627
|
-
}
|
|
1628
|
-
if (isList(parentList.node.type.name, extensions) && listType.validContent(parentList.node.content) && dispatch) {
|
|
1629
|
-
return chain().command(() => {
|
|
1630
|
-
tr.setNodeMarkup(parentList.pos, listType);
|
|
1631
|
-
return true;
|
|
1632
|
-
}).command(() => joinListBackwards(tr, listType)).command(() => joinListForwards(tr, listType)).run();
|
|
1633
|
-
}
|
|
1634
|
-
}
|
|
1635
|
-
if (!keepMarks || !marks || !dispatch) {
|
|
1636
|
-
return chain().command(() => {
|
|
1637
|
-
const canWrapInList = can().wrapInList(listType, attributes);
|
|
1638
|
-
if (canWrapInList) {
|
|
1639
|
-
return true;
|
|
1640
|
-
}
|
|
1641
|
-
return commands2.clearNodes();
|
|
1642
|
-
}).wrapInList(listType, attributes).command(() => joinListBackwards(tr, listType)).command(() => joinListForwards(tr, listType)).run();
|
|
1643
|
-
}
|
|
1644
|
-
return chain().command(() => {
|
|
1645
|
-
const canWrapInList = can().wrapInList(listType, attributes);
|
|
1646
|
-
const filteredMarks = marks.filter((mark) => splittableMarks.includes(mark.type.name));
|
|
1647
|
-
tr.ensureMarks(filteredMarks);
|
|
1648
|
-
if (canWrapInList) {
|
|
1649
|
-
return true;
|
|
1650
|
-
}
|
|
1651
|
-
return commands2.clearNodes();
|
|
1652
|
-
}).wrapInList(listType, attributes).command(() => joinListBackwards(tr, listType)).command(() => joinListForwards(tr, listType)).run();
|
|
1653
|
-
};
|
|
1654
|
-
toggleMark = (typeOrName, attributes = {}, options = {}) => ({ state, commands: commands2 }) => {
|
|
1655
|
-
const { extendEmptyMarkRange = false } = options;
|
|
1656
|
-
const type = getMarkType(typeOrName, state.schema);
|
|
1657
|
-
const isActive = isMarkActive(state, type, attributes);
|
|
1658
|
-
if (isActive) {
|
|
1659
|
-
return commands2.unsetMark(type, { extendEmptyMarkRange });
|
|
1660
|
-
}
|
|
1661
|
-
return commands2.setMark(type, attributes);
|
|
1662
|
-
};
|
|
1663
|
-
toggleNode = (typeOrName, toggleTypeOrName, attributes = {}) => ({ state, commands: commands2 }) => {
|
|
1664
|
-
const type = getNodeType(typeOrName, state.schema);
|
|
1665
|
-
const toggleType = getNodeType(toggleTypeOrName, state.schema);
|
|
1666
|
-
const isActive = isNodeActive(state, type, attributes);
|
|
1667
|
-
let attributesToCopy;
|
|
1668
|
-
if (state.selection.$anchor.sameParent(state.selection.$head)) {
|
|
1669
|
-
attributesToCopy = state.selection.$anchor.parent.attrs;
|
|
1670
|
-
}
|
|
1671
|
-
if (isActive) {
|
|
1672
|
-
return commands2.setNode(toggleType, attributesToCopy);
|
|
1673
|
-
}
|
|
1674
|
-
return commands2.setNode(type, { ...attributesToCopy, ...attributes });
|
|
1675
|
-
};
|
|
1676
|
-
toggleWrap = (typeOrName, attributes = {}) => ({ state, commands: commands2 }) => {
|
|
1677
|
-
const type = getNodeType(typeOrName, state.schema);
|
|
1678
|
-
const isActive = isNodeActive(state, type, attributes);
|
|
1679
|
-
if (isActive) {
|
|
1680
|
-
return commands2.lift(type);
|
|
1681
|
-
}
|
|
1682
|
-
return commands2.wrapIn(type, attributes);
|
|
1683
|
-
};
|
|
1684
|
-
undoInputRule = () => ({ state, dispatch }) => {
|
|
1685
|
-
const plugins = state.plugins;
|
|
1686
|
-
for (let i = 0; i < plugins.length; i += 1) {
|
|
1687
|
-
const plugin = plugins[i];
|
|
1688
|
-
let undoable;
|
|
1689
|
-
if (plugin.spec.isInputRules && (undoable = plugin.getState(state))) {
|
|
1690
|
-
if (dispatch) {
|
|
1691
|
-
const tr = state.tr;
|
|
1692
|
-
const toUndo = undoable.transform;
|
|
1693
|
-
for (let j = toUndo.steps.length - 1; j >= 0; j -= 1) {
|
|
1694
|
-
tr.step(toUndo.steps[j].invert(toUndo.docs[j]));
|
|
1695
|
-
}
|
|
1696
|
-
if (undoable.text) {
|
|
1697
|
-
const marks = tr.doc.resolve(undoable.from).marks();
|
|
1698
|
-
tr.replaceWith(undoable.from, undoable.to, state.schema.text(undoable.text, marks));
|
|
1699
|
-
} else {
|
|
1700
|
-
tr.delete(undoable.from, undoable.to);
|
|
1701
|
-
}
|
|
1702
|
-
}
|
|
1703
|
-
return true;
|
|
1704
|
-
}
|
|
1705
|
-
}
|
|
1706
|
-
return false;
|
|
1707
|
-
};
|
|
1708
|
-
unsetAllMarks = () => ({ tr, dispatch }) => {
|
|
1709
|
-
const { selection } = tr;
|
|
1710
|
-
const { empty, ranges } = selection;
|
|
1711
|
-
if (empty) {
|
|
1712
|
-
return true;
|
|
1713
|
-
}
|
|
1714
|
-
if (dispatch) {
|
|
1715
|
-
ranges.forEach((range) => {
|
|
1716
|
-
tr.removeMark(range.$from.pos, range.$to.pos);
|
|
1717
|
-
});
|
|
1718
|
-
}
|
|
1719
|
-
return true;
|
|
1720
|
-
};
|
|
1721
|
-
unsetMark = (typeOrName, options = {}) => ({ tr, state, dispatch }) => {
|
|
1722
|
-
var _a;
|
|
1723
|
-
const { extendEmptyMarkRange = false } = options;
|
|
1724
|
-
const { selection } = tr;
|
|
1725
|
-
const type = getMarkType(typeOrName, state.schema);
|
|
1726
|
-
const { $from, empty, ranges } = selection;
|
|
1727
|
-
if (!dispatch) {
|
|
1728
|
-
return true;
|
|
1729
|
-
}
|
|
1730
|
-
if (empty && extendEmptyMarkRange) {
|
|
1731
|
-
let { from, to } = selection;
|
|
1732
|
-
const attrs = (_a = $from.marks().find((mark) => mark.type === type)) === null || _a === void 0 ? void 0 : _a.attrs;
|
|
1733
|
-
const range = getMarkRange($from, type, attrs);
|
|
1734
|
-
if (range) {
|
|
1735
|
-
from = range.from;
|
|
1736
|
-
to = range.to;
|
|
1737
|
-
}
|
|
1738
|
-
tr.removeMark(from, to, type);
|
|
1739
|
-
} else {
|
|
1740
|
-
ranges.forEach((range) => {
|
|
1741
|
-
tr.removeMark(range.$from.pos, range.$to.pos, type);
|
|
1742
|
-
});
|
|
1743
|
-
}
|
|
1744
|
-
tr.removeStoredMark(type);
|
|
1745
|
-
return true;
|
|
1746
|
-
};
|
|
1747
|
-
updateAttributes = (typeOrName, attributes = {}) => ({ tr, state, dispatch }) => {
|
|
1748
|
-
let nodeType = null;
|
|
1749
|
-
let markType = null;
|
|
1750
|
-
const schemaType = getSchemaTypeNameByName(typeof typeOrName === "string" ? typeOrName : typeOrName.name, state.schema);
|
|
1751
|
-
if (!schemaType) {
|
|
1752
|
-
return false;
|
|
1753
|
-
}
|
|
1754
|
-
if (schemaType === "node") {
|
|
1755
|
-
nodeType = getNodeType(typeOrName, state.schema);
|
|
1756
|
-
}
|
|
1757
|
-
if (schemaType === "mark") {
|
|
1758
|
-
markType = getMarkType(typeOrName, state.schema);
|
|
1759
|
-
}
|
|
1760
|
-
if (dispatch) {
|
|
1761
|
-
tr.selection.ranges.forEach((range) => {
|
|
1762
|
-
const from = range.$from.pos;
|
|
1763
|
-
const to = range.$to.pos;
|
|
1764
|
-
let lastPos;
|
|
1765
|
-
let lastNode;
|
|
1766
|
-
let trimmedFrom;
|
|
1767
|
-
let trimmedTo;
|
|
1768
|
-
if (tr.selection.empty) {
|
|
1769
|
-
state.doc.nodesBetween(from, to, (node, pos) => {
|
|
1770
|
-
if (nodeType && nodeType === node.type) {
|
|
1771
|
-
trimmedFrom = Math.max(pos, from);
|
|
1772
|
-
trimmedTo = Math.min(pos + node.nodeSize, to);
|
|
1773
|
-
lastPos = pos;
|
|
1774
|
-
lastNode = node;
|
|
1775
|
-
}
|
|
1776
|
-
});
|
|
1777
|
-
} else {
|
|
1778
|
-
state.doc.nodesBetween(from, to, (node, pos) => {
|
|
1779
|
-
if (pos < from && nodeType && nodeType === node.type) {
|
|
1780
|
-
trimmedFrom = Math.max(pos, from);
|
|
1781
|
-
trimmedTo = Math.min(pos + node.nodeSize, to);
|
|
1782
|
-
lastPos = pos;
|
|
1783
|
-
lastNode = node;
|
|
1784
|
-
}
|
|
1785
|
-
if (pos >= from && pos <= to) {
|
|
1786
|
-
if (nodeType && nodeType === node.type) {
|
|
1787
|
-
tr.setNodeMarkup(pos, void 0, {
|
|
1788
|
-
...node.attrs,
|
|
1789
|
-
...attributes
|
|
1790
|
-
});
|
|
1791
|
-
}
|
|
1792
|
-
if (markType && node.marks.length) {
|
|
1793
|
-
node.marks.forEach((mark) => {
|
|
1794
|
-
if (markType === mark.type) {
|
|
1795
|
-
const trimmedFrom2 = Math.max(pos, from);
|
|
1796
|
-
const trimmedTo2 = Math.min(pos + node.nodeSize, to);
|
|
1797
|
-
tr.addMark(trimmedFrom2, trimmedTo2, markType.create({
|
|
1798
|
-
...mark.attrs,
|
|
1799
|
-
...attributes
|
|
1800
|
-
}));
|
|
1801
|
-
}
|
|
1802
|
-
});
|
|
1803
|
-
}
|
|
1804
|
-
}
|
|
1805
|
-
});
|
|
1806
|
-
}
|
|
1807
|
-
if (lastNode) {
|
|
1808
|
-
if (lastPos !== void 0) {
|
|
1809
|
-
tr.setNodeMarkup(lastPos, void 0, {
|
|
1810
|
-
...lastNode.attrs,
|
|
1811
|
-
...attributes
|
|
1812
|
-
});
|
|
1813
|
-
}
|
|
1814
|
-
if (markType && lastNode.marks.length) {
|
|
1815
|
-
lastNode.marks.forEach((mark) => {
|
|
1816
|
-
if (markType === mark.type) {
|
|
1817
|
-
tr.addMark(trimmedFrom, trimmedTo, markType.create({
|
|
1818
|
-
...mark.attrs,
|
|
1819
|
-
...attributes
|
|
1820
|
-
}));
|
|
1821
|
-
}
|
|
1822
|
-
});
|
|
1823
|
-
}
|
|
1824
|
-
}
|
|
1825
|
-
});
|
|
1826
|
-
}
|
|
1827
|
-
return true;
|
|
1828
|
-
};
|
|
1829
|
-
wrapIn = (typeOrName, attributes = {}) => ({ state, dispatch }) => {
|
|
1830
|
-
const type = getNodeType(typeOrName, state.schema);
|
|
1831
|
-
return (0, import_commands.wrapIn)(type, attributes)(state, dispatch);
|
|
1832
|
-
};
|
|
1833
|
-
wrapInList = (typeOrName, attributes = {}) => ({ state, dispatch }) => {
|
|
1834
|
-
const type = getNodeType(typeOrName, state.schema);
|
|
1835
|
-
return (0, import_schema_list.wrapInList)(type, attributes)(state, dispatch);
|
|
1836
|
-
};
|
|
1837
|
-
commands = /* @__PURE__ */ Object.freeze({
|
|
1838
|
-
__proto__: null,
|
|
1839
|
-
blur,
|
|
1840
|
-
clearContent,
|
|
1841
|
-
clearNodes,
|
|
1842
|
-
command,
|
|
1843
|
-
createParagraphNear,
|
|
1844
|
-
cut,
|
|
1845
|
-
deleteCurrentNode,
|
|
1846
|
-
deleteNode,
|
|
1847
|
-
deleteRange,
|
|
1848
|
-
deleteSelection,
|
|
1849
|
-
enter,
|
|
1850
|
-
exitCode,
|
|
1851
|
-
extendMarkRange,
|
|
1852
|
-
first,
|
|
1853
|
-
focus,
|
|
1854
|
-
forEach,
|
|
1855
|
-
insertContent,
|
|
1856
|
-
insertContentAt,
|
|
1857
|
-
joinBackward,
|
|
1858
|
-
joinDown,
|
|
1859
|
-
joinForward,
|
|
1860
|
-
joinItemBackward,
|
|
1861
|
-
joinItemForward,
|
|
1862
|
-
joinTextblockBackward,
|
|
1863
|
-
joinTextblockForward,
|
|
1864
|
-
joinUp,
|
|
1865
|
-
keyboardShortcut,
|
|
1866
|
-
lift,
|
|
1867
|
-
liftEmptyBlock,
|
|
1868
|
-
liftListItem,
|
|
1869
|
-
newlineInCode,
|
|
1870
|
-
resetAttributes,
|
|
1871
|
-
scrollIntoView,
|
|
1872
|
-
selectAll,
|
|
1873
|
-
selectNodeBackward,
|
|
1874
|
-
selectNodeForward,
|
|
1875
|
-
selectParentNode,
|
|
1876
|
-
selectTextblockEnd,
|
|
1877
|
-
selectTextblockStart,
|
|
1878
|
-
setContent,
|
|
1879
|
-
setMark,
|
|
1880
|
-
setMeta,
|
|
1881
|
-
setNode,
|
|
1882
|
-
setNodeSelection,
|
|
1883
|
-
setTextSelection,
|
|
1884
|
-
sinkListItem,
|
|
1885
|
-
splitBlock,
|
|
1886
|
-
splitListItem,
|
|
1887
|
-
toggleList,
|
|
1888
|
-
toggleMark,
|
|
1889
|
-
toggleNode,
|
|
1890
|
-
toggleWrap,
|
|
1891
|
-
undoInputRule,
|
|
1892
|
-
unsetAllMarks,
|
|
1893
|
-
unsetMark,
|
|
1894
|
-
updateAttributes,
|
|
1895
|
-
wrapIn,
|
|
1896
|
-
wrapInList
|
|
1897
|
-
});
|
|
1898
|
-
Commands = Extension.create({
|
|
1899
|
-
name: "commands",
|
|
1900
|
-
addCommands() {
|
|
1901
|
-
return {
|
|
1902
|
-
...commands
|
|
1903
|
-
};
|
|
1904
|
-
}
|
|
1905
|
-
});
|
|
1906
|
-
Drop = Extension.create({
|
|
1907
|
-
name: "drop",
|
|
1908
|
-
addProseMirrorPlugins() {
|
|
1909
|
-
return [
|
|
1910
|
-
new import_state.Plugin({
|
|
1911
|
-
key: new import_state.PluginKey("tiptapDrop"),
|
|
1912
|
-
props: {
|
|
1913
|
-
handleDrop: (_, e, slice, moved) => {
|
|
1914
|
-
this.editor.emit("drop", {
|
|
1915
|
-
editor: this.editor,
|
|
1916
|
-
event: e,
|
|
1917
|
-
slice,
|
|
1918
|
-
moved
|
|
1919
|
-
});
|
|
1920
|
-
}
|
|
1921
|
-
}
|
|
1922
|
-
})
|
|
1923
|
-
];
|
|
1924
|
-
}
|
|
1925
|
-
});
|
|
1926
|
-
Editable = Extension.create({
|
|
1927
|
-
name: "editable",
|
|
1928
|
-
addProseMirrorPlugins() {
|
|
1929
|
-
return [
|
|
1930
|
-
new import_state.Plugin({
|
|
1931
|
-
key: new import_state.PluginKey("editable"),
|
|
1932
|
-
props: {
|
|
1933
|
-
editable: () => this.editor.options.editable
|
|
1934
|
-
}
|
|
1935
|
-
})
|
|
1936
|
-
];
|
|
1937
|
-
}
|
|
1938
|
-
});
|
|
1939
|
-
focusEventsPluginKey = new import_state.PluginKey("focusEvents");
|
|
1940
|
-
FocusEvents = Extension.create({
|
|
1941
|
-
name: "focusEvents",
|
|
1942
|
-
addProseMirrorPlugins() {
|
|
1943
|
-
const { editor } = this;
|
|
1944
|
-
return [
|
|
1945
|
-
new import_state.Plugin({
|
|
1946
|
-
key: focusEventsPluginKey,
|
|
1947
|
-
props: {
|
|
1948
|
-
handleDOMEvents: {
|
|
1949
|
-
focus: (view, event) => {
|
|
1950
|
-
editor.isFocused = true;
|
|
1951
|
-
const transaction = editor.state.tr.setMeta("focus", { event }).setMeta("addToHistory", false);
|
|
1952
|
-
view.dispatch(transaction);
|
|
1953
|
-
return false;
|
|
1954
|
-
},
|
|
1955
|
-
blur: (view, event) => {
|
|
1956
|
-
editor.isFocused = false;
|
|
1957
|
-
const transaction = editor.state.tr.setMeta("blur", { event }).setMeta("addToHistory", false);
|
|
1958
|
-
view.dispatch(transaction);
|
|
1959
|
-
return false;
|
|
1960
|
-
}
|
|
1961
|
-
}
|
|
1962
|
-
}
|
|
1963
|
-
})
|
|
1964
|
-
];
|
|
1965
|
-
}
|
|
1966
|
-
});
|
|
1967
|
-
Keymap = Extension.create({
|
|
1968
|
-
name: "keymap",
|
|
1969
|
-
addKeyboardShortcuts() {
|
|
1970
|
-
const handleBackspace = () => this.editor.commands.first(({ commands: commands2 }) => [
|
|
1971
|
-
() => commands2.undoInputRule(),
|
|
1972
|
-
// maybe convert first text block node to default node
|
|
1973
|
-
() => commands2.command(({ tr }) => {
|
|
1974
|
-
const { selection, doc } = tr;
|
|
1975
|
-
const { empty, $anchor } = selection;
|
|
1976
|
-
const { pos, parent } = $anchor;
|
|
1977
|
-
const $parentPos = $anchor.parent.isTextblock && pos > 0 ? tr.doc.resolve(pos - 1) : $anchor;
|
|
1978
|
-
const parentIsIsolating = $parentPos.parent.type.spec.isolating;
|
|
1979
|
-
const parentPos = $anchor.pos - $anchor.parentOffset;
|
|
1980
|
-
const isAtStart = parentIsIsolating && $parentPos.parent.childCount === 1 ? parentPos === $anchor.pos : import_state.Selection.atStart(doc).from === pos;
|
|
1981
|
-
if (!empty || !parent.type.isTextblock || parent.textContent.length || !isAtStart || isAtStart && $anchor.parent.type.name === "paragraph") {
|
|
1982
|
-
return false;
|
|
1983
|
-
}
|
|
1984
|
-
return commands2.clearNodes();
|
|
1985
|
-
}),
|
|
1986
|
-
() => commands2.deleteSelection(),
|
|
1987
|
-
() => commands2.joinBackward(),
|
|
1988
|
-
() => commands2.selectNodeBackward()
|
|
1989
|
-
]);
|
|
1990
|
-
const handleDelete = () => this.editor.commands.first(({ commands: commands2 }) => [
|
|
1991
|
-
() => commands2.deleteSelection(),
|
|
1992
|
-
() => commands2.deleteCurrentNode(),
|
|
1993
|
-
() => commands2.joinForward(),
|
|
1994
|
-
() => commands2.selectNodeForward()
|
|
1995
|
-
]);
|
|
1996
|
-
const handleEnter = () => this.editor.commands.first(({ commands: commands2 }) => [
|
|
1997
|
-
() => commands2.newlineInCode(),
|
|
1998
|
-
() => commands2.createParagraphNear(),
|
|
1999
|
-
() => commands2.liftEmptyBlock(),
|
|
2000
|
-
() => commands2.splitBlock()
|
|
2001
|
-
]);
|
|
2002
|
-
const baseKeymap = {
|
|
2003
|
-
Enter: handleEnter,
|
|
2004
|
-
"Mod-Enter": () => this.editor.commands.exitCode(),
|
|
2005
|
-
Backspace: handleBackspace,
|
|
2006
|
-
"Mod-Backspace": handleBackspace,
|
|
2007
|
-
"Shift-Backspace": handleBackspace,
|
|
2008
|
-
Delete: handleDelete,
|
|
2009
|
-
"Mod-Delete": handleDelete,
|
|
2010
|
-
"Mod-a": () => this.editor.commands.selectAll()
|
|
2011
|
-
};
|
|
2012
|
-
const pcKeymap = {
|
|
2013
|
-
...baseKeymap
|
|
2014
|
-
};
|
|
2015
|
-
const macKeymap = {
|
|
2016
|
-
...baseKeymap,
|
|
2017
|
-
"Ctrl-h": handleBackspace,
|
|
2018
|
-
"Alt-Backspace": handleBackspace,
|
|
2019
|
-
"Ctrl-d": handleDelete,
|
|
2020
|
-
"Ctrl-Alt-Backspace": handleDelete,
|
|
2021
|
-
"Alt-Delete": handleDelete,
|
|
2022
|
-
"Alt-d": handleDelete,
|
|
2023
|
-
"Ctrl-a": () => this.editor.commands.selectTextblockStart(),
|
|
2024
|
-
"Ctrl-e": () => this.editor.commands.selectTextblockEnd()
|
|
2025
|
-
};
|
|
2026
|
-
if (isiOS() || isMacOS()) {
|
|
2027
|
-
return macKeymap;
|
|
2028
|
-
}
|
|
2029
|
-
return pcKeymap;
|
|
2030
|
-
},
|
|
2031
|
-
addProseMirrorPlugins() {
|
|
2032
|
-
return [
|
|
2033
|
-
// With this plugin we check if the whole document was selected and deleted.
|
|
2034
|
-
// In this case we will additionally call `clearNodes()` to convert e.g. a heading
|
|
2035
|
-
// to a paragraph if necessary.
|
|
2036
|
-
// This is an alternative to ProseMirror's `AllSelection`, which doesn’t work well
|
|
2037
|
-
// with many other commands.
|
|
2038
|
-
new import_state.Plugin({
|
|
2039
|
-
key: new import_state.PluginKey("clearDocument"),
|
|
2040
|
-
appendTransaction: (transactions, oldState, newState) => {
|
|
2041
|
-
if (transactions.some((tr2) => tr2.getMeta("composition"))) {
|
|
2042
|
-
return;
|
|
2043
|
-
}
|
|
2044
|
-
const docChanges = transactions.some((transaction) => transaction.docChanged) && !oldState.doc.eq(newState.doc);
|
|
2045
|
-
const ignoreTr = transactions.some((transaction) => transaction.getMeta("preventClearDocument"));
|
|
2046
|
-
if (!docChanges || ignoreTr) {
|
|
2047
|
-
return;
|
|
2048
|
-
}
|
|
2049
|
-
const { empty, from, to } = oldState.selection;
|
|
2050
|
-
const allFrom = import_state.Selection.atStart(oldState.doc).from;
|
|
2051
|
-
const allEnd = import_state.Selection.atEnd(oldState.doc).to;
|
|
2052
|
-
const allWasSelected = from === allFrom && to === allEnd;
|
|
2053
|
-
if (empty || !allWasSelected) {
|
|
2054
|
-
return;
|
|
2055
|
-
}
|
|
2056
|
-
const isEmpty = isNodeEmpty(newState.doc);
|
|
2057
|
-
if (!isEmpty) {
|
|
2058
|
-
return;
|
|
2059
|
-
}
|
|
2060
|
-
const tr = newState.tr;
|
|
2061
|
-
const state = createChainableState({
|
|
2062
|
-
state: newState,
|
|
2063
|
-
transaction: tr
|
|
2064
|
-
});
|
|
2065
|
-
const { commands: commands2 } = new CommandManager({
|
|
2066
|
-
editor: this.editor,
|
|
2067
|
-
state
|
|
2068
|
-
});
|
|
2069
|
-
commands2.clearNodes();
|
|
2070
|
-
if (!tr.steps.length) {
|
|
2071
|
-
return;
|
|
2072
|
-
}
|
|
2073
|
-
return tr;
|
|
2074
|
-
}
|
|
2075
|
-
})
|
|
2076
|
-
];
|
|
2077
|
-
}
|
|
2078
|
-
});
|
|
2079
|
-
Paste = Extension.create({
|
|
2080
|
-
name: "paste",
|
|
2081
|
-
addProseMirrorPlugins() {
|
|
2082
|
-
return [
|
|
2083
|
-
new import_state.Plugin({
|
|
2084
|
-
key: new import_state.PluginKey("tiptapPaste"),
|
|
2085
|
-
props: {
|
|
2086
|
-
handlePaste: (_view, e, slice) => {
|
|
2087
|
-
this.editor.emit("paste", {
|
|
2088
|
-
editor: this.editor,
|
|
2089
|
-
event: e,
|
|
2090
|
-
slice
|
|
2091
|
-
});
|
|
2092
|
-
}
|
|
2093
|
-
}
|
|
2094
|
-
})
|
|
2095
|
-
];
|
|
2096
|
-
}
|
|
2097
|
-
});
|
|
2098
|
-
Tabindex = Extension.create({
|
|
2099
|
-
name: "tabindex",
|
|
2100
|
-
addProseMirrorPlugins() {
|
|
2101
|
-
return [
|
|
2102
|
-
new import_state.Plugin({
|
|
2103
|
-
key: new import_state.PluginKey("tabindex"),
|
|
2104
|
-
props: {
|
|
2105
|
-
attributes: () => this.editor.isEditable ? { tabindex: "0" } : {}
|
|
2106
|
-
}
|
|
2107
|
-
})
|
|
2108
|
-
];
|
|
2109
|
-
}
|
|
2110
|
-
});
|
|
2111
|
-
Node = class _Node {
|
|
2112
|
-
constructor(config = {}) {
|
|
2113
|
-
this.type = "node";
|
|
2114
|
-
this.name = "node";
|
|
2115
|
-
this.parent = null;
|
|
2116
|
-
this.child = null;
|
|
2117
|
-
this.config = {
|
|
2118
|
-
name: this.name,
|
|
2119
|
-
defaultOptions: {}
|
|
2120
|
-
};
|
|
2121
|
-
this.config = {
|
|
2122
|
-
...this.config,
|
|
2123
|
-
...config
|
|
2124
|
-
};
|
|
2125
|
-
this.name = this.config.name;
|
|
2126
|
-
if (config.defaultOptions && Object.keys(config.defaultOptions).length > 0) {
|
|
2127
|
-
console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`);
|
|
2128
|
-
}
|
|
2129
|
-
this.options = this.config.defaultOptions;
|
|
2130
|
-
if (this.config.addOptions) {
|
|
2131
|
-
this.options = callOrReturn(getExtensionField(this, "addOptions", {
|
|
2132
|
-
name: this.name
|
|
2133
|
-
}));
|
|
2134
|
-
}
|
|
2135
|
-
this.storage = callOrReturn(getExtensionField(this, "addStorage", {
|
|
2136
|
-
name: this.name,
|
|
2137
|
-
options: this.options
|
|
2138
|
-
})) || {};
|
|
2139
|
-
}
|
|
2140
|
-
static create(config = {}) {
|
|
2141
|
-
return new _Node(config);
|
|
2142
|
-
}
|
|
2143
|
-
configure(options = {}) {
|
|
2144
|
-
const extension = this.extend({
|
|
2145
|
-
...this.config,
|
|
2146
|
-
addOptions: () => {
|
|
2147
|
-
return mergeDeep(this.options, options);
|
|
2148
|
-
}
|
|
2149
|
-
});
|
|
2150
|
-
extension.name = this.name;
|
|
2151
|
-
extension.parent = this.parent;
|
|
2152
|
-
return extension;
|
|
2153
|
-
}
|
|
2154
|
-
extend(extendedConfig = {}) {
|
|
2155
|
-
const extension = new _Node(extendedConfig);
|
|
2156
|
-
extension.parent = this;
|
|
2157
|
-
this.child = extension;
|
|
2158
|
-
extension.name = extendedConfig.name ? extendedConfig.name : extension.parent.name;
|
|
2159
|
-
if (extendedConfig.defaultOptions && Object.keys(extendedConfig.defaultOptions).length > 0) {
|
|
2160
|
-
console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${extension.name}".`);
|
|
2161
|
-
}
|
|
2162
|
-
extension.options = callOrReturn(getExtensionField(extension, "addOptions", {
|
|
2163
|
-
name: extension.name
|
|
2164
|
-
}));
|
|
2165
|
-
extension.storage = callOrReturn(getExtensionField(extension, "addStorage", {
|
|
2166
|
-
name: extension.name,
|
|
2167
|
-
options: extension.options
|
|
2168
|
-
}));
|
|
2169
|
-
return extension;
|
|
2170
|
-
}
|
|
2171
|
-
};
|
|
2172
|
-
}
|
|
2173
|
-
});
|
|
2174
|
-
|
|
2175
37
|
// src/extensions/FontSize.ts
|
|
2176
|
-
var FontSize;
|
|
38
|
+
var import_core, FontSize;
|
|
2177
39
|
var init_FontSize = __esm({
|
|
2178
40
|
"src/extensions/FontSize.ts"() {
|
|
2179
41
|
"use strict";
|
|
2180
|
-
|
|
2181
|
-
FontSize = Extension.create({
|
|
42
|
+
import_core = require("@tiptap/core");
|
|
43
|
+
FontSize = import_core.Extension.create({
|
|
2182
44
|
name: "fontSize",
|
|
2183
45
|
addOptions() {
|
|
2184
46
|
return {
|
|
@@ -2221,12 +83,12 @@ var init_FontSize = __esm({
|
|
|
2221
83
|
});
|
|
2222
84
|
|
|
2223
85
|
// src/extensions/LineHeight.ts
|
|
2224
|
-
var LineHeight;
|
|
86
|
+
var import_core2, LineHeight;
|
|
2225
87
|
var init_LineHeight = __esm({
|
|
2226
88
|
"src/extensions/LineHeight.ts"() {
|
|
2227
89
|
"use strict";
|
|
2228
|
-
|
|
2229
|
-
LineHeight = Extension.create({
|
|
90
|
+
import_core2 = require("@tiptap/core");
|
|
91
|
+
LineHeight = import_core2.Extension.create({
|
|
2230
92
|
name: "lineHeight",
|
|
2231
93
|
addOptions() {
|
|
2232
94
|
return {
|
|
@@ -2257,14 +119,14 @@ var init_LineHeight = __esm({
|
|
|
2257
119
|
},
|
|
2258
120
|
addCommands() {
|
|
2259
121
|
return {
|
|
2260
|
-
setLineHeight: (lineHeight) => ({ commands
|
|
122
|
+
setLineHeight: (lineHeight) => ({ commands }) => {
|
|
2261
123
|
return this.options.types.every(
|
|
2262
|
-
(type) =>
|
|
124
|
+
(type) => commands.updateAttributes(type, { lineHeight })
|
|
2263
125
|
);
|
|
2264
126
|
},
|
|
2265
|
-
unsetLineHeight: () => ({ commands
|
|
127
|
+
unsetLineHeight: () => ({ commands }) => {
|
|
2266
128
|
return this.options.types.every(
|
|
2267
|
-
(type) =>
|
|
129
|
+
(type) => commands.resetAttributes(type, "lineHeight")
|
|
2268
130
|
);
|
|
2269
131
|
}
|
|
2270
132
|
};
|
|
@@ -2274,12 +136,12 @@ var init_LineHeight = __esm({
|
|
|
2274
136
|
});
|
|
2275
137
|
|
|
2276
138
|
// src/extensions/Video.ts
|
|
2277
|
-
var Video;
|
|
139
|
+
var import_core3, Video;
|
|
2278
140
|
var init_Video = __esm({
|
|
2279
141
|
"src/extensions/Video.ts"() {
|
|
2280
142
|
"use strict";
|
|
2281
|
-
|
|
2282
|
-
Video = Node.create({
|
|
143
|
+
import_core3 = require("@tiptap/core");
|
|
144
|
+
Video = import_core3.Node.create({
|
|
2283
145
|
name: "video",
|
|
2284
146
|
addOptions() {
|
|
2285
147
|
return {
|
|
@@ -2327,14 +189,14 @@ var init_Video = __esm({
|
|
|
2327
189
|
renderHTML({ HTMLAttributes }) {
|
|
2328
190
|
return [
|
|
2329
191
|
"video",
|
|
2330
|
-
mergeAttributes(this.options.HTMLAttributes, HTMLAttributes),
|
|
192
|
+
(0, import_core3.mergeAttributes)(this.options.HTMLAttributes, HTMLAttributes),
|
|
2331
193
|
["source", { src: HTMLAttributes.src }]
|
|
2332
194
|
];
|
|
2333
195
|
},
|
|
2334
196
|
addCommands() {
|
|
2335
197
|
return {
|
|
2336
|
-
setVideo: (options) => ({ commands
|
|
2337
|
-
return
|
|
198
|
+
setVideo: (options) => ({ commands }) => {
|
|
199
|
+
return commands.insertContent({
|
|
2338
200
|
type: this.name,
|
|
2339
201
|
attrs: options
|
|
2340
202
|
});
|
|
@@ -2346,11 +208,11 @@ var init_Video = __esm({
|
|
|
2346
208
|
});
|
|
2347
209
|
|
|
2348
210
|
// src/extensions/Emoji.ts
|
|
2349
|
-
var EMOJI_CATEGORIES, Emoji;
|
|
211
|
+
var import_core4, EMOJI_CATEGORIES, Emoji;
|
|
2350
212
|
var init_Emoji = __esm({
|
|
2351
213
|
"src/extensions/Emoji.ts"() {
|
|
2352
214
|
"use strict";
|
|
2353
|
-
|
|
215
|
+
import_core4 = require("@tiptap/core");
|
|
2354
216
|
EMOJI_CATEGORIES = {
|
|
2355
217
|
smileys: {
|
|
2356
218
|
label: "Smileys & People",
|
|
@@ -3359,7 +1221,7 @@ var init_Emoji = __esm({
|
|
|
3359
1221
|
]
|
|
3360
1222
|
}
|
|
3361
1223
|
};
|
|
3362
|
-
Emoji = Extension.create({
|
|
1224
|
+
Emoji = import_core4.Extension.create({
|
|
3363
1225
|
name: "emoji",
|
|
3364
1226
|
addOptions() {
|
|
3365
1227
|
return {
|
|
@@ -3368,8 +1230,8 @@ var init_Emoji = __esm({
|
|
|
3368
1230
|
},
|
|
3369
1231
|
addCommands() {
|
|
3370
1232
|
return {
|
|
3371
|
-
insertEmoji: (emoji) => ({ commands
|
|
3372
|
-
return
|
|
1233
|
+
insertEmoji: (emoji) => ({ commands }) => {
|
|
1234
|
+
return commands.insertContent(emoji);
|
|
3373
1235
|
}
|
|
3374
1236
|
};
|
|
3375
1237
|
}
|
|
@@ -3378,12 +1240,12 @@ var init_Emoji = __esm({
|
|
|
3378
1240
|
});
|
|
3379
1241
|
|
|
3380
1242
|
// src/extensions/Fullscreen.ts
|
|
3381
|
-
var Fullscreen;
|
|
1243
|
+
var import_core5, Fullscreen;
|
|
3382
1244
|
var init_Fullscreen = __esm({
|
|
3383
1245
|
"src/extensions/Fullscreen.ts"() {
|
|
3384
1246
|
"use strict";
|
|
3385
|
-
|
|
3386
|
-
Fullscreen = Extension.create({
|
|
1247
|
+
import_core5 = require("@tiptap/core");
|
|
1248
|
+
Fullscreen = import_core5.Extension.create({
|
|
3387
1249
|
name: "fullscreen",
|
|
3388
1250
|
addOptions() {
|
|
3389
1251
|
return {
|
|
@@ -3449,11 +1311,11 @@ var init_Fullscreen = __esm({
|
|
|
3449
1311
|
});
|
|
3450
1312
|
|
|
3451
1313
|
// src/extensions/Print.ts
|
|
3452
|
-
var defaultPrintStyles, Print;
|
|
1314
|
+
var import_core6, defaultPrintStyles, Print;
|
|
3453
1315
|
var init_Print = __esm({
|
|
3454
1316
|
"src/extensions/Print.ts"() {
|
|
3455
1317
|
"use strict";
|
|
3456
|
-
|
|
1318
|
+
import_core6 = require("@tiptap/core");
|
|
3457
1319
|
defaultPrintStyles = `
|
|
3458
1320
|
body {
|
|
3459
1321
|
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
|
|
@@ -3569,7 +1431,7 @@ var init_Print = __esm({
|
|
|
3569
1431
|
}
|
|
3570
1432
|
}
|
|
3571
1433
|
`;
|
|
3572
|
-
Print = Extension.create({
|
|
1434
|
+
Print = import_core6.Extension.create({
|
|
3573
1435
|
name: "print",
|
|
3574
1436
|
addOptions() {
|
|
3575
1437
|
return {
|
|
@@ -3627,12 +1489,12 @@ var init_Print = __esm({
|
|
|
3627
1489
|
});
|
|
3628
1490
|
|
|
3629
1491
|
// src/extensions/Indent.ts
|
|
3630
|
-
var Indent;
|
|
1492
|
+
var import_core7, Indent;
|
|
3631
1493
|
var init_Indent = __esm({
|
|
3632
1494
|
"src/extensions/Indent.ts"() {
|
|
3633
1495
|
"use strict";
|
|
3634
|
-
|
|
3635
|
-
Indent = Extension.create({
|
|
1496
|
+
import_core7 = require("@tiptap/core");
|
|
1497
|
+
Indent = import_core7.Extension.create({
|
|
3636
1498
|
name: "indent",
|
|
3637
1499
|
addOptions() {
|
|
3638
1500
|
return {
|
|
@@ -3846,7 +1708,7 @@ var init_TipTapToolbar = __esm({
|
|
|
3846
1708
|
onClick: () => editor.chain().focus().toggleBold().run(),
|
|
3847
1709
|
active: editor.isActive("bold"),
|
|
3848
1710
|
title: "Bold (Ctrl+B)",
|
|
3849
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("
|
|
1711
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime.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" }) })
|
|
3850
1712
|
},
|
|
3851
1713
|
"bold"
|
|
3852
1714
|
);
|
|
@@ -3857,7 +1719,7 @@ var init_TipTapToolbar = __esm({
|
|
|
3857
1719
|
onClick: () => editor.chain().focus().toggleItalic().run(),
|
|
3858
1720
|
active: editor.isActive("italic"),
|
|
3859
1721
|
title: "Italic (Ctrl+I)",
|
|
3860
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("
|
|
1722
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M10 4v3h2.21l-3.42 8H6v3h8v-3h-2.21l3.42-8H18V4z" }) })
|
|
3861
1723
|
},
|
|
3862
1724
|
"italic"
|
|
3863
1725
|
);
|
|
@@ -3868,7 +1730,7 @@ var init_TipTapToolbar = __esm({
|
|
|
3868
1730
|
onClick: () => editor.chain().focus().toggleUnderline().run(),
|
|
3869
1731
|
active: editor.isActive("underline"),
|
|
3870
1732
|
title: "Underline (Ctrl+U)",
|
|
3871
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("
|
|
1733
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime.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" }) })
|
|
3872
1734
|
},
|
|
3873
1735
|
"underline"
|
|
3874
1736
|
);
|
|
@@ -3879,7 +1741,7 @@ var init_TipTapToolbar = __esm({
|
|
|
3879
1741
|
onClick: () => editor.chain().focus().toggleStrike().run(),
|
|
3880
1742
|
active: editor.isActive("strike"),
|
|
3881
1743
|
title: "Strikethrough",
|
|
3882
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("
|
|
1744
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M10 19h4v-3h-4v3zM5 4v3h5v3h4V7h5V4H5zM3 14h18v-2H3v2z" }) })
|
|
3883
1745
|
},
|
|
3884
1746
|
"strike"
|
|
3885
1747
|
);
|
|
@@ -3890,7 +1752,23 @@ var init_TipTapToolbar = __esm({
|
|
|
3890
1752
|
onClick: () => editor.chain().focus().toggleCode().run(),
|
|
3891
1753
|
active: editor.isActive("code"),
|
|
3892
1754
|
title: "Inline Code",
|
|
3893
|
-
children:
|
|
1755
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
1756
|
+
"svg",
|
|
1757
|
+
{
|
|
1758
|
+
width: "18",
|
|
1759
|
+
height: "18",
|
|
1760
|
+
viewBox: "0 0 24 24",
|
|
1761
|
+
fill: "none",
|
|
1762
|
+
stroke: "currentColor",
|
|
1763
|
+
strokeWidth: "2",
|
|
1764
|
+
strokeLinecap: "round",
|
|
1765
|
+
strokeLinejoin: "round",
|
|
1766
|
+
children: [
|
|
1767
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("polyline", { points: "16 18 22 12 16 6" }),
|
|
1768
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("polyline", { points: "8 6 2 12 8 18" })
|
|
1769
|
+
]
|
|
1770
|
+
}
|
|
1771
|
+
)
|
|
3894
1772
|
},
|
|
3895
1773
|
"code"
|
|
3896
1774
|
);
|
|
@@ -3901,35 +1779,46 @@ var init_TipTapToolbar = __esm({
|
|
|
3901
1779
|
onClick: () => editor.chain().focus().toggleCodeBlock().run(),
|
|
3902
1780
|
active: editor.isActive("codeBlock"),
|
|
3903
1781
|
title: "Code Block",
|
|
3904
|
-
children:
|
|
1782
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
1783
|
+
"svg",
|
|
1784
|
+
{
|
|
1785
|
+
width: "18",
|
|
1786
|
+
height: "18",
|
|
1787
|
+
viewBox: "0 0 24 24",
|
|
1788
|
+
fill: "none",
|
|
1789
|
+
stroke: "currentColor",
|
|
1790
|
+
strokeWidth: "2",
|
|
1791
|
+
strokeLinecap: "round",
|
|
1792
|
+
strokeLinejoin: "round",
|
|
1793
|
+
children: [
|
|
1794
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("rect", { x: "3", y: "3", width: "18", height: "18", rx: "2", ry: "2" }),
|
|
1795
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("polyline", { points: "9 8 5 12 9 16" }),
|
|
1796
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("polyline", { points: "15 8 19 12 15 16" })
|
|
1797
|
+
]
|
|
1798
|
+
}
|
|
1799
|
+
)
|
|
3905
1800
|
},
|
|
3906
1801
|
"codeBlock"
|
|
3907
1802
|
);
|
|
3908
1803
|
case "subscript":
|
|
3909
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.
|
|
1804
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
3910
1805
|
ToolbarButton3,
|
|
3911
1806
|
{
|
|
3912
1807
|
onClick: () => editor.chain().focus().toggleSubscript().run(),
|
|
3913
1808
|
active: editor.isActive("subscript"),
|
|
3914
1809
|
title: "Subscript",
|
|
3915
|
-
children:
|
|
3916
|
-
"X",
|
|
3917
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("sub", { children: "2" })
|
|
3918
|
-
]
|
|
1810
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime.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" }) })
|
|
3919
1811
|
},
|
|
3920
1812
|
"subscript"
|
|
3921
1813
|
);
|
|
3922
1814
|
case "superscript":
|
|
3923
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.
|
|
1815
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
3924
1816
|
ToolbarButton3,
|
|
3925
1817
|
{
|
|
3926
1818
|
onClick: () => editor.chain().focus().toggleSuperscript().run(),
|
|
3927
1819
|
active: editor.isActive("superscript"),
|
|
3928
1820
|
title: "Superscript",
|
|
3929
|
-
children:
|
|
3930
|
-
"X",
|
|
3931
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("sup", { children: "2" })
|
|
3932
|
-
]
|
|
1821
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime.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" }) })
|
|
3933
1822
|
},
|
|
3934
1823
|
"superscript"
|
|
3935
1824
|
);
|
|
@@ -3939,7 +1828,7 @@ var init_TipTapToolbar = __esm({
|
|
|
3939
1828
|
{
|
|
3940
1829
|
onClick: () => editor.chain().focus().clearNodes().unsetAllMarks().run(),
|
|
3941
1830
|
title: "Clear Formatting",
|
|
3942
|
-
children: "
|
|
1831
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime.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" }) })
|
|
3943
1832
|
},
|
|
3944
1833
|
"clearFormatting"
|
|
3945
1834
|
);
|
|
@@ -4005,29 +1894,85 @@ var init_TipTapToolbar = __esm({
|
|
|
4005
1894
|
"lineHeight"
|
|
4006
1895
|
);
|
|
4007
1896
|
case "textColor":
|
|
4008
|
-
|
|
4009
|
-
|
|
4010
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
4011
|
-
"
|
|
1897
|
+
const textPresetColors = ["#11a161", "#85144b", "#ff851b", "#b10dc9"];
|
|
1898
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { className: "rte-builder-toolbar-color-group", children: [
|
|
1899
|
+
textPresetColors.map((color) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
1900
|
+
"button",
|
|
4012
1901
|
{
|
|
4013
|
-
|
|
4014
|
-
|
|
4015
|
-
|
|
4016
|
-
|
|
4017
|
-
|
|
4018
|
-
|
|
1902
|
+
className: "rte-builder-color-preset",
|
|
1903
|
+
style: { backgroundColor: color },
|
|
1904
|
+
onClick: () => editor.chain().focus().setColor(color).run(),
|
|
1905
|
+
title: `Text Color: ${color}`,
|
|
1906
|
+
type: "button"
|
|
1907
|
+
},
|
|
1908
|
+
`text-${color}`
|
|
1909
|
+
)),
|
|
1910
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "rte-builder-toolbar-color", children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", { title: "Custom Text Color", children: [
|
|
1911
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
1912
|
+
"svg",
|
|
1913
|
+
{
|
|
1914
|
+
width: "14",
|
|
1915
|
+
height: "14",
|
|
1916
|
+
viewBox: "0 0 24 24",
|
|
1917
|
+
fill: "currentColor",
|
|
1918
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.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" })
|
|
1919
|
+
}
|
|
1920
|
+
),
|
|
1921
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
1922
|
+
"input",
|
|
1923
|
+
{
|
|
1924
|
+
type: "color",
|
|
1925
|
+
onChange: (e) => editor.chain().focus().setColor(e.target.value).run(),
|
|
1926
|
+
value: editor.getAttributes("textStyle").color || "#000000"
|
|
1927
|
+
}
|
|
1928
|
+
)
|
|
1929
|
+
] }) })
|
|
1930
|
+
] }, "textColor");
|
|
4019
1931
|
case "backgroundColor":
|
|
4020
|
-
|
|
4021
|
-
|
|
4022
|
-
|
|
4023
|
-
|
|
4024
|
-
|
|
4025
|
-
|
|
4026
|
-
|
|
4027
|
-
|
|
4028
|
-
|
|
4029
|
-
|
|
4030
|
-
|
|
1932
|
+
const bgPresetColors = ["#11a161", "#85144b", "#ff851b", "#b10dc9"];
|
|
1933
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
1934
|
+
"span",
|
|
1935
|
+
{
|
|
1936
|
+
className: "rte-builder-toolbar-color-group",
|
|
1937
|
+
children: [
|
|
1938
|
+
bgPresetColors.map((color) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
1939
|
+
"button",
|
|
1940
|
+
{
|
|
1941
|
+
className: "rte-builder-color-preset rte-builder-color-preset-bg",
|
|
1942
|
+
style: { backgroundColor: color },
|
|
1943
|
+
onClick: () => editor.chain().focus().toggleHighlight({ color }).run(),
|
|
1944
|
+
title: `Highlight Color: ${color}`,
|
|
1945
|
+
type: "button"
|
|
1946
|
+
},
|
|
1947
|
+
`bg-${color}`
|
|
1948
|
+
)),
|
|
1949
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "rte-builder-toolbar-color", children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", { title: "Custom Background Color", children: [
|
|
1950
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
1951
|
+
"svg",
|
|
1952
|
+
{
|
|
1953
|
+
width: "14",
|
|
1954
|
+
height: "14",
|
|
1955
|
+
viewBox: "0 0 24 24",
|
|
1956
|
+
fill: "currentColor",
|
|
1957
|
+
children: [
|
|
1958
|
+
/* @__PURE__ */ (0, import_jsx_runtime.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" }),
|
|
1959
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M2 20h20v4H2z", fillOpacity: ".36" })
|
|
1960
|
+
]
|
|
1961
|
+
}
|
|
1962
|
+
),
|
|
1963
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
1964
|
+
"input",
|
|
1965
|
+
{
|
|
1966
|
+
type: "color",
|
|
1967
|
+
onChange: (e) => editor.chain().focus().toggleHighlight({ color: e.target.value }).run(),
|
|
1968
|
+
value: editor.getAttributes("highlight").color || "#ffff00"
|
|
1969
|
+
}
|
|
1970
|
+
)
|
|
1971
|
+
] }) })
|
|
1972
|
+
]
|
|
1973
|
+
},
|
|
1974
|
+
"backgroundColor"
|
|
1975
|
+
);
|
|
4031
1976
|
case "alignLeft":
|
|
4032
1977
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
4033
1978
|
ToolbarButton3,
|
|
@@ -4035,7 +1980,7 @@ var init_TipTapToolbar = __esm({
|
|
|
4035
1980
|
onClick: () => editor.chain().focus().setTextAlign("left").run(),
|
|
4036
1981
|
active: editor.isActive({ textAlign: "left" }),
|
|
4037
1982
|
title: "Align Left",
|
|
4038
|
-
children: "
|
|
1983
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M15 15H3v2h12v-2zm0-8H3v2h12V7zM3 13h18v-2H3v2zm0 8h18v-2H3v2zM3 3v2h18V3H3z" }) })
|
|
4039
1984
|
},
|
|
4040
1985
|
"alignLeft"
|
|
4041
1986
|
);
|
|
@@ -4046,7 +1991,7 @@ var init_TipTapToolbar = __esm({
|
|
|
4046
1991
|
onClick: () => editor.chain().focus().setTextAlign("center").run(),
|
|
4047
1992
|
active: editor.isActive({ textAlign: "center" }),
|
|
4048
1993
|
title: "Align Center",
|
|
4049
|
-
children: "
|
|
1994
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M7 15v2h10v-2H7zm-4 6h18v-2H3v2zm0-8h18v-2H3v2zm4-6v2h10V7H7zM3 3v2h18V3H3z" }) })
|
|
4050
1995
|
},
|
|
4051
1996
|
"alignCenter"
|
|
4052
1997
|
);
|
|
@@ -4057,7 +2002,7 @@ var init_TipTapToolbar = __esm({
|
|
|
4057
2002
|
onClick: () => editor.chain().focus().setTextAlign("right").run(),
|
|
4058
2003
|
active: editor.isActive({ textAlign: "right" }),
|
|
4059
2004
|
title: "Align Right",
|
|
4060
|
-
children: "
|
|
2005
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M3 21h18v-2H3v2zm6-4h12v-2H9v2zm-6-4h18v-2H3v2zm6-4h12V7H9v2zM3 3v2h18V3H3z" }) })
|
|
4061
2006
|
},
|
|
4062
2007
|
"alignRight"
|
|
4063
2008
|
);
|
|
@@ -4068,7 +2013,7 @@ var init_TipTapToolbar = __esm({
|
|
|
4068
2013
|
onClick: () => editor.chain().focus().setTextAlign("justify").run(),
|
|
4069
2014
|
active: editor.isActive({ textAlign: "justify" }),
|
|
4070
2015
|
title: "Justify",
|
|
4071
|
-
children: "
|
|
2016
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M3 21h18v-2H3v2zm0-4h18v-2H3v2zm0-4h18v-2H3v2zm0-4h18V7H3v2zM3 3v2h18V3H3z" }) })
|
|
4072
2017
|
},
|
|
4073
2018
|
"alignJustify"
|
|
4074
2019
|
);
|
|
@@ -4078,7 +2023,7 @@ var init_TipTapToolbar = __esm({
|
|
|
4078
2023
|
{
|
|
4079
2024
|
onClick: () => editor.chain().focus().indent().run(),
|
|
4080
2025
|
title: "Indent (Tab)",
|
|
4081
|
-
children: "
|
|
2026
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M3 21h18v-2H3v2zM3 8v8l4-4-4-4zm8 9h10v-2H11v2zM3 3v2h18V3H3zm8 6h10V7H11v2zm0 4h10v-2H11v2z" }) })
|
|
4082
2027
|
},
|
|
4083
2028
|
"indent"
|
|
4084
2029
|
);
|
|
@@ -4088,7 +2033,7 @@ var init_TipTapToolbar = __esm({
|
|
|
4088
2033
|
{
|
|
4089
2034
|
onClick: () => editor.chain().focus().outdent().run(),
|
|
4090
2035
|
title: "Outdent (Shift+Tab)",
|
|
4091
|
-
children: "
|
|
2036
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M11 17h10v-2H11v2zm-8-5l4 4V8l-4 4zm0 9h18v-2H3v2zM3 3v2h18V3H3zm8 6h10V7H11v2zm0 4h10v-2H11v2z" }) })
|
|
4092
2037
|
},
|
|
4093
2038
|
"outdent"
|
|
4094
2039
|
);
|
|
@@ -4099,7 +2044,7 @@ var init_TipTapToolbar = __esm({
|
|
|
4099
2044
|
onClick: () => editor.chain().focus().toggleBulletList().run(),
|
|
4100
2045
|
active: editor.isActive("bulletList"),
|
|
4101
2046
|
title: "Bullet List",
|
|
4102
|
-
children: "
|
|
2047
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime.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" }) })
|
|
4103
2048
|
},
|
|
4104
2049
|
"bulletList"
|
|
4105
2050
|
);
|
|
@@ -4110,7 +2055,7 @@ var init_TipTapToolbar = __esm({
|
|
|
4110
2055
|
onClick: () => editor.chain().focus().toggleOrderedList().run(),
|
|
4111
2056
|
active: editor.isActive("orderedList"),
|
|
4112
2057
|
title: "Numbered List",
|
|
4113
|
-
children: "1."
|
|
2058
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M2 17h2v.5H3v1h1v.5H2v1h3v-4H2v1zm1-9h1V4H2v1h1v3zm-1 3h1.8L2 13.1v.9h3v-1H3.2L5 10.9V10H2v1zm5-6v2h14V5H7zm0 14h14v-2H7v2zm0-6h14v-2H7v2z" }) })
|
|
4114
2059
|
},
|
|
4115
2060
|
"orderedList"
|
|
4116
2061
|
);
|
|
@@ -4121,16 +2066,21 @@ var init_TipTapToolbar = __esm({
|
|
|
4121
2066
|
case "heading5":
|
|
4122
2067
|
case "heading6":
|
|
4123
2068
|
const level = parseInt(button.replace("heading", ""));
|
|
4124
|
-
|
|
2069
|
+
const headingIcons = {
|
|
2070
|
+
1: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime.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" }) }),
|
|
2071
|
+
2: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime.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" }) }),
|
|
2072
|
+
3: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime.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" }) }),
|
|
2073
|
+
4: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime.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" }) }),
|
|
2074
|
+
5: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime.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" }) }),
|
|
2075
|
+
6: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime.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" }) })
|
|
2076
|
+
};
|
|
2077
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
4125
2078
|
ToolbarButton3,
|
|
4126
2079
|
{
|
|
4127
2080
|
onClick: () => editor.chain().focus().toggleHeading({ level }).run(),
|
|
4128
2081
|
active: editor.isActive("heading", { level }),
|
|
4129
2082
|
title: `Heading ${level}`,
|
|
4130
|
-
children: [
|
|
4131
|
-
"H",
|
|
4132
|
-
level
|
|
4133
|
-
]
|
|
2083
|
+
children: headingIcons[level]
|
|
4134
2084
|
},
|
|
4135
2085
|
button
|
|
4136
2086
|
);
|
|
@@ -4141,7 +2091,7 @@ var init_TipTapToolbar = __esm({
|
|
|
4141
2091
|
onClick: () => editor.chain().focus().toggleBlockquote().run(),
|
|
4142
2092
|
active: editor.isActive("blockquote"),
|
|
4143
2093
|
title: "Blockquote",
|
|
4144
|
-
children:
|
|
2094
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M6 17h3l2-4V7H5v6h3zm8 0h3l2-4V7h-6v6h3z" }) })
|
|
4145
2095
|
},
|
|
4146
2096
|
"blockquote"
|
|
4147
2097
|
);
|
|
@@ -4151,7 +2101,7 @@ var init_TipTapToolbar = __esm({
|
|
|
4151
2101
|
{
|
|
4152
2102
|
onClick: () => editor.chain().focus().setHorizontalRule().run(),
|
|
4153
2103
|
title: "Horizontal Rule",
|
|
4154
|
-
children: "
|
|
2104
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M4 11h16v2H4z" }) })
|
|
4155
2105
|
},
|
|
4156
2106
|
"horizontalRule"
|
|
4157
2107
|
);
|
|
@@ -4167,7 +2117,7 @@ var init_TipTapToolbar = __esm({
|
|
|
4167
2117
|
},
|
|
4168
2118
|
active: editor.isActive("link"),
|
|
4169
2119
|
title: "Insert Link",
|
|
4170
|
-
children: "
|
|
2120
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime.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" }) })
|
|
4171
2121
|
},
|
|
4172
2122
|
"link"
|
|
4173
2123
|
);
|
|
@@ -4178,7 +2128,7 @@ var init_TipTapToolbar = __esm({
|
|
|
4178
2128
|
onClick: () => editor.chain().focus().unsetLink().run(),
|
|
4179
2129
|
disabled: !editor.isActive("link"),
|
|
4180
2130
|
title: "Remove Link",
|
|
4181
|
-
children: "
|
|
2131
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime.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" }) })
|
|
4182
2132
|
},
|
|
4183
2133
|
"unlink"
|
|
4184
2134
|
);
|
|
@@ -4197,7 +2147,7 @@ var init_TipTapToolbar = __esm({
|
|
|
4197
2147
|
}
|
|
4198
2148
|
},
|
|
4199
2149
|
title: "Insert Image",
|
|
4200
|
-
children: "
|
|
2150
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime.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" }) })
|
|
4201
2151
|
},
|
|
4202
2152
|
"image"
|
|
4203
2153
|
);
|
|
@@ -4216,7 +2166,7 @@ var init_TipTapToolbar = __esm({
|
|
|
4216
2166
|
}
|
|
4217
2167
|
},
|
|
4218
2168
|
title: "Insert Video",
|
|
4219
|
-
children: "
|
|
2169
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime.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" }) })
|
|
4220
2170
|
},
|
|
4221
2171
|
"video"
|
|
4222
2172
|
);
|
|
@@ -4226,7 +2176,7 @@ var init_TipTapToolbar = __esm({
|
|
|
4226
2176
|
{
|
|
4227
2177
|
onClick: () => editor.chain().focus().insertTable({ rows: 3, cols: 3, withHeaderRow: true }).run(),
|
|
4228
2178
|
title: "Insert Table",
|
|
4229
|
-
children: "
|
|
2179
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime.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" }) })
|
|
4230
2180
|
},
|
|
4231
2181
|
"table"
|
|
4232
2182
|
);
|
|
@@ -4239,7 +2189,16 @@ var init_TipTapToolbar = __esm({
|
|
|
4239
2189
|
onClick: () => setShowEmojiPicker(!showEmojiPicker),
|
|
4240
2190
|
active: showEmojiPicker,
|
|
4241
2191
|
title: "Insert Emoji",
|
|
4242
|
-
children:
|
|
2192
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
2193
|
+
"svg",
|
|
2194
|
+
{
|
|
2195
|
+
width: "16",
|
|
2196
|
+
height: "16",
|
|
2197
|
+
viewBox: "0 0 24 24",
|
|
2198
|
+
fill: "currentColor",
|
|
2199
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.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" })
|
|
2200
|
+
}
|
|
2201
|
+
)
|
|
4243
2202
|
}
|
|
4244
2203
|
),
|
|
4245
2204
|
showEmojiPicker && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
@@ -4258,7 +2217,25 @@ var init_TipTapToolbar = __esm({
|
|
|
4258
2217
|
onClick: () => editor.chain().focus().toggleFullscreen().run(),
|
|
4259
2218
|
active: isFullscreen,
|
|
4260
2219
|
title: isFullscreen ? "Exit Fullscreen (Esc)" : "Fullscreen (Ctrl+Shift+F)",
|
|
4261
|
-
children: isFullscreen ?
|
|
2220
|
+
children: isFullscreen ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
2221
|
+
"svg",
|
|
2222
|
+
{
|
|
2223
|
+
width: "16",
|
|
2224
|
+
height: "16",
|
|
2225
|
+
viewBox: "0 0 24 24",
|
|
2226
|
+
fill: "currentColor",
|
|
2227
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M5 16h3v3h2v-5H5v2zm3-8H5v2h5V5H8v3zm6 11h2v-3h3v-2h-5v5zm2-11V5h-2v5h5V8h-3z" })
|
|
2228
|
+
}
|
|
2229
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
2230
|
+
"svg",
|
|
2231
|
+
{
|
|
2232
|
+
width: "16",
|
|
2233
|
+
height: "16",
|
|
2234
|
+
viewBox: "0 0 24 24",
|
|
2235
|
+
fill: "currentColor",
|
|
2236
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M7 14H5v5h5v-2H7v-3zm-2-4h2V7h3V5H5v5zm12 7h-3v2h5v-5h-2v3zM14 5v2h3v3h2V5h-5z" })
|
|
2237
|
+
}
|
|
2238
|
+
)
|
|
4262
2239
|
},
|
|
4263
2240
|
"fullscreen"
|
|
4264
2241
|
);
|
|
@@ -4268,7 +2245,7 @@ var init_TipTapToolbar = __esm({
|
|
|
4268
2245
|
{
|
|
4269
2246
|
onClick: () => editor.chain().focus().print().run(),
|
|
4270
2247
|
title: "Print (Ctrl+P)",
|
|
4271
|
-
children: "
|
|
2248
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime.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" }) })
|
|
4272
2249
|
},
|
|
4273
2250
|
"print"
|
|
4274
2251
|
);
|
|
@@ -4279,7 +2256,7 @@ var init_TipTapToolbar = __esm({
|
|
|
4279
2256
|
onClick: () => editor.chain().focus().undo().run(),
|
|
4280
2257
|
disabled: !editor.can().undo(),
|
|
4281
2258
|
title: "Undo (Ctrl+Z)",
|
|
4282
|
-
children: "
|
|
2259
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime.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" }) })
|
|
4283
2260
|
},
|
|
4284
2261
|
"undo"
|
|
4285
2262
|
);
|
|
@@ -4290,7 +2267,7 @@ var init_TipTapToolbar = __esm({
|
|
|
4290
2267
|
onClick: () => editor.chain().focus().redo().run(),
|
|
4291
2268
|
disabled: !editor.can().redo(),
|
|
4292
2269
|
title: "Redo (Ctrl+Y)",
|
|
4293
|
-
children: "
|
|
2270
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime.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" }) })
|
|
4294
2271
|
},
|
|
4295
2272
|
"redo"
|
|
4296
2273
|
);
|
|
@@ -4833,43 +2810,253 @@ var init_SlateToolbar = __esm({
|
|
|
4833
2810
|
}
|
|
4834
2811
|
);
|
|
4835
2812
|
icons = {
|
|
4836
|
-
bold: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("svg", { viewBox: "0 0 24 24", width: "16", height: "16", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
4837
|
-
|
|
4838
|
-
|
|
4839
|
-
|
|
4840
|
-
|
|
4841
|
-
|
|
4842
|
-
|
|
4843
|
-
|
|
4844
|
-
|
|
4845
|
-
|
|
4846
|
-
|
|
4847
|
-
|
|
4848
|
-
|
|
4849
|
-
|
|
4850
|
-
|
|
4851
|
-
|
|
4852
|
-
|
|
4853
|
-
|
|
4854
|
-
|
|
4855
|
-
|
|
4856
|
-
|
|
4857
|
-
|
|
4858
|
-
|
|
4859
|
-
|
|
4860
|
-
|
|
2813
|
+
bold: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("svg", { viewBox: "0 0 24 24", width: "16", height: "16", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
2814
|
+
"path",
|
|
2815
|
+
{
|
|
2816
|
+
fill: "currentColor",
|
|
2817
|
+
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"
|
|
2818
|
+
}
|
|
2819
|
+
) }),
|
|
2820
|
+
italic: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("svg", { viewBox: "0 0 24 24", width: "16", height: "16", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
2821
|
+
"path",
|
|
2822
|
+
{
|
|
2823
|
+
fill: "currentColor",
|
|
2824
|
+
d: "M10 4v3h2.21l-3.42 8H6v3h8v-3h-2.21l3.42-8H18V4z"
|
|
2825
|
+
}
|
|
2826
|
+
) }),
|
|
2827
|
+
underline: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("svg", { viewBox: "0 0 24 24", width: "16", height: "16", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
2828
|
+
"path",
|
|
2829
|
+
{
|
|
2830
|
+
fill: "currentColor",
|
|
2831
|
+
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"
|
|
2832
|
+
}
|
|
2833
|
+
) }),
|
|
2834
|
+
strike: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("svg", { viewBox: "0 0 24 24", width: "16", height: "16", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
2835
|
+
"path",
|
|
2836
|
+
{
|
|
2837
|
+
fill: "currentColor",
|
|
2838
|
+
d: "M10 19h4v-3h-4v3zM5 4v3h5v3h4V7h5V4H5zM3 14h18v-2H3v2z"
|
|
2839
|
+
}
|
|
2840
|
+
) }),
|
|
2841
|
+
code: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("svg", { viewBox: "0 0 24 24", width: "16", height: "16", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
2842
|
+
"path",
|
|
2843
|
+
{
|
|
2844
|
+
fill: "currentColor",
|
|
2845
|
+
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"
|
|
2846
|
+
}
|
|
2847
|
+
) }),
|
|
2848
|
+
codeBlock: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("svg", { viewBox: "0 0 24 24", width: "16", height: "16", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
2849
|
+
"path",
|
|
2850
|
+
{
|
|
2851
|
+
fill: "currentColor",
|
|
2852
|
+
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"
|
|
2853
|
+
}
|
|
2854
|
+
) }),
|
|
2855
|
+
subscript: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("svg", { viewBox: "0 0 24 24", width: "16", height: "16", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
2856
|
+
"path",
|
|
2857
|
+
{
|
|
2858
|
+
fill: "currentColor",
|
|
2859
|
+
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"
|
|
2860
|
+
}
|
|
2861
|
+
) }),
|
|
2862
|
+
superscript: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("svg", { viewBox: "0 0 24 24", width: "16", height: "16", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
2863
|
+
"path",
|
|
2864
|
+
{
|
|
2865
|
+
fill: "currentColor",
|
|
2866
|
+
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"
|
|
2867
|
+
}
|
|
2868
|
+
) }),
|
|
2869
|
+
clearFormatting: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("svg", { viewBox: "0 0 24 24", width: "16", height: "16", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
2870
|
+
"path",
|
|
2871
|
+
{
|
|
2872
|
+
fill: "currentColor",
|
|
2873
|
+
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"
|
|
2874
|
+
}
|
|
2875
|
+
) }),
|
|
2876
|
+
fontFamily: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("svg", { viewBox: "0 0 24 24", width: "16", height: "16", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
2877
|
+
"path",
|
|
2878
|
+
{
|
|
2879
|
+
fill: "currentColor",
|
|
2880
|
+
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"
|
|
2881
|
+
}
|
|
2882
|
+
) }),
|
|
2883
|
+
fontSize: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("svg", { viewBox: "0 0 24 24", width: "16", height: "16", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
2884
|
+
"path",
|
|
2885
|
+
{
|
|
2886
|
+
fill: "currentColor",
|
|
2887
|
+
d: "M9 4v3h5v12h3V7h5V4H9zm-6 8h3v7h3v-7h3v-3H3v3z"
|
|
2888
|
+
}
|
|
2889
|
+
) }),
|
|
2890
|
+
lineHeight: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("svg", { viewBox: "0 0 24 24", width: "16", height: "16", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
2891
|
+
"path",
|
|
2892
|
+
{
|
|
2893
|
+
fill: "currentColor",
|
|
2894
|
+
d: "M6 7h2.5L5 3.5 1.5 7H4v10H1.5L5 20.5 8.5 17H6V7zm4-2v2h12V5H10zm0 14h12v-2H10v2zm0-6h12v-2H10v2z"
|
|
2895
|
+
}
|
|
2896
|
+
) }),
|
|
2897
|
+
textColor: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("svg", { viewBox: "0 0 24 24", width: "16", height: "16", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
2898
|
+
"path",
|
|
2899
|
+
{
|
|
2900
|
+
fill: "currentColor",
|
|
2901
|
+
d: "M11 3L5.5 17h2.25l1.12-3h6.25l1.12 3h2.25L13 3h-2zm-1.38 9L12 5.67 14.38 12H9.62z"
|
|
2902
|
+
}
|
|
2903
|
+
) }),
|
|
2904
|
+
backgroundColor: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("svg", { viewBox: "0 0 24 24", width: "16", height: "16", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
2905
|
+
"path",
|
|
2906
|
+
{
|
|
2907
|
+
fill: "currentColor",
|
|
2908
|
+
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"
|
|
2909
|
+
}
|
|
2910
|
+
) }),
|
|
2911
|
+
alignLeft: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("svg", { viewBox: "0 0 24 24", width: "16", height: "16", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
2912
|
+
"path",
|
|
2913
|
+
{
|
|
2914
|
+
fill: "currentColor",
|
|
2915
|
+
d: "M15 15H3v2h12v-2zm0-8H3v2h12V7zM3 13h18v-2H3v2zm0 8h18v-2H3v2zM3 3v2h18V3H3z"
|
|
2916
|
+
}
|
|
2917
|
+
) }),
|
|
2918
|
+
alignCenter: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("svg", { viewBox: "0 0 24 24", width: "16", height: "16", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
2919
|
+
"path",
|
|
2920
|
+
{
|
|
2921
|
+
fill: "currentColor",
|
|
2922
|
+
d: "M7 15v2h10v-2H7zm-4 6h18v-2H3v2zm0-8h18v-2H3v2zm4-6v2h10V7H7zM3 3v2h18V3H3z"
|
|
2923
|
+
}
|
|
2924
|
+
) }),
|
|
2925
|
+
alignRight: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("svg", { viewBox: "0 0 24 24", width: "16", height: "16", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
2926
|
+
"path",
|
|
2927
|
+
{
|
|
2928
|
+
fill: "currentColor",
|
|
2929
|
+
d: "M3 21h18v-2H3v2zm6-4h12v-2H9v2zm-6-4h18v-2H3v2zm6-4h12V7H9v2zM3 3v2h18V3H3z"
|
|
2930
|
+
}
|
|
2931
|
+
) }),
|
|
2932
|
+
alignJustify: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("svg", { viewBox: "0 0 24 24", width: "16", height: "16", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
2933
|
+
"path",
|
|
2934
|
+
{
|
|
2935
|
+
fill: "currentColor",
|
|
2936
|
+
d: "M3 21h18v-2H3v2zm0-4h18v-2H3v2zm0-4h18v-2H3v2zm0-4h18V7H3v2zm0-6v2h18V3H3z"
|
|
2937
|
+
}
|
|
2938
|
+
) }),
|
|
2939
|
+
indent: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("svg", { viewBox: "0 0 24 24", width: "16", height: "16", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
2940
|
+
"path",
|
|
2941
|
+
{
|
|
2942
|
+
fill: "currentColor",
|
|
2943
|
+
d: "M3 21h18v-2H3v2zM3 8v8l4-4-4-4zm8 9h10v-2H11v2zM3 3v2h18V3H3zm8 6h10V7H11v2zm0 4h10v-2H11v2z"
|
|
2944
|
+
}
|
|
2945
|
+
) }),
|
|
2946
|
+
outdent: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("svg", { viewBox: "0 0 24 24", width: "16", height: "16", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
2947
|
+
"path",
|
|
2948
|
+
{
|
|
2949
|
+
fill: "currentColor",
|
|
2950
|
+
d: "M11 17h10v-2H11v2zm-8-5l4 4V8l-4 4zm0 9h18v-2H3v2zM3 3v2h18V3H3zm8 6h10V7H11v2zm0 4h10v-2H11v2z"
|
|
2951
|
+
}
|
|
2952
|
+
) }),
|
|
2953
|
+
bulletList: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("svg", { viewBox: "0 0 24 24", width: "16", height: "16", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
2954
|
+
"path",
|
|
2955
|
+
{
|
|
2956
|
+
fill: "currentColor",
|
|
2957
|
+
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"
|
|
2958
|
+
}
|
|
2959
|
+
) }),
|
|
2960
|
+
orderedList: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("svg", { viewBox: "0 0 24 24", width: "16", height: "16", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
2961
|
+
"path",
|
|
2962
|
+
{
|
|
2963
|
+
fill: "currentColor",
|
|
2964
|
+
d: "M2 17h2v.5H3v1h1v.5H2v1h3v-4H2v1zm1-9h1V4H2v1h1v3zm-1 3h1.8L2 13.1v.9h3v-1H3.2L5 10.9V10H2v1zm5-6v2h14V5H7zm0 14h14v-2H7v2zm0-6h14v-2H7v2z"
|
|
2965
|
+
}
|
|
2966
|
+
) }),
|
|
2967
|
+
heading1: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("svg", { viewBox: "0 0 24 24", width: "16", height: "16", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
2968
|
+
"path",
|
|
2969
|
+
{
|
|
2970
|
+
fill: "currentColor",
|
|
2971
|
+
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"
|
|
2972
|
+
}
|
|
2973
|
+
) }),
|
|
2974
|
+
heading2: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("svg", { viewBox: "0 0 24 24", width: "16", height: "16", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
2975
|
+
"path",
|
|
2976
|
+
{
|
|
2977
|
+
fill: "currentColor",
|
|
2978
|
+
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"
|
|
2979
|
+
}
|
|
2980
|
+
) }),
|
|
2981
|
+
heading3: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("svg", { viewBox: "0 0 24 24", width: "16", height: "16", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
2982
|
+
"path",
|
|
2983
|
+
{
|
|
2984
|
+
fill: "currentColor",
|
|
2985
|
+
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"
|
|
2986
|
+
}
|
|
2987
|
+
) }),
|
|
4861
2988
|
blockquote: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("svg", { viewBox: "0 0 24 24", width: "16", height: "16", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { fill: "currentColor", d: "M6 17h3l2-4V7H5v6h3zm8 0h3l2-4V7h-6v6h3z" }) }),
|
|
4862
2989
|
horizontalRule: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("svg", { viewBox: "0 0 24 24", width: "16", height: "16", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { fill: "currentColor", d: "M4 11h16v2H4z" }) }),
|
|
4863
|
-
link: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("svg", { viewBox: "0 0 24 24", width: "16", height: "16", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
4864
|
-
|
|
4865
|
-
|
|
4866
|
-
|
|
4867
|
-
|
|
4868
|
-
|
|
4869
|
-
|
|
4870
|
-
|
|
4871
|
-
|
|
4872
|
-
|
|
2990
|
+
link: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("svg", { viewBox: "0 0 24 24", width: "16", height: "16", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
2991
|
+
"path",
|
|
2992
|
+
{
|
|
2993
|
+
fill: "currentColor",
|
|
2994
|
+
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"
|
|
2995
|
+
}
|
|
2996
|
+
) }),
|
|
2997
|
+
unlink: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("svg", { viewBox: "0 0 24 24", width: "16", height: "16", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
2998
|
+
"path",
|
|
2999
|
+
{
|
|
3000
|
+
fill: "currentColor",
|
|
3001
|
+
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"
|
|
3002
|
+
}
|
|
3003
|
+
) }),
|
|
3004
|
+
image: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("svg", { viewBox: "0 0 24 24", width: "16", height: "16", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
3005
|
+
"path",
|
|
3006
|
+
{
|
|
3007
|
+
fill: "currentColor",
|
|
3008
|
+
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"
|
|
3009
|
+
}
|
|
3010
|
+
) }),
|
|
3011
|
+
video: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("svg", { viewBox: "0 0 24 24", width: "16", height: "16", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
3012
|
+
"path",
|
|
3013
|
+
{
|
|
3014
|
+
fill: "currentColor",
|
|
3015
|
+
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"
|
|
3016
|
+
}
|
|
3017
|
+
) }),
|
|
3018
|
+
table: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("svg", { viewBox: "0 0 24 24", width: "16", height: "16", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
3019
|
+
"path",
|
|
3020
|
+
{
|
|
3021
|
+
fill: "currentColor",
|
|
3022
|
+
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"
|
|
3023
|
+
}
|
|
3024
|
+
) }),
|
|
3025
|
+
emoji: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("svg", { viewBox: "0 0 24 24", width: "16", height: "16", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
3026
|
+
"path",
|
|
3027
|
+
{
|
|
3028
|
+
fill: "currentColor",
|
|
3029
|
+
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"
|
|
3030
|
+
}
|
|
3031
|
+
) }),
|
|
3032
|
+
undo: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("svg", { viewBox: "0 0 24 24", width: "16", height: "16", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
3033
|
+
"path",
|
|
3034
|
+
{
|
|
3035
|
+
fill: "currentColor",
|
|
3036
|
+
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"
|
|
3037
|
+
}
|
|
3038
|
+
) }),
|
|
3039
|
+
redo: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("svg", { viewBox: "0 0 24 24", width: "16", height: "16", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
3040
|
+
"path",
|
|
3041
|
+
{
|
|
3042
|
+
fill: "currentColor",
|
|
3043
|
+
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"
|
|
3044
|
+
}
|
|
3045
|
+
) }),
|
|
3046
|
+
fullscreen: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("svg", { viewBox: "0 0 24 24", width: "16", height: "16", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
3047
|
+
"path",
|
|
3048
|
+
{
|
|
3049
|
+
fill: "currentColor",
|
|
3050
|
+
d: "M7 14H5v5h5v-2H7v-3zm-2-4h2V7h3V5H5v5zm12 7h-3v2h5v-5h-2v3zM14 5v2h3v3h2V5h-5z"
|
|
3051
|
+
}
|
|
3052
|
+
) }),
|
|
3053
|
+
print: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("svg", { viewBox: "0 0 24 24", width: "16", height: "16", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
3054
|
+
"path",
|
|
3055
|
+
{
|
|
3056
|
+
fill: "currentColor",
|
|
3057
|
+
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"
|
|
3058
|
+
}
|
|
3059
|
+
) })
|
|
4873
3060
|
};
|
|
4874
3061
|
SlateToolbar = ({
|
|
4875
3062
|
editor,
|
|
@@ -4879,9 +3066,9 @@ var init_SlateToolbar = __esm({
|
|
|
4879
3066
|
onToggleFullscreen,
|
|
4880
3067
|
onPrint,
|
|
4881
3068
|
isFullscreen = false,
|
|
4882
|
-
toggleMark:
|
|
3069
|
+
toggleMark: toggleMark2,
|
|
4883
3070
|
toggleBlock: toggleBlock2,
|
|
4884
|
-
isMarkActive:
|
|
3071
|
+
isMarkActive: isMarkActive2,
|
|
4885
3072
|
isBlockActive: isBlockActive2
|
|
4886
3073
|
}) => {
|
|
4887
3074
|
const [showEmojiPicker, setShowEmojiPicker] = (0, import_react4.useState)(false);
|
|
@@ -4890,7 +3077,9 @@ var init_SlateToolbar = __esm({
|
|
|
4890
3077
|
const [showLinkDialog, setShowLinkDialog] = (0, import_react4.useState)(false);
|
|
4891
3078
|
const [linkUrl, setLinkUrl] = (0, import_react4.useState)("");
|
|
4892
3079
|
const linkDialogRef = (0, import_react4.useRef)(null);
|
|
4893
|
-
const [showColorPicker, setShowColorPicker] = (0, import_react4.useState)(
|
|
3080
|
+
const [showColorPicker, setShowColorPicker] = (0, import_react4.useState)(
|
|
3081
|
+
null
|
|
3082
|
+
);
|
|
4894
3083
|
const colorPickerRef = (0, import_react4.useRef)(null);
|
|
4895
3084
|
(0, import_react4.useEffect)(() => {
|
|
4896
3085
|
const handleClickOutside = (event) => {
|
|
@@ -4936,7 +3125,10 @@ var init_SlateToolbar = __esm({
|
|
|
4936
3125
|
const insertHorizontalRule = (0, import_react4.useCallback)(() => {
|
|
4937
3126
|
const hr = { type: "horizontal-rule", children: [{ text: "" }] };
|
|
4938
3127
|
import_slate.Transforms.insertNodes(editor, hr);
|
|
4939
|
-
import_slate.Transforms.insertNodes(editor, {
|
|
3128
|
+
import_slate.Transforms.insertNodes(editor, {
|
|
3129
|
+
type: "paragraph",
|
|
3130
|
+
children: [{ text: "" }]
|
|
3131
|
+
});
|
|
4940
3132
|
}, [editor]);
|
|
4941
3133
|
const insertTable = (0, import_react4.useCallback)(() => {
|
|
4942
3134
|
const table = {
|
|
@@ -5015,8 +3207,8 @@ var init_SlateToolbar = __esm({
|
|
|
5015
3207
|
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
5016
3208
|
ToolbarButton,
|
|
5017
3209
|
{
|
|
5018
|
-
active:
|
|
5019
|
-
onClick: () =>
|
|
3210
|
+
active: isMarkActive2(editor, "bold"),
|
|
3211
|
+
onClick: () => toggleMark2(editor, "bold"),
|
|
5020
3212
|
title: "Bold (Ctrl+B)",
|
|
5021
3213
|
children: icons.bold
|
|
5022
3214
|
},
|
|
@@ -5026,8 +3218,8 @@ var init_SlateToolbar = __esm({
|
|
|
5026
3218
|
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
5027
3219
|
ToolbarButton,
|
|
5028
3220
|
{
|
|
5029
|
-
active:
|
|
5030
|
-
onClick: () =>
|
|
3221
|
+
active: isMarkActive2(editor, "italic"),
|
|
3222
|
+
onClick: () => toggleMark2(editor, "italic"),
|
|
5031
3223
|
title: "Italic (Ctrl+I)",
|
|
5032
3224
|
children: icons.italic
|
|
5033
3225
|
},
|
|
@@ -5037,8 +3229,8 @@ var init_SlateToolbar = __esm({
|
|
|
5037
3229
|
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
5038
3230
|
ToolbarButton,
|
|
5039
3231
|
{
|
|
5040
|
-
active:
|
|
5041
|
-
onClick: () =>
|
|
3232
|
+
active: isMarkActive2(editor, "underline"),
|
|
3233
|
+
onClick: () => toggleMark2(editor, "underline"),
|
|
5042
3234
|
title: "Underline (Ctrl+U)",
|
|
5043
3235
|
children: icons.underline
|
|
5044
3236
|
},
|
|
@@ -5048,8 +3240,8 @@ var init_SlateToolbar = __esm({
|
|
|
5048
3240
|
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
5049
3241
|
ToolbarButton,
|
|
5050
3242
|
{
|
|
5051
|
-
active:
|
|
5052
|
-
onClick: () =>
|
|
3243
|
+
active: isMarkActive2(editor, "strikethrough"),
|
|
3244
|
+
onClick: () => toggleMark2(editor, "strikethrough"),
|
|
5053
3245
|
title: "Strikethrough",
|
|
5054
3246
|
children: icons.strike
|
|
5055
3247
|
},
|
|
@@ -5059,8 +3251,8 @@ var init_SlateToolbar = __esm({
|
|
|
5059
3251
|
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
5060
3252
|
ToolbarButton,
|
|
5061
3253
|
{
|
|
5062
|
-
active:
|
|
5063
|
-
onClick: () =>
|
|
3254
|
+
active: isMarkActive2(editor, "code"),
|
|
3255
|
+
onClick: () => toggleMark2(editor, "code"),
|
|
5064
3256
|
title: "Code",
|
|
5065
3257
|
children: icons.code
|
|
5066
3258
|
},
|
|
@@ -5081,8 +3273,8 @@ var init_SlateToolbar = __esm({
|
|
|
5081
3273
|
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
5082
3274
|
ToolbarButton,
|
|
5083
3275
|
{
|
|
5084
|
-
active:
|
|
5085
|
-
onClick: () =>
|
|
3276
|
+
active: isMarkActive2(editor, "subscript"),
|
|
3277
|
+
onClick: () => toggleMark2(editor, "subscript"),
|
|
5086
3278
|
title: "Subscript",
|
|
5087
3279
|
children: icons.subscript
|
|
5088
3280
|
},
|
|
@@ -5092,8 +3284,8 @@ var init_SlateToolbar = __esm({
|
|
|
5092
3284
|
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
5093
3285
|
ToolbarButton,
|
|
5094
3286
|
{
|
|
5095
|
-
active:
|
|
5096
|
-
onClick: () =>
|
|
3287
|
+
active: isMarkActive2(editor, "superscript"),
|
|
3288
|
+
onClick: () => toggleMark2(editor, "superscript"),
|
|
5097
3289
|
title: "Superscript",
|
|
5098
3290
|
children: icons.superscript
|
|
5099
3291
|
},
|
|
@@ -5253,45 +3445,45 @@ var init_SlateToolbar = __esm({
|
|
|
5253
3445
|
);
|
|
5254
3446
|
// Links
|
|
5255
3447
|
case "link":
|
|
5256
|
-
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
5257
|
-
|
|
5258
|
-
ToolbarButton,
|
|
5259
|
-
{
|
|
5260
|
-
onClick: () => setShowLinkDialog(!showLinkDialog),
|
|
5261
|
-
title: "Insert Link",
|
|
5262
|
-
children: icons.link
|
|
5263
|
-
}
|
|
5264
|
-
),
|
|
5265
|
-
showLinkDialog && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "rte-builder-toolbar-dropdown-content", children: [
|
|
5266
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
5267
|
-
"input",
|
|
5268
|
-
{
|
|
5269
|
-
type: "url",
|
|
5270
|
-
placeholder: "Enter URL...",
|
|
5271
|
-
value: linkUrl,
|
|
5272
|
-
onChange: (e) => setLinkUrl(e.target.value),
|
|
5273
|
-
onKeyDown: (e) => {
|
|
5274
|
-
if (e.key === "Enter") {
|
|
5275
|
-
e.preventDefault();
|
|
5276
|
-
insertLink();
|
|
5277
|
-
}
|
|
5278
|
-
},
|
|
5279
|
-
autoFocus: true
|
|
5280
|
-
}
|
|
5281
|
-
),
|
|
5282
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("button", { onClick: insertLink, children: "Insert" })
|
|
5283
|
-
] })
|
|
5284
|
-
] }, button);
|
|
5285
|
-
case "unlink":
|
|
5286
|
-
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
5287
|
-
ToolbarButton,
|
|
3448
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
3449
|
+
"div",
|
|
5288
3450
|
{
|
|
5289
|
-
|
|
5290
|
-
|
|
5291
|
-
children:
|
|
3451
|
+
className: "rte-builder-toolbar-dropdown",
|
|
3452
|
+
ref: linkDialogRef,
|
|
3453
|
+
children: [
|
|
3454
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
3455
|
+
ToolbarButton,
|
|
3456
|
+
{
|
|
3457
|
+
onClick: () => setShowLinkDialog(!showLinkDialog),
|
|
3458
|
+
title: "Insert Link",
|
|
3459
|
+
children: icons.link
|
|
3460
|
+
}
|
|
3461
|
+
),
|
|
3462
|
+
showLinkDialog && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "rte-builder-toolbar-dropdown-content", children: [
|
|
3463
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
3464
|
+
"input",
|
|
3465
|
+
{
|
|
3466
|
+
type: "url",
|
|
3467
|
+
placeholder: "Enter URL...",
|
|
3468
|
+
value: linkUrl,
|
|
3469
|
+
onChange: (e) => setLinkUrl(e.target.value),
|
|
3470
|
+
onKeyDown: (e) => {
|
|
3471
|
+
if (e.key === "Enter") {
|
|
3472
|
+
e.preventDefault();
|
|
3473
|
+
insertLink();
|
|
3474
|
+
}
|
|
3475
|
+
},
|
|
3476
|
+
autoFocus: true
|
|
3477
|
+
}
|
|
3478
|
+
),
|
|
3479
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("button", { onClick: insertLink, children: "Insert" })
|
|
3480
|
+
] })
|
|
3481
|
+
]
|
|
5292
3482
|
},
|
|
5293
3483
|
button
|
|
5294
3484
|
);
|
|
3485
|
+
case "unlink":
|
|
3486
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(ToolbarButton, { onClick: removeLink, title: "Remove Link", children: icons.unlink }, button);
|
|
5295
3487
|
// Media
|
|
5296
3488
|
case "image":
|
|
5297
3489
|
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
@@ -5329,82 +3521,104 @@ var init_SlateToolbar = __esm({
|
|
|
5329
3521
|
);
|
|
5330
3522
|
// Colors
|
|
5331
3523
|
case "textColor":
|
|
5332
|
-
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
5333
|
-
|
|
5334
|
-
|
|
5335
|
-
|
|
5336
|
-
|
|
5337
|
-
|
|
5338
|
-
|
|
5339
|
-
|
|
5340
|
-
|
|
5341
|
-
|
|
5342
|
-
|
|
5343
|
-
|
|
5344
|
-
|
|
5345
|
-
|
|
5346
|
-
|
|
5347
|
-
|
|
5348
|
-
|
|
5349
|
-
|
|
5350
|
-
|
|
5351
|
-
|
|
3524
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
3525
|
+
"div",
|
|
3526
|
+
{
|
|
3527
|
+
className: "rte-builder-toolbar-dropdown",
|
|
3528
|
+
ref: colorPickerRef,
|
|
3529
|
+
children: [
|
|
3530
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
3531
|
+
ToolbarButton,
|
|
3532
|
+
{
|
|
3533
|
+
onClick: () => setShowColorPicker(showColorPicker === "text" ? null : "text"),
|
|
3534
|
+
title: "Text Color",
|
|
3535
|
+
children: icons.textColor
|
|
3536
|
+
}
|
|
3537
|
+
),
|
|
3538
|
+
showColorPicker === "text" && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "rte-builder-toolbar-dropdown-content rte-builder-color-picker", children: colors.map((color) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
3539
|
+
"button",
|
|
3540
|
+
{
|
|
3541
|
+
className: "rte-builder-color-swatch",
|
|
3542
|
+
style: { backgroundColor: color },
|
|
3543
|
+
onClick: () => setColor(color, "text"),
|
|
3544
|
+
title: color
|
|
3545
|
+
},
|
|
3546
|
+
color
|
|
3547
|
+
)) })
|
|
3548
|
+
]
|
|
3549
|
+
},
|
|
3550
|
+
button
|
|
3551
|
+
);
|
|
5352
3552
|
case "backgroundColor":
|
|
5353
|
-
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
5354
|
-
|
|
5355
|
-
|
|
5356
|
-
|
|
5357
|
-
|
|
5358
|
-
|
|
5359
|
-
|
|
5360
|
-
|
|
5361
|
-
|
|
5362
|
-
|
|
5363
|
-
|
|
5364
|
-
|
|
5365
|
-
|
|
5366
|
-
|
|
5367
|
-
|
|
5368
|
-
title: color
|
|
5369
|
-
},
|
|
5370
|
-
color
|
|
5371
|
-
)) })
|
|
5372
|
-
] }, button);
|
|
5373
|
-
// Emoji
|
|
5374
|
-
case "emoji":
|
|
5375
|
-
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "rte-builder-toolbar-dropdown", ref: emojiPickerRef, children: [
|
|
5376
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
5377
|
-
ToolbarButton,
|
|
5378
|
-
{
|
|
5379
|
-
onClick: () => setShowEmojiPicker(!showEmojiPicker),
|
|
5380
|
-
title: "Insert Emoji",
|
|
5381
|
-
children: icons.emoji
|
|
5382
|
-
}
|
|
5383
|
-
),
|
|
5384
|
-
showEmojiPicker && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "rte-builder-emoji-picker", children: [
|
|
5385
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "rte-builder-emoji-categories", children: Object.entries(EMOJI_CATEGORIES).map(([key, category]) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
5386
|
-
"button",
|
|
5387
|
-
{
|
|
5388
|
-
className: `rte-builder-emoji-category-btn ${selectedEmojiCategory === key ? "active" : ""}`,
|
|
5389
|
-
onClick: () => setSelectedEmojiCategory(key),
|
|
5390
|
-
title: category.label,
|
|
5391
|
-
children: category.emojis[0]
|
|
5392
|
-
},
|
|
5393
|
-
key
|
|
5394
|
-
)) }),
|
|
5395
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "rte-builder-emoji-grid", children: EMOJI_CATEGORIES[selectedEmojiCategory]?.emojis.map(
|
|
5396
|
-
(emoji, idx) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
3553
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
3554
|
+
"div",
|
|
3555
|
+
{
|
|
3556
|
+
className: "rte-builder-toolbar-dropdown",
|
|
3557
|
+
ref: colorPickerRef,
|
|
3558
|
+
children: [
|
|
3559
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
3560
|
+
ToolbarButton,
|
|
3561
|
+
{
|
|
3562
|
+
onClick: () => setShowColorPicker(showColorPicker === "bg" ? null : "bg"),
|
|
3563
|
+
title: "Background Color",
|
|
3564
|
+
children: icons.backgroundColor
|
|
3565
|
+
}
|
|
3566
|
+
),
|
|
3567
|
+
showColorPicker === "bg" && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "rte-builder-toolbar-dropdown-content rte-builder-color-picker", children: colors.map((color) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
5397
3568
|
"button",
|
|
5398
3569
|
{
|
|
5399
|
-
className: "rte-builder-
|
|
5400
|
-
|
|
5401
|
-
|
|
3570
|
+
className: "rte-builder-color-swatch",
|
|
3571
|
+
style: { backgroundColor: color },
|
|
3572
|
+
onClick: () => setColor(color, "bg"),
|
|
3573
|
+
title: color
|
|
5402
3574
|
},
|
|
5403
|
-
|
|
5404
|
-
)
|
|
5405
|
-
|
|
5406
|
-
|
|
5407
|
-
|
|
3575
|
+
color
|
|
3576
|
+
)) })
|
|
3577
|
+
]
|
|
3578
|
+
},
|
|
3579
|
+
button
|
|
3580
|
+
);
|
|
3581
|
+
// Emoji
|
|
3582
|
+
case "emoji":
|
|
3583
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
3584
|
+
"div",
|
|
3585
|
+
{
|
|
3586
|
+
className: "rte-builder-toolbar-dropdown",
|
|
3587
|
+
ref: emojiPickerRef,
|
|
3588
|
+
children: [
|
|
3589
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
3590
|
+
ToolbarButton,
|
|
3591
|
+
{
|
|
3592
|
+
onClick: () => setShowEmojiPicker(!showEmojiPicker),
|
|
3593
|
+
title: "Insert Emoji",
|
|
3594
|
+
children: icons.emoji
|
|
3595
|
+
}
|
|
3596
|
+
),
|
|
3597
|
+
showEmojiPicker && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "rte-builder-emoji-picker", children: [
|
|
3598
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "rte-builder-emoji-categories", children: Object.entries(EMOJI_CATEGORIES).map(([key, category]) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
3599
|
+
"button",
|
|
3600
|
+
{
|
|
3601
|
+
className: `rte-builder-emoji-category-btn ${selectedEmojiCategory === key ? "active" : ""}`,
|
|
3602
|
+
onClick: () => setSelectedEmojiCategory(key),
|
|
3603
|
+
title: category.label,
|
|
3604
|
+
children: category.emojis[0]
|
|
3605
|
+
},
|
|
3606
|
+
key
|
|
3607
|
+
)) }),
|
|
3608
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "rte-builder-emoji-grid", children: EMOJI_CATEGORIES[selectedEmojiCategory]?.emojis.map((emoji, idx) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
3609
|
+
"button",
|
|
3610
|
+
{
|
|
3611
|
+
className: "rte-builder-emoji-btn",
|
|
3612
|
+
onClick: () => insertEmoji(emoji),
|
|
3613
|
+
children: emoji
|
|
3614
|
+
},
|
|
3615
|
+
idx
|
|
3616
|
+
)) })
|
|
3617
|
+
] })
|
|
3618
|
+
]
|
|
3619
|
+
},
|
|
3620
|
+
button
|
|
3621
|
+
);
|
|
5408
3622
|
// Actions
|
|
5409
3623
|
case "undo":
|
|
5410
3624
|
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
@@ -5464,7 +3678,7 @@ __export(SlateEditorComponent_exports, {
|
|
|
5464
3678
|
SlateEditorComponent: () => SlateEditorComponent,
|
|
5465
3679
|
default: () => SlateEditorComponent_default
|
|
5466
3680
|
});
|
|
5467
|
-
var import_react5, import_slate2, import_slate_react2, import_slate_history, import_is_hotkey, import_jsx_runtime4, HOTKEYS, LIST_TYPES, TEXT_ALIGN_TYPES,
|
|
3681
|
+
var import_react5, import_slate2, import_slate_react2, import_slate_history, import_is_hotkey, import_jsx_runtime4, HOTKEYS, LIST_TYPES, TEXT_ALIGN_TYPES, isMarkActive, isBlockActive, toggleMark, toggleBlock, serializeToHtml, serializeNode, escapeHtml, deserializeFromHtml, deserializeElement, renderElement, renderLeaf, withInlines, SlateEditorComponent, SlateEditorComponent_default;
|
|
5468
3682
|
var init_SlateEditorComponent = __esm({
|
|
5469
3683
|
"src/adapters/slate/SlateEditorComponent.tsx"() {
|
|
5470
3684
|
"use strict";
|
|
@@ -5484,7 +3698,7 @@ var init_SlateEditorComponent = __esm({
|
|
|
5484
3698
|
};
|
|
5485
3699
|
LIST_TYPES = ["numbered-list", "bulleted-list"];
|
|
5486
3700
|
TEXT_ALIGN_TYPES = ["left", "center", "right", "justify"];
|
|
5487
|
-
|
|
3701
|
+
isMarkActive = (editor, format) => {
|
|
5488
3702
|
const marks = import_slate2.Editor.marks(editor);
|
|
5489
3703
|
return marks ? marks[format] === true : false;
|
|
5490
3704
|
};
|
|
@@ -5499,8 +3713,8 @@ var init_SlateEditorComponent = __esm({
|
|
|
5499
3713
|
);
|
|
5500
3714
|
return !!match;
|
|
5501
3715
|
};
|
|
5502
|
-
|
|
5503
|
-
const isActive =
|
|
3716
|
+
toggleMark = (editor, format) => {
|
|
3717
|
+
const isActive = isMarkActive(editor, format);
|
|
5504
3718
|
if (isActive) {
|
|
5505
3719
|
import_slate2.Editor.removeMark(editor, format);
|
|
5506
3720
|
} else {
|
|
@@ -5513,7 +3727,7 @@ var init_SlateEditorComponent = __esm({
|
|
|
5513
3727
|
format,
|
|
5514
3728
|
TEXT_ALIGN_TYPES.includes(format) ? "align" : "type"
|
|
5515
3729
|
);
|
|
5516
|
-
const
|
|
3730
|
+
const isList = LIST_TYPES.includes(format);
|
|
5517
3731
|
import_slate2.Transforms.unwrapNodes(editor, {
|
|
5518
3732
|
match: (n) => !import_slate2.Editor.isEditor(n) && import_slate2.Element.isElement(n) && LIST_TYPES.includes(n.type) && !TEXT_ALIGN_TYPES.includes(format),
|
|
5519
3733
|
split: true
|
|
@@ -5525,11 +3739,11 @@ var init_SlateEditorComponent = __esm({
|
|
|
5525
3739
|
};
|
|
5526
3740
|
} else {
|
|
5527
3741
|
newProperties = {
|
|
5528
|
-
type: isActive ? "paragraph" :
|
|
3742
|
+
type: isActive ? "paragraph" : isList ? "list-item" : format
|
|
5529
3743
|
};
|
|
5530
3744
|
}
|
|
5531
3745
|
import_slate2.Transforms.setNodes(editor, newProperties);
|
|
5532
|
-
if (!isActive &&
|
|
3746
|
+
if (!isActive && isList) {
|
|
5533
3747
|
const block = { type: format, children: [] };
|
|
5534
3748
|
import_slate2.Transforms.wrapNodes(editor, block);
|
|
5535
3749
|
}
|
|
@@ -5816,7 +4030,7 @@ var init_SlateEditorComponent = __esm({
|
|
|
5816
4030
|
if ((0, import_is_hotkey.default)(hotkey, event)) {
|
|
5817
4031
|
event.preventDefault();
|
|
5818
4032
|
const mark = HOTKEYS[hotkey];
|
|
5819
|
-
|
|
4033
|
+
toggleMark(editor, mark);
|
|
5820
4034
|
}
|
|
5821
4035
|
}
|
|
5822
4036
|
},
|
|
@@ -5950,9 +4164,9 @@ var init_SlateEditorComponent = __esm({
|
|
|
5950
4164
|
onToggleFullscreen: handleToggleFullscreen,
|
|
5951
4165
|
onPrint: handlePrint,
|
|
5952
4166
|
isFullscreen,
|
|
5953
|
-
toggleMark
|
|
4167
|
+
toggleMark,
|
|
5954
4168
|
toggleBlock,
|
|
5955
|
-
isMarkActive
|
|
4169
|
+
isMarkActive,
|
|
5956
4170
|
isBlockActive
|
|
5957
4171
|
}
|
|
5958
4172
|
),
|
|
@@ -6037,40 +4251,232 @@ var init_LexicalToolbar = __esm({
|
|
|
6037
4251
|
}
|
|
6038
4252
|
);
|
|
6039
4253
|
icons2 = {
|
|
6040
|
-
bold: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("svg", { viewBox: "0 0 24 24", width: "16", height: "16", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
6041
|
-
|
|
6042
|
-
|
|
6043
|
-
|
|
6044
|
-
|
|
6045
|
-
|
|
6046
|
-
|
|
6047
|
-
|
|
6048
|
-
|
|
6049
|
-
|
|
6050
|
-
|
|
6051
|
-
|
|
6052
|
-
|
|
6053
|
-
|
|
6054
|
-
|
|
6055
|
-
|
|
6056
|
-
|
|
6057
|
-
|
|
6058
|
-
|
|
6059
|
-
|
|
4254
|
+
bold: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("svg", { viewBox: "0 0 24 24", width: "16", height: "16", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
4255
|
+
"path",
|
|
4256
|
+
{
|
|
4257
|
+
fill: "currentColor",
|
|
4258
|
+
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"
|
|
4259
|
+
}
|
|
4260
|
+
) }),
|
|
4261
|
+
italic: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("svg", { viewBox: "0 0 24 24", width: "16", height: "16", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
4262
|
+
"path",
|
|
4263
|
+
{
|
|
4264
|
+
fill: "currentColor",
|
|
4265
|
+
d: "M10 4v3h2.21l-3.42 8H6v3h8v-3h-2.21l3.42-8H18V4z"
|
|
4266
|
+
}
|
|
4267
|
+
) }),
|
|
4268
|
+
underline: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("svg", { viewBox: "0 0 24 24", width: "16", height: "16", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
4269
|
+
"path",
|
|
4270
|
+
{
|
|
4271
|
+
fill: "currentColor",
|
|
4272
|
+
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"
|
|
4273
|
+
}
|
|
4274
|
+
) }),
|
|
4275
|
+
strike: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("svg", { viewBox: "0 0 24 24", width: "16", height: "16", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
4276
|
+
"path",
|
|
4277
|
+
{
|
|
4278
|
+
fill: "currentColor",
|
|
4279
|
+
d: "M10 19h4v-3h-4v3zM5 4v3h5v3h4V7h5V4H5zM3 14h18v-2H3v2z"
|
|
4280
|
+
}
|
|
4281
|
+
) }),
|
|
4282
|
+
code: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("svg", { viewBox: "0 0 24 24", width: "16", height: "16", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
4283
|
+
"path",
|
|
4284
|
+
{
|
|
4285
|
+
fill: "currentColor",
|
|
4286
|
+
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"
|
|
4287
|
+
}
|
|
4288
|
+
) }),
|
|
4289
|
+
codeBlock: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("svg", { viewBox: "0 0 24 24", width: "16", height: "16", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
4290
|
+
"path",
|
|
4291
|
+
{
|
|
4292
|
+
fill: "currentColor",
|
|
4293
|
+
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"
|
|
4294
|
+
}
|
|
4295
|
+
) }),
|
|
4296
|
+
subscript: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("svg", { viewBox: "0 0 24 24", width: "16", height: "16", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
4297
|
+
"path",
|
|
4298
|
+
{
|
|
4299
|
+
fill: "currentColor",
|
|
4300
|
+
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"
|
|
4301
|
+
}
|
|
4302
|
+
) }),
|
|
4303
|
+
superscript: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("svg", { viewBox: "0 0 24 24", width: "16", height: "16", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
4304
|
+
"path",
|
|
4305
|
+
{
|
|
4306
|
+
fill: "currentColor",
|
|
4307
|
+
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"
|
|
4308
|
+
}
|
|
4309
|
+
) }),
|
|
4310
|
+
clearFormatting: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("svg", { viewBox: "0 0 24 24", width: "16", height: "16", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
4311
|
+
"path",
|
|
4312
|
+
{
|
|
4313
|
+
fill: "currentColor",
|
|
4314
|
+
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"
|
|
4315
|
+
}
|
|
4316
|
+
) }),
|
|
4317
|
+
alignLeft: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("svg", { viewBox: "0 0 24 24", width: "16", height: "16", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
4318
|
+
"path",
|
|
4319
|
+
{
|
|
4320
|
+
fill: "currentColor",
|
|
4321
|
+
d: "M15 15H3v2h12v-2zm0-8H3v2h12V7zM3 13h18v-2H3v2zm0 8h18v-2H3v2zM3 3v2h18V3H3z"
|
|
4322
|
+
}
|
|
4323
|
+
) }),
|
|
4324
|
+
alignCenter: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("svg", { viewBox: "0 0 24 24", width: "16", height: "16", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
4325
|
+
"path",
|
|
4326
|
+
{
|
|
4327
|
+
fill: "currentColor",
|
|
4328
|
+
d: "M7 15v2h10v-2H7zm-4 6h18v-2H3v2zm0-8h18v-2H3v2zm4-6v2h10V7H7zM3 3v2h18V3H3z"
|
|
4329
|
+
}
|
|
4330
|
+
) }),
|
|
4331
|
+
alignRight: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("svg", { viewBox: "0 0 24 24", width: "16", height: "16", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
4332
|
+
"path",
|
|
4333
|
+
{
|
|
4334
|
+
fill: "currentColor",
|
|
4335
|
+
d: "M3 21h18v-2H3v2zm6-4h12v-2H9v2zm-6-4h18v-2H3v2zm6-4h12V7H9v2zM3 3v2h18V3H3z"
|
|
4336
|
+
}
|
|
4337
|
+
) }),
|
|
4338
|
+
alignJustify: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("svg", { viewBox: "0 0 24 24", width: "16", height: "16", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
4339
|
+
"path",
|
|
4340
|
+
{
|
|
4341
|
+
fill: "currentColor",
|
|
4342
|
+
d: "M3 21h18v-2H3v2zm0-4h18v-2H3v2zm0-4h18v-2H3v2zm0-4h18V7H3v2zm0-6v2h18V3H3z"
|
|
4343
|
+
}
|
|
4344
|
+
) }),
|
|
4345
|
+
indent: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("svg", { viewBox: "0 0 24 24", width: "16", height: "16", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
4346
|
+
"path",
|
|
4347
|
+
{
|
|
4348
|
+
fill: "currentColor",
|
|
4349
|
+
d: "M3 21h18v-2H3v2zM3 8v8l4-4-4-4zm8 9h10v-2H11v2zM3 3v2h18V3H3zm8 6h10V7H11v2zm0 4h10v-2H11v2z"
|
|
4350
|
+
}
|
|
4351
|
+
) }),
|
|
4352
|
+
outdent: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("svg", { viewBox: "0 0 24 24", width: "16", height: "16", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
4353
|
+
"path",
|
|
4354
|
+
{
|
|
4355
|
+
fill: "currentColor",
|
|
4356
|
+
d: "M11 17h10v-2H11v2zm-8-5l4 4V8l-4 4zm0 9h18v-2H3v2zM3 3v2h18V3H3zm8 6h10V7H11v2zm0 4h10v-2H11v2z"
|
|
4357
|
+
}
|
|
4358
|
+
) }),
|
|
4359
|
+
bulletList: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("svg", { viewBox: "0 0 24 24", width: "16", height: "16", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
4360
|
+
"path",
|
|
4361
|
+
{
|
|
4362
|
+
fill: "currentColor",
|
|
4363
|
+
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"
|
|
4364
|
+
}
|
|
4365
|
+
) }),
|
|
4366
|
+
orderedList: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("svg", { viewBox: "0 0 24 24", width: "16", height: "16", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
4367
|
+
"path",
|
|
4368
|
+
{
|
|
4369
|
+
fill: "currentColor",
|
|
4370
|
+
d: "M2 17h2v.5H3v1h1v.5H2v1h3v-4H2v1zm1-9h1V4H2v1h1v3zm-1 3h1.8L2 13.1v.9h3v-1H3.2L5 10.9V10H2v1zm5-6v2h14V5H7zm0 14h14v-2H7v2zm0-6h14v-2H7v2z"
|
|
4371
|
+
}
|
|
4372
|
+
) }),
|
|
4373
|
+
heading1: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("svg", { viewBox: "0 0 24 24", width: "16", height: "16", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
4374
|
+
"path",
|
|
4375
|
+
{
|
|
4376
|
+
fill: "currentColor",
|
|
4377
|
+
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"
|
|
4378
|
+
}
|
|
4379
|
+
) }),
|
|
4380
|
+
heading2: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("svg", { viewBox: "0 0 24 24", width: "16", height: "16", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
4381
|
+
"path",
|
|
4382
|
+
{
|
|
4383
|
+
fill: "currentColor",
|
|
4384
|
+
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"
|
|
4385
|
+
}
|
|
4386
|
+
) }),
|
|
4387
|
+
heading3: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("svg", { viewBox: "0 0 24 24", width: "16", height: "16", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
4388
|
+
"path",
|
|
4389
|
+
{
|
|
4390
|
+
fill: "currentColor",
|
|
4391
|
+
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"
|
|
4392
|
+
}
|
|
4393
|
+
) }),
|
|
6060
4394
|
blockquote: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("svg", { viewBox: "0 0 24 24", width: "16", height: "16", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("path", { fill: "currentColor", d: "M6 17h3l2-4V7H5v6h3zm8 0h3l2-4V7h-6v6h3z" }) }),
|
|
6061
4395
|
horizontalRule: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("svg", { viewBox: "0 0 24 24", width: "16", height: "16", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("path", { fill: "currentColor", d: "M4 11h16v2H4z" }) }),
|
|
6062
|
-
link: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("svg", { viewBox: "0 0 24 24", width: "16", height: "16", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
6063
|
-
|
|
6064
|
-
|
|
6065
|
-
|
|
6066
|
-
|
|
6067
|
-
|
|
6068
|
-
|
|
6069
|
-
|
|
6070
|
-
|
|
6071
|
-
|
|
6072
|
-
|
|
6073
|
-
|
|
4396
|
+
link: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("svg", { viewBox: "0 0 24 24", width: "16", height: "16", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
4397
|
+
"path",
|
|
4398
|
+
{
|
|
4399
|
+
fill: "currentColor",
|
|
4400
|
+
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"
|
|
4401
|
+
}
|
|
4402
|
+
) }),
|
|
4403
|
+
unlink: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("svg", { viewBox: "0 0 24 24", width: "16", height: "16", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
4404
|
+
"path",
|
|
4405
|
+
{
|
|
4406
|
+
fill: "currentColor",
|
|
4407
|
+
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"
|
|
4408
|
+
}
|
|
4409
|
+
) }),
|
|
4410
|
+
image: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("svg", { viewBox: "0 0 24 24", width: "16", height: "16", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
4411
|
+
"path",
|
|
4412
|
+
{
|
|
4413
|
+
fill: "currentColor",
|
|
4414
|
+
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"
|
|
4415
|
+
}
|
|
4416
|
+
) }),
|
|
4417
|
+
video: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("svg", { viewBox: "0 0 24 24", width: "16", height: "16", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
4418
|
+
"path",
|
|
4419
|
+
{
|
|
4420
|
+
fill: "currentColor",
|
|
4421
|
+
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"
|
|
4422
|
+
}
|
|
4423
|
+
) }),
|
|
4424
|
+
table: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("svg", { viewBox: "0 0 24 24", width: "16", height: "16", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
4425
|
+
"path",
|
|
4426
|
+
{
|
|
4427
|
+
fill: "currentColor",
|
|
4428
|
+
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"
|
|
4429
|
+
}
|
|
4430
|
+
) }),
|
|
4431
|
+
emoji: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("svg", { viewBox: "0 0 24 24", width: "16", height: "16", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
4432
|
+
"path",
|
|
4433
|
+
{
|
|
4434
|
+
fill: "currentColor",
|
|
4435
|
+
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"
|
|
4436
|
+
}
|
|
4437
|
+
) }),
|
|
4438
|
+
undo: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("svg", { viewBox: "0 0 24 24", width: "16", height: "16", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
4439
|
+
"path",
|
|
4440
|
+
{
|
|
4441
|
+
fill: "currentColor",
|
|
4442
|
+
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"
|
|
4443
|
+
}
|
|
4444
|
+
) }),
|
|
4445
|
+
redo: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("svg", { viewBox: "0 0 24 24", width: "16", height: "16", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
4446
|
+
"path",
|
|
4447
|
+
{
|
|
4448
|
+
fill: "currentColor",
|
|
4449
|
+
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"
|
|
4450
|
+
}
|
|
4451
|
+
) }),
|
|
4452
|
+
fullscreen: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("svg", { viewBox: "0 0 24 24", width: "16", height: "16", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
4453
|
+
"path",
|
|
4454
|
+
{
|
|
4455
|
+
fill: "currentColor",
|
|
4456
|
+
d: "M7 14H5v5h5v-2H7v-3zm-2-4h2V7h3V5H5v5zm12 7h-3v2h5v-5h-2v3zM14 5v2h3v3h2V5h-5z"
|
|
4457
|
+
}
|
|
4458
|
+
) }),
|
|
4459
|
+
print: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("svg", { viewBox: "0 0 24 24", width: "16", height: "16", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
4460
|
+
"path",
|
|
4461
|
+
{
|
|
4462
|
+
fill: "currentColor",
|
|
4463
|
+
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"
|
|
4464
|
+
}
|
|
4465
|
+
) }),
|
|
4466
|
+
textColor: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("svg", { viewBox: "0 0 24 24", width: "16", height: "16", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
4467
|
+
"path",
|
|
4468
|
+
{
|
|
4469
|
+
fill: "currentColor",
|
|
4470
|
+
d: "M11 3L5.5 17h2.25l1.12-3h6.25l1.12 3h2.25L13 3h-2zm-1.38 9L12 5.67 14.38 12H9.62z"
|
|
4471
|
+
}
|
|
4472
|
+
) }),
|
|
4473
|
+
backgroundColor: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("svg", { viewBox: "0 0 24 24", width: "16", height: "16", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
4474
|
+
"path",
|
|
4475
|
+
{
|
|
4476
|
+
fill: "currentColor",
|
|
4477
|
+
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"
|
|
4478
|
+
}
|
|
4479
|
+
) })
|
|
6074
4480
|
};
|
|
6075
4481
|
LexicalToolbar = ({
|
|
6076
4482
|
editor,
|
|
@@ -6339,15 +4745,7 @@ var init_LexicalToolbar = __esm({
|
|
|
6339
4745
|
);
|
|
6340
4746
|
// Blocks
|
|
6341
4747
|
case "blockquote":
|
|
6342
|
-
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
6343
|
-
ToolbarButton2,
|
|
6344
|
-
{
|
|
6345
|
-
onClick: formatQuote,
|
|
6346
|
-
title: "Blockquote",
|
|
6347
|
-
children: icons2.blockquote
|
|
6348
|
-
},
|
|
6349
|
-
button
|
|
6350
|
-
);
|
|
4748
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(ToolbarButton2, { onClick: formatQuote, title: "Blockquote", children: icons2.blockquote }, button);
|
|
6351
4749
|
case "horizontalRule":
|
|
6352
4750
|
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
6353
4751
|
ToolbarButton2,
|
|
@@ -6360,45 +4758,45 @@ var init_LexicalToolbar = __esm({
|
|
|
6360
4758
|
);
|
|
6361
4759
|
// Links
|
|
6362
4760
|
case "link":
|
|
6363
|
-
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
6364
|
-
|
|
6365
|
-
ToolbarButton2,
|
|
6366
|
-
{
|
|
6367
|
-
onClick: () => setShowLinkDialog(!showLinkDialog),
|
|
6368
|
-
title: "Insert Link",
|
|
6369
|
-
children: icons2.link
|
|
6370
|
-
}
|
|
6371
|
-
),
|
|
6372
|
-
showLinkDialog && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "rte-builder-toolbar-dropdown-content", children: [
|
|
6373
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
6374
|
-
"input",
|
|
6375
|
-
{
|
|
6376
|
-
type: "url",
|
|
6377
|
-
placeholder: "Enter URL...",
|
|
6378
|
-
value: linkUrl,
|
|
6379
|
-
onChange: (e) => setLinkUrl(e.target.value),
|
|
6380
|
-
onKeyDown: (e) => {
|
|
6381
|
-
if (e.key === "Enter") {
|
|
6382
|
-
e.preventDefault();
|
|
6383
|
-
insertLink();
|
|
6384
|
-
}
|
|
6385
|
-
},
|
|
6386
|
-
autoFocus: true
|
|
6387
|
-
}
|
|
6388
|
-
),
|
|
6389
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { onClick: insertLink, children: "Insert" })
|
|
6390
|
-
] })
|
|
6391
|
-
] }, button);
|
|
6392
|
-
case "unlink":
|
|
6393
|
-
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
6394
|
-
ToolbarButton2,
|
|
4761
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
4762
|
+
"div",
|
|
6395
4763
|
{
|
|
6396
|
-
|
|
6397
|
-
|
|
6398
|
-
children:
|
|
4764
|
+
className: "rte-builder-toolbar-dropdown",
|
|
4765
|
+
ref: linkDialogRef,
|
|
4766
|
+
children: [
|
|
4767
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
4768
|
+
ToolbarButton2,
|
|
4769
|
+
{
|
|
4770
|
+
onClick: () => setShowLinkDialog(!showLinkDialog),
|
|
4771
|
+
title: "Insert Link",
|
|
4772
|
+
children: icons2.link
|
|
4773
|
+
}
|
|
4774
|
+
),
|
|
4775
|
+
showLinkDialog && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "rte-builder-toolbar-dropdown-content", children: [
|
|
4776
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
4777
|
+
"input",
|
|
4778
|
+
{
|
|
4779
|
+
type: "url",
|
|
4780
|
+
placeholder: "Enter URL...",
|
|
4781
|
+
value: linkUrl,
|
|
4782
|
+
onChange: (e) => setLinkUrl(e.target.value),
|
|
4783
|
+
onKeyDown: (e) => {
|
|
4784
|
+
if (e.key === "Enter") {
|
|
4785
|
+
e.preventDefault();
|
|
4786
|
+
insertLink();
|
|
4787
|
+
}
|
|
4788
|
+
},
|
|
4789
|
+
autoFocus: true
|
|
4790
|
+
}
|
|
4791
|
+
),
|
|
4792
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { onClick: insertLink, children: "Insert" })
|
|
4793
|
+
] })
|
|
4794
|
+
]
|
|
6399
4795
|
},
|
|
6400
4796
|
button
|
|
6401
4797
|
);
|
|
4798
|
+
case "unlink":
|
|
4799
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(ToolbarButton2, { onClick: removeLink, title: "Remove Link", children: icons2.unlink }, button);
|
|
6402
4800
|
// Media
|
|
6403
4801
|
case "image":
|
|
6404
4802
|
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
@@ -6436,39 +4834,45 @@ var init_LexicalToolbar = __esm({
|
|
|
6436
4834
|
);
|
|
6437
4835
|
// Emoji
|
|
6438
4836
|
case "emoji":
|
|
6439
|
-
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
6440
|
-
|
|
6441
|
-
|
|
6442
|
-
|
|
6443
|
-
|
|
6444
|
-
|
|
6445
|
-
|
|
6446
|
-
|
|
6447
|
-
),
|
|
6448
|
-
showEmojiPicker && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "rte-builder-emoji-picker", children: [
|
|
6449
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "rte-builder-emoji-categories", children: Object.entries(EMOJI_CATEGORIES).map(([key, category]) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
6450
|
-
"button",
|
|
6451
|
-
{
|
|
6452
|
-
className: `rte-builder-emoji-category-btn ${selectedEmojiCategory === key ? "active" : ""}`,
|
|
6453
|
-
onClick: () => setSelectedEmojiCategory(key),
|
|
6454
|
-
title: category.label,
|
|
6455
|
-
children: category.emojis[0]
|
|
6456
|
-
},
|
|
6457
|
-
key
|
|
6458
|
-
)) }),
|
|
6459
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "rte-builder-emoji-grid", children: EMOJI_CATEGORIES[selectedEmojiCategory]?.emojis.map(
|
|
6460
|
-
(emoji, idx) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
6461
|
-
"button",
|
|
4837
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
4838
|
+
"div",
|
|
4839
|
+
{
|
|
4840
|
+
className: "rte-builder-toolbar-dropdown",
|
|
4841
|
+
ref: emojiPickerRef,
|
|
4842
|
+
children: [
|
|
4843
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
4844
|
+
ToolbarButton2,
|
|
6462
4845
|
{
|
|
6463
|
-
|
|
6464
|
-
|
|
6465
|
-
children: emoji
|
|
6466
|
-
}
|
|
6467
|
-
|
|
6468
|
-
)
|
|
6469
|
-
|
|
6470
|
-
|
|
6471
|
-
|
|
4846
|
+
onClick: () => setShowEmojiPicker(!showEmojiPicker),
|
|
4847
|
+
title: "Insert Emoji",
|
|
4848
|
+
children: icons2.emoji
|
|
4849
|
+
}
|
|
4850
|
+
),
|
|
4851
|
+
showEmojiPicker && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "rte-builder-emoji-picker", children: [
|
|
4852
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "rte-builder-emoji-categories", children: Object.entries(EMOJI_CATEGORIES).map(([key, category]) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
4853
|
+
"button",
|
|
4854
|
+
{
|
|
4855
|
+
className: `rte-builder-emoji-category-btn ${selectedEmojiCategory === key ? "active" : ""}`,
|
|
4856
|
+
onClick: () => setSelectedEmojiCategory(key),
|
|
4857
|
+
title: category.label,
|
|
4858
|
+
children: category.emojis[0]
|
|
4859
|
+
},
|
|
4860
|
+
key
|
|
4861
|
+
)) }),
|
|
4862
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "rte-builder-emoji-grid", children: EMOJI_CATEGORIES[selectedEmojiCategory]?.emojis.map((emoji, idx) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
4863
|
+
"button",
|
|
4864
|
+
{
|
|
4865
|
+
className: "rte-builder-emoji-btn",
|
|
4866
|
+
onClick: () => insertEmoji(emoji),
|
|
4867
|
+
children: emoji
|
|
4868
|
+
},
|
|
4869
|
+
idx
|
|
4870
|
+
)) })
|
|
4871
|
+
] })
|
|
4872
|
+
]
|
|
4873
|
+
},
|
|
4874
|
+
button
|
|
4875
|
+
);
|
|
6472
4876
|
// Actions
|
|
6473
4877
|
case "undo":
|
|
6474
4878
|
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
@@ -7366,12 +5770,7 @@ var DEFAULT_FEATURES = {
|
|
|
7366
5770
|
|
|
7367
5771
|
// src/adapters/tiptap/TipTapAdapter.ts
|
|
7368
5772
|
function checkTipTapAvailable() {
|
|
7369
|
-
|
|
7370
|
-
require("@tiptap/react");
|
|
7371
|
-
return true;
|
|
7372
|
-
} catch {
|
|
7373
|
-
return false;
|
|
7374
|
-
}
|
|
5773
|
+
return true;
|
|
7375
5774
|
}
|
|
7376
5775
|
var TIPTAP_FEATURES = {
|
|
7377
5776
|
...DEFAULT_FEATURES,
|
|
@@ -7799,6 +6198,7 @@ init_Indent();
|
|
|
7799
6198
|
// src/components/Toolbar.tsx
|
|
7800
6199
|
var import_react9 = require("react");
|
|
7801
6200
|
init_Emoji();
|
|
6201
|
+
var import_lucide_react = require("lucide-react");
|
|
7802
6202
|
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
7803
6203
|
var FONT_FAMILIES2 = [
|
|
7804
6204
|
{ value: "Arial", label: "Arial" },
|
|
@@ -7912,7 +6312,7 @@ var Toolbar = ({
|
|
|
7912
6312
|
onClick: () => editor.chain().focus().toggleBold().run(),
|
|
7913
6313
|
active: editor.isActive("bold"),
|
|
7914
6314
|
title: "Bold (Ctrl+B)",
|
|
7915
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
6315
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react.Bold, { size: 18 })
|
|
7916
6316
|
},
|
|
7917
6317
|
"bold"
|
|
7918
6318
|
);
|
|
@@ -7923,7 +6323,7 @@ var Toolbar = ({
|
|
|
7923
6323
|
onClick: () => editor.chain().focus().toggleItalic().run(),
|
|
7924
6324
|
active: editor.isActive("italic"),
|
|
7925
6325
|
title: "Italic (Ctrl+I)",
|
|
7926
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
6326
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react.Italic, { size: 18 })
|
|
7927
6327
|
},
|
|
7928
6328
|
"italic"
|
|
7929
6329
|
);
|
|
@@ -7934,7 +6334,7 @@ var Toolbar = ({
|
|
|
7934
6334
|
onClick: () => editor.chain().focus().toggleUnderline().run(),
|
|
7935
6335
|
active: editor.isActive("underline"),
|
|
7936
6336
|
title: "Underline (Ctrl+U)",
|
|
7937
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
6337
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react.Underline, { size: 18 })
|
|
7938
6338
|
},
|
|
7939
6339
|
"underline"
|
|
7940
6340
|
);
|
|
@@ -7945,7 +6345,7 @@ var Toolbar = ({
|
|
|
7945
6345
|
onClick: () => editor.chain().focus().toggleStrike().run(),
|
|
7946
6346
|
active: editor.isActive("strike"),
|
|
7947
6347
|
title: "Strikethrough",
|
|
7948
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
6348
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react.Strikethrough, { size: 18 })
|
|
7949
6349
|
},
|
|
7950
6350
|
"strike"
|
|
7951
6351
|
);
|
|
@@ -7956,7 +6356,7 @@ var Toolbar = ({
|
|
|
7956
6356
|
onClick: () => editor.chain().focus().toggleCode().run(),
|
|
7957
6357
|
active: editor.isActive("code"),
|
|
7958
6358
|
title: "Inline Code",
|
|
7959
|
-
children:
|
|
6359
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react.Code, { size: 18 })
|
|
7960
6360
|
},
|
|
7961
6361
|
"code"
|
|
7962
6362
|
);
|
|
@@ -7967,35 +6367,29 @@ var Toolbar = ({
|
|
|
7967
6367
|
onClick: () => editor.chain().focus().toggleCodeBlock().run(),
|
|
7968
6368
|
active: editor.isActive("codeBlock"),
|
|
7969
6369
|
title: "Code Block",
|
|
7970
|
-
children:
|
|
6370
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react.FileCode, { size: 18 })
|
|
7971
6371
|
},
|
|
7972
6372
|
"codeBlock"
|
|
7973
6373
|
);
|
|
7974
6374
|
case "subscript":
|
|
7975
|
-
return /* @__PURE__ */ (0, import_jsx_runtime8.
|
|
6375
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
7976
6376
|
ToolbarButton3,
|
|
7977
6377
|
{
|
|
7978
6378
|
onClick: () => editor.chain().focus().toggleSubscript().run(),
|
|
7979
6379
|
active: editor.isActive("subscript"),
|
|
7980
6380
|
title: "Subscript",
|
|
7981
|
-
children:
|
|
7982
|
-
"X",
|
|
7983
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("sub", { children: "2" })
|
|
7984
|
-
]
|
|
6381
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react.Subscript, { size: 18 })
|
|
7985
6382
|
},
|
|
7986
6383
|
"subscript"
|
|
7987
6384
|
);
|
|
7988
6385
|
case "superscript":
|
|
7989
|
-
return /* @__PURE__ */ (0, import_jsx_runtime8.
|
|
6386
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
7990
6387
|
ToolbarButton3,
|
|
7991
6388
|
{
|
|
7992
6389
|
onClick: () => editor.chain().focus().toggleSuperscript().run(),
|
|
7993
6390
|
active: editor.isActive("superscript"),
|
|
7994
6391
|
title: "Superscript",
|
|
7995
|
-
children:
|
|
7996
|
-
"X",
|
|
7997
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("sup", { children: "2" })
|
|
7998
|
-
]
|
|
6392
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react.Superscript, { size: 18 })
|
|
7999
6393
|
},
|
|
8000
6394
|
"superscript"
|
|
8001
6395
|
);
|
|
@@ -8005,7 +6399,7 @@ var Toolbar = ({
|
|
|
8005
6399
|
{
|
|
8006
6400
|
onClick: () => editor.chain().focus().clearNodes().unsetAllMarks().run(),
|
|
8007
6401
|
title: "Clear Formatting",
|
|
8008
|
-
children:
|
|
6402
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react.RemoveFormatting, { size: 18 })
|
|
8009
6403
|
},
|
|
8010
6404
|
"clearFormatting"
|
|
8011
6405
|
);
|
|
@@ -8072,7 +6466,7 @@ var Toolbar = ({
|
|
|
8072
6466
|
);
|
|
8073
6467
|
case "textColor":
|
|
8074
6468
|
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "rte-builder-toolbar-color", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("label", { title: "Text Color", children: [
|
|
8075
|
-
|
|
6469
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react.Type, { size: 18 }),
|
|
8076
6470
|
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
8077
6471
|
"input",
|
|
8078
6472
|
{
|
|
@@ -8084,7 +6478,7 @@ var Toolbar = ({
|
|
|
8084
6478
|
] }) }, "textColor");
|
|
8085
6479
|
case "backgroundColor":
|
|
8086
6480
|
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "rte-builder-toolbar-color", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("label", { title: "Background Color", children: [
|
|
8087
|
-
|
|
6481
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react.Highlighter, { size: 18 }),
|
|
8088
6482
|
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
8089
6483
|
"input",
|
|
8090
6484
|
{
|
|
@@ -8101,7 +6495,7 @@ var Toolbar = ({
|
|
|
8101
6495
|
onClick: () => editor.chain().focus().setTextAlign("left").run(),
|
|
8102
6496
|
active: editor.isActive({ textAlign: "left" }),
|
|
8103
6497
|
title: "Align Left",
|
|
8104
|
-
children:
|
|
6498
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react.AlignLeft, { size: 18 })
|
|
8105
6499
|
},
|
|
8106
6500
|
"alignLeft"
|
|
8107
6501
|
);
|
|
@@ -8112,7 +6506,7 @@ var Toolbar = ({
|
|
|
8112
6506
|
onClick: () => editor.chain().focus().setTextAlign("center").run(),
|
|
8113
6507
|
active: editor.isActive({ textAlign: "center" }),
|
|
8114
6508
|
title: "Align Center",
|
|
8115
|
-
children:
|
|
6509
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react.AlignCenter, { size: 18 })
|
|
8116
6510
|
},
|
|
8117
6511
|
"alignCenter"
|
|
8118
6512
|
);
|
|
@@ -8123,7 +6517,7 @@ var Toolbar = ({
|
|
|
8123
6517
|
onClick: () => editor.chain().focus().setTextAlign("right").run(),
|
|
8124
6518
|
active: editor.isActive({ textAlign: "right" }),
|
|
8125
6519
|
title: "Align Right",
|
|
8126
|
-
children:
|
|
6520
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react.AlignRight, { size: 18 })
|
|
8127
6521
|
},
|
|
8128
6522
|
"alignRight"
|
|
8129
6523
|
);
|
|
@@ -8134,7 +6528,7 @@ var Toolbar = ({
|
|
|
8134
6528
|
onClick: () => editor.chain().focus().setTextAlign("justify").run(),
|
|
8135
6529
|
active: editor.isActive({ textAlign: "justify" }),
|
|
8136
6530
|
title: "Justify",
|
|
8137
|
-
children:
|
|
6531
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react.AlignJustify, { size: 18 })
|
|
8138
6532
|
},
|
|
8139
6533
|
"alignJustify"
|
|
8140
6534
|
);
|
|
@@ -8144,7 +6538,7 @@ var Toolbar = ({
|
|
|
8144
6538
|
{
|
|
8145
6539
|
onClick: () => editor.chain().focus().indent().run(),
|
|
8146
6540
|
title: "Indent (Tab)",
|
|
8147
|
-
children:
|
|
6541
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react.Indent, { size: 18 })
|
|
8148
6542
|
},
|
|
8149
6543
|
"indent"
|
|
8150
6544
|
);
|
|
@@ -8154,7 +6548,7 @@ var Toolbar = ({
|
|
|
8154
6548
|
{
|
|
8155
6549
|
onClick: () => editor.chain().focus().outdent().run(),
|
|
8156
6550
|
title: "Outdent (Shift+Tab)",
|
|
8157
|
-
children:
|
|
6551
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react.Outdent, { size: 18 })
|
|
8158
6552
|
},
|
|
8159
6553
|
"outdent"
|
|
8160
6554
|
);
|
|
@@ -8165,7 +6559,7 @@ var Toolbar = ({
|
|
|
8165
6559
|
onClick: () => editor.chain().focus().toggleBulletList().run(),
|
|
8166
6560
|
active: editor.isActive("bulletList"),
|
|
8167
6561
|
title: "Bullet List",
|
|
8168
|
-
children:
|
|
6562
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react.List, { size: 18 })
|
|
8169
6563
|
},
|
|
8170
6564
|
"bulletList"
|
|
8171
6565
|
);
|
|
@@ -8176,7 +6570,7 @@ var Toolbar = ({
|
|
|
8176
6570
|
onClick: () => editor.chain().focus().toggleOrderedList().run(),
|
|
8177
6571
|
active: editor.isActive("orderedList"),
|
|
8178
6572
|
title: "Numbered List",
|
|
8179
|
-
children:
|
|
6573
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react.ListOrdered, { size: 18 })
|
|
8180
6574
|
},
|
|
8181
6575
|
"orderedList"
|
|
8182
6576
|
);
|
|
@@ -8187,16 +6581,16 @@ var Toolbar = ({
|
|
|
8187
6581
|
case "heading5":
|
|
8188
6582
|
case "heading6":
|
|
8189
6583
|
const level = parseInt(button.replace("heading", ""));
|
|
8190
|
-
return /* @__PURE__ */ (0, import_jsx_runtime8.
|
|
6584
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
8191
6585
|
ToolbarButton3,
|
|
8192
6586
|
{
|
|
8193
6587
|
onClick: () => editor.chain().focus().toggleHeading({ level }).run(),
|
|
8194
6588
|
active: editor.isActive("heading", { level }),
|
|
8195
6589
|
title: `Heading ${level}`,
|
|
8196
|
-
children: [
|
|
8197
|
-
|
|
8198
|
-
level
|
|
8199
|
-
]
|
|
6590
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("span", { style: { display: "flex", alignItems: "center", gap: "2px" }, children: [
|
|
6591
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react.Heading, { size: 18 }),
|
|
6592
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { style: { fontSize: "11px", fontWeight: "bold" }, children: level })
|
|
6593
|
+
] })
|
|
8200
6594
|
},
|
|
8201
6595
|
button
|
|
8202
6596
|
);
|
|
@@ -8207,7 +6601,7 @@ var Toolbar = ({
|
|
|
8207
6601
|
onClick: () => editor.chain().focus().toggleBlockquote().run(),
|
|
8208
6602
|
active: editor.isActive("blockquote"),
|
|
8209
6603
|
title: "Blockquote",
|
|
8210
|
-
children:
|
|
6604
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react.Quote, { size: 18 })
|
|
8211
6605
|
},
|
|
8212
6606
|
"blockquote"
|
|
8213
6607
|
);
|
|
@@ -8217,7 +6611,7 @@ var Toolbar = ({
|
|
|
8217
6611
|
{
|
|
8218
6612
|
onClick: () => editor.chain().focus().setHorizontalRule().run(),
|
|
8219
6613
|
title: "Horizontal Rule",
|
|
8220
|
-
children:
|
|
6614
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react.Minus, { size: 18 })
|
|
8221
6615
|
},
|
|
8222
6616
|
"horizontalRule"
|
|
8223
6617
|
);
|
|
@@ -8233,7 +6627,7 @@ var Toolbar = ({
|
|
|
8233
6627
|
},
|
|
8234
6628
|
active: editor.isActive("link"),
|
|
8235
6629
|
title: "Insert Link",
|
|
8236
|
-
children:
|
|
6630
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react.Link, { size: 18 })
|
|
8237
6631
|
},
|
|
8238
6632
|
"link"
|
|
8239
6633
|
);
|
|
@@ -8244,7 +6638,7 @@ var Toolbar = ({
|
|
|
8244
6638
|
onClick: () => editor.chain().focus().unsetLink().run(),
|
|
8245
6639
|
disabled: !editor.isActive("link"),
|
|
8246
6640
|
title: "Remove Link",
|
|
8247
|
-
children:
|
|
6641
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react.Unlink, { size: 18 })
|
|
8248
6642
|
},
|
|
8249
6643
|
"unlink"
|
|
8250
6644
|
);
|
|
@@ -8263,7 +6657,7 @@ var Toolbar = ({
|
|
|
8263
6657
|
}
|
|
8264
6658
|
},
|
|
8265
6659
|
title: "Insert Image",
|
|
8266
|
-
children:
|
|
6660
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react.Image, { size: 18 })
|
|
8267
6661
|
},
|
|
8268
6662
|
"image"
|
|
8269
6663
|
);
|
|
@@ -8282,7 +6676,7 @@ var Toolbar = ({
|
|
|
8282
6676
|
}
|
|
8283
6677
|
},
|
|
8284
6678
|
title: "Insert Video",
|
|
8285
|
-
children:
|
|
6679
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react.Video, { size: 18 })
|
|
8286
6680
|
},
|
|
8287
6681
|
"video"
|
|
8288
6682
|
);
|
|
@@ -8292,7 +6686,7 @@ var Toolbar = ({
|
|
|
8292
6686
|
{
|
|
8293
6687
|
onClick: () => editor.chain().focus().insertTable({ rows: 3, cols: 3, withHeaderRow: true }).run(),
|
|
8294
6688
|
title: "Insert Table",
|
|
8295
|
-
children:
|
|
6689
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react.Table, { size: 18 })
|
|
8296
6690
|
},
|
|
8297
6691
|
"table"
|
|
8298
6692
|
);
|
|
@@ -8305,7 +6699,7 @@ var Toolbar = ({
|
|
|
8305
6699
|
onClick: () => setShowEmojiPicker(!showEmojiPicker),
|
|
8306
6700
|
active: showEmojiPicker,
|
|
8307
6701
|
title: "Insert Emoji",
|
|
8308
|
-
children:
|
|
6702
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react.Smile, { size: 18 })
|
|
8309
6703
|
}
|
|
8310
6704
|
),
|
|
8311
6705
|
showEmojiPicker && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
@@ -8324,7 +6718,7 @@ var Toolbar = ({
|
|
|
8324
6718
|
onClick: () => editor.chain().focus().toggleFullscreen().run(),
|
|
8325
6719
|
active: isFullscreen,
|
|
8326
6720
|
title: isFullscreen ? "Exit Fullscreen (Esc)" : "Fullscreen (Ctrl+Shift+F)",
|
|
8327
|
-
children: isFullscreen ?
|
|
6721
|
+
children: isFullscreen ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react.Minimize, { size: 18 }) : /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react.Maximize, { size: 18 })
|
|
8328
6722
|
},
|
|
8329
6723
|
"fullscreen"
|
|
8330
6724
|
);
|
|
@@ -8334,7 +6728,7 @@ var Toolbar = ({
|
|
|
8334
6728
|
{
|
|
8335
6729
|
onClick: () => editor.chain().focus().print().run(),
|
|
8336
6730
|
title: "Print (Ctrl+P)",
|
|
8337
|
-
children:
|
|
6731
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react.Printer, { size: 18 })
|
|
8338
6732
|
},
|
|
8339
6733
|
"print"
|
|
8340
6734
|
);
|
|
@@ -8345,7 +6739,7 @@ var Toolbar = ({
|
|
|
8345
6739
|
onClick: () => editor.chain().focus().undo().run(),
|
|
8346
6740
|
disabled: !editor.can().undo(),
|
|
8347
6741
|
title: "Undo (Ctrl+Z)",
|
|
8348
|
-
children:
|
|
6742
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react.Undo, { size: 18 })
|
|
8349
6743
|
},
|
|
8350
6744
|
"undo"
|
|
8351
6745
|
);
|
|
@@ -8356,7 +6750,7 @@ var Toolbar = ({
|
|
|
8356
6750
|
onClick: () => editor.chain().focus().redo().run(),
|
|
8357
6751
|
disabled: !editor.can().redo(),
|
|
8358
6752
|
title: "Redo (Ctrl+Y)",
|
|
8359
|
-
children:
|
|
6753
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react.Redo, { size: 18 })
|
|
8360
6754
|
},
|
|
8361
6755
|
"redo"
|
|
8362
6756
|
);
|