tetrons 2.1.6 → 2.1.7
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.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +195 -168
- package/dist/index.mjs +190 -166
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,34 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
-
var __spreadValues = (a, b) => {
|
|
9
|
-
for (var prop in b || (b = {}))
|
|
10
|
-
if (__hasOwnProp.call(b, prop))
|
|
11
|
-
__defNormalProp(a, prop, b[prop]);
|
|
12
|
-
if (__getOwnPropSymbols)
|
|
13
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
-
if (__propIsEnum.call(b, prop))
|
|
15
|
-
__defNormalProp(a, prop, b[prop]);
|
|
16
|
-
}
|
|
17
|
-
return a;
|
|
18
|
-
};
|
|
19
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
-
var __objRest = (source, exclude) => {
|
|
21
|
-
var target = {};
|
|
22
|
-
for (var prop in source)
|
|
23
|
-
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
24
|
-
target[prop] = source[prop];
|
|
25
|
-
if (source != null && __getOwnPropSymbols)
|
|
26
|
-
for (var prop of __getOwnPropSymbols(source)) {
|
|
27
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
28
|
-
target[prop] = source[prop];
|
|
29
|
-
}
|
|
30
|
-
return target;
|
|
31
|
-
};
|
|
1
|
+
// src/components/tetrons/EditorContent.tsx
|
|
2
|
+
import React6 from "react";
|
|
32
3
|
|
|
33
4
|
// node_modules/orderedmap/dist/index.js
|
|
34
5
|
function OrderedMap(content) {
|
|
@@ -8606,7 +8577,8 @@ function createChainableState(config) {
|
|
|
8606
8577
|
let { selection } = transaction;
|
|
8607
8578
|
let { doc: doc3 } = transaction;
|
|
8608
8579
|
let { storedMarks } = transaction;
|
|
8609
|
-
return
|
|
8580
|
+
return {
|
|
8581
|
+
...state,
|
|
8610
8582
|
apply: state.apply.bind(state),
|
|
8611
8583
|
applyTransaction: state.applyTransaction.bind(state),
|
|
8612
8584
|
plugins: state.plugins,
|
|
@@ -8628,7 +8600,7 @@ function createChainableState(config) {
|
|
|
8628
8600
|
storedMarks = transaction.storedMarks;
|
|
8629
8601
|
return transaction;
|
|
8630
8602
|
}
|
|
8631
|
-
}
|
|
8603
|
+
};
|
|
8632
8604
|
}
|
|
8633
8605
|
var CommandManager = class {
|
|
8634
8606
|
constructor(props) {
|
|
@@ -8676,17 +8648,18 @@ var CommandManager = class {
|
|
|
8676
8648
|
}
|
|
8677
8649
|
return callbacks.every((callback) => callback === true);
|
|
8678
8650
|
};
|
|
8679
|
-
const chain =
|
|
8680
|
-
|
|
8681
|
-
const
|
|
8682
|
-
|
|
8683
|
-
|
|
8684
|
-
|
|
8685
|
-
|
|
8686
|
-
|
|
8687
|
-
|
|
8651
|
+
const chain = {
|
|
8652
|
+
...Object.fromEntries(Object.entries(rawCommands).map(([name, command2]) => {
|
|
8653
|
+
const chainedCommand = (...args) => {
|
|
8654
|
+
const props = this.buildProps(tr, shouldDispatch);
|
|
8655
|
+
const callback = command2(...args)(props);
|
|
8656
|
+
callbacks.push(callback);
|
|
8657
|
+
return chain;
|
|
8658
|
+
};
|
|
8659
|
+
return [name, chainedCommand];
|
|
8660
|
+
})),
|
|
8688
8661
|
run
|
|
8689
|
-
}
|
|
8662
|
+
};
|
|
8690
8663
|
return chain;
|
|
8691
8664
|
}
|
|
8692
8665
|
createCan(startTr) {
|
|
@@ -8695,11 +8668,12 @@ var CommandManager = class {
|
|
|
8695
8668
|
const tr = startTr || state.tr;
|
|
8696
8669
|
const props = this.buildProps(tr, dispatch);
|
|
8697
8670
|
const formattedCommands = Object.fromEntries(Object.entries(rawCommands).map(([name, command2]) => {
|
|
8698
|
-
return [name, (...args) => command2(...args)(
|
|
8671
|
+
return [name, (...args) => command2(...args)({ ...props, dispatch: void 0 })];
|
|
8699
8672
|
}));
|
|
8700
|
-
return
|
|
8673
|
+
return {
|
|
8674
|
+
...formattedCommands,
|
|
8701
8675
|
chain: () => this.createChain(tr, dispatch)
|
|
8702
|
-
}
|
|
8676
|
+
};
|
|
8703
8677
|
}
|
|
8704
8678
|
buildProps(tr, shouldDispatch = true) {
|
|
8705
8679
|
const { rawCommands, editor, state } = this;
|
|
@@ -8729,9 +8703,10 @@ function getExtensionField(extension, field, context) {
|
|
|
8729
8703
|
return getExtensionField(extension.parent, field, context);
|
|
8730
8704
|
}
|
|
8731
8705
|
if (typeof extension.config[field] === "function") {
|
|
8732
|
-
const value = extension.config[field].bind(
|
|
8706
|
+
const value = extension.config[field].bind({
|
|
8707
|
+
...context,
|
|
8733
8708
|
parent: extension.parent ? getExtensionField(extension.parent, field, context) : null
|
|
8734
|
-
})
|
|
8709
|
+
});
|
|
8735
8710
|
return value;
|
|
8736
8711
|
}
|
|
8737
8712
|
return extension.config[field];
|
|
@@ -8757,7 +8732,7 @@ function getNodeType(nameOrType, schema) {
|
|
|
8757
8732
|
}
|
|
8758
8733
|
function mergeAttributes(...objects) {
|
|
8759
8734
|
return objects.filter((item) => !!item).reduce((items, item) => {
|
|
8760
|
-
const mergedAttributes =
|
|
8735
|
+
const mergedAttributes = { ...items };
|
|
8761
8736
|
Object.entries(item).forEach(([key, value]) => {
|
|
8762
8737
|
const exists = mergedAttributes[key];
|
|
8763
8738
|
if (!exists) {
|
|
@@ -8820,7 +8795,7 @@ function isPlainObject(value) {
|
|
|
8820
8795
|
return value.constructor === Object && Object.getPrototypeOf(value) === Object.prototype;
|
|
8821
8796
|
}
|
|
8822
8797
|
function mergeDeep(target, source) {
|
|
8823
|
-
const output =
|
|
8798
|
+
const output = { ...target };
|
|
8824
8799
|
if (isPlainObject(target) && isPlainObject(source)) {
|
|
8825
8800
|
Object.keys(source).forEach((key) => {
|
|
8826
8801
|
if (isPlainObject(source[key]) && isPlainObject(target[key])) {
|
|
@@ -8842,7 +8817,10 @@ var Mark2 = class _Mark {
|
|
|
8842
8817
|
name: this.name,
|
|
8843
8818
|
defaultOptions: {}
|
|
8844
8819
|
};
|
|
8845
|
-
this.config =
|
|
8820
|
+
this.config = {
|
|
8821
|
+
...this.config,
|
|
8822
|
+
...config
|
|
8823
|
+
};
|
|
8846
8824
|
this.name = this.config.name;
|
|
8847
8825
|
if (config.defaultOptions && Object.keys(config.defaultOptions).length > 0) {
|
|
8848
8826
|
console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`);
|
|
@@ -8862,11 +8840,12 @@ var Mark2 = class _Mark {
|
|
|
8862
8840
|
return new _Mark(config);
|
|
8863
8841
|
}
|
|
8864
8842
|
configure(options = {}) {
|
|
8865
|
-
const extension = this.extend(
|
|
8843
|
+
const extension = this.extend({
|
|
8844
|
+
...this.config,
|
|
8866
8845
|
addOptions: () => {
|
|
8867
8846
|
return mergeDeep(this.options, options);
|
|
8868
8847
|
}
|
|
8869
|
-
})
|
|
8848
|
+
});
|
|
8870
8849
|
extension.name = this.name;
|
|
8871
8850
|
extension.parent = this.parent;
|
|
8872
8851
|
return extension;
|
|
@@ -8925,7 +8904,10 @@ var Extension = class _Extension {
|
|
|
8925
8904
|
name: this.name,
|
|
8926
8905
|
defaultOptions: {}
|
|
8927
8906
|
};
|
|
8928
|
-
this.config =
|
|
8907
|
+
this.config = {
|
|
8908
|
+
...this.config,
|
|
8909
|
+
...config
|
|
8910
|
+
};
|
|
8929
8911
|
this.name = this.config.name;
|
|
8930
8912
|
if (config.defaultOptions && Object.keys(config.defaultOptions).length > 0) {
|
|
8931
8913
|
console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`);
|
|
@@ -8945,17 +8927,18 @@ var Extension = class _Extension {
|
|
|
8945
8927
|
return new _Extension(config);
|
|
8946
8928
|
}
|
|
8947
8929
|
configure(options = {}) {
|
|
8948
|
-
const extension = this.extend(
|
|
8930
|
+
const extension = this.extend({
|
|
8931
|
+
...this.config,
|
|
8949
8932
|
addOptions: () => {
|
|
8950
8933
|
return mergeDeep(this.options, options);
|
|
8951
8934
|
}
|
|
8952
|
-
})
|
|
8935
|
+
});
|
|
8953
8936
|
extension.name = this.name;
|
|
8954
8937
|
extension.parent = this.parent;
|
|
8955
8938
|
return extension;
|
|
8956
8939
|
}
|
|
8957
8940
|
extend(extendedConfig = {}) {
|
|
8958
|
-
const extension = new _Extension(
|
|
8941
|
+
const extension = new _Extension({ ...this.config, ...extendedConfig });
|
|
8959
8942
|
extension.parent = this;
|
|
8960
8943
|
this.child = extension;
|
|
8961
8944
|
extension.name = extendedConfig.name ? extendedConfig.name : extension.parent.name;
|
|
@@ -9024,9 +9007,10 @@ var ClipboardTextSerializer = Extension.create({
|
|
|
9024
9007
|
const to = Math.max(...ranges.map((range2) => range2.$to.pos));
|
|
9025
9008
|
const textSerializers = getTextSerializersFromSchema(schema);
|
|
9026
9009
|
const range = { from: from2, to };
|
|
9027
|
-
return getTextBetween(doc3, range,
|
|
9010
|
+
return getTextBetween(doc3, range, {
|
|
9011
|
+
...this.options.blockSeparator !== void 0 ? { blockSeparator: this.options.blockSeparator } : {},
|
|
9028
9012
|
textSerializers
|
|
9029
|
-
})
|
|
9013
|
+
});
|
|
9030
9014
|
}
|
|
9031
9015
|
}
|
|
9032
9016
|
})
|
|
@@ -9274,9 +9258,10 @@ function isiOS() {
|
|
|
9274
9258
|
].includes(navigator.platform) || navigator.userAgent.includes("Mac") && "ontouchend" in document;
|
|
9275
9259
|
}
|
|
9276
9260
|
var focus = (position = null, options = {}) => ({ editor, view, tr, dispatch }) => {
|
|
9277
|
-
options =
|
|
9278
|
-
scrollIntoView: true
|
|
9279
|
-
|
|
9261
|
+
options = {
|
|
9262
|
+
scrollIntoView: true,
|
|
9263
|
+
...options
|
|
9264
|
+
};
|
|
9280
9265
|
const delayedFocus = () => {
|
|
9281
9266
|
if (isiOS() || isAndroid()) {
|
|
9282
9267
|
view.dom.focus();
|
|
@@ -9311,7 +9296,7 @@ var focus = (position = null, options = {}) => ({ editor, view, tr, dispatch })
|
|
|
9311
9296
|
return true;
|
|
9312
9297
|
};
|
|
9313
9298
|
var forEach = (items, fn) => (props) => {
|
|
9314
|
-
return items.every((item, index) => fn(item,
|
|
9299
|
+
return items.every((item, index) => fn(item, { ...props, index }));
|
|
9315
9300
|
};
|
|
9316
9301
|
var insertContent = (value, options) => ({ tr, commands: commands2 }) => {
|
|
9317
9302
|
return commands2.insertContentAt({ from: tr.selection.from, to: tr.selection.to }, value, options);
|
|
@@ -9337,10 +9322,11 @@ function createNodeFromContent(content, schema, options) {
|
|
|
9337
9322
|
if (content instanceof Node || content instanceof Fragment) {
|
|
9338
9323
|
return content;
|
|
9339
9324
|
}
|
|
9340
|
-
options =
|
|
9325
|
+
options = {
|
|
9341
9326
|
slice: true,
|
|
9342
|
-
parseOptions: {}
|
|
9343
|
-
|
|
9327
|
+
parseOptions: {},
|
|
9328
|
+
...options
|
|
9329
|
+
};
|
|
9344
9330
|
const isJSONContent = typeof content === "object" && content !== null;
|
|
9345
9331
|
const isTextContent = typeof content === "string";
|
|
9346
9332
|
if (isJSONContent) {
|
|
@@ -9429,18 +9415,20 @@ var isFragment = (nodeOrFragment) => {
|
|
|
9429
9415
|
var insertContentAt = (position, value, options) => ({ tr, dispatch, editor }) => {
|
|
9430
9416
|
var _a;
|
|
9431
9417
|
if (dispatch) {
|
|
9432
|
-
options =
|
|
9418
|
+
options = {
|
|
9433
9419
|
parseOptions: editor.options.parseOptions,
|
|
9434
9420
|
updateSelection: true,
|
|
9435
9421
|
applyInputRules: false,
|
|
9436
|
-
applyPasteRules: false
|
|
9437
|
-
|
|
9422
|
+
applyPasteRules: false,
|
|
9423
|
+
...options
|
|
9424
|
+
};
|
|
9438
9425
|
let content;
|
|
9439
9426
|
try {
|
|
9440
9427
|
content = createNodeFromContent(value, editor.schema, {
|
|
9441
|
-
parseOptions:
|
|
9442
|
-
preserveWhitespace: "full"
|
|
9443
|
-
|
|
9428
|
+
parseOptions: {
|
|
9429
|
+
preserveWhitespace: "full",
|
|
9430
|
+
...options.parseOptions
|
|
9431
|
+
},
|
|
9444
9432
|
errorOnInvalidContent: (_a = options.errorOnInvalidContent) !== null && _a !== void 0 ? _a : editor.options.enableContentCheck
|
|
9445
9433
|
});
|
|
9446
9434
|
} catch (e) {
|
|
@@ -9529,7 +9517,7 @@ var joinItemBackward = () => ({ state, dispatch, tr }) => {
|
|
|
9529
9517
|
dispatch(tr);
|
|
9530
9518
|
}
|
|
9531
9519
|
return true;
|
|
9532
|
-
} catch
|
|
9520
|
+
} catch {
|
|
9533
9521
|
return false;
|
|
9534
9522
|
}
|
|
9535
9523
|
};
|
|
@@ -9544,7 +9532,7 @@ var joinItemForward = () => ({ state, dispatch, tr }) => {
|
|
|
9544
9532
|
dispatch(tr);
|
|
9545
9533
|
}
|
|
9546
9534
|
return true;
|
|
9547
|
-
} catch
|
|
9535
|
+
} catch {
|
|
9548
9536
|
return false;
|
|
9549
9537
|
}
|
|
9550
9538
|
};
|
|
@@ -9793,7 +9781,7 @@ function getMarkAttributes(state, typeOrName) {
|
|
|
9793
9781
|
if (!mark) {
|
|
9794
9782
|
return {};
|
|
9795
9783
|
}
|
|
9796
|
-
return
|
|
9784
|
+
return { ...mark.attrs };
|
|
9797
9785
|
}
|
|
9798
9786
|
function defaultBlockAt2(match) {
|
|
9799
9787
|
for (let i = 0; i < match.edgeCount; i += 1) {
|
|
@@ -9829,9 +9817,10 @@ function getMarksBetween(from2, to, doc3) {
|
|
|
9829
9817
|
if (!range) {
|
|
9830
9818
|
return;
|
|
9831
9819
|
}
|
|
9832
|
-
marks.push(
|
|
9833
|
-
mark
|
|
9834
|
-
|
|
9820
|
+
marks.push({
|
|
9821
|
+
mark,
|
|
9822
|
+
...range
|
|
9823
|
+
});
|
|
9835
9824
|
});
|
|
9836
9825
|
} else {
|
|
9837
9826
|
doc3.nodesBetween(from2, to, (node, pos) => {
|
|
@@ -9995,7 +9984,10 @@ var setMark = (typeOrName, attributes = {}) => ({ tr, state, dispatch }) => {
|
|
|
9995
9984
|
if (dispatch) {
|
|
9996
9985
|
if (empty2) {
|
|
9997
9986
|
const oldAttributes = getMarkAttributes(state, type);
|
|
9998
|
-
tr.addStoredMark(type.create(
|
|
9987
|
+
tr.addStoredMark(type.create({
|
|
9988
|
+
...oldAttributes,
|
|
9989
|
+
...attributes
|
|
9990
|
+
}));
|
|
9999
9991
|
} else {
|
|
10000
9992
|
ranges.forEach((range) => {
|
|
10001
9993
|
const from2 = range.$from.pos;
|
|
@@ -10007,7 +9999,10 @@ var setMark = (typeOrName, attributes = {}) => ({ tr, state, dispatch }) => {
|
|
|
10007
9999
|
if (someHasMark) {
|
|
10008
10000
|
node.marks.forEach((mark) => {
|
|
10009
10001
|
if (type === mark.type) {
|
|
10010
|
-
tr.addMark(trimmedFrom, trimmedTo, type.create(
|
|
10002
|
+
tr.addMark(trimmedFrom, trimmedTo, type.create({
|
|
10003
|
+
...mark.attrs,
|
|
10004
|
+
...attributes
|
|
10005
|
+
}));
|
|
10011
10006
|
}
|
|
10012
10007
|
});
|
|
10013
10008
|
} else {
|
|
@@ -10034,13 +10029,13 @@ var setNode = (typeOrName, attributes = {}) => ({ state, dispatch, chain }) => {
|
|
|
10034
10029
|
return false;
|
|
10035
10030
|
}
|
|
10036
10031
|
return chain().command(({ commands: commands2 }) => {
|
|
10037
|
-
const canSetBlock = setBlockType2(type,
|
|
10032
|
+
const canSetBlock = setBlockType2(type, { ...attributesToCopy, ...attributes })(state);
|
|
10038
10033
|
if (canSetBlock) {
|
|
10039
10034
|
return true;
|
|
10040
10035
|
}
|
|
10041
10036
|
return commands2.clearNodes();
|
|
10042
10037
|
}).command(({ state: updatedState }) => {
|
|
10043
|
-
return setBlockType2(type,
|
|
10038
|
+
return setBlockType2(type, { ...attributesToCopy, ...attributes })(updatedState, dispatch);
|
|
10044
10039
|
}).run();
|
|
10045
10040
|
};
|
|
10046
10041
|
var setNodeSelection = (position) => ({ tr, dispatch }) => {
|
|
@@ -10159,7 +10154,10 @@ var splitListItem = (typeOrName, overrideAttrs = {}) => ({ tr, state, dispatch,
|
|
|
10159
10154
|
wrap2 = Fragment.from($from.node(d).copy(wrap2));
|
|
10160
10155
|
}
|
|
10161
10156
|
const depthAfter = $from.indexAfter(-1) < $from.node(-2).childCount ? 1 : $from.indexAfter(-2) < $from.node(-3).childCount ? 2 : 3;
|
|
10162
|
-
const newNextTypeAttributes2 =
|
|
10157
|
+
const newNextTypeAttributes2 = {
|
|
10158
|
+
...getSplittedAttributes(extensionAttributes, $from.node().type.name, $from.node().attrs),
|
|
10159
|
+
...overrideAttrs
|
|
10160
|
+
};
|
|
10163
10161
|
const nextType2 = ((_a = type.contentMatch.defaultType) === null || _a === void 0 ? void 0 : _a.createAndFill(newNextTypeAttributes2)) || void 0;
|
|
10164
10162
|
wrap2 = wrap2.append(Fragment.from(type.createAndFill(null, nextType2) || void 0));
|
|
10165
10163
|
const start = $from.before($from.depth - (depthBefore - 1));
|
|
@@ -10181,8 +10179,14 @@ var splitListItem = (typeOrName, overrideAttrs = {}) => ({ tr, state, dispatch,
|
|
|
10181
10179
|
return true;
|
|
10182
10180
|
}
|
|
10183
10181
|
const nextType = $to.pos === $from.end() ? grandParent.contentMatchAt(0).defaultType : null;
|
|
10184
|
-
const newTypeAttributes =
|
|
10185
|
-
|
|
10182
|
+
const newTypeAttributes = {
|
|
10183
|
+
...getSplittedAttributes(extensionAttributes, grandParent.type.name, grandParent.attrs),
|
|
10184
|
+
...overrideAttrs
|
|
10185
|
+
};
|
|
10186
|
+
const newNextTypeAttributes = {
|
|
10187
|
+
...getSplittedAttributes(extensionAttributes, $from.node().type.name, $from.node().attrs),
|
|
10188
|
+
...overrideAttrs
|
|
10189
|
+
};
|
|
10186
10190
|
tr.delete($from.pos, $to.pos);
|
|
10187
10191
|
const types = nextType ? [
|
|
10188
10192
|
{ type, attrs: newTypeAttributes },
|
|
@@ -10300,7 +10304,7 @@ var toggleNode = (typeOrName, toggleTypeOrName, attributes = {}) => ({ state, co
|
|
|
10300
10304
|
if (isActive) {
|
|
10301
10305
|
return commands2.setNode(toggleType, attributesToCopy);
|
|
10302
10306
|
}
|
|
10303
|
-
return commands2.setNode(type,
|
|
10307
|
+
return commands2.setNode(type, { ...attributesToCopy, ...attributes });
|
|
10304
10308
|
};
|
|
10305
10309
|
var toggleWrap = (typeOrName, attributes = {}) => ({ state, commands: commands2 }) => {
|
|
10306
10310
|
const type = getNodeType(typeOrName, state.schema);
|
|
@@ -10413,14 +10417,20 @@ var updateAttributes = (typeOrName, attributes = {}) => ({ tr, state, dispatch }
|
|
|
10413
10417
|
}
|
|
10414
10418
|
if (pos >= from2 && pos <= to) {
|
|
10415
10419
|
if (nodeType && nodeType === node.type) {
|
|
10416
|
-
tr.setNodeMarkup(pos, void 0,
|
|
10420
|
+
tr.setNodeMarkup(pos, void 0, {
|
|
10421
|
+
...node.attrs,
|
|
10422
|
+
...attributes
|
|
10423
|
+
});
|
|
10417
10424
|
}
|
|
10418
10425
|
if (markType && node.marks.length) {
|
|
10419
10426
|
node.marks.forEach((mark) => {
|
|
10420
10427
|
if (markType === mark.type) {
|
|
10421
10428
|
const trimmedFrom2 = Math.max(pos, from2);
|
|
10422
10429
|
const trimmedTo2 = Math.min(pos + node.nodeSize, to);
|
|
10423
|
-
tr.addMark(trimmedFrom2, trimmedTo2, markType.create(
|
|
10430
|
+
tr.addMark(trimmedFrom2, trimmedTo2, markType.create({
|
|
10431
|
+
...mark.attrs,
|
|
10432
|
+
...attributes
|
|
10433
|
+
}));
|
|
10424
10434
|
}
|
|
10425
10435
|
});
|
|
10426
10436
|
}
|
|
@@ -10429,12 +10439,18 @@ var updateAttributes = (typeOrName, attributes = {}) => ({ tr, state, dispatch }
|
|
|
10429
10439
|
}
|
|
10430
10440
|
if (lastNode) {
|
|
10431
10441
|
if (lastPos !== void 0) {
|
|
10432
|
-
tr.setNodeMarkup(lastPos, void 0,
|
|
10442
|
+
tr.setNodeMarkup(lastPos, void 0, {
|
|
10443
|
+
...lastNode.attrs,
|
|
10444
|
+
...attributes
|
|
10445
|
+
});
|
|
10433
10446
|
}
|
|
10434
10447
|
if (markType && lastNode.marks.length) {
|
|
10435
10448
|
lastNode.marks.forEach((mark) => {
|
|
10436
10449
|
if (markType === mark.type) {
|
|
10437
|
-
tr.addMark(trimmedFrom, trimmedTo, markType.create(
|
|
10450
|
+
tr.addMark(trimmedFrom, trimmedTo, markType.create({
|
|
10451
|
+
...mark.attrs,
|
|
10452
|
+
...attributes
|
|
10453
|
+
}));
|
|
10438
10454
|
}
|
|
10439
10455
|
});
|
|
10440
10456
|
}
|
|
@@ -10515,7 +10531,9 @@ var commands = /* @__PURE__ */ Object.freeze({
|
|
|
10515
10531
|
var Commands = Extension.create({
|
|
10516
10532
|
name: "commands",
|
|
10517
10533
|
addCommands() {
|
|
10518
|
-
return
|
|
10534
|
+
return {
|
|
10535
|
+
...commands
|
|
10536
|
+
};
|
|
10519
10537
|
}
|
|
10520
10538
|
});
|
|
10521
10539
|
var Drop = Extension.create({
|
|
@@ -10624,8 +10642,11 @@ var Keymap = Extension.create({
|
|
|
10624
10642
|
"Mod-Delete": handleDelete,
|
|
10625
10643
|
"Mod-a": () => this.editor.commands.selectAll()
|
|
10626
10644
|
};
|
|
10627
|
-
const pcKeymap =
|
|
10628
|
-
|
|
10645
|
+
const pcKeymap = {
|
|
10646
|
+
...baseKeymap
|
|
10647
|
+
};
|
|
10648
|
+
const macKeymap = {
|
|
10649
|
+
...baseKeymap,
|
|
10629
10650
|
"Ctrl-h": handleBackspace,
|
|
10630
10651
|
"Alt-Backspace": handleBackspace,
|
|
10631
10652
|
"Ctrl-d": handleDelete,
|
|
@@ -10634,7 +10655,7 @@ var Keymap = Extension.create({
|
|
|
10634
10655
|
"Alt-d": handleDelete,
|
|
10635
10656
|
"Ctrl-a": () => this.editor.commands.selectTextblockStart(),
|
|
10636
10657
|
"Ctrl-e": () => this.editor.commands.selectTextblockEnd()
|
|
10637
|
-
}
|
|
10658
|
+
};
|
|
10638
10659
|
if (isiOS() || isMacOS()) {
|
|
10639
10660
|
return macKeymap;
|
|
10640
10661
|
}
|
|
@@ -10839,7 +10860,10 @@ var Node2 = class _Node {
|
|
|
10839
10860
|
name: this.name,
|
|
10840
10861
|
defaultOptions: {}
|
|
10841
10862
|
};
|
|
10842
|
-
this.config =
|
|
10863
|
+
this.config = {
|
|
10864
|
+
...this.config,
|
|
10865
|
+
...config
|
|
10866
|
+
};
|
|
10843
10867
|
this.name = this.config.name;
|
|
10844
10868
|
if (config.defaultOptions && Object.keys(config.defaultOptions).length > 0) {
|
|
10845
10869
|
console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`);
|
|
@@ -10859,11 +10883,12 @@ var Node2 = class _Node {
|
|
|
10859
10883
|
return new _Node(config);
|
|
10860
10884
|
}
|
|
10861
10885
|
configure(options = {}) {
|
|
10862
|
-
const extension = this.extend(
|
|
10886
|
+
const extension = this.extend({
|
|
10887
|
+
...this.config,
|
|
10863
10888
|
addOptions: () => {
|
|
10864
10889
|
return mergeDeep(this.options, options);
|
|
10865
10890
|
}
|
|
10866
|
-
})
|
|
10891
|
+
});
|
|
10867
10892
|
extension.name = this.name;
|
|
10868
10893
|
extension.parent = this.parent;
|
|
10869
10894
|
return extension;
|
|
@@ -10970,7 +10995,7 @@ var Comment = Mark2.create({
|
|
|
10970
10995
|
});
|
|
10971
10996
|
|
|
10972
10997
|
// src/components/tetrons/EditorContent.tsx
|
|
10973
|
-
import { useEffect as useEffect7, useRef as useRef6
|
|
10998
|
+
import { useEffect as useEffect7, useRef as useRef6 } from "react";
|
|
10974
10999
|
import {
|
|
10975
11000
|
useEditor,
|
|
10976
11001
|
EditorContent as TiptapEditorContent
|
|
@@ -12031,8 +12056,11 @@ var Heading = Node2.create({
|
|
|
12031
12056
|
};
|
|
12032
12057
|
},
|
|
12033
12058
|
addKeyboardShortcuts() {
|
|
12034
|
-
return this.options.levels.reduce((items, level) =>
|
|
12035
|
-
|
|
12059
|
+
return this.options.levels.reduce((items, level) => ({
|
|
12060
|
+
...items,
|
|
12061
|
+
...{
|
|
12062
|
+
[`Mod-Alt-${level}`]: () => this.editor.commands.toggleHeading({ level })
|
|
12063
|
+
}
|
|
12036
12064
|
}), {});
|
|
12037
12065
|
},
|
|
12038
12066
|
addInputRules() {
|
|
@@ -12325,7 +12353,7 @@ var OrderedList = Node2.create({
|
|
|
12325
12353
|
];
|
|
12326
12354
|
},
|
|
12327
12355
|
renderHTML({ HTMLAttributes }) {
|
|
12328
|
-
const
|
|
12356
|
+
const { start, ...attributesWithoutStart } = HTMLAttributes;
|
|
12329
12357
|
return start === 1 ? ["ol", mergeAttributes(this.options.HTMLAttributes, attributesWithoutStart), 0] : ["ol", mergeAttributes(this.options.HTMLAttributes, HTMLAttributes), 0];
|
|
12330
12358
|
},
|
|
12331
12359
|
addCommands() {
|
|
@@ -12356,7 +12384,7 @@ var OrderedList = Node2.create({
|
|
|
12356
12384
|
type: this.type,
|
|
12357
12385
|
keepMarks: this.options.keepMarks,
|
|
12358
12386
|
keepAttributes: this.options.keepAttributes,
|
|
12359
|
-
getAttributes: (match) =>
|
|
12387
|
+
getAttributes: (match) => ({ start: +match[1], ...this.editor.getAttributes(TextStyleName2) }),
|
|
12360
12388
|
joinPredicate: (match, node) => node.childCount + node.attrs.start === +match[1],
|
|
12361
12389
|
editor: this.editor
|
|
12362
12390
|
});
|
|
@@ -12752,7 +12780,7 @@ function nextCell($pos, axis, dir) {
|
|
|
12752
12780
|
return moved == null ? null : $pos.node(0).resolve(tableStart + moved);
|
|
12753
12781
|
}
|
|
12754
12782
|
function removeColSpan(attrs, pos, n = 1) {
|
|
12755
|
-
const result =
|
|
12783
|
+
const result = { ...attrs, colspan: attrs.colspan - n };
|
|
12756
12784
|
if (result.colwidth) {
|
|
12757
12785
|
result.colwidth = result.colwidth.slice();
|
|
12758
12786
|
result.colwidth.splice(pos, n);
|
|
@@ -12853,9 +12881,10 @@ var CellSelection = class _CellSelection extends Selection {
|
|
|
12853
12881
|
}
|
|
12854
12882
|
}
|
|
12855
12883
|
if (cellRect.top < rect.top || cellRect.bottom > rect.bottom) {
|
|
12856
|
-
const attrs =
|
|
12884
|
+
const attrs = {
|
|
12885
|
+
...cell.attrs,
|
|
12857
12886
|
rowspan: Math.min(cellRect.bottom, rect.bottom) - Math.max(cellRect.top, rect.top)
|
|
12858
|
-
}
|
|
12887
|
+
};
|
|
12859
12888
|
if (cellRect.top < rect.top) {
|
|
12860
12889
|
cell = cell.type.createAndFill(attrs);
|
|
12861
12890
|
} else {
|
|
@@ -13134,15 +13163,17 @@ function fixTable(state, table, tablePos, tr) {
|
|
|
13134
13163
|
} else if (prob.type == "overlong_rowspan") {
|
|
13135
13164
|
const cell = table.nodeAt(prob.pos);
|
|
13136
13165
|
if (!cell) continue;
|
|
13137
|
-
tr.setNodeMarkup(tr.mapping.map(tablePos + 1 + prob.pos), null,
|
|
13166
|
+
tr.setNodeMarkup(tr.mapping.map(tablePos + 1 + prob.pos), null, {
|
|
13167
|
+
...cell.attrs,
|
|
13138
13168
|
rowspan: cell.attrs.rowspan - prob.n
|
|
13139
|
-
})
|
|
13169
|
+
});
|
|
13140
13170
|
} else if (prob.type == "colwidth mismatch") {
|
|
13141
13171
|
const cell = table.nodeAt(prob.pos);
|
|
13142
13172
|
if (!cell) continue;
|
|
13143
|
-
tr.setNodeMarkup(tr.mapping.map(tablePos + 1 + prob.pos), null,
|
|
13173
|
+
tr.setNodeMarkup(tr.mapping.map(tablePos + 1 + prob.pos), null, {
|
|
13174
|
+
...cell.attrs,
|
|
13144
13175
|
colwidth: prob.colwidth
|
|
13145
|
-
})
|
|
13176
|
+
});
|
|
13146
13177
|
} else if (prob.type == "zero_sized") {
|
|
13147
13178
|
const pos = tr.mapping.map(tablePos);
|
|
13148
13179
|
tr.delete(pos, pos + table.nodeSize);
|
|
@@ -13185,7 +13216,7 @@ function selectedRect(state) {
|
|
|
13185
13216
|
sel.$anchorCell.pos - tableStart,
|
|
13186
13217
|
sel.$headCell.pos - tableStart
|
|
13187
13218
|
) : map2.findCell($pos.pos - tableStart);
|
|
13188
|
-
return
|
|
13219
|
+
return { ...rect, tableStart, map: map2, table };
|
|
13189
13220
|
}
|
|
13190
13221
|
function deprecated_toggleHeader(type) {
|
|
13191
13222
|
return function(state, dispatch) {
|
|
@@ -13408,9 +13439,10 @@ function clipCells({ width, height, rows }, newWidth, newHeight) {
|
|
|
13408
13439
|
let cell = source.child(j);
|
|
13409
13440
|
if (row + cell.attrs.rowspan > newHeight)
|
|
13410
13441
|
cell = cell.type.create(
|
|
13411
|
-
|
|
13442
|
+
{
|
|
13443
|
+
...cell.attrs,
|
|
13412
13444
|
rowspan: Math.max(1, newHeight - cell.attrs.rowspan)
|
|
13413
|
-
}
|
|
13445
|
+
},
|
|
13414
13446
|
cell.content
|
|
13415
13447
|
);
|
|
13416
13448
|
cells.push(cell);
|
|
@@ -13463,14 +13495,16 @@ function isolateHorizontal(tr, map2, table, start, left, right, top, mapFrom) {
|
|
|
13463
13495
|
found2 = true;
|
|
13464
13496
|
const cell = table.nodeAt(pos);
|
|
13465
13497
|
const { top: cellTop, left: cellLeft } = map2.findCell(pos);
|
|
13466
|
-
tr.setNodeMarkup(tr.mapping.slice(mapFrom).map(pos + start), null,
|
|
13498
|
+
tr.setNodeMarkup(tr.mapping.slice(mapFrom).map(pos + start), null, {
|
|
13499
|
+
...cell.attrs,
|
|
13467
13500
|
rowspan: top - cellTop
|
|
13468
|
-
})
|
|
13501
|
+
});
|
|
13469
13502
|
tr.insert(
|
|
13470
13503
|
tr.mapping.slice(mapFrom).map(map2.positionAt(top, cellLeft, table)),
|
|
13471
|
-
cell.type.createAndFill(
|
|
13504
|
+
cell.type.createAndFill({
|
|
13505
|
+
...cell.attrs,
|
|
13472
13506
|
rowspan: cellTop + cell.attrs.rowspan - top
|
|
13473
|
-
})
|
|
13507
|
+
})
|
|
13474
13508
|
);
|
|
13475
13509
|
col += cell.attrs.colspan - 1;
|
|
13476
13510
|
}
|
|
@@ -14042,7 +14076,7 @@ function updateColumnWidth(view, cell, width) {
|
|
|
14042
14076
|
if (attrs.colwidth && attrs.colwidth[index] == width) continue;
|
|
14043
14077
|
const colwidth = attrs.colwidth ? attrs.colwidth.slice() : zeroes(attrs.colspan);
|
|
14044
14078
|
colwidth[index] = width;
|
|
14045
|
-
tr.setNodeMarkup(start + pos, null,
|
|
14079
|
+
tr.setNodeMarkup(start + pos, null, { ...attrs, colwidth });
|
|
14046
14080
|
}
|
|
14047
14081
|
if (tr.docChanged) view.dispatch(tr);
|
|
14048
14082
|
}
|
|
@@ -14146,10 +14180,10 @@ function tableEditing({
|
|
|
14146
14180
|
// src/components/tetrons/toolbar/extensions/ResizableTable.ts
|
|
14147
14181
|
var ResizableTable = Table.extend({
|
|
14148
14182
|
addOptions() {
|
|
14149
|
-
|
|
14150
|
-
|
|
14183
|
+
return {
|
|
14184
|
+
...this.parent?.(),
|
|
14151
14185
|
resizable: true
|
|
14152
|
-
}
|
|
14186
|
+
};
|
|
14153
14187
|
},
|
|
14154
14188
|
addProseMirrorPlugins() {
|
|
14155
14189
|
return [columnResizing({ handleWidth: 5 }), tableEditing()];
|
|
@@ -14230,10 +14264,11 @@ var Embed = Node2.create({
|
|
|
14230
14264
|
window.removeEventListener("mousemove", onMouseMove);
|
|
14231
14265
|
window.removeEventListener("mouseup", onMouseUp);
|
|
14232
14266
|
editor.commands.command(({ tr }) => {
|
|
14233
|
-
tr.setNodeMarkup(getPos(), void 0,
|
|
14267
|
+
tr.setNodeMarkup(getPos(), void 0, {
|
|
14268
|
+
...node.attrs,
|
|
14234
14269
|
width: container.offsetWidth,
|
|
14235
14270
|
height: container.offsetHeight
|
|
14236
|
-
})
|
|
14271
|
+
});
|
|
14237
14272
|
return true;
|
|
14238
14273
|
});
|
|
14239
14274
|
};
|
|
@@ -14333,8 +14368,8 @@ var ToolbarButton = React2.forwardRef(
|
|
|
14333
14368
|
ref,
|
|
14334
14369
|
onClick,
|
|
14335
14370
|
disabled,
|
|
14336
|
-
title: title
|
|
14337
|
-
"aria-label": title
|
|
14371
|
+
title: title ?? label,
|
|
14372
|
+
"aria-label": title ?? label,
|
|
14338
14373
|
className: `p-2 rounded hover:bg-gray-200 disabled:opacity-50 disabled:cursor-not-allowed ${isActive ? "bg-gray-300" : ""}`
|
|
14339
14374
|
},
|
|
14340
14375
|
/* @__PURE__ */ React2.createElement(Icon, { size: 20 })
|
|
@@ -14612,14 +14647,13 @@ function FontStyleGroup({ editor }) {
|
|
|
14612
14647
|
useEffect2(() => {
|
|
14613
14648
|
if (!editor) return;
|
|
14614
14649
|
const updateStates = () => {
|
|
14615
|
-
var _a, _b, _c;
|
|
14616
14650
|
const highlight = editor.getAttributes("highlight");
|
|
14617
|
-
setHighlightColor(
|
|
14618
|
-
const color =
|
|
14651
|
+
setHighlightColor(highlight?.color || "#ffff00");
|
|
14652
|
+
const color = editor.getAttributes("textStyle")?.color;
|
|
14619
14653
|
setTextColor(color || "#000000");
|
|
14620
|
-
const fontAttr =
|
|
14654
|
+
const fontAttr = editor.getAttributes("fontFamily")?.font || "Arial";
|
|
14621
14655
|
setFontFamily(fontAttr);
|
|
14622
|
-
const sizeAttr =
|
|
14656
|
+
const sizeAttr = editor.getAttributes("fontSize")?.size || "16px";
|
|
14623
14657
|
setFontSize(sizeAttr);
|
|
14624
14658
|
};
|
|
14625
14659
|
updateStates();
|
|
@@ -14826,8 +14860,7 @@ function InsertGroup({ editor }) {
|
|
|
14826
14860
|
setSelectedCols(1);
|
|
14827
14861
|
};
|
|
14828
14862
|
const handleImageUpload = (e) => {
|
|
14829
|
-
|
|
14830
|
-
const file = (_a = e.target.files) == null ? void 0 : _a[0];
|
|
14863
|
+
const file = e.target.files?.[0];
|
|
14831
14864
|
if (file) {
|
|
14832
14865
|
const reader = new FileReader();
|
|
14833
14866
|
reader.onload = () => {
|
|
@@ -14837,8 +14870,7 @@ function InsertGroup({ editor }) {
|
|
|
14837
14870
|
}
|
|
14838
14871
|
};
|
|
14839
14872
|
const handleVideoUpload = (e) => {
|
|
14840
|
-
|
|
14841
|
-
const file = (_a = e.target.files) == null ? void 0 : _a[0];
|
|
14873
|
+
const file = e.target.files?.[0];
|
|
14842
14874
|
if (file) {
|
|
14843
14875
|
const reader = new FileReader();
|
|
14844
14876
|
reader.onload = () => {
|
|
@@ -14873,7 +14905,7 @@ function InsertGroup({ editor }) {
|
|
|
14873
14905
|
return url.replace("/maps/", "/maps/embed/");
|
|
14874
14906
|
}
|
|
14875
14907
|
return url;
|
|
14876
|
-
} catch
|
|
14908
|
+
} catch {
|
|
14877
14909
|
return url;
|
|
14878
14910
|
}
|
|
14879
14911
|
}
|
|
@@ -14932,20 +14964,14 @@ function InsertGroup({ editor }) {
|
|
|
14932
14964
|
{
|
|
14933
14965
|
icon: MdInsertPhoto,
|
|
14934
14966
|
label: "Insert Image",
|
|
14935
|
-
onClick: () =>
|
|
14936
|
-
var _a;
|
|
14937
|
-
return (_a = imageInputRef.current) == null ? void 0 : _a.click();
|
|
14938
|
-
}
|
|
14967
|
+
onClick: () => imageInputRef.current?.click()
|
|
14939
14968
|
}
|
|
14940
14969
|
), /* @__PURE__ */ React3.createElement(
|
|
14941
14970
|
ToolbarButton_default,
|
|
14942
14971
|
{
|
|
14943
14972
|
icon: MdVideoLibrary,
|
|
14944
14973
|
label: "Insert Video",
|
|
14945
|
-
onClick: () =>
|
|
14946
|
-
var _a;
|
|
14947
|
-
return (_a = videoInputRef.current) == null ? void 0 : _a.click();
|
|
14948
|
-
}
|
|
14974
|
+
onClick: () => videoInputRef.current?.click()
|
|
14949
14975
|
}
|
|
14950
14976
|
), /* @__PURE__ */ React3.createElement(
|
|
14951
14977
|
ToolbarButton_default,
|
|
@@ -15181,12 +15207,10 @@ function FileGroup({ editor }) {
|
|
|
15181
15207
|
}
|
|
15182
15208
|
};
|
|
15183
15209
|
const handleOpen = () => {
|
|
15184
|
-
|
|
15185
|
-
(_a = fileInputRef.current) == null ? void 0 : _a.click();
|
|
15210
|
+
fileInputRef.current?.click();
|
|
15186
15211
|
};
|
|
15187
15212
|
const handleFileChange = async (e) => {
|
|
15188
|
-
|
|
15189
|
-
const file = (_a = e.target.files) == null ? void 0 : _a[0];
|
|
15213
|
+
const file = e.target.files?.[0];
|
|
15190
15214
|
if (!file) return;
|
|
15191
15215
|
try {
|
|
15192
15216
|
const text = await file.text();
|
|
@@ -15308,8 +15332,8 @@ var ResizableImageComponent = ({
|
|
|
15308
15332
|
{
|
|
15309
15333
|
ref: imgRef,
|
|
15310
15334
|
src,
|
|
15311
|
-
alt: alt
|
|
15312
|
-
title: title
|
|
15335
|
+
alt: alt ?? "",
|
|
15336
|
+
title: title ?? "",
|
|
15313
15337
|
loading: "lazy",
|
|
15314
15338
|
style: {
|
|
15315
15339
|
width: width ? `${width}px` : "auto",
|
|
@@ -15329,26 +15353,27 @@ var ResizableImageComponent_default = ResizableImageComponent;
|
|
|
15329
15353
|
var ResizableImage = Image.extend({
|
|
15330
15354
|
name: "resizableImage",
|
|
15331
15355
|
addAttributes() {
|
|
15332
|
-
|
|
15333
|
-
|
|
15356
|
+
return {
|
|
15357
|
+
...this.parent?.(),
|
|
15334
15358
|
width: {
|
|
15335
15359
|
default: null
|
|
15336
15360
|
},
|
|
15337
15361
|
height: {
|
|
15338
15362
|
default: null
|
|
15339
15363
|
}
|
|
15340
|
-
}
|
|
15364
|
+
};
|
|
15341
15365
|
},
|
|
15342
15366
|
renderHTML({ HTMLAttributes }) {
|
|
15343
|
-
const
|
|
15367
|
+
const { width, height, ...rest } = HTMLAttributes;
|
|
15344
15368
|
const style = [];
|
|
15345
15369
|
if (width) style.push(`width: ${width}px`);
|
|
15346
15370
|
if (height) style.push(`height: ${height}px`);
|
|
15347
15371
|
return [
|
|
15348
15372
|
"img",
|
|
15349
|
-
|
|
15373
|
+
{
|
|
15374
|
+
...rest,
|
|
15350
15375
|
style: style.join("; ")
|
|
15351
|
-
}
|
|
15376
|
+
}
|
|
15352
15377
|
];
|
|
15353
15378
|
},
|
|
15354
15379
|
addNodeView() {
|
|
@@ -15437,11 +15462,11 @@ var ResizableVideo = Node2.create({
|
|
|
15437
15462
|
return [{ tag: "video[src]" }];
|
|
15438
15463
|
},
|
|
15439
15464
|
renderHTML({ HTMLAttributes }) {
|
|
15440
|
-
const
|
|
15465
|
+
const { width, height, ...rest } = HTMLAttributes;
|
|
15441
15466
|
const style = [];
|
|
15442
15467
|
if (width) style.push(`width: ${width}px`);
|
|
15443
15468
|
if (height) style.push(`height: ${height}px`);
|
|
15444
|
-
return ["video",
|
|
15469
|
+
return ["video", { ...rest, style: style.join("; ") }];
|
|
15445
15470
|
},
|
|
15446
15471
|
addCommands() {
|
|
15447
15472
|
return {
|
|
@@ -17068,10 +17093,8 @@ var lowlight = createLowlight();
|
|
|
17068
17093
|
lowlight.register("js", javascript);
|
|
17069
17094
|
lowlight.register("ts", typescript);
|
|
17070
17095
|
function EditorContent() {
|
|
17071
|
-
const [versions, setVersions] =
|
|
17072
|
-
const [currentVersionIndex, setCurrentVersionIndex] =
|
|
17073
|
-
null
|
|
17074
|
-
);
|
|
17096
|
+
const [versions, setVersions] = React6.useState([]);
|
|
17097
|
+
const [currentVersionIndex, setCurrentVersionIndex] = React6.useState(null);
|
|
17075
17098
|
const editor = useEditor({
|
|
17076
17099
|
extensions: [
|
|
17077
17100
|
Document,
|
|
@@ -17127,12 +17150,13 @@ function EditorContent() {
|
|
|
17127
17150
|
class: "min-h-full focus:outline-none p-0",
|
|
17128
17151
|
"data-placeholder": "Start typing here..."
|
|
17129
17152
|
}
|
|
17130
|
-
}
|
|
17153
|
+
},
|
|
17154
|
+
immediatelyRender: false
|
|
17131
17155
|
});
|
|
17132
17156
|
const wrapperRef = useRef6(null);
|
|
17133
17157
|
useEffect7(() => {
|
|
17134
17158
|
return () => {
|
|
17135
|
-
editor
|
|
17159
|
+
editor?.destroy();
|
|
17136
17160
|
};
|
|
17137
17161
|
}, [editor]);
|
|
17138
17162
|
const handleEditorClick = () => {
|
|
@@ -17154,7 +17178,7 @@ function EditorContent() {
|
|
|
17154
17178
|
setCurrentVersionIndex(index);
|
|
17155
17179
|
}
|
|
17156
17180
|
};
|
|
17157
|
-
return /* @__PURE__ */
|
|
17181
|
+
return /* @__PURE__ */ React6.createElement("div", { className: "flex flex-col h-full" }, /* @__PURE__ */ React6.createElement("div", { className: "p-2 border-b border-gray-300 bg-gray-50 flex flex-wrap items-center gap-3" }, /* @__PURE__ */ React6.createElement(
|
|
17158
17182
|
"button",
|
|
17159
17183
|
{
|
|
17160
17184
|
onClick: saveVersion,
|
|
@@ -17162,7 +17186,7 @@ function EditorContent() {
|
|
|
17162
17186
|
className: "px-3 py-1 bg-blue-600 text-white rounded hover:bg-blue-700 disabled:opacity-50"
|
|
17163
17187
|
},
|
|
17164
17188
|
"Save Version"
|
|
17165
|
-
), /* @__PURE__ */
|
|
17189
|
+
), /* @__PURE__ */ React6.createElement("div", { className: "flex items-center gap-2 overflow-x-auto max-w-full" }, versions.length === 0 && /* @__PURE__ */ React6.createElement("span", { className: "text-gray-500 text-sm" }, "No saved versions"), versions.map((_, idx) => /* @__PURE__ */ React6.createElement(
|
|
17166
17190
|
"button",
|
|
17167
17191
|
{
|
|
17168
17192
|
key: idx,
|
|
@@ -17171,14 +17195,14 @@ function EditorContent() {
|
|
|
17171
17195
|
title: `Restore Version ${idx + 1}`
|
|
17172
17196
|
},
|
|
17173
17197
|
`V${idx + 1}`
|
|
17174
|
-
)))), editor && /* @__PURE__ */
|
|
17198
|
+
)))), editor && /* @__PURE__ */ React6.createElement(TetronsToolbar, { editor }), /* @__PURE__ */ React6.createElement(
|
|
17175
17199
|
"div",
|
|
17176
17200
|
{
|
|
17177
17201
|
ref: wrapperRef,
|
|
17178
17202
|
className: "flex-grow p-4 md:p-6 bg-white border border-gray-300 rounded shadow-sm overflow-auto min-h-0 prose relative",
|
|
17179
17203
|
onClick: handleEditorClick
|
|
17180
17204
|
},
|
|
17181
|
-
editor ? /* @__PURE__ */
|
|
17205
|
+
editor ? /* @__PURE__ */ React6.createElement(React6.Fragment, null, /* @__PURE__ */ React6.createElement(TiptapEditorContent, { editor }), editor && /* @__PURE__ */ React6.createElement(TableContextMenu, { editor })) : /* @__PURE__ */ React6.createElement("div", { className: "text-gray-500" }, "Loading editor...")
|
|
17182
17206
|
));
|
|
17183
17207
|
}
|
|
17184
17208
|
|