@bendyline/squisq-editor-react 2.4.1 → 2.4.3
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/NOTICE.md +2 -0
- package/THIRD_PARTY_LICENSES.txt +0 -52
- package/dist/{chunk-KR4VLXUM.js → chunk-JGW6BJZJ.js} +250 -2393
- package/dist/{chunk-LJRHKXDV.js → chunk-PEI5EBEN.js} +1 -1
- package/dist/{chunk-LOTY7AOS.js → chunk-PKGBWNUQ.js} +4 -4
- package/dist/index.d.ts +14 -3
- package/dist/index.js +3 -3
- package/dist/recorder/index.d.ts +1 -1
- package/dist/recorder/index.js +2 -2
- package/dist/{recorder-C5tAYUE3.d.ts → recorder-C0Tkyu5W.d.ts} +1 -1
- package/dist/shell/index.js +2 -2
- package/dist/styles/index.css +23 -6
- package/package.json +6 -4
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
import {
|
|
16
16
|
RecorderPanel,
|
|
17
17
|
useModalDialog
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-PKGBWNUQ.js";
|
|
19
19
|
import {
|
|
20
20
|
Icon
|
|
21
21
|
} from "./chunk-GS7QWYFT.js";
|
|
@@ -4463,8 +4463,8 @@ function PreviewModeMenu({ openRequest = 0 }) {
|
|
|
4463
4463
|
useLayoutEffect(() => {
|
|
4464
4464
|
if (!open || !anchor) return;
|
|
4465
4465
|
const selected = menuRef.current?.querySelector('[aria-checked="true"]');
|
|
4466
|
-
const
|
|
4467
|
-
(selected ??
|
|
4466
|
+
const first = menuRef.current?.querySelector('[role="menuitemradio"]');
|
|
4467
|
+
(selected ?? first)?.focus();
|
|
4468
4468
|
}, [anchor, open]);
|
|
4469
4469
|
return /* @__PURE__ */ jsxs6(Fragment3, { children: [
|
|
4470
4470
|
/* @__PURE__ */ jsx8(
|
|
@@ -11441,2159 +11441,9 @@ function SceneToolbar({
|
|
|
11441
11441
|
)) });
|
|
11442
11442
|
}
|
|
11443
11443
|
|
|
11444
|
-
// ../../node_modules/@tiptap/core/dist/index.js
|
|
11445
|
-
import { Plugin, PluginKey, TextSelection, Selection, AllSelection, NodeSelection, EditorState } from "@tiptap/pm/state";
|
|
11446
|
-
import { EditorView } from "@tiptap/pm/view";
|
|
11447
|
-
import { keymap } from "@tiptap/pm/keymap";
|
|
11448
|
-
import { Schema, DOMSerializer, Fragment as Fragment6, Node as Node$1, DOMParser, Slice } from "@tiptap/pm/model";
|
|
11449
|
-
import { liftTarget, ReplaceStep, ReplaceAroundStep, joinPoint, Transform, canSplit, canJoin, findWrapping } from "@tiptap/pm/transform";
|
|
11450
|
-
import { createParagraphNear as createParagraphNear$1, deleteSelection as deleteSelection$1, exitCode as exitCode$1, joinUp as joinUp$1, joinDown as joinDown$1, joinBackward as joinBackward$1, joinForward as joinForward$1, joinTextblockBackward as joinTextblockBackward$1, joinTextblockForward as joinTextblockForward$1, lift as lift$1, liftEmptyBlock as liftEmptyBlock$1, newlineInCode as newlineInCode$1, selectNodeBackward as selectNodeBackward$1, selectNodeForward as selectNodeForward$1, selectParentNode as selectParentNode$1, selectTextblockEnd as selectTextblockEnd$1, selectTextblockStart as selectTextblockStart$1, setBlockType, wrapIn as wrapIn$1 } from "@tiptap/pm/commands";
|
|
11451
|
-
import { liftListItem as liftListItem$1, sinkListItem as sinkListItem$1, wrapInList as wrapInList$1 } from "@tiptap/pm/schema-list";
|
|
11452
|
-
function createChainableState(config3) {
|
|
11453
|
-
const { state, transaction } = config3;
|
|
11454
|
-
let { selection } = transaction;
|
|
11455
|
-
let { doc } = transaction;
|
|
11456
|
-
let { storedMarks } = transaction;
|
|
11457
|
-
return {
|
|
11458
|
-
...state,
|
|
11459
|
-
apply: state.apply.bind(state),
|
|
11460
|
-
applyTransaction: state.applyTransaction.bind(state),
|
|
11461
|
-
plugins: state.plugins,
|
|
11462
|
-
schema: state.schema,
|
|
11463
|
-
reconfigure: state.reconfigure.bind(state),
|
|
11464
|
-
toJSON: state.toJSON.bind(state),
|
|
11465
|
-
get storedMarks() {
|
|
11466
|
-
return storedMarks;
|
|
11467
|
-
},
|
|
11468
|
-
get selection() {
|
|
11469
|
-
return selection;
|
|
11470
|
-
},
|
|
11471
|
-
get doc() {
|
|
11472
|
-
return doc;
|
|
11473
|
-
},
|
|
11474
|
-
get tr() {
|
|
11475
|
-
selection = transaction.selection;
|
|
11476
|
-
doc = transaction.doc;
|
|
11477
|
-
storedMarks = transaction.storedMarks;
|
|
11478
|
-
return transaction;
|
|
11479
|
-
}
|
|
11480
|
-
};
|
|
11481
|
-
}
|
|
11482
|
-
var CommandManager = class {
|
|
11483
|
-
constructor(props) {
|
|
11484
|
-
this.editor = props.editor;
|
|
11485
|
-
this.rawCommands = this.editor.extensionManager.commands;
|
|
11486
|
-
this.customState = props.state;
|
|
11487
|
-
}
|
|
11488
|
-
get hasCustomState() {
|
|
11489
|
-
return !!this.customState;
|
|
11490
|
-
}
|
|
11491
|
-
get state() {
|
|
11492
|
-
return this.customState || this.editor.state;
|
|
11493
|
-
}
|
|
11494
|
-
get commands() {
|
|
11495
|
-
const { rawCommands, editor, state } = this;
|
|
11496
|
-
const { view } = editor;
|
|
11497
|
-
const { tr } = state;
|
|
11498
|
-
const props = this.buildProps(tr);
|
|
11499
|
-
return Object.fromEntries(Object.entries(rawCommands).map(([name, command2]) => {
|
|
11500
|
-
const method = (...args) => {
|
|
11501
|
-
const callback = command2(...args)(props);
|
|
11502
|
-
if (!tr.getMeta("preventDispatch") && !this.hasCustomState) {
|
|
11503
|
-
view.dispatch(tr);
|
|
11504
|
-
}
|
|
11505
|
-
return callback;
|
|
11506
|
-
};
|
|
11507
|
-
return [name, method];
|
|
11508
|
-
}));
|
|
11509
|
-
}
|
|
11510
|
-
get chain() {
|
|
11511
|
-
return () => this.createChain();
|
|
11512
|
-
}
|
|
11513
|
-
get can() {
|
|
11514
|
-
return () => this.createCan();
|
|
11515
|
-
}
|
|
11516
|
-
createChain(startTr, shouldDispatch = true) {
|
|
11517
|
-
const { rawCommands, editor, state } = this;
|
|
11518
|
-
const { view } = editor;
|
|
11519
|
-
const callbacks = [];
|
|
11520
|
-
const hasStartTransaction = !!startTr;
|
|
11521
|
-
const tr = startTr || state.tr;
|
|
11522
|
-
const run = () => {
|
|
11523
|
-
if (!hasStartTransaction && shouldDispatch && !tr.getMeta("preventDispatch") && !this.hasCustomState) {
|
|
11524
|
-
view.dispatch(tr);
|
|
11525
|
-
}
|
|
11526
|
-
return callbacks.every((callback) => callback === true);
|
|
11527
|
-
};
|
|
11528
|
-
const chain = {
|
|
11529
|
-
...Object.fromEntries(Object.entries(rawCommands).map(([name, command2]) => {
|
|
11530
|
-
const chainedCommand = (...args) => {
|
|
11531
|
-
const props = this.buildProps(tr, shouldDispatch);
|
|
11532
|
-
const callback = command2(...args)(props);
|
|
11533
|
-
callbacks.push(callback);
|
|
11534
|
-
return chain;
|
|
11535
|
-
};
|
|
11536
|
-
return [name, chainedCommand];
|
|
11537
|
-
})),
|
|
11538
|
-
run
|
|
11539
|
-
};
|
|
11540
|
-
return chain;
|
|
11541
|
-
}
|
|
11542
|
-
createCan(startTr) {
|
|
11543
|
-
const { rawCommands, state } = this;
|
|
11544
|
-
const dispatch = false;
|
|
11545
|
-
const tr = startTr || state.tr;
|
|
11546
|
-
const props = this.buildProps(tr, dispatch);
|
|
11547
|
-
const formattedCommands = Object.fromEntries(Object.entries(rawCommands).map(([name, command2]) => {
|
|
11548
|
-
return [name, (...args) => command2(...args)({ ...props, dispatch: void 0 })];
|
|
11549
|
-
}));
|
|
11550
|
-
return {
|
|
11551
|
-
...formattedCommands,
|
|
11552
|
-
chain: () => this.createChain(tr, dispatch)
|
|
11553
|
-
};
|
|
11554
|
-
}
|
|
11555
|
-
buildProps(tr, shouldDispatch = true) {
|
|
11556
|
-
const { rawCommands, editor, state } = this;
|
|
11557
|
-
const { view } = editor;
|
|
11558
|
-
const props = {
|
|
11559
|
-
tr,
|
|
11560
|
-
editor,
|
|
11561
|
-
view,
|
|
11562
|
-
state: createChainableState({
|
|
11563
|
-
state,
|
|
11564
|
-
transaction: tr
|
|
11565
|
-
}),
|
|
11566
|
-
dispatch: shouldDispatch ? () => void 0 : void 0,
|
|
11567
|
-
chain: () => this.createChain(tr, shouldDispatch),
|
|
11568
|
-
can: () => this.createCan(tr),
|
|
11569
|
-
get commands() {
|
|
11570
|
-
return Object.fromEntries(Object.entries(rawCommands).map(([name, command2]) => {
|
|
11571
|
-
return [name, (...args) => command2(...args)(props)];
|
|
11572
|
-
}));
|
|
11573
|
-
}
|
|
11574
|
-
};
|
|
11575
|
-
return props;
|
|
11576
|
-
}
|
|
11577
|
-
};
|
|
11578
|
-
function getExtensionField(extension, field, context) {
|
|
11579
|
-
if (extension.config[field] === void 0 && extension.parent) {
|
|
11580
|
-
return getExtensionField(extension.parent, field, context);
|
|
11581
|
-
}
|
|
11582
|
-
if (typeof extension.config[field] === "function") {
|
|
11583
|
-
const value = extension.config[field].bind({
|
|
11584
|
-
...context,
|
|
11585
|
-
parent: extension.parent ? getExtensionField(extension.parent, field, context) : null
|
|
11586
|
-
});
|
|
11587
|
-
return value;
|
|
11588
|
-
}
|
|
11589
|
-
return extension.config[field];
|
|
11590
|
-
}
|
|
11591
|
-
function splitExtensions(extensions) {
|
|
11592
|
-
const baseExtensions = extensions.filter((extension) => extension.type === "extension");
|
|
11593
|
-
const nodeExtensions = extensions.filter((extension) => extension.type === "node");
|
|
11594
|
-
const markExtensions = extensions.filter((extension) => extension.type === "mark");
|
|
11595
|
-
return {
|
|
11596
|
-
baseExtensions,
|
|
11597
|
-
nodeExtensions,
|
|
11598
|
-
markExtensions
|
|
11599
|
-
};
|
|
11600
|
-
}
|
|
11601
|
-
function getNodeType(nameOrType, schema) {
|
|
11602
|
-
if (typeof nameOrType === "string") {
|
|
11603
|
-
if (!schema.nodes[nameOrType]) {
|
|
11604
|
-
throw Error(`There is no node type named '${nameOrType}'. Maybe you forgot to add the extension?`);
|
|
11605
|
-
}
|
|
11606
|
-
return schema.nodes[nameOrType];
|
|
11607
|
-
}
|
|
11608
|
-
return nameOrType;
|
|
11609
|
-
}
|
|
11610
|
-
function mergeAttributes(...objects) {
|
|
11611
|
-
return objects.filter((item) => !!item).reduce((items, item) => {
|
|
11612
|
-
const mergedAttributes = { ...items };
|
|
11613
|
-
Object.entries(item).forEach(([key, value]) => {
|
|
11614
|
-
const exists = mergedAttributes[key];
|
|
11615
|
-
if (!exists) {
|
|
11616
|
-
mergedAttributes[key] = value;
|
|
11617
|
-
return;
|
|
11618
|
-
}
|
|
11619
|
-
if (key === "class") {
|
|
11620
|
-
const valueClasses = value ? String(value).split(" ") : [];
|
|
11621
|
-
const existingClasses = mergedAttributes[key] ? mergedAttributes[key].split(" ") : [];
|
|
11622
|
-
const insertClasses = valueClasses.filter((valueClass) => !existingClasses.includes(valueClass));
|
|
11623
|
-
mergedAttributes[key] = [...existingClasses, ...insertClasses].join(" ");
|
|
11624
|
-
} else if (key === "style") {
|
|
11625
|
-
const newStyles = value ? value.split(";").map((style) => style.trim()).filter(Boolean) : [];
|
|
11626
|
-
const existingStyles = mergedAttributes[key] ? mergedAttributes[key].split(";").map((style) => style.trim()).filter(Boolean) : [];
|
|
11627
|
-
const styleMap = /* @__PURE__ */ new Map();
|
|
11628
|
-
existingStyles.forEach((style) => {
|
|
11629
|
-
const [property, val] = style.split(":").map((part) => part.trim());
|
|
11630
|
-
styleMap.set(property, val);
|
|
11631
|
-
});
|
|
11632
|
-
newStyles.forEach((style) => {
|
|
11633
|
-
const [property, val] = style.split(":").map((part) => part.trim());
|
|
11634
|
-
styleMap.set(property, val);
|
|
11635
|
-
});
|
|
11636
|
-
mergedAttributes[key] = Array.from(styleMap.entries()).map(([property, val]) => `${property}: ${val}`).join("; ");
|
|
11637
|
-
} else {
|
|
11638
|
-
mergedAttributes[key] = value;
|
|
11639
|
-
}
|
|
11640
|
-
});
|
|
11641
|
-
return mergedAttributes;
|
|
11642
|
-
}, {});
|
|
11643
|
-
}
|
|
11644
|
-
function isFunction2(value) {
|
|
11645
|
-
return typeof value === "function";
|
|
11646
|
-
}
|
|
11647
|
-
function callOrReturn(value, context = void 0, ...props) {
|
|
11648
|
-
if (isFunction2(value)) {
|
|
11649
|
-
if (context) {
|
|
11650
|
-
return value.bind(context)(...props);
|
|
11651
|
-
}
|
|
11652
|
-
return value(...props);
|
|
11653
|
-
}
|
|
11654
|
-
return value;
|
|
11655
|
-
}
|
|
11656
|
-
function isRegExp(value) {
|
|
11657
|
-
return Object.prototype.toString.call(value) === "[object RegExp]";
|
|
11658
|
-
}
|
|
11659
|
-
var InputRule = class {
|
|
11660
|
-
constructor(config3) {
|
|
11661
|
-
this.find = config3.find;
|
|
11662
|
-
this.handler = config3.handler;
|
|
11663
|
-
}
|
|
11664
|
-
};
|
|
11665
|
-
function getType(value) {
|
|
11666
|
-
return Object.prototype.toString.call(value).slice(8, -1);
|
|
11667
|
-
}
|
|
11668
|
-
function isPlainObject(value) {
|
|
11669
|
-
if (getType(value) !== "Object") {
|
|
11670
|
-
return false;
|
|
11671
|
-
}
|
|
11672
|
-
return value.constructor === Object && Object.getPrototypeOf(value) === Object.prototype;
|
|
11673
|
-
}
|
|
11674
|
-
function mergeDeep(target, source) {
|
|
11675
|
-
const output = { ...target };
|
|
11676
|
-
if (isPlainObject(target) && isPlainObject(source)) {
|
|
11677
|
-
Object.keys(source).forEach((key) => {
|
|
11678
|
-
if (isPlainObject(source[key]) && isPlainObject(target[key])) {
|
|
11679
|
-
output[key] = mergeDeep(target[key], source[key]);
|
|
11680
|
-
} else {
|
|
11681
|
-
output[key] = source[key];
|
|
11682
|
-
}
|
|
11683
|
-
});
|
|
11684
|
-
}
|
|
11685
|
-
return output;
|
|
11686
|
-
}
|
|
11687
|
-
var Extension = class _Extension {
|
|
11688
|
-
constructor(config3 = {}) {
|
|
11689
|
-
this.type = "extension";
|
|
11690
|
-
this.name = "extension";
|
|
11691
|
-
this.parent = null;
|
|
11692
|
-
this.child = null;
|
|
11693
|
-
this.config = {
|
|
11694
|
-
name: this.name,
|
|
11695
|
-
defaultOptions: {}
|
|
11696
|
-
};
|
|
11697
|
-
this.config = {
|
|
11698
|
-
...this.config,
|
|
11699
|
-
...config3
|
|
11700
|
-
};
|
|
11701
|
-
this.name = this.config.name;
|
|
11702
|
-
if (config3.defaultOptions && Object.keys(config3.defaultOptions).length > 0) {
|
|
11703
|
-
console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`);
|
|
11704
|
-
}
|
|
11705
|
-
this.options = this.config.defaultOptions;
|
|
11706
|
-
if (this.config.addOptions) {
|
|
11707
|
-
this.options = callOrReturn(getExtensionField(this, "addOptions", {
|
|
11708
|
-
name: this.name
|
|
11709
|
-
}));
|
|
11710
|
-
}
|
|
11711
|
-
this.storage = callOrReturn(getExtensionField(this, "addStorage", {
|
|
11712
|
-
name: this.name,
|
|
11713
|
-
options: this.options
|
|
11714
|
-
})) || {};
|
|
11715
|
-
}
|
|
11716
|
-
static create(config3 = {}) {
|
|
11717
|
-
return new _Extension(config3);
|
|
11718
|
-
}
|
|
11719
|
-
configure(options = {}) {
|
|
11720
|
-
const extension = this.extend({
|
|
11721
|
-
...this.config,
|
|
11722
|
-
addOptions: () => {
|
|
11723
|
-
return mergeDeep(this.options, options);
|
|
11724
|
-
}
|
|
11725
|
-
});
|
|
11726
|
-
extension.name = this.name;
|
|
11727
|
-
extension.parent = this.parent;
|
|
11728
|
-
return extension;
|
|
11729
|
-
}
|
|
11730
|
-
extend(extendedConfig = {}) {
|
|
11731
|
-
const extension = new _Extension({ ...this.config, ...extendedConfig });
|
|
11732
|
-
extension.parent = this;
|
|
11733
|
-
this.child = extension;
|
|
11734
|
-
extension.name = extendedConfig.name ? extendedConfig.name : extension.parent.name;
|
|
11735
|
-
if (extendedConfig.defaultOptions && Object.keys(extendedConfig.defaultOptions).length > 0) {
|
|
11736
|
-
console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${extension.name}".`);
|
|
11737
|
-
}
|
|
11738
|
-
extension.options = callOrReturn(getExtensionField(extension, "addOptions", {
|
|
11739
|
-
name: extension.name
|
|
11740
|
-
}));
|
|
11741
|
-
extension.storage = callOrReturn(getExtensionField(extension, "addStorage", {
|
|
11742
|
-
name: extension.name,
|
|
11743
|
-
options: extension.options
|
|
11744
|
-
}));
|
|
11745
|
-
return extension;
|
|
11746
|
-
}
|
|
11747
|
-
};
|
|
11748
|
-
function getTextBetween(startNode, range, options) {
|
|
11749
|
-
const { from, to } = range;
|
|
11750
|
-
const { blockSeparator = "\n\n", textSerializers = {} } = options || {};
|
|
11751
|
-
let text = "";
|
|
11752
|
-
startNode.nodesBetween(from, to, (node2, pos, parent, index2) => {
|
|
11753
|
-
var _a;
|
|
11754
|
-
if (node2.isBlock && pos > from) {
|
|
11755
|
-
text += blockSeparator;
|
|
11756
|
-
}
|
|
11757
|
-
const textSerializer = textSerializers === null || textSerializers === void 0 ? void 0 : textSerializers[node2.type.name];
|
|
11758
|
-
if (textSerializer) {
|
|
11759
|
-
if (parent) {
|
|
11760
|
-
text += textSerializer({
|
|
11761
|
-
node: node2,
|
|
11762
|
-
pos,
|
|
11763
|
-
parent,
|
|
11764
|
-
index: index2,
|
|
11765
|
-
range
|
|
11766
|
-
});
|
|
11767
|
-
}
|
|
11768
|
-
return false;
|
|
11769
|
-
}
|
|
11770
|
-
if (node2.isText) {
|
|
11771
|
-
text += (_a = node2 === null || node2 === void 0 ? void 0 : node2.text) === null || _a === void 0 ? void 0 : _a.slice(Math.max(from, pos) - pos, to - pos);
|
|
11772
|
-
}
|
|
11773
|
-
});
|
|
11774
|
-
return text;
|
|
11775
|
-
}
|
|
11776
|
-
function getTextSerializersFromSchema(schema) {
|
|
11777
|
-
return Object.fromEntries(Object.entries(schema.nodes).filter(([, node2]) => node2.spec.toText).map(([name, node2]) => [name, node2.spec.toText]));
|
|
11778
|
-
}
|
|
11779
|
-
var ClipboardTextSerializer = Extension.create({
|
|
11780
|
-
name: "clipboardTextSerializer",
|
|
11781
|
-
addOptions() {
|
|
11782
|
-
return {
|
|
11783
|
-
blockSeparator: void 0
|
|
11784
|
-
};
|
|
11785
|
-
},
|
|
11786
|
-
addProseMirrorPlugins() {
|
|
11787
|
-
return [
|
|
11788
|
-
new Plugin({
|
|
11789
|
-
key: new PluginKey("clipboardTextSerializer"),
|
|
11790
|
-
props: {
|
|
11791
|
-
clipboardTextSerializer: () => {
|
|
11792
|
-
const { editor } = this;
|
|
11793
|
-
const { state, schema } = editor;
|
|
11794
|
-
const { doc, selection } = state;
|
|
11795
|
-
const { ranges } = selection;
|
|
11796
|
-
const from = Math.min(...ranges.map((range2) => range2.$from.pos));
|
|
11797
|
-
const to = Math.max(...ranges.map((range2) => range2.$to.pos));
|
|
11798
|
-
const textSerializers = getTextSerializersFromSchema(schema);
|
|
11799
|
-
const range = { from, to };
|
|
11800
|
-
return getTextBetween(doc, range, {
|
|
11801
|
-
...this.options.blockSeparator !== void 0 ? { blockSeparator: this.options.blockSeparator } : {},
|
|
11802
|
-
textSerializers
|
|
11803
|
-
});
|
|
11804
|
-
}
|
|
11805
|
-
}
|
|
11806
|
-
})
|
|
11807
|
-
];
|
|
11808
|
-
}
|
|
11809
|
-
});
|
|
11810
|
-
var blur = () => ({ editor, view }) => {
|
|
11811
|
-
requestAnimationFrame(() => {
|
|
11812
|
-
var _a;
|
|
11813
|
-
if (!editor.isDestroyed) {
|
|
11814
|
-
view.dom.blur();
|
|
11815
|
-
(_a = window === null || window === void 0 ? void 0 : window.getSelection()) === null || _a === void 0 ? void 0 : _a.removeAllRanges();
|
|
11816
|
-
}
|
|
11817
|
-
});
|
|
11818
|
-
return true;
|
|
11819
|
-
};
|
|
11820
|
-
var clearContent = (emitUpdate = false) => ({ commands: commands2 }) => {
|
|
11821
|
-
return commands2.setContent("", emitUpdate);
|
|
11822
|
-
};
|
|
11823
|
-
var clearNodes = () => ({ state, tr, dispatch }) => {
|
|
11824
|
-
const { selection } = tr;
|
|
11825
|
-
const { ranges } = selection;
|
|
11826
|
-
if (!dispatch) {
|
|
11827
|
-
return true;
|
|
11828
|
-
}
|
|
11829
|
-
ranges.forEach(({ $from, $to }) => {
|
|
11830
|
-
state.doc.nodesBetween($from.pos, $to.pos, (node2, pos) => {
|
|
11831
|
-
if (node2.type.isText) {
|
|
11832
|
-
return;
|
|
11833
|
-
}
|
|
11834
|
-
const { doc, mapping } = tr;
|
|
11835
|
-
const $mappedFrom = doc.resolve(mapping.map(pos));
|
|
11836
|
-
const $mappedTo = doc.resolve(mapping.map(pos + node2.nodeSize));
|
|
11837
|
-
const nodeRange = $mappedFrom.blockRange($mappedTo);
|
|
11838
|
-
if (!nodeRange) {
|
|
11839
|
-
return;
|
|
11840
|
-
}
|
|
11841
|
-
const targetLiftDepth = liftTarget(nodeRange);
|
|
11842
|
-
if (node2.type.isTextblock) {
|
|
11843
|
-
const { defaultType } = $mappedFrom.parent.contentMatchAt($mappedFrom.index());
|
|
11844
|
-
tr.setNodeMarkup(nodeRange.start, defaultType);
|
|
11845
|
-
}
|
|
11846
|
-
if (targetLiftDepth || targetLiftDepth === 0) {
|
|
11847
|
-
tr.lift(nodeRange, targetLiftDepth);
|
|
11848
|
-
}
|
|
11849
|
-
});
|
|
11850
|
-
});
|
|
11851
|
-
return true;
|
|
11852
|
-
};
|
|
11853
|
-
var command = (fn) => (props) => {
|
|
11854
|
-
return fn(props);
|
|
11855
|
-
};
|
|
11856
|
-
var createParagraphNear = () => ({ state, dispatch }) => {
|
|
11857
|
-
return createParagraphNear$1(state, dispatch);
|
|
11858
|
-
};
|
|
11859
|
-
var cut = (originRange, targetPos) => ({ editor, tr }) => {
|
|
11860
|
-
const { state } = editor;
|
|
11861
|
-
const contentSlice = state.doc.slice(originRange.from, originRange.to);
|
|
11862
|
-
tr.deleteRange(originRange.from, originRange.to);
|
|
11863
|
-
const newPos = tr.mapping.map(targetPos);
|
|
11864
|
-
tr.insert(newPos, contentSlice.content);
|
|
11865
|
-
tr.setSelection(new TextSelection(tr.doc.resolve(Math.max(newPos - 1, 0))));
|
|
11866
|
-
return true;
|
|
11867
|
-
};
|
|
11868
|
-
var deleteCurrentNode = () => ({ tr, dispatch }) => {
|
|
11869
|
-
const { selection } = tr;
|
|
11870
|
-
const currentNode = selection.$anchor.node();
|
|
11871
|
-
if (currentNode.content.size > 0) {
|
|
11872
|
-
return false;
|
|
11873
|
-
}
|
|
11874
|
-
const $pos = tr.selection.$anchor;
|
|
11875
|
-
for (let depth = $pos.depth; depth > 0; depth -= 1) {
|
|
11876
|
-
const node2 = $pos.node(depth);
|
|
11877
|
-
if (node2.type === currentNode.type) {
|
|
11878
|
-
if (dispatch) {
|
|
11879
|
-
const from = $pos.before(depth);
|
|
11880
|
-
const to = $pos.after(depth);
|
|
11881
|
-
tr.delete(from, to).scrollIntoView();
|
|
11882
|
-
}
|
|
11883
|
-
return true;
|
|
11884
|
-
}
|
|
11885
|
-
}
|
|
11886
|
-
return false;
|
|
11887
|
-
};
|
|
11888
|
-
var deleteNode = (typeOrName) => ({ tr, state, dispatch }) => {
|
|
11889
|
-
const type = getNodeType(typeOrName, state.schema);
|
|
11890
|
-
const $pos = tr.selection.$anchor;
|
|
11891
|
-
for (let depth = $pos.depth; depth > 0; depth -= 1) {
|
|
11892
|
-
const node2 = $pos.node(depth);
|
|
11893
|
-
if (node2.type === type) {
|
|
11894
|
-
if (dispatch) {
|
|
11895
|
-
const from = $pos.before(depth);
|
|
11896
|
-
const to = $pos.after(depth);
|
|
11897
|
-
tr.delete(from, to).scrollIntoView();
|
|
11898
|
-
}
|
|
11899
|
-
return true;
|
|
11900
|
-
}
|
|
11901
|
-
}
|
|
11902
|
-
return false;
|
|
11903
|
-
};
|
|
11904
|
-
var deleteRange = (range) => ({ tr, dispatch }) => {
|
|
11905
|
-
const { from, to } = range;
|
|
11906
|
-
if (dispatch) {
|
|
11907
|
-
tr.delete(from, to);
|
|
11908
|
-
}
|
|
11909
|
-
return true;
|
|
11910
|
-
};
|
|
11911
|
-
var deleteSelection = () => ({ state, dispatch }) => {
|
|
11912
|
-
return deleteSelection$1(state, dispatch);
|
|
11913
|
-
};
|
|
11914
|
-
var enter = () => ({ commands: commands2 }) => {
|
|
11915
|
-
return commands2.keyboardShortcut("Enter");
|
|
11916
|
-
};
|
|
11917
|
-
var exitCode = () => ({ state, dispatch }) => {
|
|
11918
|
-
return exitCode$1(state, dispatch);
|
|
11919
|
-
};
|
|
11920
|
-
function objectIncludes(object1, object2, options = { strict: true }) {
|
|
11921
|
-
const keys = Object.keys(object2);
|
|
11922
|
-
if (!keys.length) {
|
|
11923
|
-
return true;
|
|
11924
|
-
}
|
|
11925
|
-
return keys.every((key) => {
|
|
11926
|
-
if (options.strict) {
|
|
11927
|
-
return object2[key] === object1[key];
|
|
11928
|
-
}
|
|
11929
|
-
if (isRegExp(object2[key])) {
|
|
11930
|
-
return object2[key].test(object1[key]);
|
|
11931
|
-
}
|
|
11932
|
-
return object2[key] === object1[key];
|
|
11933
|
-
});
|
|
11934
|
-
}
|
|
11935
|
-
function findMarkInSet(marks, type, attributes = {}) {
|
|
11936
|
-
return marks.find((item) => {
|
|
11937
|
-
return item.type === type && objectIncludes(
|
|
11938
|
-
// Only check equality for the attributes that are provided
|
|
11939
|
-
Object.fromEntries(Object.keys(attributes).map((k2) => [k2, item.attrs[k2]])),
|
|
11940
|
-
attributes
|
|
11941
|
-
);
|
|
11942
|
-
});
|
|
11943
|
-
}
|
|
11944
|
-
function isMarkInSet(marks, type, attributes = {}) {
|
|
11945
|
-
return !!findMarkInSet(marks, type, attributes);
|
|
11946
|
-
}
|
|
11947
|
-
function getMarkRange($pos, type, attributes) {
|
|
11948
|
-
var _a;
|
|
11949
|
-
if (!$pos || !type) {
|
|
11950
|
-
return;
|
|
11951
|
-
}
|
|
11952
|
-
let start = $pos.parent.childAfter($pos.parentOffset);
|
|
11953
|
-
if (!start.node || !start.node.marks.some((mark2) => mark2.type === type)) {
|
|
11954
|
-
start = $pos.parent.childBefore($pos.parentOffset);
|
|
11955
|
-
}
|
|
11956
|
-
if (!start.node || !start.node.marks.some((mark2) => mark2.type === type)) {
|
|
11957
|
-
return;
|
|
11958
|
-
}
|
|
11959
|
-
attributes = attributes || ((_a = start.node.marks[0]) === null || _a === void 0 ? void 0 : _a.attrs);
|
|
11960
|
-
const mark = findMarkInSet([...start.node.marks], type, attributes);
|
|
11961
|
-
if (!mark) {
|
|
11962
|
-
return;
|
|
11963
|
-
}
|
|
11964
|
-
let startIndex = start.index;
|
|
11965
|
-
let startPos = $pos.start() + start.offset;
|
|
11966
|
-
let endIndex = startIndex + 1;
|
|
11967
|
-
let endPos = startPos + start.node.nodeSize;
|
|
11968
|
-
while (startIndex > 0 && isMarkInSet([...$pos.parent.child(startIndex - 1).marks], type, attributes)) {
|
|
11969
|
-
startIndex -= 1;
|
|
11970
|
-
startPos -= $pos.parent.child(startIndex).nodeSize;
|
|
11971
|
-
}
|
|
11972
|
-
while (endIndex < $pos.parent.childCount && isMarkInSet([...$pos.parent.child(endIndex).marks], type, attributes)) {
|
|
11973
|
-
endPos += $pos.parent.child(endIndex).nodeSize;
|
|
11974
|
-
endIndex += 1;
|
|
11975
|
-
}
|
|
11976
|
-
return {
|
|
11977
|
-
from: startPos,
|
|
11978
|
-
to: endPos
|
|
11979
|
-
};
|
|
11980
|
-
}
|
|
11981
|
-
function getMarkType(nameOrType, schema) {
|
|
11982
|
-
if (typeof nameOrType === "string") {
|
|
11983
|
-
if (!schema.marks[nameOrType]) {
|
|
11984
|
-
throw Error(`There is no mark type named '${nameOrType}'. Maybe you forgot to add the extension?`);
|
|
11985
|
-
}
|
|
11986
|
-
return schema.marks[nameOrType];
|
|
11987
|
-
}
|
|
11988
|
-
return nameOrType;
|
|
11989
|
-
}
|
|
11990
|
-
var extendMarkRange = (typeOrName, attributes = {}) => ({ tr, state, dispatch }) => {
|
|
11991
|
-
const type = getMarkType(typeOrName, state.schema);
|
|
11992
|
-
const { doc, selection } = tr;
|
|
11993
|
-
const { $from, from, to } = selection;
|
|
11994
|
-
if (dispatch) {
|
|
11995
|
-
const range = getMarkRange($from, type, attributes);
|
|
11996
|
-
if (range && range.from <= from && range.to >= to) {
|
|
11997
|
-
const newSelection = TextSelection.create(doc, range.from, range.to);
|
|
11998
|
-
tr.setSelection(newSelection);
|
|
11999
|
-
}
|
|
12000
|
-
}
|
|
12001
|
-
return true;
|
|
12002
|
-
};
|
|
12003
|
-
var first = (commands2) => (props) => {
|
|
12004
|
-
const items = typeof commands2 === "function" ? commands2(props) : commands2;
|
|
12005
|
-
for (let i = 0; i < items.length; i += 1) {
|
|
12006
|
-
if (items[i](props)) {
|
|
12007
|
-
return true;
|
|
12008
|
-
}
|
|
12009
|
-
}
|
|
12010
|
-
return false;
|
|
12011
|
-
};
|
|
12012
|
-
function isTextSelection(value) {
|
|
12013
|
-
return value instanceof TextSelection;
|
|
12014
|
-
}
|
|
12015
|
-
function minMax(value = 0, min = 0, max = 0) {
|
|
12016
|
-
return Math.min(Math.max(value, min), max);
|
|
12017
|
-
}
|
|
12018
|
-
function resolveFocusPosition(doc, position = null) {
|
|
12019
|
-
if (!position) {
|
|
12020
|
-
return null;
|
|
12021
|
-
}
|
|
12022
|
-
const selectionAtStart = Selection.atStart(doc);
|
|
12023
|
-
const selectionAtEnd = Selection.atEnd(doc);
|
|
12024
|
-
if (position === "start" || position === true) {
|
|
12025
|
-
return selectionAtStart;
|
|
12026
|
-
}
|
|
12027
|
-
if (position === "end") {
|
|
12028
|
-
return selectionAtEnd;
|
|
12029
|
-
}
|
|
12030
|
-
const minPos = selectionAtStart.from;
|
|
12031
|
-
const maxPos = selectionAtEnd.to;
|
|
12032
|
-
if (position === "all") {
|
|
12033
|
-
return TextSelection.create(doc, minMax(0, minPos, maxPos), minMax(doc.content.size, minPos, maxPos));
|
|
12034
|
-
}
|
|
12035
|
-
return TextSelection.create(doc, minMax(position, minPos, maxPos), minMax(position, minPos, maxPos));
|
|
12036
|
-
}
|
|
12037
|
-
function isAndroid() {
|
|
12038
|
-
return navigator.platform === "Android" || /android/i.test(navigator.userAgent);
|
|
12039
|
-
}
|
|
12040
|
-
function isiOS() {
|
|
12041
|
-
return [
|
|
12042
|
-
"iPad Simulator",
|
|
12043
|
-
"iPhone Simulator",
|
|
12044
|
-
"iPod Simulator",
|
|
12045
|
-
"iPad",
|
|
12046
|
-
"iPhone",
|
|
12047
|
-
"iPod"
|
|
12048
|
-
].includes(navigator.platform) || navigator.userAgent.includes("Mac") && "ontouchend" in document;
|
|
12049
|
-
}
|
|
12050
|
-
function isSafari() {
|
|
12051
|
-
return typeof navigator !== "undefined" ? /^((?!chrome|android).)*safari/i.test(navigator.userAgent) : false;
|
|
12052
|
-
}
|
|
12053
|
-
var focus = (position = null, options = {}) => ({ editor, view, tr, dispatch }) => {
|
|
12054
|
-
options = {
|
|
12055
|
-
scrollIntoView: true,
|
|
12056
|
-
...options
|
|
12057
|
-
};
|
|
12058
|
-
const delayedFocus = () => {
|
|
12059
|
-
if (isiOS() || isAndroid()) {
|
|
12060
|
-
view.dom.focus();
|
|
12061
|
-
}
|
|
12062
|
-
requestAnimationFrame(() => {
|
|
12063
|
-
if (!editor.isDestroyed) {
|
|
12064
|
-
view.focus();
|
|
12065
|
-
if (isSafari() && !isiOS() && !isAndroid()) {
|
|
12066
|
-
view.dom.focus({ preventScroll: true });
|
|
12067
|
-
}
|
|
12068
|
-
}
|
|
12069
|
-
});
|
|
12070
|
-
};
|
|
12071
|
-
if (view.hasFocus() && position === null || position === false) {
|
|
12072
|
-
return true;
|
|
12073
|
-
}
|
|
12074
|
-
if (dispatch && position === null && !isTextSelection(editor.state.selection)) {
|
|
12075
|
-
delayedFocus();
|
|
12076
|
-
return true;
|
|
12077
|
-
}
|
|
12078
|
-
const selection = resolveFocusPosition(tr.doc, position) || editor.state.selection;
|
|
12079
|
-
const isSameSelection = editor.state.selection.eq(selection);
|
|
12080
|
-
if (dispatch) {
|
|
12081
|
-
if (!isSameSelection) {
|
|
12082
|
-
tr.setSelection(selection);
|
|
12083
|
-
}
|
|
12084
|
-
if (isSameSelection && tr.storedMarks) {
|
|
12085
|
-
tr.setStoredMarks(tr.storedMarks);
|
|
12086
|
-
}
|
|
12087
|
-
delayedFocus();
|
|
12088
|
-
}
|
|
12089
|
-
return true;
|
|
12090
|
-
};
|
|
12091
|
-
var forEach = (items, fn) => (props) => {
|
|
12092
|
-
return items.every((item, index2) => fn(item, { ...props, index: index2 }));
|
|
12093
|
-
};
|
|
12094
|
-
var insertContent = (value, options) => ({ tr, commands: commands2 }) => {
|
|
12095
|
-
return commands2.insertContentAt({ from: tr.selection.from, to: tr.selection.to }, value, options);
|
|
12096
|
-
};
|
|
12097
|
-
var removeWhitespaces = (node2) => {
|
|
12098
|
-
const children = node2.childNodes;
|
|
12099
|
-
for (let i = children.length - 1; i >= 0; i -= 1) {
|
|
12100
|
-
const child = children[i];
|
|
12101
|
-
if (child.nodeType === 3 && child.nodeValue && /^(\n\s\s|\n)$/.test(child.nodeValue)) {
|
|
12102
|
-
node2.removeChild(child);
|
|
12103
|
-
} else if (child.nodeType === 1) {
|
|
12104
|
-
removeWhitespaces(child);
|
|
12105
|
-
}
|
|
12106
|
-
}
|
|
12107
|
-
return node2;
|
|
12108
|
-
};
|
|
12109
|
-
function elementFromString(value) {
|
|
12110
|
-
const wrappedValue = `<body>${value}</body>`;
|
|
12111
|
-
const html = new window.DOMParser().parseFromString(wrappedValue, "text/html").body;
|
|
12112
|
-
return removeWhitespaces(html);
|
|
12113
|
-
}
|
|
12114
|
-
function createNodeFromContent(content, schema, options) {
|
|
12115
|
-
if (content instanceof Node$1 || content instanceof Fragment6) {
|
|
12116
|
-
return content;
|
|
12117
|
-
}
|
|
12118
|
-
options = {
|
|
12119
|
-
slice: true,
|
|
12120
|
-
parseOptions: {},
|
|
12121
|
-
...options
|
|
12122
|
-
};
|
|
12123
|
-
const isJSONContent = typeof content === "object" && content !== null;
|
|
12124
|
-
const isTextContent = typeof content === "string";
|
|
12125
|
-
if (isJSONContent) {
|
|
12126
|
-
try {
|
|
12127
|
-
const isArrayContent = Array.isArray(content) && content.length > 0;
|
|
12128
|
-
if (isArrayContent) {
|
|
12129
|
-
return Fragment6.fromArray(content.map((item) => schema.nodeFromJSON(item)));
|
|
12130
|
-
}
|
|
12131
|
-
const node2 = schema.nodeFromJSON(content);
|
|
12132
|
-
if (options.errorOnInvalidContent) {
|
|
12133
|
-
node2.check();
|
|
12134
|
-
}
|
|
12135
|
-
return node2;
|
|
12136
|
-
} catch (error) {
|
|
12137
|
-
if (options.errorOnInvalidContent) {
|
|
12138
|
-
throw new Error("[tiptap error]: Invalid JSON content", { cause: error });
|
|
12139
|
-
}
|
|
12140
|
-
console.warn("[tiptap warn]: Invalid content.", "Passed value:", content, "Error:", error);
|
|
12141
|
-
return createNodeFromContent("", schema, options);
|
|
12142
|
-
}
|
|
12143
|
-
}
|
|
12144
|
-
if (isTextContent) {
|
|
12145
|
-
if (options.errorOnInvalidContent) {
|
|
12146
|
-
let hasInvalidContent = false;
|
|
12147
|
-
let invalidContent = "";
|
|
12148
|
-
const contentCheckSchema = new Schema({
|
|
12149
|
-
topNode: schema.spec.topNode,
|
|
12150
|
-
marks: schema.spec.marks,
|
|
12151
|
-
// Prosemirror's schemas are executed such that: the last to execute, matches last
|
|
12152
|
-
// 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
|
|
12153
|
-
nodes: schema.spec.nodes.append({
|
|
12154
|
-
__tiptap__private__unknown__catch__all__node: {
|
|
12155
|
-
content: "inline*",
|
|
12156
|
-
group: "block",
|
|
12157
|
-
parseDOM: [
|
|
12158
|
-
{
|
|
12159
|
-
tag: "*",
|
|
12160
|
-
getAttrs: (e2) => {
|
|
12161
|
-
hasInvalidContent = true;
|
|
12162
|
-
invalidContent = typeof e2 === "string" ? e2 : e2.outerHTML;
|
|
12163
|
-
return null;
|
|
12164
|
-
}
|
|
12165
|
-
}
|
|
12166
|
-
]
|
|
12167
|
-
}
|
|
12168
|
-
})
|
|
12169
|
-
});
|
|
12170
|
-
if (options.slice) {
|
|
12171
|
-
DOMParser.fromSchema(contentCheckSchema).parseSlice(elementFromString(content), options.parseOptions);
|
|
12172
|
-
} else {
|
|
12173
|
-
DOMParser.fromSchema(contentCheckSchema).parse(elementFromString(content), options.parseOptions);
|
|
12174
|
-
}
|
|
12175
|
-
if (options.errorOnInvalidContent && hasInvalidContent) {
|
|
12176
|
-
throw new Error("[tiptap error]: Invalid HTML content", { cause: new Error(`Invalid element found: ${invalidContent}`) });
|
|
12177
|
-
}
|
|
12178
|
-
}
|
|
12179
|
-
const parser = DOMParser.fromSchema(schema);
|
|
12180
|
-
if (options.slice) {
|
|
12181
|
-
return parser.parseSlice(elementFromString(content), options.parseOptions).content;
|
|
12182
|
-
}
|
|
12183
|
-
return parser.parse(elementFromString(content), options.parseOptions);
|
|
12184
|
-
}
|
|
12185
|
-
return createNodeFromContent("", schema, options);
|
|
12186
|
-
}
|
|
12187
|
-
function selectionToInsertionEnd(tr, startLen, bias) {
|
|
12188
|
-
const last = tr.steps.length - 1;
|
|
12189
|
-
if (last < startLen) {
|
|
12190
|
-
return;
|
|
12191
|
-
}
|
|
12192
|
-
const step = tr.steps[last];
|
|
12193
|
-
if (!(step instanceof ReplaceStep || step instanceof ReplaceAroundStep)) {
|
|
12194
|
-
return;
|
|
12195
|
-
}
|
|
12196
|
-
const map = tr.mapping.maps[last];
|
|
12197
|
-
let end = 0;
|
|
12198
|
-
map.forEach((_from, _to, _newFrom, newTo) => {
|
|
12199
|
-
if (end === 0) {
|
|
12200
|
-
end = newTo;
|
|
12201
|
-
}
|
|
12202
|
-
});
|
|
12203
|
-
tr.setSelection(Selection.near(tr.doc.resolve(end), bias));
|
|
12204
|
-
}
|
|
12205
|
-
var isFragment = (nodeOrFragment) => {
|
|
12206
|
-
return !("type" in nodeOrFragment);
|
|
12207
|
-
};
|
|
12208
|
-
var insertContentAt = (position, value, options) => ({ tr, dispatch, editor }) => {
|
|
12209
|
-
var _a;
|
|
12210
|
-
if (dispatch) {
|
|
12211
|
-
options = {
|
|
12212
|
-
parseOptions: editor.options.parseOptions,
|
|
12213
|
-
updateSelection: true,
|
|
12214
|
-
applyInputRules: false,
|
|
12215
|
-
applyPasteRules: false,
|
|
12216
|
-
...options
|
|
12217
|
-
};
|
|
12218
|
-
let content;
|
|
12219
|
-
const emitContentError = (error) => {
|
|
12220
|
-
editor.emit("contentError", {
|
|
12221
|
-
editor,
|
|
12222
|
-
error,
|
|
12223
|
-
disableCollaboration: () => {
|
|
12224
|
-
if (editor.storage.collaboration) {
|
|
12225
|
-
editor.storage.collaboration.isDisabled = true;
|
|
12226
|
-
}
|
|
12227
|
-
}
|
|
12228
|
-
});
|
|
12229
|
-
};
|
|
12230
|
-
const parseOptions = {
|
|
12231
|
-
preserveWhitespace: "full",
|
|
12232
|
-
...options.parseOptions
|
|
12233
|
-
};
|
|
12234
|
-
if (!options.errorOnInvalidContent && !editor.options.enableContentCheck && editor.options.emitContentError) {
|
|
12235
|
-
try {
|
|
12236
|
-
createNodeFromContent(value, editor.schema, {
|
|
12237
|
-
parseOptions,
|
|
12238
|
-
errorOnInvalidContent: true
|
|
12239
|
-
});
|
|
12240
|
-
} catch (e2) {
|
|
12241
|
-
emitContentError(e2);
|
|
12242
|
-
}
|
|
12243
|
-
}
|
|
12244
|
-
try {
|
|
12245
|
-
content = createNodeFromContent(value, editor.schema, {
|
|
12246
|
-
parseOptions,
|
|
12247
|
-
errorOnInvalidContent: (_a = options.errorOnInvalidContent) !== null && _a !== void 0 ? _a : editor.options.enableContentCheck
|
|
12248
|
-
});
|
|
12249
|
-
} catch (e2) {
|
|
12250
|
-
emitContentError(e2);
|
|
12251
|
-
return false;
|
|
12252
|
-
}
|
|
12253
|
-
let { from, to } = typeof position === "number" ? { from: position, to: position } : { from: position.from, to: position.to };
|
|
12254
|
-
let isOnlyTextContent = true;
|
|
12255
|
-
let isOnlyBlockContent = true;
|
|
12256
|
-
const nodes = isFragment(content) ? content : [content];
|
|
12257
|
-
nodes.forEach((node2) => {
|
|
12258
|
-
node2.check();
|
|
12259
|
-
isOnlyTextContent = isOnlyTextContent ? node2.isText && node2.marks.length === 0 : false;
|
|
12260
|
-
isOnlyBlockContent = isOnlyBlockContent ? node2.isBlock : false;
|
|
12261
|
-
});
|
|
12262
|
-
if (from === to && isOnlyBlockContent) {
|
|
12263
|
-
const { parent } = tr.doc.resolve(from);
|
|
12264
|
-
const isEmptyTextBlock = parent.isTextblock && !parent.type.spec.code && !parent.childCount;
|
|
12265
|
-
if (isEmptyTextBlock) {
|
|
12266
|
-
from -= 1;
|
|
12267
|
-
to += 1;
|
|
12268
|
-
}
|
|
12269
|
-
}
|
|
12270
|
-
let newContent;
|
|
12271
|
-
if (isOnlyTextContent) {
|
|
12272
|
-
if (Array.isArray(value)) {
|
|
12273
|
-
newContent = value.map((v2) => v2.text || "").join("");
|
|
12274
|
-
} else if (value instanceof Fragment6) {
|
|
12275
|
-
let text = "";
|
|
12276
|
-
value.forEach((node2) => {
|
|
12277
|
-
if (node2.text) {
|
|
12278
|
-
text += node2.text;
|
|
12279
|
-
}
|
|
12280
|
-
});
|
|
12281
|
-
newContent = text;
|
|
12282
|
-
} else if (typeof value === "object" && !!value && !!value.text) {
|
|
12283
|
-
newContent = value.text;
|
|
12284
|
-
} else {
|
|
12285
|
-
newContent = value;
|
|
12286
|
-
}
|
|
12287
|
-
tr.insertText(newContent, from, to);
|
|
12288
|
-
} else {
|
|
12289
|
-
newContent = content;
|
|
12290
|
-
tr.replaceWith(from, to, newContent);
|
|
12291
|
-
}
|
|
12292
|
-
if (options.updateSelection) {
|
|
12293
|
-
selectionToInsertionEnd(tr, tr.steps.length - 1, -1);
|
|
12294
|
-
}
|
|
12295
|
-
if (options.applyInputRules) {
|
|
12296
|
-
tr.setMeta("applyInputRules", { from, text: newContent });
|
|
12297
|
-
}
|
|
12298
|
-
if (options.applyPasteRules) {
|
|
12299
|
-
tr.setMeta("applyPasteRules", { from, text: newContent });
|
|
12300
|
-
}
|
|
12301
|
-
}
|
|
12302
|
-
return true;
|
|
12303
|
-
};
|
|
12304
|
-
var joinUp = () => ({ state, dispatch }) => {
|
|
12305
|
-
return joinUp$1(state, dispatch);
|
|
12306
|
-
};
|
|
12307
|
-
var joinDown = () => ({ state, dispatch }) => {
|
|
12308
|
-
return joinDown$1(state, dispatch);
|
|
12309
|
-
};
|
|
12310
|
-
var joinBackward = () => ({ state, dispatch }) => {
|
|
12311
|
-
return joinBackward$1(state, dispatch);
|
|
12312
|
-
};
|
|
12313
|
-
var joinForward = () => ({ state, dispatch }) => {
|
|
12314
|
-
return joinForward$1(state, dispatch);
|
|
12315
|
-
};
|
|
12316
|
-
var joinItemBackward = () => ({ state, dispatch, tr }) => {
|
|
12317
|
-
try {
|
|
12318
|
-
const point = joinPoint(state.doc, state.selection.$from.pos, -1);
|
|
12319
|
-
if (point === null || point === void 0) {
|
|
12320
|
-
return false;
|
|
12321
|
-
}
|
|
12322
|
-
tr.join(point, 2);
|
|
12323
|
-
if (dispatch) {
|
|
12324
|
-
dispatch(tr);
|
|
12325
|
-
}
|
|
12326
|
-
return true;
|
|
12327
|
-
} catch {
|
|
12328
|
-
return false;
|
|
12329
|
-
}
|
|
12330
|
-
};
|
|
12331
|
-
var joinItemForward = () => ({ state, dispatch, tr }) => {
|
|
12332
|
-
try {
|
|
12333
|
-
const point = joinPoint(state.doc, state.selection.$from.pos, 1);
|
|
12334
|
-
if (point === null || point === void 0) {
|
|
12335
|
-
return false;
|
|
12336
|
-
}
|
|
12337
|
-
tr.join(point, 2);
|
|
12338
|
-
if (dispatch) {
|
|
12339
|
-
dispatch(tr);
|
|
12340
|
-
}
|
|
12341
|
-
return true;
|
|
12342
|
-
} catch {
|
|
12343
|
-
return false;
|
|
12344
|
-
}
|
|
12345
|
-
};
|
|
12346
|
-
var joinTextblockBackward = () => ({ state, dispatch }) => {
|
|
12347
|
-
return joinTextblockBackward$1(state, dispatch);
|
|
12348
|
-
};
|
|
12349
|
-
var joinTextblockForward = () => ({ state, dispatch }) => {
|
|
12350
|
-
return joinTextblockForward$1(state, dispatch);
|
|
12351
|
-
};
|
|
12352
|
-
function isMacOS() {
|
|
12353
|
-
return typeof navigator !== "undefined" ? /Mac/.test(navigator.platform) : false;
|
|
12354
|
-
}
|
|
12355
|
-
function normalizeKeyName(name) {
|
|
12356
|
-
const parts = name.split(/-(?!$)/);
|
|
12357
|
-
let result = parts[parts.length - 1];
|
|
12358
|
-
if (result === "Space") {
|
|
12359
|
-
result = " ";
|
|
12360
|
-
}
|
|
12361
|
-
let alt;
|
|
12362
|
-
let ctrl;
|
|
12363
|
-
let shift;
|
|
12364
|
-
let meta;
|
|
12365
|
-
for (let i = 0; i < parts.length - 1; i += 1) {
|
|
12366
|
-
const mod = parts[i];
|
|
12367
|
-
if (/^(cmd|meta|m)$/i.test(mod)) {
|
|
12368
|
-
meta = true;
|
|
12369
|
-
} else if (/^a(lt)?$/i.test(mod)) {
|
|
12370
|
-
alt = true;
|
|
12371
|
-
} else if (/^(c|ctrl|control)$/i.test(mod)) {
|
|
12372
|
-
ctrl = true;
|
|
12373
|
-
} else if (/^s(hift)?$/i.test(mod)) {
|
|
12374
|
-
shift = true;
|
|
12375
|
-
} else if (/^mod$/i.test(mod)) {
|
|
12376
|
-
if (isiOS() || isMacOS()) {
|
|
12377
|
-
meta = true;
|
|
12378
|
-
} else {
|
|
12379
|
-
ctrl = true;
|
|
12380
|
-
}
|
|
12381
|
-
} else {
|
|
12382
|
-
throw new Error(`Unrecognized modifier name: ${mod}`);
|
|
12383
|
-
}
|
|
12384
|
-
}
|
|
12385
|
-
if (alt) {
|
|
12386
|
-
result = `Alt-${result}`;
|
|
12387
|
-
}
|
|
12388
|
-
if (ctrl) {
|
|
12389
|
-
result = `Ctrl-${result}`;
|
|
12390
|
-
}
|
|
12391
|
-
if (meta) {
|
|
12392
|
-
result = `Meta-${result}`;
|
|
12393
|
-
}
|
|
12394
|
-
if (shift) {
|
|
12395
|
-
result = `Shift-${result}`;
|
|
12396
|
-
}
|
|
12397
|
-
return result;
|
|
12398
|
-
}
|
|
12399
|
-
var keyboardShortcut = (name) => ({ editor, view, tr, dispatch }) => {
|
|
12400
|
-
const keys = normalizeKeyName(name).split(/-(?!$)/);
|
|
12401
|
-
const key = keys.find((item) => !["Alt", "Ctrl", "Meta", "Shift"].includes(item));
|
|
12402
|
-
const event = new KeyboardEvent("keydown", {
|
|
12403
|
-
key: key === "Space" ? " " : key,
|
|
12404
|
-
altKey: keys.includes("Alt"),
|
|
12405
|
-
ctrlKey: keys.includes("Ctrl"),
|
|
12406
|
-
metaKey: keys.includes("Meta"),
|
|
12407
|
-
shiftKey: keys.includes("Shift"),
|
|
12408
|
-
bubbles: true,
|
|
12409
|
-
cancelable: true
|
|
12410
|
-
});
|
|
12411
|
-
const capturedTransaction = editor.captureTransaction(() => {
|
|
12412
|
-
view.someProp("handleKeyDown", (f) => f(view, event));
|
|
12413
|
-
});
|
|
12414
|
-
capturedTransaction === null || capturedTransaction === void 0 ? void 0 : capturedTransaction.steps.forEach((step) => {
|
|
12415
|
-
const newStep = step.map(tr.mapping);
|
|
12416
|
-
if (newStep && dispatch) {
|
|
12417
|
-
tr.maybeStep(newStep);
|
|
12418
|
-
}
|
|
12419
|
-
});
|
|
12420
|
-
return true;
|
|
12421
|
-
};
|
|
12422
|
-
function isNodeActive(state, typeOrName, attributes = {}) {
|
|
12423
|
-
const { from, to, empty } = state.selection;
|
|
12424
|
-
const type = typeOrName ? getNodeType(typeOrName, state.schema) : null;
|
|
12425
|
-
const nodeRanges = [];
|
|
12426
|
-
state.doc.nodesBetween(from, to, (node2, pos) => {
|
|
12427
|
-
if (node2.isText) {
|
|
12428
|
-
return;
|
|
12429
|
-
}
|
|
12430
|
-
const relativeFrom = Math.max(from, pos);
|
|
12431
|
-
const relativeTo = Math.min(to, pos + node2.nodeSize);
|
|
12432
|
-
nodeRanges.push({
|
|
12433
|
-
node: node2,
|
|
12434
|
-
from: relativeFrom,
|
|
12435
|
-
to: relativeTo
|
|
12436
|
-
});
|
|
12437
|
-
});
|
|
12438
|
-
const selectionRange = to - from;
|
|
12439
|
-
const matchedNodeRanges = nodeRanges.filter((nodeRange) => {
|
|
12440
|
-
if (!type) {
|
|
12441
|
-
return true;
|
|
12442
|
-
}
|
|
12443
|
-
return type.name === nodeRange.node.type.name;
|
|
12444
|
-
}).filter((nodeRange) => objectIncludes(nodeRange.node.attrs, attributes, { strict: false }));
|
|
12445
|
-
if (empty) {
|
|
12446
|
-
return !!matchedNodeRanges.length;
|
|
12447
|
-
}
|
|
12448
|
-
const range = matchedNodeRanges.reduce((sum, nodeRange) => sum + nodeRange.to - nodeRange.from, 0);
|
|
12449
|
-
return range >= selectionRange;
|
|
12450
|
-
}
|
|
12451
|
-
var lift = (typeOrName, attributes = {}) => ({ state, dispatch }) => {
|
|
12452
|
-
const type = getNodeType(typeOrName, state.schema);
|
|
12453
|
-
const isActive = isNodeActive(state, type, attributes);
|
|
12454
|
-
if (!isActive) {
|
|
12455
|
-
return false;
|
|
12456
|
-
}
|
|
12457
|
-
return lift$1(state, dispatch);
|
|
12458
|
-
};
|
|
12459
|
-
var liftEmptyBlock = () => ({ state, dispatch }) => {
|
|
12460
|
-
return liftEmptyBlock$1(state, dispatch);
|
|
12461
|
-
};
|
|
12462
|
-
var liftListItem = (typeOrName) => ({ state, dispatch }) => {
|
|
12463
|
-
const type = getNodeType(typeOrName, state.schema);
|
|
12464
|
-
return liftListItem$1(type)(state, dispatch);
|
|
12465
|
-
};
|
|
12466
|
-
var newlineInCode = () => ({ state, dispatch }) => {
|
|
12467
|
-
return newlineInCode$1(state, dispatch);
|
|
12468
|
-
};
|
|
12469
|
-
function getSchemaTypeNameByName(name, schema) {
|
|
12470
|
-
if (schema.nodes[name]) {
|
|
12471
|
-
return "node";
|
|
12472
|
-
}
|
|
12473
|
-
if (schema.marks[name]) {
|
|
12474
|
-
return "mark";
|
|
12475
|
-
}
|
|
12476
|
-
return null;
|
|
12477
|
-
}
|
|
12478
|
-
function deleteProps(obj, propOrProps) {
|
|
12479
|
-
const props = typeof propOrProps === "string" ? [propOrProps] : propOrProps;
|
|
12480
|
-
return Object.keys(obj).reduce((newObj, prop) => {
|
|
12481
|
-
if (!props.includes(prop)) {
|
|
12482
|
-
newObj[prop] = obj[prop];
|
|
12483
|
-
}
|
|
12484
|
-
return newObj;
|
|
12485
|
-
}, {});
|
|
12486
|
-
}
|
|
12487
|
-
var resetAttributes = (typeOrName, attributes) => ({ tr, state, dispatch }) => {
|
|
12488
|
-
let nodeType = null;
|
|
12489
|
-
let markType = null;
|
|
12490
|
-
const schemaType = getSchemaTypeNameByName(typeof typeOrName === "string" ? typeOrName : typeOrName.name, state.schema);
|
|
12491
|
-
if (!schemaType) {
|
|
12492
|
-
return false;
|
|
12493
|
-
}
|
|
12494
|
-
if (schemaType === "node") {
|
|
12495
|
-
nodeType = getNodeType(typeOrName, state.schema);
|
|
12496
|
-
}
|
|
12497
|
-
if (schemaType === "mark") {
|
|
12498
|
-
markType = getMarkType(typeOrName, state.schema);
|
|
12499
|
-
}
|
|
12500
|
-
if (dispatch) {
|
|
12501
|
-
tr.selection.ranges.forEach((range) => {
|
|
12502
|
-
state.doc.nodesBetween(range.$from.pos, range.$to.pos, (node2, pos) => {
|
|
12503
|
-
if (nodeType && nodeType === node2.type) {
|
|
12504
|
-
tr.setNodeMarkup(pos, void 0, deleteProps(node2.attrs, attributes));
|
|
12505
|
-
}
|
|
12506
|
-
if (markType && node2.marks.length) {
|
|
12507
|
-
node2.marks.forEach((mark) => {
|
|
12508
|
-
if (markType === mark.type) {
|
|
12509
|
-
tr.addMark(pos, pos + node2.nodeSize, markType.create(deleteProps(mark.attrs, attributes)));
|
|
12510
|
-
}
|
|
12511
|
-
});
|
|
12512
|
-
}
|
|
12513
|
-
});
|
|
12514
|
-
});
|
|
12515
|
-
}
|
|
12516
|
-
return true;
|
|
12517
|
-
};
|
|
12518
|
-
var scrollIntoView = () => ({ tr, dispatch }) => {
|
|
12519
|
-
if (dispatch) {
|
|
12520
|
-
tr.scrollIntoView();
|
|
12521
|
-
}
|
|
12522
|
-
return true;
|
|
12523
|
-
};
|
|
12524
|
-
var selectAll = () => ({ tr, dispatch }) => {
|
|
12525
|
-
if (dispatch) {
|
|
12526
|
-
const selection = new AllSelection(tr.doc);
|
|
12527
|
-
tr.setSelection(selection);
|
|
12528
|
-
}
|
|
12529
|
-
return true;
|
|
12530
|
-
};
|
|
12531
|
-
var selectNodeBackward = () => ({ state, dispatch }) => {
|
|
12532
|
-
return selectNodeBackward$1(state, dispatch);
|
|
12533
|
-
};
|
|
12534
|
-
var selectNodeForward = () => ({ state, dispatch }) => {
|
|
12535
|
-
return selectNodeForward$1(state, dispatch);
|
|
12536
|
-
};
|
|
12537
|
-
var selectParentNode = () => ({ state, dispatch }) => {
|
|
12538
|
-
return selectParentNode$1(state, dispatch);
|
|
12539
|
-
};
|
|
12540
|
-
var selectTextblockEnd = () => ({ state, dispatch }) => {
|
|
12541
|
-
return selectTextblockEnd$1(state, dispatch);
|
|
12542
|
-
};
|
|
12543
|
-
var selectTextblockStart = () => ({ state, dispatch }) => {
|
|
12544
|
-
return selectTextblockStart$1(state, dispatch);
|
|
12545
|
-
};
|
|
12546
|
-
function createDocument(content, schema, parseOptions = {}, options = {}) {
|
|
12547
|
-
return createNodeFromContent(content, schema, {
|
|
12548
|
-
slice: false,
|
|
12549
|
-
parseOptions,
|
|
12550
|
-
errorOnInvalidContent: options.errorOnInvalidContent
|
|
12551
|
-
});
|
|
12552
|
-
}
|
|
12553
|
-
var setContent = (content, emitUpdate = false, parseOptions = {}, options = {}) => ({ editor, tr, dispatch, commands: commands2 }) => {
|
|
12554
|
-
var _a, _b;
|
|
12555
|
-
const { doc } = tr;
|
|
12556
|
-
if (parseOptions.preserveWhitespace !== "full") {
|
|
12557
|
-
const document2 = createDocument(content, editor.schema, parseOptions, {
|
|
12558
|
-
errorOnInvalidContent: (_a = options.errorOnInvalidContent) !== null && _a !== void 0 ? _a : editor.options.enableContentCheck
|
|
12559
|
-
});
|
|
12560
|
-
if (dispatch) {
|
|
12561
|
-
tr.replaceWith(0, doc.content.size, document2).setMeta("preventUpdate", !emitUpdate);
|
|
12562
|
-
}
|
|
12563
|
-
return true;
|
|
12564
|
-
}
|
|
12565
|
-
if (dispatch) {
|
|
12566
|
-
tr.setMeta("preventUpdate", !emitUpdate);
|
|
12567
|
-
}
|
|
12568
|
-
return commands2.insertContentAt({ from: 0, to: doc.content.size }, content, {
|
|
12569
|
-
parseOptions,
|
|
12570
|
-
errorOnInvalidContent: (_b = options.errorOnInvalidContent) !== null && _b !== void 0 ? _b : editor.options.enableContentCheck
|
|
12571
|
-
});
|
|
12572
|
-
};
|
|
12573
|
-
function getMarkAttributes(state, typeOrName) {
|
|
12574
|
-
const type = getMarkType(typeOrName, state.schema);
|
|
12575
|
-
const { from, to, empty } = state.selection;
|
|
12576
|
-
const marks = [];
|
|
12577
|
-
if (empty) {
|
|
12578
|
-
if (state.storedMarks) {
|
|
12579
|
-
marks.push(...state.storedMarks);
|
|
12580
|
-
}
|
|
12581
|
-
marks.push(...state.selection.$head.marks());
|
|
12582
|
-
} else {
|
|
12583
|
-
state.doc.nodesBetween(from, to, (node2) => {
|
|
12584
|
-
marks.push(...node2.marks);
|
|
12585
|
-
});
|
|
12586
|
-
}
|
|
12587
|
-
const mark = marks.find((markItem) => markItem.type.name === type.name);
|
|
12588
|
-
if (!mark) {
|
|
12589
|
-
return {};
|
|
12590
|
-
}
|
|
12591
|
-
return { ...mark.attrs };
|
|
12592
|
-
}
|
|
12593
|
-
function defaultBlockAt(match) {
|
|
12594
|
-
for (let i = 0; i < match.edgeCount; i += 1) {
|
|
12595
|
-
const { type } = match.edge(i);
|
|
12596
|
-
if (type.isTextblock && !type.hasRequiredAttrs()) {
|
|
12597
|
-
return type;
|
|
12598
|
-
}
|
|
12599
|
-
}
|
|
12600
|
-
return null;
|
|
12601
|
-
}
|
|
12602
|
-
function findParentNodeClosestToPos($pos, predicate) {
|
|
12603
|
-
for (let i = $pos.depth; i > 0; i -= 1) {
|
|
12604
|
-
const node2 = $pos.node(i);
|
|
12605
|
-
if (predicate(node2)) {
|
|
12606
|
-
return {
|
|
12607
|
-
pos: i > 0 ? $pos.before(i) : 0,
|
|
12608
|
-
start: $pos.start(i),
|
|
12609
|
-
depth: i,
|
|
12610
|
-
node: node2
|
|
12611
|
-
};
|
|
12612
|
-
}
|
|
12613
|
-
}
|
|
12614
|
-
}
|
|
12615
|
-
function findParentNode(predicate) {
|
|
12616
|
-
return (selection) => findParentNodeClosestToPos(selection.$from, predicate);
|
|
12617
|
-
}
|
|
12618
|
-
function getSplittedAttributes(extensionAttributes, typeName, attributes) {
|
|
12619
|
-
return Object.fromEntries(Object.entries(attributes).filter(([name]) => {
|
|
12620
|
-
const extensionAttribute = extensionAttributes.find((item) => {
|
|
12621
|
-
return item.type === typeName && item.name === name;
|
|
12622
|
-
});
|
|
12623
|
-
if (!extensionAttribute) {
|
|
12624
|
-
return false;
|
|
12625
|
-
}
|
|
12626
|
-
return extensionAttribute.attribute.keepOnSplit;
|
|
12627
|
-
}));
|
|
12628
|
-
}
|
|
12629
|
-
function isMarkActive(state, typeOrName, attributes = {}) {
|
|
12630
|
-
const { empty, ranges } = state.selection;
|
|
12631
|
-
const type = typeOrName ? getMarkType(typeOrName, state.schema) : null;
|
|
12632
|
-
if (empty) {
|
|
12633
|
-
return !!(state.storedMarks || state.selection.$from.marks()).filter((mark) => {
|
|
12634
|
-
if (!type) {
|
|
12635
|
-
return true;
|
|
12636
|
-
}
|
|
12637
|
-
return type.name === mark.type.name;
|
|
12638
|
-
}).find((mark) => objectIncludes(mark.attrs, attributes, { strict: false }));
|
|
12639
|
-
}
|
|
12640
|
-
let selectionRange = 0;
|
|
12641
|
-
const markRanges = [];
|
|
12642
|
-
ranges.forEach(({ $from, $to }) => {
|
|
12643
|
-
const from = $from.pos;
|
|
12644
|
-
const to = $to.pos;
|
|
12645
|
-
state.doc.nodesBetween(from, to, (node2, pos) => {
|
|
12646
|
-
if (!node2.isText && !node2.marks.length) {
|
|
12647
|
-
return;
|
|
12648
|
-
}
|
|
12649
|
-
const relativeFrom = Math.max(from, pos);
|
|
12650
|
-
const relativeTo = Math.min(to, pos + node2.nodeSize);
|
|
12651
|
-
const range2 = relativeTo - relativeFrom;
|
|
12652
|
-
selectionRange += range2;
|
|
12653
|
-
markRanges.push(...node2.marks.map((mark) => ({
|
|
12654
|
-
mark,
|
|
12655
|
-
from: relativeFrom,
|
|
12656
|
-
to: relativeTo
|
|
12657
|
-
})));
|
|
12658
|
-
});
|
|
12659
|
-
});
|
|
12660
|
-
if (selectionRange === 0) {
|
|
12661
|
-
return false;
|
|
12662
|
-
}
|
|
12663
|
-
const matchedRange = markRanges.filter((markRange) => {
|
|
12664
|
-
if (!type) {
|
|
12665
|
-
return true;
|
|
12666
|
-
}
|
|
12667
|
-
return type.name === markRange.mark.type.name;
|
|
12668
|
-
}).filter((markRange) => objectIncludes(markRange.mark.attrs, attributes, { strict: false })).reduce((sum, markRange) => sum + markRange.to - markRange.from, 0);
|
|
12669
|
-
const excludedRange = markRanges.filter((markRange) => {
|
|
12670
|
-
if (!type) {
|
|
12671
|
-
return true;
|
|
12672
|
-
}
|
|
12673
|
-
return markRange.mark.type !== type && markRange.mark.type.excludes(type);
|
|
12674
|
-
}).reduce((sum, markRange) => sum + markRange.to - markRange.from, 0);
|
|
12675
|
-
const range = matchedRange > 0 ? matchedRange + excludedRange : matchedRange;
|
|
12676
|
-
return range >= selectionRange;
|
|
12677
|
-
}
|
|
12678
|
-
function isList(name, extensions) {
|
|
12679
|
-
const { nodeExtensions } = splitExtensions(extensions);
|
|
12680
|
-
const extension = nodeExtensions.find((item) => item.name === name);
|
|
12681
|
-
if (!extension) {
|
|
12682
|
-
return false;
|
|
12683
|
-
}
|
|
12684
|
-
const context = {
|
|
12685
|
-
name: extension.name,
|
|
12686
|
-
options: extension.options,
|
|
12687
|
-
storage: extension.storage
|
|
12688
|
-
};
|
|
12689
|
-
const group = callOrReturn(getExtensionField(extension, "group", context));
|
|
12690
|
-
if (typeof group !== "string") {
|
|
12691
|
-
return false;
|
|
12692
|
-
}
|
|
12693
|
-
return group.split(" ").includes("list");
|
|
12694
|
-
}
|
|
12695
|
-
function isNodeEmpty(node2, { checkChildren = true, ignoreWhitespace = false } = {}) {
|
|
12696
|
-
var _a;
|
|
12697
|
-
if (ignoreWhitespace) {
|
|
12698
|
-
if (node2.type.name === "hardBreak") {
|
|
12699
|
-
return true;
|
|
12700
|
-
}
|
|
12701
|
-
if (node2.isText) {
|
|
12702
|
-
return /^\s*$/m.test((_a = node2.text) !== null && _a !== void 0 ? _a : "");
|
|
12703
|
-
}
|
|
12704
|
-
}
|
|
12705
|
-
if (node2.isText) {
|
|
12706
|
-
return !node2.text;
|
|
12707
|
-
}
|
|
12708
|
-
if (node2.isAtom || node2.isLeaf) {
|
|
12709
|
-
return false;
|
|
12710
|
-
}
|
|
12711
|
-
if (node2.content.childCount === 0) {
|
|
12712
|
-
return true;
|
|
12713
|
-
}
|
|
12714
|
-
if (checkChildren) {
|
|
12715
|
-
let isContentEmpty = true;
|
|
12716
|
-
node2.content.forEach((childNode) => {
|
|
12717
|
-
if (isContentEmpty === false) {
|
|
12718
|
-
return;
|
|
12719
|
-
}
|
|
12720
|
-
if (!isNodeEmpty(childNode, { ignoreWhitespace, checkChildren })) {
|
|
12721
|
-
isContentEmpty = false;
|
|
12722
|
-
}
|
|
12723
|
-
});
|
|
12724
|
-
return isContentEmpty;
|
|
12725
|
-
}
|
|
12726
|
-
return false;
|
|
12727
|
-
}
|
|
12728
|
-
function canSetMark(state, tr, newMarkType) {
|
|
12729
|
-
var _a;
|
|
12730
|
-
const { selection } = tr;
|
|
12731
|
-
let cursor = null;
|
|
12732
|
-
if (isTextSelection(selection)) {
|
|
12733
|
-
cursor = selection.$cursor;
|
|
12734
|
-
}
|
|
12735
|
-
if (cursor) {
|
|
12736
|
-
const currentMarks = (_a = state.storedMarks) !== null && _a !== void 0 ? _a : cursor.marks();
|
|
12737
|
-
return !!newMarkType.isInSet(currentMarks) || !currentMarks.some((mark) => mark.type.excludes(newMarkType));
|
|
12738
|
-
}
|
|
12739
|
-
const { ranges } = selection;
|
|
12740
|
-
return ranges.some(({ $from, $to }) => {
|
|
12741
|
-
let someNodeSupportsMark = $from.depth === 0 ? state.doc.inlineContent && state.doc.type.allowsMarkType(newMarkType) : false;
|
|
12742
|
-
state.doc.nodesBetween($from.pos, $to.pos, (node2, _pos, parent) => {
|
|
12743
|
-
if (someNodeSupportsMark) {
|
|
12744
|
-
return false;
|
|
12745
|
-
}
|
|
12746
|
-
if (node2.isInline) {
|
|
12747
|
-
const parentAllowsMarkType = !parent || parent.type.allowsMarkType(newMarkType);
|
|
12748
|
-
const currentMarksAllowMarkType = !!newMarkType.isInSet(node2.marks) || !node2.marks.some((otherMark) => otherMark.type.excludes(newMarkType));
|
|
12749
|
-
someNodeSupportsMark = parentAllowsMarkType && currentMarksAllowMarkType;
|
|
12750
|
-
}
|
|
12751
|
-
return !someNodeSupportsMark;
|
|
12752
|
-
});
|
|
12753
|
-
return someNodeSupportsMark;
|
|
12754
|
-
});
|
|
12755
|
-
}
|
|
12756
|
-
var setMark = (typeOrName, attributes = {}) => ({ tr, state, dispatch }) => {
|
|
12757
|
-
const { selection } = tr;
|
|
12758
|
-
const { empty, ranges } = selection;
|
|
12759
|
-
const type = getMarkType(typeOrName, state.schema);
|
|
12760
|
-
if (dispatch) {
|
|
12761
|
-
if (empty) {
|
|
12762
|
-
const oldAttributes = getMarkAttributes(state, type);
|
|
12763
|
-
tr.addStoredMark(type.create({
|
|
12764
|
-
...oldAttributes,
|
|
12765
|
-
...attributes
|
|
12766
|
-
}));
|
|
12767
|
-
} else {
|
|
12768
|
-
ranges.forEach((range) => {
|
|
12769
|
-
const from = range.$from.pos;
|
|
12770
|
-
const to = range.$to.pos;
|
|
12771
|
-
state.doc.nodesBetween(from, to, (node2, pos) => {
|
|
12772
|
-
const trimmedFrom = Math.max(pos, from);
|
|
12773
|
-
const trimmedTo = Math.min(pos + node2.nodeSize, to);
|
|
12774
|
-
const someHasMark = node2.marks.find((mark) => mark.type === type);
|
|
12775
|
-
if (someHasMark) {
|
|
12776
|
-
node2.marks.forEach((mark) => {
|
|
12777
|
-
if (type === mark.type) {
|
|
12778
|
-
tr.addMark(trimmedFrom, trimmedTo, type.create({
|
|
12779
|
-
...mark.attrs,
|
|
12780
|
-
...attributes
|
|
12781
|
-
}));
|
|
12782
|
-
}
|
|
12783
|
-
});
|
|
12784
|
-
} else {
|
|
12785
|
-
tr.addMark(trimmedFrom, trimmedTo, type.create(attributes));
|
|
12786
|
-
}
|
|
12787
|
-
});
|
|
12788
|
-
});
|
|
12789
|
-
}
|
|
12790
|
-
}
|
|
12791
|
-
return canSetMark(state, tr, type);
|
|
12792
|
-
};
|
|
12793
|
-
var setMeta = (key, value) => ({ tr }) => {
|
|
12794
|
-
tr.setMeta(key, value);
|
|
12795
|
-
return true;
|
|
12796
|
-
};
|
|
12797
|
-
var setNode = (typeOrName, attributes = {}) => ({ state, dispatch, chain }) => {
|
|
12798
|
-
const type = getNodeType(typeOrName, state.schema);
|
|
12799
|
-
let attributesToCopy;
|
|
12800
|
-
if (state.selection.$anchor.sameParent(state.selection.$head)) {
|
|
12801
|
-
attributesToCopy = state.selection.$anchor.parent.attrs;
|
|
12802
|
-
}
|
|
12803
|
-
if (!type.isTextblock) {
|
|
12804
|
-
console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.');
|
|
12805
|
-
return false;
|
|
12806
|
-
}
|
|
12807
|
-
return chain().command(({ commands: commands2 }) => {
|
|
12808
|
-
const canSetBlock = setBlockType(type, { ...attributesToCopy, ...attributes })(state);
|
|
12809
|
-
if (canSetBlock) {
|
|
12810
|
-
return true;
|
|
12811
|
-
}
|
|
12812
|
-
return commands2.clearNodes();
|
|
12813
|
-
}).command(({ state: updatedState }) => {
|
|
12814
|
-
return setBlockType(type, { ...attributesToCopy, ...attributes })(updatedState, dispatch);
|
|
12815
|
-
}).run();
|
|
12816
|
-
};
|
|
12817
|
-
var setNodeSelection = (position) => ({ tr, dispatch }) => {
|
|
12818
|
-
if (dispatch) {
|
|
12819
|
-
const { doc } = tr;
|
|
12820
|
-
const from = minMax(position, 0, doc.content.size);
|
|
12821
|
-
const selection = NodeSelection.create(doc, from);
|
|
12822
|
-
tr.setSelection(selection);
|
|
12823
|
-
}
|
|
12824
|
-
return true;
|
|
12825
|
-
};
|
|
12826
|
-
var setTextSelection = (position) => ({ tr, dispatch }) => {
|
|
12827
|
-
if (dispatch) {
|
|
12828
|
-
const { doc } = tr;
|
|
12829
|
-
const { from, to } = typeof position === "number" ? { from: position, to: position } : position;
|
|
12830
|
-
const minPos = TextSelection.atStart(doc).from;
|
|
12831
|
-
const maxPos = TextSelection.atEnd(doc).to;
|
|
12832
|
-
const resolvedFrom = minMax(from, minPos, maxPos);
|
|
12833
|
-
const resolvedEnd = minMax(to, minPos, maxPos);
|
|
12834
|
-
const selection = TextSelection.create(doc, resolvedFrom, resolvedEnd);
|
|
12835
|
-
tr.setSelection(selection);
|
|
12836
|
-
}
|
|
12837
|
-
return true;
|
|
12838
|
-
};
|
|
12839
|
-
var sinkListItem = (typeOrName) => ({ state, dispatch }) => {
|
|
12840
|
-
const type = getNodeType(typeOrName, state.schema);
|
|
12841
|
-
return sinkListItem$1(type)(state, dispatch);
|
|
12842
|
-
};
|
|
12843
|
-
function ensureMarks(state, splittableMarks) {
|
|
12844
|
-
const marks = state.storedMarks || state.selection.$to.parentOffset && state.selection.$from.marks();
|
|
12845
|
-
if (marks) {
|
|
12846
|
-
const filteredMarks = marks.filter((mark) => splittableMarks === null || splittableMarks === void 0 ? void 0 : splittableMarks.includes(mark.type.name));
|
|
12847
|
-
state.tr.ensureMarks(filteredMarks);
|
|
12848
|
-
}
|
|
12849
|
-
}
|
|
12850
|
-
var splitBlock = ({ keepMarks = true } = {}) => ({ tr, state, dispatch, editor }) => {
|
|
12851
|
-
const { selection, doc } = tr;
|
|
12852
|
-
const { $from, $to } = selection;
|
|
12853
|
-
const extensionAttributes = editor.extensionManager.attributes;
|
|
12854
|
-
const newAttributes = getSplittedAttributes(extensionAttributes, $from.node().type.name, $from.node().attrs);
|
|
12855
|
-
if (selection instanceof NodeSelection && selection.node.isBlock) {
|
|
12856
|
-
if (!$from.parentOffset || !canSplit(doc, $from.pos)) {
|
|
12857
|
-
return false;
|
|
12858
|
-
}
|
|
12859
|
-
if (dispatch) {
|
|
12860
|
-
if (keepMarks) {
|
|
12861
|
-
ensureMarks(state, editor.extensionManager.splittableMarks);
|
|
12862
|
-
}
|
|
12863
|
-
tr.split($from.pos).scrollIntoView();
|
|
12864
|
-
}
|
|
12865
|
-
return true;
|
|
12866
|
-
}
|
|
12867
|
-
if (!$from.parent.isBlock) {
|
|
12868
|
-
return false;
|
|
12869
|
-
}
|
|
12870
|
-
const atEnd = $to.parentOffset === $to.parent.content.size;
|
|
12871
|
-
const deflt = $from.depth === 0 ? void 0 : defaultBlockAt($from.node(-1).contentMatchAt($from.indexAfter(-1)));
|
|
12872
|
-
let types = atEnd && deflt ? [
|
|
12873
|
-
{
|
|
12874
|
-
type: deflt,
|
|
12875
|
-
attrs: newAttributes
|
|
12876
|
-
}
|
|
12877
|
-
] : void 0;
|
|
12878
|
-
let can = canSplit(tr.doc, tr.mapping.map($from.pos), 1, types);
|
|
12879
|
-
if (!types && !can && canSplit(tr.doc, tr.mapping.map($from.pos), 1, deflt ? [{ type: deflt }] : void 0)) {
|
|
12880
|
-
can = true;
|
|
12881
|
-
types = deflt ? [
|
|
12882
|
-
{
|
|
12883
|
-
type: deflt,
|
|
12884
|
-
attrs: newAttributes
|
|
12885
|
-
}
|
|
12886
|
-
] : void 0;
|
|
12887
|
-
}
|
|
12888
|
-
if (dispatch) {
|
|
12889
|
-
if (can) {
|
|
12890
|
-
if (selection instanceof TextSelection) {
|
|
12891
|
-
tr.deleteSelection();
|
|
12892
|
-
}
|
|
12893
|
-
tr.split(tr.mapping.map($from.pos), 1, types);
|
|
12894
|
-
if (deflt && !atEnd && !$from.parentOffset && $from.parent.type !== deflt) {
|
|
12895
|
-
const first2 = tr.mapping.map($from.before());
|
|
12896
|
-
const $first = tr.doc.resolve(first2);
|
|
12897
|
-
if ($from.node(-1).canReplaceWith($first.index(), $first.index() + 1, deflt)) {
|
|
12898
|
-
tr.setNodeMarkup(tr.mapping.map($from.before()), deflt);
|
|
12899
|
-
}
|
|
12900
|
-
}
|
|
12901
|
-
}
|
|
12902
|
-
if (keepMarks) {
|
|
12903
|
-
ensureMarks(state, editor.extensionManager.splittableMarks);
|
|
12904
|
-
}
|
|
12905
|
-
tr.scrollIntoView();
|
|
12906
|
-
}
|
|
12907
|
-
return can;
|
|
12908
|
-
};
|
|
12909
|
-
var splitListItem = (typeOrName, overrideAttrs = {}) => ({ tr, state, dispatch, editor }) => {
|
|
12910
|
-
var _a;
|
|
12911
|
-
const type = getNodeType(typeOrName, state.schema);
|
|
12912
|
-
const { $from, $to } = state.selection;
|
|
12913
|
-
const node2 = state.selection.node;
|
|
12914
|
-
if (node2 && node2.isBlock || $from.depth < 2 || !$from.sameParent($to)) {
|
|
12915
|
-
return false;
|
|
12916
|
-
}
|
|
12917
|
-
const grandParent = $from.node(-1);
|
|
12918
|
-
if (grandParent.type !== type) {
|
|
12919
|
-
return false;
|
|
12920
|
-
}
|
|
12921
|
-
const extensionAttributes = editor.extensionManager.attributes;
|
|
12922
|
-
if ($from.parent.content.size === 0 && $from.node(-1).childCount === $from.indexAfter(-1)) {
|
|
12923
|
-
if ($from.depth === 2 || $from.node(-3).type !== type || $from.index(-2) !== $from.node(-2).childCount - 1) {
|
|
12924
|
-
return false;
|
|
12925
|
-
}
|
|
12926
|
-
if (dispatch) {
|
|
12927
|
-
let wrap = Fragment6.empty;
|
|
12928
|
-
const depthBefore = $from.index(-1) ? 1 : $from.index(-2) ? 2 : 3;
|
|
12929
|
-
for (let d = $from.depth - depthBefore; d >= $from.depth - 3; d -= 1) {
|
|
12930
|
-
wrap = Fragment6.from($from.node(d).copy(wrap));
|
|
12931
|
-
}
|
|
12932
|
-
const depthAfter = $from.indexAfter(-1) < $from.node(-2).childCount ? 1 : $from.indexAfter(-2) < $from.node(-3).childCount ? 2 : 3;
|
|
12933
|
-
const newNextTypeAttributes2 = {
|
|
12934
|
-
...getSplittedAttributes(extensionAttributes, $from.node().type.name, $from.node().attrs),
|
|
12935
|
-
...overrideAttrs
|
|
12936
|
-
};
|
|
12937
|
-
const nextType2 = ((_a = type.contentMatch.defaultType) === null || _a === void 0 ? void 0 : _a.createAndFill(newNextTypeAttributes2)) || void 0;
|
|
12938
|
-
wrap = wrap.append(Fragment6.from(type.createAndFill(null, nextType2) || void 0));
|
|
12939
|
-
const start = $from.before($from.depth - (depthBefore - 1));
|
|
12940
|
-
tr.replace(start, $from.after(-depthAfter), new Slice(wrap, 4 - depthBefore, 0));
|
|
12941
|
-
let sel = -1;
|
|
12942
|
-
tr.doc.nodesBetween(start, tr.doc.content.size, (n, pos) => {
|
|
12943
|
-
if (sel > -1) {
|
|
12944
|
-
return false;
|
|
12945
|
-
}
|
|
12946
|
-
if (n.isTextblock && n.content.size === 0) {
|
|
12947
|
-
sel = pos + 1;
|
|
12948
|
-
}
|
|
12949
|
-
});
|
|
12950
|
-
if (sel > -1) {
|
|
12951
|
-
tr.setSelection(TextSelection.near(tr.doc.resolve(sel)));
|
|
12952
|
-
}
|
|
12953
|
-
tr.scrollIntoView();
|
|
12954
|
-
}
|
|
12955
|
-
return true;
|
|
12956
|
-
}
|
|
12957
|
-
const nextType = $to.pos === $from.end() ? grandParent.contentMatchAt(0).defaultType : null;
|
|
12958
|
-
const newTypeAttributes = {
|
|
12959
|
-
...getSplittedAttributes(extensionAttributes, grandParent.type.name, grandParent.attrs),
|
|
12960
|
-
...overrideAttrs
|
|
12961
|
-
};
|
|
12962
|
-
const newNextTypeAttributes = {
|
|
12963
|
-
...getSplittedAttributes(extensionAttributes, $from.node().type.name, $from.node().attrs),
|
|
12964
|
-
...overrideAttrs
|
|
12965
|
-
};
|
|
12966
|
-
tr.delete($from.pos, $to.pos);
|
|
12967
|
-
const types = nextType ? [
|
|
12968
|
-
{ type, attrs: newTypeAttributes },
|
|
12969
|
-
{ type: nextType, attrs: newNextTypeAttributes }
|
|
12970
|
-
] : [{ type, attrs: newTypeAttributes }];
|
|
12971
|
-
if (!canSplit(tr.doc, $from.pos, 2)) {
|
|
12972
|
-
return false;
|
|
12973
|
-
}
|
|
12974
|
-
if (dispatch) {
|
|
12975
|
-
const { selection, storedMarks } = state;
|
|
12976
|
-
const { splittableMarks } = editor.extensionManager;
|
|
12977
|
-
const marks = storedMarks || selection.$to.parentOffset && selection.$from.marks();
|
|
12978
|
-
tr.split($from.pos, 2, types).scrollIntoView();
|
|
12979
|
-
if (!marks || !dispatch) {
|
|
12980
|
-
return true;
|
|
12981
|
-
}
|
|
12982
|
-
const filteredMarks = marks.filter((mark) => splittableMarks.includes(mark.type.name));
|
|
12983
|
-
tr.ensureMarks(filteredMarks);
|
|
12984
|
-
}
|
|
12985
|
-
return true;
|
|
12986
|
-
};
|
|
12987
|
-
var joinListBackwards = (tr, listType) => {
|
|
12988
|
-
const list = findParentNode((node2) => node2.type === listType)(tr.selection);
|
|
12989
|
-
if (!list) {
|
|
12990
|
-
return true;
|
|
12991
|
-
}
|
|
12992
|
-
const before = tr.doc.resolve(Math.max(0, list.pos - 1)).before(list.depth);
|
|
12993
|
-
if (before === void 0) {
|
|
12994
|
-
return true;
|
|
12995
|
-
}
|
|
12996
|
-
const nodeBefore = tr.doc.nodeAt(before);
|
|
12997
|
-
const canJoinBackwards = list.node.type === (nodeBefore === null || nodeBefore === void 0 ? void 0 : nodeBefore.type) && canJoin(tr.doc, list.pos);
|
|
12998
|
-
if (!canJoinBackwards) {
|
|
12999
|
-
return true;
|
|
13000
|
-
}
|
|
13001
|
-
tr.join(list.pos);
|
|
13002
|
-
return true;
|
|
13003
|
-
};
|
|
13004
|
-
var joinListForwards = (tr, listType) => {
|
|
13005
|
-
const list = findParentNode((node2) => node2.type === listType)(tr.selection);
|
|
13006
|
-
if (!list) {
|
|
13007
|
-
return true;
|
|
13008
|
-
}
|
|
13009
|
-
const after = tr.doc.resolve(list.start).after(list.depth);
|
|
13010
|
-
if (after === void 0) {
|
|
13011
|
-
return true;
|
|
13012
|
-
}
|
|
13013
|
-
const nodeAfter = tr.doc.nodeAt(after);
|
|
13014
|
-
const canJoinForwards = list.node.type === (nodeAfter === null || nodeAfter === void 0 ? void 0 : nodeAfter.type) && canJoin(tr.doc, after);
|
|
13015
|
-
if (!canJoinForwards) {
|
|
13016
|
-
return true;
|
|
13017
|
-
}
|
|
13018
|
-
tr.join(after);
|
|
13019
|
-
return true;
|
|
13020
|
-
};
|
|
13021
|
-
var toggleList = (listTypeOrName, itemTypeOrName, keepMarks, attributes = {}) => ({ editor, tr, state, dispatch, chain, commands: commands2, can }) => {
|
|
13022
|
-
const { extensions, splittableMarks } = editor.extensionManager;
|
|
13023
|
-
const listType = getNodeType(listTypeOrName, state.schema);
|
|
13024
|
-
const itemType = getNodeType(itemTypeOrName, state.schema);
|
|
13025
|
-
const { selection, storedMarks } = state;
|
|
13026
|
-
const { $from, $to } = selection;
|
|
13027
|
-
const range = $from.blockRange($to);
|
|
13028
|
-
const marks = storedMarks || selection.$to.parentOffset && selection.$from.marks();
|
|
13029
|
-
if (!range) {
|
|
13030
|
-
return false;
|
|
13031
|
-
}
|
|
13032
|
-
const parentList = findParentNode((node2) => isList(node2.type.name, extensions))(selection);
|
|
13033
|
-
if (range.depth >= 1 && parentList && range.depth - parentList.depth <= 1) {
|
|
13034
|
-
if (parentList.node.type === listType) {
|
|
13035
|
-
return commands2.liftListItem(itemType);
|
|
13036
|
-
}
|
|
13037
|
-
if (isList(parentList.node.type.name, extensions) && listType.validContent(parentList.node.content) && dispatch) {
|
|
13038
|
-
return chain().command(() => {
|
|
13039
|
-
tr.setNodeMarkup(parentList.pos, listType);
|
|
13040
|
-
return true;
|
|
13041
|
-
}).command(() => joinListBackwards(tr, listType)).command(() => joinListForwards(tr, listType)).run();
|
|
13042
|
-
}
|
|
13043
|
-
}
|
|
13044
|
-
if (!keepMarks || !marks || !dispatch) {
|
|
13045
|
-
return chain().command(() => {
|
|
13046
|
-
const canWrapInList = can().wrapInList(listType, attributes);
|
|
13047
|
-
if (canWrapInList) {
|
|
13048
|
-
return true;
|
|
13049
|
-
}
|
|
13050
|
-
return commands2.clearNodes();
|
|
13051
|
-
}).wrapInList(listType, attributes).command(() => joinListBackwards(tr, listType)).command(() => joinListForwards(tr, listType)).run();
|
|
13052
|
-
}
|
|
13053
|
-
return chain().command(() => {
|
|
13054
|
-
const canWrapInList = can().wrapInList(listType, attributes);
|
|
13055
|
-
const filteredMarks = marks.filter((mark) => splittableMarks.includes(mark.type.name));
|
|
13056
|
-
tr.ensureMarks(filteredMarks);
|
|
13057
|
-
if (canWrapInList) {
|
|
13058
|
-
return true;
|
|
13059
|
-
}
|
|
13060
|
-
return commands2.clearNodes();
|
|
13061
|
-
}).wrapInList(listType, attributes).command(() => joinListBackwards(tr, listType)).command(() => joinListForwards(tr, listType)).run();
|
|
13062
|
-
};
|
|
13063
|
-
var toggleMark = (typeOrName, attributes = {}, options = {}) => ({ state, commands: commands2 }) => {
|
|
13064
|
-
const { extendEmptyMarkRange = false } = options;
|
|
13065
|
-
const type = getMarkType(typeOrName, state.schema);
|
|
13066
|
-
const isActive = isMarkActive(state, type, attributes);
|
|
13067
|
-
if (isActive) {
|
|
13068
|
-
return commands2.unsetMark(type, { extendEmptyMarkRange });
|
|
13069
|
-
}
|
|
13070
|
-
return commands2.setMark(type, attributes);
|
|
13071
|
-
};
|
|
13072
|
-
var toggleNode = (typeOrName, toggleTypeOrName, attributes = {}) => ({ state, commands: commands2 }) => {
|
|
13073
|
-
const type = getNodeType(typeOrName, state.schema);
|
|
13074
|
-
const toggleType = getNodeType(toggleTypeOrName, state.schema);
|
|
13075
|
-
const isActive = isNodeActive(state, type, attributes);
|
|
13076
|
-
let attributesToCopy;
|
|
13077
|
-
if (state.selection.$anchor.sameParent(state.selection.$head)) {
|
|
13078
|
-
attributesToCopy = state.selection.$anchor.parent.attrs;
|
|
13079
|
-
}
|
|
13080
|
-
if (isActive) {
|
|
13081
|
-
return commands2.setNode(toggleType, attributesToCopy);
|
|
13082
|
-
}
|
|
13083
|
-
return commands2.setNode(type, { ...attributesToCopy, ...attributes });
|
|
13084
|
-
};
|
|
13085
|
-
var toggleWrap = (typeOrName, attributes = {}) => ({ state, commands: commands2 }) => {
|
|
13086
|
-
const type = getNodeType(typeOrName, state.schema);
|
|
13087
|
-
const isActive = isNodeActive(state, type, attributes);
|
|
13088
|
-
if (isActive) {
|
|
13089
|
-
return commands2.lift(type);
|
|
13090
|
-
}
|
|
13091
|
-
return commands2.wrapIn(type, attributes);
|
|
13092
|
-
};
|
|
13093
|
-
var undoInputRule = () => ({ state, dispatch }) => {
|
|
13094
|
-
const plugins = state.plugins;
|
|
13095
|
-
for (let i = 0; i < plugins.length; i += 1) {
|
|
13096
|
-
const plugin = plugins[i];
|
|
13097
|
-
let undoable;
|
|
13098
|
-
if (plugin.spec.isInputRules && (undoable = plugin.getState(state))) {
|
|
13099
|
-
if (dispatch) {
|
|
13100
|
-
const tr = state.tr;
|
|
13101
|
-
const toUndo = undoable.transform;
|
|
13102
|
-
for (let j = toUndo.steps.length - 1; j >= 0; j -= 1) {
|
|
13103
|
-
tr.step(toUndo.steps[j].invert(toUndo.docs[j]));
|
|
13104
|
-
}
|
|
13105
|
-
if (undoable.text) {
|
|
13106
|
-
const marks = tr.doc.resolve(undoable.from).marks();
|
|
13107
|
-
tr.replaceWith(undoable.from, undoable.to, state.schema.text(undoable.text, marks));
|
|
13108
|
-
} else {
|
|
13109
|
-
tr.delete(undoable.from, undoable.to);
|
|
13110
|
-
}
|
|
13111
|
-
}
|
|
13112
|
-
return true;
|
|
13113
|
-
}
|
|
13114
|
-
}
|
|
13115
|
-
return false;
|
|
13116
|
-
};
|
|
13117
|
-
var unsetAllMarks = () => ({ tr, dispatch }) => {
|
|
13118
|
-
const { selection } = tr;
|
|
13119
|
-
const { empty, ranges } = selection;
|
|
13120
|
-
if (empty) {
|
|
13121
|
-
return true;
|
|
13122
|
-
}
|
|
13123
|
-
if (dispatch) {
|
|
13124
|
-
ranges.forEach((range) => {
|
|
13125
|
-
tr.removeMark(range.$from.pos, range.$to.pos);
|
|
13126
|
-
});
|
|
13127
|
-
}
|
|
13128
|
-
return true;
|
|
13129
|
-
};
|
|
13130
|
-
var unsetMark = (typeOrName, options = {}) => ({ tr, state, dispatch }) => {
|
|
13131
|
-
var _a;
|
|
13132
|
-
const { extendEmptyMarkRange = false } = options;
|
|
13133
|
-
const { selection } = tr;
|
|
13134
|
-
const type = getMarkType(typeOrName, state.schema);
|
|
13135
|
-
const { $from, empty, ranges } = selection;
|
|
13136
|
-
if (!dispatch) {
|
|
13137
|
-
return true;
|
|
13138
|
-
}
|
|
13139
|
-
if (empty && extendEmptyMarkRange) {
|
|
13140
|
-
let { from, to } = selection;
|
|
13141
|
-
const attrs = (_a = $from.marks().find((mark) => mark.type === type)) === null || _a === void 0 ? void 0 : _a.attrs;
|
|
13142
|
-
const range = getMarkRange($from, type, attrs);
|
|
13143
|
-
if (range) {
|
|
13144
|
-
from = range.from;
|
|
13145
|
-
to = range.to;
|
|
13146
|
-
}
|
|
13147
|
-
tr.removeMark(from, to, type);
|
|
13148
|
-
} else {
|
|
13149
|
-
ranges.forEach((range) => {
|
|
13150
|
-
tr.removeMark(range.$from.pos, range.$to.pos, type);
|
|
13151
|
-
});
|
|
13152
|
-
}
|
|
13153
|
-
tr.removeStoredMark(type);
|
|
13154
|
-
return true;
|
|
13155
|
-
};
|
|
13156
|
-
var updateAttributes = (typeOrName, attributes = {}) => ({ tr, state, dispatch }) => {
|
|
13157
|
-
let nodeType = null;
|
|
13158
|
-
let markType = null;
|
|
13159
|
-
const schemaType = getSchemaTypeNameByName(typeof typeOrName === "string" ? typeOrName : typeOrName.name, state.schema);
|
|
13160
|
-
if (!schemaType) {
|
|
13161
|
-
return false;
|
|
13162
|
-
}
|
|
13163
|
-
if (schemaType === "node") {
|
|
13164
|
-
nodeType = getNodeType(typeOrName, state.schema);
|
|
13165
|
-
}
|
|
13166
|
-
if (schemaType === "mark") {
|
|
13167
|
-
markType = getMarkType(typeOrName, state.schema);
|
|
13168
|
-
}
|
|
13169
|
-
if (dispatch) {
|
|
13170
|
-
tr.selection.ranges.forEach((range) => {
|
|
13171
|
-
const from = range.$from.pos;
|
|
13172
|
-
const to = range.$to.pos;
|
|
13173
|
-
let lastPos;
|
|
13174
|
-
let lastNode;
|
|
13175
|
-
let trimmedFrom;
|
|
13176
|
-
let trimmedTo;
|
|
13177
|
-
if (tr.selection.empty) {
|
|
13178
|
-
state.doc.nodesBetween(from, to, (node2, pos) => {
|
|
13179
|
-
if (nodeType && nodeType === node2.type) {
|
|
13180
|
-
trimmedFrom = Math.max(pos, from);
|
|
13181
|
-
trimmedTo = Math.min(pos + node2.nodeSize, to);
|
|
13182
|
-
lastPos = pos;
|
|
13183
|
-
lastNode = node2;
|
|
13184
|
-
}
|
|
13185
|
-
});
|
|
13186
|
-
} else {
|
|
13187
|
-
state.doc.nodesBetween(from, to, (node2, pos) => {
|
|
13188
|
-
if (pos < from && nodeType && nodeType === node2.type) {
|
|
13189
|
-
trimmedFrom = Math.max(pos, from);
|
|
13190
|
-
trimmedTo = Math.min(pos + node2.nodeSize, to);
|
|
13191
|
-
lastPos = pos;
|
|
13192
|
-
lastNode = node2;
|
|
13193
|
-
}
|
|
13194
|
-
if (pos >= from && pos <= to) {
|
|
13195
|
-
if (nodeType && nodeType === node2.type) {
|
|
13196
|
-
tr.setNodeMarkup(pos, void 0, {
|
|
13197
|
-
...node2.attrs,
|
|
13198
|
-
...attributes
|
|
13199
|
-
});
|
|
13200
|
-
}
|
|
13201
|
-
if (markType && node2.marks.length) {
|
|
13202
|
-
node2.marks.forEach((mark) => {
|
|
13203
|
-
if (markType === mark.type) {
|
|
13204
|
-
const trimmedFrom2 = Math.max(pos, from);
|
|
13205
|
-
const trimmedTo2 = Math.min(pos + node2.nodeSize, to);
|
|
13206
|
-
tr.addMark(trimmedFrom2, trimmedTo2, markType.create({
|
|
13207
|
-
...mark.attrs,
|
|
13208
|
-
...attributes
|
|
13209
|
-
}));
|
|
13210
|
-
}
|
|
13211
|
-
});
|
|
13212
|
-
}
|
|
13213
|
-
}
|
|
13214
|
-
});
|
|
13215
|
-
}
|
|
13216
|
-
if (lastNode) {
|
|
13217
|
-
if (lastPos !== void 0) {
|
|
13218
|
-
tr.setNodeMarkup(lastPos, void 0, {
|
|
13219
|
-
...lastNode.attrs,
|
|
13220
|
-
...attributes
|
|
13221
|
-
});
|
|
13222
|
-
}
|
|
13223
|
-
if (markType && lastNode.marks.length) {
|
|
13224
|
-
lastNode.marks.forEach((mark) => {
|
|
13225
|
-
if (markType === mark.type) {
|
|
13226
|
-
tr.addMark(trimmedFrom, trimmedTo, markType.create({
|
|
13227
|
-
...mark.attrs,
|
|
13228
|
-
...attributes
|
|
13229
|
-
}));
|
|
13230
|
-
}
|
|
13231
|
-
});
|
|
13232
|
-
}
|
|
13233
|
-
}
|
|
13234
|
-
});
|
|
13235
|
-
}
|
|
13236
|
-
return true;
|
|
13237
|
-
};
|
|
13238
|
-
var wrapIn = (typeOrName, attributes = {}) => ({ state, dispatch }) => {
|
|
13239
|
-
const type = getNodeType(typeOrName, state.schema);
|
|
13240
|
-
return wrapIn$1(type, attributes)(state, dispatch);
|
|
13241
|
-
};
|
|
13242
|
-
var wrapInList = (typeOrName, attributes = {}) => ({ state, dispatch }) => {
|
|
13243
|
-
const type = getNodeType(typeOrName, state.schema);
|
|
13244
|
-
return wrapInList$1(type, attributes)(state, dispatch);
|
|
13245
|
-
};
|
|
13246
|
-
var commands = /* @__PURE__ */ Object.freeze({
|
|
13247
|
-
__proto__: null,
|
|
13248
|
-
blur,
|
|
13249
|
-
clearContent,
|
|
13250
|
-
clearNodes,
|
|
13251
|
-
command,
|
|
13252
|
-
createParagraphNear,
|
|
13253
|
-
cut,
|
|
13254
|
-
deleteCurrentNode,
|
|
13255
|
-
deleteNode,
|
|
13256
|
-
deleteRange,
|
|
13257
|
-
deleteSelection,
|
|
13258
|
-
enter,
|
|
13259
|
-
exitCode,
|
|
13260
|
-
extendMarkRange,
|
|
13261
|
-
first,
|
|
13262
|
-
focus,
|
|
13263
|
-
forEach,
|
|
13264
|
-
insertContent,
|
|
13265
|
-
insertContentAt,
|
|
13266
|
-
joinBackward,
|
|
13267
|
-
joinDown,
|
|
13268
|
-
joinForward,
|
|
13269
|
-
joinItemBackward,
|
|
13270
|
-
joinItemForward,
|
|
13271
|
-
joinTextblockBackward,
|
|
13272
|
-
joinTextblockForward,
|
|
13273
|
-
joinUp,
|
|
13274
|
-
keyboardShortcut,
|
|
13275
|
-
lift,
|
|
13276
|
-
liftEmptyBlock,
|
|
13277
|
-
liftListItem,
|
|
13278
|
-
newlineInCode,
|
|
13279
|
-
resetAttributes,
|
|
13280
|
-
scrollIntoView,
|
|
13281
|
-
selectAll,
|
|
13282
|
-
selectNodeBackward,
|
|
13283
|
-
selectNodeForward,
|
|
13284
|
-
selectParentNode,
|
|
13285
|
-
selectTextblockEnd,
|
|
13286
|
-
selectTextblockStart,
|
|
13287
|
-
setContent,
|
|
13288
|
-
setMark,
|
|
13289
|
-
setMeta,
|
|
13290
|
-
setNode,
|
|
13291
|
-
setNodeSelection,
|
|
13292
|
-
setTextSelection,
|
|
13293
|
-
sinkListItem,
|
|
13294
|
-
splitBlock,
|
|
13295
|
-
splitListItem,
|
|
13296
|
-
toggleList,
|
|
13297
|
-
toggleMark,
|
|
13298
|
-
toggleNode,
|
|
13299
|
-
toggleWrap,
|
|
13300
|
-
undoInputRule,
|
|
13301
|
-
unsetAllMarks,
|
|
13302
|
-
unsetMark,
|
|
13303
|
-
updateAttributes,
|
|
13304
|
-
wrapIn,
|
|
13305
|
-
wrapInList
|
|
13306
|
-
});
|
|
13307
|
-
var Commands = Extension.create({
|
|
13308
|
-
name: "commands",
|
|
13309
|
-
addCommands() {
|
|
13310
|
-
return {
|
|
13311
|
-
...commands
|
|
13312
|
-
};
|
|
13313
|
-
}
|
|
13314
|
-
});
|
|
13315
|
-
var Drop = Extension.create({
|
|
13316
|
-
name: "drop",
|
|
13317
|
-
addProseMirrorPlugins() {
|
|
13318
|
-
return [
|
|
13319
|
-
new Plugin({
|
|
13320
|
-
key: new PluginKey("tiptapDrop"),
|
|
13321
|
-
props: {
|
|
13322
|
-
handleDrop: (_2, e2, slice, moved) => {
|
|
13323
|
-
this.editor.emit("drop", {
|
|
13324
|
-
editor: this.editor,
|
|
13325
|
-
event: e2,
|
|
13326
|
-
slice,
|
|
13327
|
-
moved
|
|
13328
|
-
});
|
|
13329
|
-
}
|
|
13330
|
-
}
|
|
13331
|
-
})
|
|
13332
|
-
];
|
|
13333
|
-
}
|
|
13334
|
-
});
|
|
13335
|
-
var Editable = Extension.create({
|
|
13336
|
-
name: "editable",
|
|
13337
|
-
addProseMirrorPlugins() {
|
|
13338
|
-
return [
|
|
13339
|
-
new Plugin({
|
|
13340
|
-
key: new PluginKey("editable"),
|
|
13341
|
-
props: {
|
|
13342
|
-
editable: () => this.editor.options.editable
|
|
13343
|
-
}
|
|
13344
|
-
})
|
|
13345
|
-
];
|
|
13346
|
-
}
|
|
13347
|
-
});
|
|
13348
|
-
var focusEventsPluginKey = new PluginKey("focusEvents");
|
|
13349
|
-
var FocusEvents = Extension.create({
|
|
13350
|
-
name: "focusEvents",
|
|
13351
|
-
addProseMirrorPlugins() {
|
|
13352
|
-
const { editor } = this;
|
|
13353
|
-
return [
|
|
13354
|
-
new Plugin({
|
|
13355
|
-
key: focusEventsPluginKey,
|
|
13356
|
-
props: {
|
|
13357
|
-
handleDOMEvents: {
|
|
13358
|
-
focus: (view, event) => {
|
|
13359
|
-
editor.isFocused = true;
|
|
13360
|
-
const transaction = editor.state.tr.setMeta("focus", { event }).setMeta("addToHistory", false);
|
|
13361
|
-
view.dispatch(transaction);
|
|
13362
|
-
return false;
|
|
13363
|
-
},
|
|
13364
|
-
blur: (view, event) => {
|
|
13365
|
-
editor.isFocused = false;
|
|
13366
|
-
const transaction = editor.state.tr.setMeta("blur", { event }).setMeta("addToHistory", false);
|
|
13367
|
-
view.dispatch(transaction);
|
|
13368
|
-
return false;
|
|
13369
|
-
}
|
|
13370
|
-
}
|
|
13371
|
-
}
|
|
13372
|
-
})
|
|
13373
|
-
];
|
|
13374
|
-
}
|
|
13375
|
-
});
|
|
13376
|
-
var Keymap = Extension.create({
|
|
13377
|
-
name: "keymap",
|
|
13378
|
-
addKeyboardShortcuts() {
|
|
13379
|
-
const handleBackspace = () => this.editor.commands.first(({ commands: commands2 }) => [
|
|
13380
|
-
() => commands2.undoInputRule(),
|
|
13381
|
-
// maybe convert first text block node to default node
|
|
13382
|
-
() => commands2.command(({ tr }) => {
|
|
13383
|
-
const { selection, doc } = tr;
|
|
13384
|
-
const { empty, $anchor } = selection;
|
|
13385
|
-
const { pos, parent } = $anchor;
|
|
13386
|
-
const $parentPos = $anchor.parent.isTextblock && pos > 0 ? tr.doc.resolve(pos - 1) : $anchor;
|
|
13387
|
-
const parentIsIsolating = $parentPos.parent.type.spec.isolating;
|
|
13388
|
-
const parentPos = $anchor.pos - $anchor.parentOffset;
|
|
13389
|
-
const isAtStart = parentIsIsolating && $parentPos.parent.childCount === 1 ? parentPos === $anchor.pos : Selection.atStart(doc).from === pos;
|
|
13390
|
-
if (!empty || !parent.type.isTextblock || parent.textContent.length || !isAtStart || isAtStart && $anchor.parent.type.name === "paragraph") {
|
|
13391
|
-
return false;
|
|
13392
|
-
}
|
|
13393
|
-
return commands2.clearNodes();
|
|
13394
|
-
}),
|
|
13395
|
-
() => commands2.deleteSelection(),
|
|
13396
|
-
() => commands2.joinBackward(),
|
|
13397
|
-
() => commands2.selectNodeBackward()
|
|
13398
|
-
]);
|
|
13399
|
-
const handleDelete = () => this.editor.commands.first(({ commands: commands2 }) => [
|
|
13400
|
-
() => commands2.deleteSelection(),
|
|
13401
|
-
() => commands2.deleteCurrentNode(),
|
|
13402
|
-
() => commands2.joinForward(),
|
|
13403
|
-
() => commands2.selectNodeForward()
|
|
13404
|
-
]);
|
|
13405
|
-
const handleEnter = () => this.editor.commands.first(({ commands: commands2 }) => [
|
|
13406
|
-
() => commands2.newlineInCode(),
|
|
13407
|
-
() => commands2.createParagraphNear(),
|
|
13408
|
-
() => commands2.liftEmptyBlock(),
|
|
13409
|
-
() => commands2.splitBlock()
|
|
13410
|
-
]);
|
|
13411
|
-
const baseKeymap = {
|
|
13412
|
-
Enter: handleEnter,
|
|
13413
|
-
"Mod-Enter": () => this.editor.commands.exitCode(),
|
|
13414
|
-
Backspace: handleBackspace,
|
|
13415
|
-
"Mod-Backspace": handleBackspace,
|
|
13416
|
-
"Shift-Backspace": handleBackspace,
|
|
13417
|
-
Delete: handleDelete,
|
|
13418
|
-
"Mod-Delete": handleDelete,
|
|
13419
|
-
"Mod-a": () => this.editor.commands.selectAll()
|
|
13420
|
-
};
|
|
13421
|
-
const pcKeymap = {
|
|
13422
|
-
...baseKeymap
|
|
13423
|
-
};
|
|
13424
|
-
const macKeymap = {
|
|
13425
|
-
...baseKeymap,
|
|
13426
|
-
"Ctrl-h": handleBackspace,
|
|
13427
|
-
"Alt-Backspace": handleBackspace,
|
|
13428
|
-
"Ctrl-d": handleDelete,
|
|
13429
|
-
"Ctrl-Alt-Backspace": handleDelete,
|
|
13430
|
-
"Alt-Delete": handleDelete,
|
|
13431
|
-
"Alt-d": handleDelete,
|
|
13432
|
-
"Ctrl-a": () => this.editor.commands.selectTextblockStart(),
|
|
13433
|
-
"Ctrl-e": () => this.editor.commands.selectTextblockEnd()
|
|
13434
|
-
};
|
|
13435
|
-
if (isiOS() || isMacOS()) {
|
|
13436
|
-
return macKeymap;
|
|
13437
|
-
}
|
|
13438
|
-
return pcKeymap;
|
|
13439
|
-
},
|
|
13440
|
-
addProseMirrorPlugins() {
|
|
13441
|
-
return [
|
|
13442
|
-
// With this plugin we check if the whole document was selected and deleted.
|
|
13443
|
-
// In this case we will additionally call `clearNodes()` to convert e.g. a heading
|
|
13444
|
-
// to a paragraph if necessary.
|
|
13445
|
-
// This is an alternative to ProseMirror's `AllSelection`, which doesn’t work well
|
|
13446
|
-
// with many other commands.
|
|
13447
|
-
new Plugin({
|
|
13448
|
-
key: new PluginKey("clearDocument"),
|
|
13449
|
-
appendTransaction: (transactions, oldState, newState) => {
|
|
13450
|
-
if (transactions.some((tr2) => tr2.getMeta("composition"))) {
|
|
13451
|
-
return;
|
|
13452
|
-
}
|
|
13453
|
-
const docChanges = transactions.some((transaction) => transaction.docChanged) && !oldState.doc.eq(newState.doc);
|
|
13454
|
-
const ignoreTr = transactions.some((transaction) => transaction.getMeta("preventClearDocument"));
|
|
13455
|
-
if (!docChanges || ignoreTr) {
|
|
13456
|
-
return;
|
|
13457
|
-
}
|
|
13458
|
-
const { empty, from, to } = oldState.selection;
|
|
13459
|
-
const allFrom = Selection.atStart(oldState.doc).from;
|
|
13460
|
-
const allEnd = Selection.atEnd(oldState.doc).to;
|
|
13461
|
-
const allWasSelected = from === allFrom && to === allEnd;
|
|
13462
|
-
if (empty || !allWasSelected) {
|
|
13463
|
-
return;
|
|
13464
|
-
}
|
|
13465
|
-
const isEmpty2 = isNodeEmpty(newState.doc);
|
|
13466
|
-
if (!isEmpty2) {
|
|
13467
|
-
return;
|
|
13468
|
-
}
|
|
13469
|
-
const tr = newState.tr;
|
|
13470
|
-
const state = createChainableState({
|
|
13471
|
-
state: newState,
|
|
13472
|
-
transaction: tr
|
|
13473
|
-
});
|
|
13474
|
-
const { commands: commands2 } = new CommandManager({
|
|
13475
|
-
editor: this.editor,
|
|
13476
|
-
state
|
|
13477
|
-
});
|
|
13478
|
-
commands2.clearNodes();
|
|
13479
|
-
if (!tr.steps.length) {
|
|
13480
|
-
return;
|
|
13481
|
-
}
|
|
13482
|
-
return tr;
|
|
13483
|
-
}
|
|
13484
|
-
})
|
|
13485
|
-
];
|
|
13486
|
-
}
|
|
13487
|
-
});
|
|
13488
|
-
var Paste = Extension.create({
|
|
13489
|
-
name: "paste",
|
|
13490
|
-
addProseMirrorPlugins() {
|
|
13491
|
-
return [
|
|
13492
|
-
new Plugin({
|
|
13493
|
-
key: new PluginKey("tiptapPaste"),
|
|
13494
|
-
props: {
|
|
13495
|
-
handlePaste: (_view, e2, slice) => {
|
|
13496
|
-
this.editor.emit("paste", {
|
|
13497
|
-
editor: this.editor,
|
|
13498
|
-
event: e2,
|
|
13499
|
-
slice
|
|
13500
|
-
});
|
|
13501
|
-
}
|
|
13502
|
-
}
|
|
13503
|
-
})
|
|
13504
|
-
];
|
|
13505
|
-
}
|
|
13506
|
-
});
|
|
13507
|
-
var Tabindex = Extension.create({
|
|
13508
|
-
name: "tabindex",
|
|
13509
|
-
addProseMirrorPlugins() {
|
|
13510
|
-
return [
|
|
13511
|
-
new Plugin({
|
|
13512
|
-
key: new PluginKey("tabindex"),
|
|
13513
|
-
props: {
|
|
13514
|
-
attributes: () => this.editor.isEditable ? { tabindex: "0" } : {}
|
|
13515
|
-
}
|
|
13516
|
-
})
|
|
13517
|
-
];
|
|
13518
|
-
}
|
|
13519
|
-
});
|
|
13520
|
-
function textblockTypeInputRule(config3) {
|
|
13521
|
-
return new InputRule({
|
|
13522
|
-
find: config3.find,
|
|
13523
|
-
handler: ({ state, range, match }) => {
|
|
13524
|
-
const $start = state.doc.resolve(range.from);
|
|
13525
|
-
const attributes = callOrReturn(config3.getAttributes, void 0, match) || {};
|
|
13526
|
-
if (!$start.node(-1).canReplaceWith($start.index(-1), $start.indexAfter(-1), config3.type)) {
|
|
13527
|
-
return null;
|
|
13528
|
-
}
|
|
13529
|
-
state.tr.delete(range.from, range.to).setBlockType(range.from, range.from, config3.type, attributes);
|
|
13530
|
-
}
|
|
13531
|
-
});
|
|
13532
|
-
}
|
|
13533
|
-
var Node2 = class _Node {
|
|
13534
|
-
constructor(config3 = {}) {
|
|
13535
|
-
this.type = "node";
|
|
13536
|
-
this.name = "node";
|
|
13537
|
-
this.parent = null;
|
|
13538
|
-
this.child = null;
|
|
13539
|
-
this.config = {
|
|
13540
|
-
name: this.name,
|
|
13541
|
-
defaultOptions: {}
|
|
13542
|
-
};
|
|
13543
|
-
this.config = {
|
|
13544
|
-
...this.config,
|
|
13545
|
-
...config3
|
|
13546
|
-
};
|
|
13547
|
-
this.name = this.config.name;
|
|
13548
|
-
if (config3.defaultOptions && Object.keys(config3.defaultOptions).length > 0) {
|
|
13549
|
-
console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`);
|
|
13550
|
-
}
|
|
13551
|
-
this.options = this.config.defaultOptions;
|
|
13552
|
-
if (this.config.addOptions) {
|
|
13553
|
-
this.options = callOrReturn(getExtensionField(this, "addOptions", {
|
|
13554
|
-
name: this.name
|
|
13555
|
-
}));
|
|
13556
|
-
}
|
|
13557
|
-
this.storage = callOrReturn(getExtensionField(this, "addStorage", {
|
|
13558
|
-
name: this.name,
|
|
13559
|
-
options: this.options
|
|
13560
|
-
})) || {};
|
|
13561
|
-
}
|
|
13562
|
-
static create(config3 = {}) {
|
|
13563
|
-
return new _Node(config3);
|
|
13564
|
-
}
|
|
13565
|
-
configure(options = {}) {
|
|
13566
|
-
const extension = this.extend({
|
|
13567
|
-
...this.config,
|
|
13568
|
-
addOptions: () => {
|
|
13569
|
-
return mergeDeep(this.options, options);
|
|
13570
|
-
}
|
|
13571
|
-
});
|
|
13572
|
-
extension.name = this.name;
|
|
13573
|
-
extension.parent = this.parent;
|
|
13574
|
-
return extension;
|
|
13575
|
-
}
|
|
13576
|
-
extend(extendedConfig = {}) {
|
|
13577
|
-
const extension = new _Node(extendedConfig);
|
|
13578
|
-
extension.parent = this;
|
|
13579
|
-
this.child = extension;
|
|
13580
|
-
extension.name = extendedConfig.name ? extendedConfig.name : extension.parent.name;
|
|
13581
|
-
if (extendedConfig.defaultOptions && Object.keys(extendedConfig.defaultOptions).length > 0) {
|
|
13582
|
-
console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${extension.name}".`);
|
|
13583
|
-
}
|
|
13584
|
-
extension.options = callOrReturn(getExtensionField(extension, "addOptions", {
|
|
13585
|
-
name: extension.name
|
|
13586
|
-
}));
|
|
13587
|
-
extension.storage = callOrReturn(getExtensionField(extension, "addStorage", {
|
|
13588
|
-
name: extension.name,
|
|
13589
|
-
options: extension.options
|
|
13590
|
-
}));
|
|
13591
|
-
return extension;
|
|
13592
|
-
}
|
|
13593
|
-
};
|
|
13594
|
-
|
|
13595
11444
|
// src/scene/SceneBlockExtension.ts
|
|
13596
|
-
import {
|
|
11445
|
+
import { Extension } from "@tiptap/core";
|
|
11446
|
+
import { Plugin, PluginKey } from "@tiptap/pm/state";
|
|
13597
11447
|
import { Decoration, DecorationSet } from "@tiptap/pm/view";
|
|
13598
11448
|
import { createRoot } from "react-dom/client";
|
|
13599
11449
|
import { createElement as createElement6 } from "react";
|
|
@@ -13679,7 +11529,7 @@ function stripBraces(s) {
|
|
|
13679
11529
|
}
|
|
13680
11530
|
|
|
13681
11531
|
// src/scene/commands/layoutCommands.ts
|
|
13682
|
-
import { DOMSerializer
|
|
11532
|
+
import { DOMSerializer, DOMParser as PMDOMParser, Fragment as Fragment6 } from "@tiptap/pm/model";
|
|
13683
11533
|
import {
|
|
13684
11534
|
parsePandocAttrTokens as parsePandocAttrTokens4,
|
|
13685
11535
|
serializePandocAttributes as serializePandocAttributes4,
|
|
@@ -13821,7 +11671,7 @@ function addLayoutLayer(editor, parentPos, id, kind, params, bodyHtml = "") {
|
|
|
13821
11671
|
dataTemplateParams: tParams.length > 0 ? tParams : null,
|
|
13822
11672
|
dataBlockAttrs: blockAttrs
|
|
13823
11673
|
});
|
|
13824
|
-
let content =
|
|
11674
|
+
let content = Fragment6.from(heading);
|
|
13825
11675
|
if (bodyHtml.trim()) content = content.append(htmlToBody(state.schema, bodyHtml));
|
|
13826
11676
|
tr.insert(insertPos, content);
|
|
13827
11677
|
return true;
|
|
@@ -13852,7 +11702,7 @@ function setLayoutText(editor, parentPos, id, bodyHtml) {
|
|
|
13852
11702
|
const [, bodyEnd] = headingRange(editor, target.pos);
|
|
13853
11703
|
return editor.chain().command(({ tr, state }) => {
|
|
13854
11704
|
if (!tr.doc.nodeAt(target.pos)) return false;
|
|
13855
|
-
const body = bodyHtml.trim() ? htmlToBody(state.schema, bodyHtml) :
|
|
11705
|
+
const body = bodyHtml.trim() ? htmlToBody(state.schema, bodyHtml) : Fragment6.empty;
|
|
13856
11706
|
tr.replaceWith(bodyStart, bodyEnd, body);
|
|
13857
11707
|
return true;
|
|
13858
11708
|
}).run();
|
|
@@ -13899,7 +11749,7 @@ function bodyToHtml(editor, headingPos, headingNode) {
|
|
|
13899
11749
|
if (bodyEnd <= bodyStart) return "";
|
|
13900
11750
|
const fragment = state.doc.slice(bodyStart, bodyEnd).content;
|
|
13901
11751
|
if (fragment.size === 0) return "";
|
|
13902
|
-
const dom =
|
|
11752
|
+
const dom = DOMSerializer.fromSchema(state.schema).serializeFragment(fragment);
|
|
13903
11753
|
const div = document.createElement("div");
|
|
13904
11754
|
div.appendChild(dom);
|
|
13905
11755
|
return div.innerHTML;
|
|
@@ -14807,7 +12657,7 @@ function createDrawShapeTool(options) {
|
|
|
14807
12657
|
// src/scene/layers/DiagramEdges.tsx
|
|
14808
12658
|
import { useId as useId8 } from "react";
|
|
14809
12659
|
import { connectorPath, markerPath } from "@bendyline/squisq/doc";
|
|
14810
|
-
import { Fragment as
|
|
12660
|
+
import { Fragment as Fragment7, jsx as jsx27, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
14811
12661
|
var MARKER_STYLES = ["arrow", "open", "diamond", "circle", "square"];
|
|
14812
12662
|
function markerId(prefix, style, dir) {
|
|
14813
12663
|
return `${prefix}-squisq-edge-${style}-${dir}`;
|
|
@@ -14894,7 +12744,7 @@ function DiagramEdges({
|
|
|
14894
12744
|
children: edge2.label
|
|
14895
12745
|
}
|
|
14896
12746
|
) : null,
|
|
14897
|
-
selected ? /* @__PURE__ */ jsxs21(
|
|
12747
|
+
selected ? /* @__PURE__ */ jsxs21(Fragment7, { children: [
|
|
14898
12748
|
/* @__PURE__ */ jsx27("circle", { cx: start.x, cy: start.y, r: 6, className: "squisq-scene-edge-handle" }),
|
|
14899
12749
|
/* @__PURE__ */ jsx27("circle", { cx: end.x, cy: end.y, r: 6, className: "squisq-scene-edge-handle" })
|
|
14900
12750
|
] }) : null
|
|
@@ -15915,7 +13765,7 @@ function findSceneHeadingPos(editor, headingKey, mode) {
|
|
|
15915
13765
|
});
|
|
15916
13766
|
return found;
|
|
15917
13767
|
}
|
|
15918
|
-
var KEY = new
|
|
13768
|
+
var KEY = new PluginKey("squisq-scene-block");
|
|
15919
13769
|
var TEMPLATE_MODE = {
|
|
15920
13770
|
layout: "layout",
|
|
15921
13771
|
drawing: "drawing"
|
|
@@ -15999,7 +13849,7 @@ var SceneBlockExtension = Extension.create({
|
|
|
15999
13849
|
const enabled = this.options.enabled !== false;
|
|
16000
13850
|
if (!enabled) return [];
|
|
16001
13851
|
return [
|
|
16002
|
-
new
|
|
13852
|
+
new Plugin({
|
|
16003
13853
|
key: KEY,
|
|
16004
13854
|
state: {
|
|
16005
13855
|
init: (_config, state) => buildDecorations(state, editor, this.options.textChannel),
|
|
@@ -16595,7 +14445,7 @@ function AddBin({ activeToolId, onActivate, canAddMedia, onAddMediaFiles }) {
|
|
|
16595
14445
|
|
|
16596
14446
|
// src/customTemplates/LayerToolbar.tsx
|
|
16597
14447
|
import { AVAILABLE_FONT_STACKS as AVAILABLE_FONT_STACKS2 } from "@bendyline/squisq/schemas";
|
|
16598
|
-
import { Fragment as
|
|
14448
|
+
import { Fragment as Fragment8, jsx as jsx35, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
16599
14449
|
function LayerToolbar({ layer, onAttr }) {
|
|
16600
14450
|
return /* @__PURE__ */ jsxs26("div", { className: "squisq-layer-toolbar", role: "toolbar", "aria-label": "Layer styling", children: [
|
|
16601
14451
|
layer.type === "text" && /* @__PURE__ */ jsx35(TextControls, { layer, onAttr }),
|
|
@@ -16615,7 +14465,7 @@ function TextControls({
|
|
|
16615
14465
|
onAttr
|
|
16616
14466
|
}) {
|
|
16617
14467
|
const style = layer.content.style;
|
|
16618
|
-
return /* @__PURE__ */ jsxs26(
|
|
14468
|
+
return /* @__PURE__ */ jsxs26(Fragment8, { children: [
|
|
16619
14469
|
/* @__PURE__ */ jsx35(
|
|
16620
14470
|
SegGroup,
|
|
16621
14471
|
{
|
|
@@ -16736,7 +14586,7 @@ function FillBorderControls({
|
|
|
16736
14586
|
content,
|
|
16737
14587
|
onAttr
|
|
16738
14588
|
}) {
|
|
16739
|
-
return /* @__PURE__ */ jsxs26(
|
|
14589
|
+
return /* @__PURE__ */ jsxs26(Fragment8, { children: [
|
|
16740
14590
|
/* @__PURE__ */ jsx35("span", { className: "squisq-layer-toolbar-label", title: "Fill", children: /* @__PURE__ */ jsx35(Icon, { icon: "fa-solid fa-fill-drip" }) }),
|
|
16741
14591
|
/* @__PURE__ */ jsx35(
|
|
16742
14592
|
FillEditor,
|
|
@@ -16775,7 +14625,7 @@ function ShapeControls({
|
|
|
16775
14625
|
layer,
|
|
16776
14626
|
onAttr
|
|
16777
14627
|
}) {
|
|
16778
|
-
return /* @__PURE__ */ jsxs26(
|
|
14628
|
+
return /* @__PURE__ */ jsxs26(Fragment8, { children: [
|
|
16779
14629
|
/* @__PURE__ */ jsxs26(
|
|
16780
14630
|
"select",
|
|
16781
14631
|
{
|
|
@@ -16893,7 +14743,7 @@ function FillEditor({
|
|
|
16893
14743
|
}) {
|
|
16894
14744
|
const isGradient = !!gradient;
|
|
16895
14745
|
const swatch = color && color !== "none" ? color : defaultColor;
|
|
16896
|
-
return /* @__PURE__ */ jsxs26(
|
|
14746
|
+
return /* @__PURE__ */ jsxs26(Fragment8, { children: [
|
|
16897
14747
|
/* @__PURE__ */ jsxs26(
|
|
16898
14748
|
"select",
|
|
16899
14749
|
{
|
|
@@ -16914,7 +14764,7 @@ function FillEditor({
|
|
|
16914
14764
|
]
|
|
16915
14765
|
}
|
|
16916
14766
|
),
|
|
16917
|
-
isGradient ? /* @__PURE__ */ jsxs26(
|
|
14767
|
+
isGradient ? /* @__PURE__ */ jsxs26(Fragment8, { children: [
|
|
16918
14768
|
/* @__PURE__ */ jsx35(
|
|
16919
14769
|
Color,
|
|
16920
14770
|
{
|
|
@@ -16974,7 +14824,7 @@ function BorderEditor({
|
|
|
16974
14824
|
stylePath,
|
|
16975
14825
|
onAttr
|
|
16976
14826
|
}) {
|
|
16977
|
-
return /* @__PURE__ */ jsxs26(
|
|
14827
|
+
return /* @__PURE__ */ jsxs26(Fragment8, { children: [
|
|
16978
14828
|
/* @__PURE__ */ jsx35(
|
|
16979
14829
|
Color,
|
|
16980
14830
|
{
|
|
@@ -17048,7 +14898,7 @@ function normalizeColor(v2) {
|
|
|
17048
14898
|
}
|
|
17049
14899
|
|
|
17050
14900
|
// src/customTemplates/TemplateDesigner.tsx
|
|
17051
|
-
import { Fragment as
|
|
14901
|
+
import { Fragment as Fragment9, jsx as jsx36, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
17052
14902
|
var DESIGN_CANVAS = { width: 1920, height: 1080 };
|
|
17053
14903
|
function slugifyLabel(label) {
|
|
17054
14904
|
return label.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^[^a-z]+/, "").replace(/^-+|-+$/g, "");
|
|
@@ -17271,7 +15121,7 @@ function TemplateDesigner({
|
|
|
17271
15121
|
children: VIEWPORT_OPTIONS.map((v2) => /* @__PURE__ */ jsx36("option", { value: v2.id, children: v2.label }, v2.id))
|
|
17272
15122
|
}
|
|
17273
15123
|
),
|
|
17274
|
-
selectedLayer && /* @__PURE__ */ jsxs27(
|
|
15124
|
+
selectedLayer && /* @__PURE__ */ jsxs27(Fragment9, { children: [
|
|
17275
15125
|
/* @__PURE__ */ jsx36("div", { className: "squisq-layer-toolbar-sep", "aria-hidden": "true" }),
|
|
17276
15126
|
/* @__PURE__ */ jsx36(LayerToolbar, { layer: selectedLayer, onAttr: handleLayerAttr })
|
|
17277
15127
|
] })
|
|
@@ -17339,7 +15189,7 @@ function TemplateDesigner({
|
|
|
17339
15189
|
}
|
|
17340
15190
|
|
|
17341
15191
|
// src/customTemplates/CustomLayoutManager.tsx
|
|
17342
|
-
import { Fragment as
|
|
15192
|
+
import { Fragment as Fragment10, jsx as jsx37, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
17343
15193
|
function CustomLayoutManager({ onClose }) {
|
|
17344
15194
|
const { docTemplates, onDocTemplatesChange } = useDocCustomTemplates();
|
|
17345
15195
|
const { mediaProvider, colorScheme } = useEditorContext();
|
|
@@ -17452,11 +15302,11 @@ function ManagerContent({
|
|
|
17452
15302
|
children: "+ New layout"
|
|
17453
15303
|
}
|
|
17454
15304
|
),
|
|
17455
|
-
docTemplates.length > 0 && /* @__PURE__ */ jsxs28(
|
|
15305
|
+
docTemplates.length > 0 && /* @__PURE__ */ jsxs28(Fragment10, { children: [
|
|
17456
15306
|
/* @__PURE__ */ jsx37("div", { className: "squisq-layout-manager-section-title", children: "This document" }),
|
|
17457
15307
|
/* @__PURE__ */ jsx37("div", { className: "squisq-layout-manager-list", children: docTemplates.map((def) => renderItem(def, "doc")) })
|
|
17458
15308
|
] }),
|
|
17459
|
-
libraryTemplates.length > 0 && /* @__PURE__ */ jsxs28(
|
|
15309
|
+
libraryTemplates.length > 0 && /* @__PURE__ */ jsxs28(Fragment10, { children: [
|
|
17460
15310
|
/* @__PURE__ */ jsx37("div", { className: "squisq-layout-manager-section-title", children: "Library" }),
|
|
17461
15311
|
/* @__PURE__ */ jsx37("div", { className: "squisq-layout-manager-list", children: libraryTemplates.map((def) => renderItem(def, "library")) })
|
|
17462
15312
|
] }),
|
|
@@ -17604,7 +15454,8 @@ function selectionToTaskListMarkdown(text) {
|
|
|
17604
15454
|
import { useCallback as useCallback28, useEffect as useEffect23, useId as useId11, useRef as useRef27, useState as useState30 } from "react";
|
|
17605
15455
|
|
|
17606
15456
|
// src/find/FindHighlightExtension.ts
|
|
17607
|
-
import {
|
|
15457
|
+
import { Extension as Extension2 } from "@tiptap/core";
|
|
15458
|
+
import { Plugin as Plugin2, PluginKey as PluginKey2 } from "@tiptap/pm/state";
|
|
17608
15459
|
import { Decoration as Decoration2, DecorationSet as DecorationSet2 } from "@tiptap/pm/view";
|
|
17609
15460
|
|
|
17610
15461
|
// src/find/findModel.ts
|
|
@@ -17659,7 +15510,7 @@ function escapeRegExp(value) {
|
|
|
17659
15510
|
}
|
|
17660
15511
|
|
|
17661
15512
|
// src/find/FindHighlightExtension.ts
|
|
17662
|
-
var FIND_HIGHLIGHT_KEY = new
|
|
15513
|
+
var FIND_HIGHLIGHT_KEY = new PluginKey2("squisq-find-highlight");
|
|
17663
15514
|
function buildState(doc, query, selectedIndex) {
|
|
17664
15515
|
const matches = findProseMirrorMatches(doc, query);
|
|
17665
15516
|
const selected = normalizeFindIndex(selectedIndex, matches.length);
|
|
@@ -17674,11 +15525,11 @@ function buildState(doc, query, selectedIndex) {
|
|
|
17674
15525
|
decorations: DecorationSet2.create(doc, decorations)
|
|
17675
15526
|
};
|
|
17676
15527
|
}
|
|
17677
|
-
var FindHighlightExtension =
|
|
15528
|
+
var FindHighlightExtension = Extension2.create({
|
|
17678
15529
|
name: "squisqFindHighlight",
|
|
17679
15530
|
addProseMirrorPlugins() {
|
|
17680
15531
|
return [
|
|
17681
|
-
new
|
|
15532
|
+
new Plugin2({
|
|
17682
15533
|
key: FIND_HIGHLIGHT_KEY,
|
|
17683
15534
|
state: {
|
|
17684
15535
|
init: (_2, state) => buildState(state.doc, "", 0),
|
|
@@ -18237,8 +16088,8 @@ function isTiptapActive(editor, id) {
|
|
|
18237
16088
|
}
|
|
18238
16089
|
|
|
18239
16090
|
// src/toolbar/sceneBlockInserts.ts
|
|
18240
|
-
import { Fragment as
|
|
18241
|
-
import { TextSelection
|
|
16091
|
+
import { Fragment as Fragment11 } from "@tiptap/pm/model";
|
|
16092
|
+
import { TextSelection } from "@tiptap/pm/state";
|
|
18242
16093
|
|
|
18243
16094
|
// src/codeSnippet/codeSnippetFocus.ts
|
|
18244
16095
|
var CODE_SNIPPET_FOCUS_INSERTED_META = "squisq-code-snippet-focus-inserted";
|
|
@@ -18321,18 +16172,18 @@ function insertChartBlock(editor, opts) {
|
|
|
18321
16172
|
const cell = (type, text) => type.create(null, paragraph.create(null, text ? state.schema.text(text) : void 0));
|
|
18322
16173
|
const headerRow = tableRow.create(
|
|
18323
16174
|
null,
|
|
18324
|
-
|
|
16175
|
+
Fragment11.fromArray(opts.table.headers.map((h2) => cell(tableHeader, h2)))
|
|
18325
16176
|
);
|
|
18326
16177
|
const bodyRows = opts.table.rows.map(
|
|
18327
|
-
(row) => tableRow.create(null,
|
|
16178
|
+
(row) => tableRow.create(null, Fragment11.fromArray(row.map((c) => cell(tableCell, c))))
|
|
18328
16179
|
);
|
|
18329
|
-
nodes.push(table.create(null,
|
|
16180
|
+
nodes.push(table.create(null, Fragment11.fromArray([headerRow, ...bodyRows])));
|
|
18330
16181
|
}
|
|
18331
16182
|
const { $from } = state.selection;
|
|
18332
16183
|
const insertPos = $from.depth > 0 ? $from.after(1) : state.doc.content.size;
|
|
18333
16184
|
if (dispatch) {
|
|
18334
|
-
tr.insert(insertPos,
|
|
18335
|
-
tr.setSelection(
|
|
16185
|
+
tr.insert(insertPos, Fragment11.fromArray(nodes));
|
|
16186
|
+
tr.setSelection(TextSelection.create(tr.doc, insertPos + 1));
|
|
18336
16187
|
}
|
|
18337
16188
|
return true;
|
|
18338
16189
|
}).run();
|
|
@@ -18353,7 +16204,7 @@ function insertTemplateHeading(editor, opts) {
|
|
|
18353
16204
|
const insertPos = $from.depth > 0 ? $from.after(1) : state.doc.content.size;
|
|
18354
16205
|
if (dispatch) {
|
|
18355
16206
|
tr.insert(insertPos, heading);
|
|
18356
|
-
tr.setSelection(
|
|
16207
|
+
tr.setSelection(TextSelection.create(tr.doc, insertPos + 1));
|
|
18357
16208
|
}
|
|
18358
16209
|
return true;
|
|
18359
16210
|
}).run();
|
|
@@ -18377,8 +16228,8 @@ function insertLayoutBlock(editor) {
|
|
|
18377
16228
|
const { $from } = state.selection;
|
|
18378
16229
|
const insertPos = $from.depth > 0 ? $from.after(1) : state.doc.content.size;
|
|
18379
16230
|
if (dispatch) {
|
|
18380
|
-
tr.insert(insertPos,
|
|
18381
|
-
tr.setSelection(
|
|
16231
|
+
tr.insert(insertPos, Fragment11.fromArray([parent, child, body]));
|
|
16232
|
+
tr.setSelection(TextSelection.create(tr.doc, insertPos + 1));
|
|
18382
16233
|
}
|
|
18383
16234
|
return true;
|
|
18384
16235
|
}).run();
|
|
@@ -18495,13 +16346,13 @@ ${chartTableMarkdown(entry.table)}
|
|
|
18495
16346
|
}
|
|
18496
16347
|
|
|
18497
16348
|
// src/chart/ChartTypeThumbnail.tsx
|
|
18498
|
-
import { Fragment as
|
|
16349
|
+
import { Fragment as Fragment12, jsx as jsx40, jsxs as jsxs30 } from "react/jsx-runtime";
|
|
18499
16350
|
function ChartTypeThumbnail({ preview }) {
|
|
18500
16351
|
const common = { fill: "none", stroke: "currentColor", strokeWidth: 2 };
|
|
18501
16352
|
let art;
|
|
18502
16353
|
switch (preview) {
|
|
18503
16354
|
case "bar":
|
|
18504
|
-
art = /* @__PURE__ */ jsxs30(
|
|
16355
|
+
art = /* @__PURE__ */ jsxs30(Fragment12, { children: [
|
|
18505
16356
|
/* @__PURE__ */ jsx40("path", { d: "M14 8v48" }),
|
|
18506
16357
|
/* @__PURE__ */ jsx40("rect", { x: "14", y: "12", width: "80", height: "9", fill: "currentColor", opacity: ".55" }),
|
|
18507
16358
|
/* @__PURE__ */ jsx40("rect", { x: "14", y: "27", width: "52", height: "9", fill: "currentColor", opacity: ".35" }),
|
|
@@ -18509,7 +16360,7 @@ function ChartTypeThumbnail({ preview }) {
|
|
|
18509
16360
|
] });
|
|
18510
16361
|
break;
|
|
18511
16362
|
case "column":
|
|
18512
|
-
art = /* @__PURE__ */ jsxs30(
|
|
16363
|
+
art = /* @__PURE__ */ jsxs30(Fragment12, { children: [
|
|
18513
16364
|
/* @__PURE__ */ jsx40("path", { d: "M10 54h100" }),
|
|
18514
16365
|
/* @__PURE__ */ jsx40("rect", { x: "22", y: "26", width: "14", height: "28", fill: "currentColor", opacity: ".45" }),
|
|
18515
16366
|
/* @__PURE__ */ jsx40("rect", { x: "44", y: "14", width: "14", height: "40", fill: "currentColor", opacity: ".55" }),
|
|
@@ -18518,14 +16369,14 @@ function ChartTypeThumbnail({ preview }) {
|
|
|
18518
16369
|
] });
|
|
18519
16370
|
break;
|
|
18520
16371
|
case "pie":
|
|
18521
|
-
art = /* @__PURE__ */ jsxs30(
|
|
16372
|
+
art = /* @__PURE__ */ jsxs30(Fragment12, { children: [
|
|
18522
16373
|
/* @__PURE__ */ jsx40("circle", { cx: "60", cy: "32", r: "24" }),
|
|
18523
16374
|
/* @__PURE__ */ jsx40("path", { d: "M60 32V8a24 24 0 0 1 22.6 31.9Z", fill: "currentColor", opacity: ".45" }),
|
|
18524
16375
|
/* @__PURE__ */ jsx40("path", { d: "M60 32 82.6 39.9A24 24 0 0 1 46 53.4Z", fill: "currentColor", opacity: ".25" })
|
|
18525
16376
|
] });
|
|
18526
16377
|
break;
|
|
18527
16378
|
case "donut":
|
|
18528
|
-
art = /* @__PURE__ */ jsxs30(
|
|
16379
|
+
art = /* @__PURE__ */ jsxs30(Fragment12, { children: [
|
|
18529
16380
|
/* @__PURE__ */ jsx40("circle", { cx: "60", cy: "32", r: "24" }),
|
|
18530
16381
|
/* @__PURE__ */ jsx40("circle", { cx: "60", cy: "32", r: "11" }),
|
|
18531
16382
|
/* @__PURE__ */ jsx40(
|
|
@@ -18539,7 +16390,7 @@ function ChartTypeThumbnail({ preview }) {
|
|
|
18539
16390
|
] });
|
|
18540
16391
|
break;
|
|
18541
16392
|
case "line":
|
|
18542
|
-
art = /* @__PURE__ */ jsxs30(
|
|
16393
|
+
art = /* @__PURE__ */ jsxs30(Fragment12, { children: [
|
|
18543
16394
|
/* @__PURE__ */ jsx40("path", { d: "M10 54h100M10 8v46", opacity: ".4" }),
|
|
18544
16395
|
/* @__PURE__ */ jsx40("path", { d: "M16 46l24-16 24 8 24-20 20 6", strokeWidth: "3" }),
|
|
18545
16396
|
/* @__PURE__ */ jsx40("circle", { cx: "40", cy: "30", r: "3", fill: "currentColor" }),
|
|
@@ -18548,7 +16399,7 @@ function ChartTypeThumbnail({ preview }) {
|
|
|
18548
16399
|
] });
|
|
18549
16400
|
break;
|
|
18550
16401
|
case "area":
|
|
18551
|
-
art = /* @__PURE__ */ jsxs30(
|
|
16402
|
+
art = /* @__PURE__ */ jsxs30(Fragment12, { children: [
|
|
18552
16403
|
/* @__PURE__ */ jsx40("path", { d: "M10 54h100", opacity: ".4" }),
|
|
18553
16404
|
/* @__PURE__ */ jsx40(
|
|
18554
16405
|
"path",
|
|
@@ -18563,7 +16414,7 @@ function ChartTypeThumbnail({ preview }) {
|
|
|
18563
16414
|
] });
|
|
18564
16415
|
break;
|
|
18565
16416
|
case "scatter":
|
|
18566
|
-
art = /* @__PURE__ */ jsxs30(
|
|
16417
|
+
art = /* @__PURE__ */ jsxs30(Fragment12, { children: [
|
|
18567
16418
|
/* @__PURE__ */ jsx40("path", { d: "M14 8v46h92", opacity: ".4" }),
|
|
18568
16419
|
/* @__PURE__ */ jsx40("circle", { cx: "30", cy: "42", r: "3.5", fill: "currentColor", opacity: ".5" }),
|
|
18569
16420
|
/* @__PURE__ */ jsx40("circle", { cx: "42", cy: "30", r: "3.5", fill: "currentColor" }),
|
|
@@ -18578,7 +16429,7 @@ function ChartTypeThumbnail({ preview }) {
|
|
|
18578
16429
|
}
|
|
18579
16430
|
|
|
18580
16431
|
// src/Toolbar.tsx
|
|
18581
|
-
import { Fragment as
|
|
16432
|
+
import { Fragment as Fragment13, jsx as jsx41, jsxs as jsxs31 } from "react/jsx-runtime";
|
|
18582
16433
|
var VIEWS = [
|
|
18583
16434
|
{ id: "wysiwyg", label: "Write", shortcutKey: "1" },
|
|
18584
16435
|
{ id: "raw", label: "Source", shortcutKey: "2" },
|
|
@@ -20249,7 +18100,7 @@ ${TASK_LIST_MARKDOWN}
|
|
|
20249
18100
|
]
|
|
20250
18101
|
}
|
|
20251
18102
|
),
|
|
20252
|
-
showBlockSectionInOverflow && /* @__PURE__ */ jsxs31(
|
|
18103
|
+
showBlockSectionInOverflow && /* @__PURE__ */ jsxs31(Fragment13, { children: [
|
|
20253
18104
|
/* @__PURE__ */ jsx41(
|
|
20254
18105
|
"div",
|
|
20255
18106
|
{
|
|
@@ -20284,7 +18135,7 @@ ${TASK_LIST_MARKDOWN}
|
|
|
20284
18135
|
accentColor: previewSettings?.activeTheme.colors.primary
|
|
20285
18136
|
}
|
|
20286
18137
|
) }),
|
|
20287
|
-
isInTable && clippedContextual.has("table") && /* @__PURE__ */ jsxs31(
|
|
18138
|
+
isInTable && clippedContextual.has("table") && /* @__PURE__ */ jsxs31(Fragment13, { children: [
|
|
20288
18139
|
/* @__PURE__ */ jsx41(
|
|
20289
18140
|
"div",
|
|
20290
18141
|
{
|
|
@@ -20415,7 +18266,7 @@ ${TASK_LIST_MARKDOWN}
|
|
|
20415
18266
|
style: { position: "fixed", top: insertMenuAnchor.top, left: insertMenuAnchor.left },
|
|
20416
18267
|
role: "menu",
|
|
20417
18268
|
children: [
|
|
20418
|
-
showConvertActions && /* @__PURE__ */ jsxs31(
|
|
18269
|
+
showConvertActions && /* @__PURE__ */ jsxs31(Fragment13, { children: [
|
|
20419
18270
|
/* @__PURE__ */ jsx41("div", { className: "squisq-insert-menu-header", children: "Convert" }),
|
|
20420
18271
|
CONVERT_BUTTONS.map((btn) => {
|
|
20421
18272
|
const label = btn.id === "table" ? "Table" : "Task List";
|
|
@@ -21396,75 +19247,8 @@ function formatClock(raw) {
|
|
|
21396
19247
|
return `${minutes}:${String(secs).padStart(2, "0")}`;
|
|
21397
19248
|
}
|
|
21398
19249
|
|
|
21399
|
-
// ../../node_modules/@tiptap/extension-heading/dist/index.js
|
|
21400
|
-
var Heading = Node2.create({
|
|
21401
|
-
name: "heading",
|
|
21402
|
-
addOptions() {
|
|
21403
|
-
return {
|
|
21404
|
-
levels: [1, 2, 3, 4, 5, 6],
|
|
21405
|
-
HTMLAttributes: {}
|
|
21406
|
-
};
|
|
21407
|
-
},
|
|
21408
|
-
content: "inline*",
|
|
21409
|
-
group: "block",
|
|
21410
|
-
defining: true,
|
|
21411
|
-
addAttributes() {
|
|
21412
|
-
return {
|
|
21413
|
-
level: {
|
|
21414
|
-
default: 1,
|
|
21415
|
-
rendered: false
|
|
21416
|
-
}
|
|
21417
|
-
};
|
|
21418
|
-
},
|
|
21419
|
-
parseHTML() {
|
|
21420
|
-
return this.options.levels.map((level) => ({
|
|
21421
|
-
tag: `h${level}`,
|
|
21422
|
-
attrs: { level }
|
|
21423
|
-
}));
|
|
21424
|
-
},
|
|
21425
|
-
renderHTML({ node: node2, HTMLAttributes }) {
|
|
21426
|
-
const hasLevel = this.options.levels.includes(node2.attrs.level);
|
|
21427
|
-
const level = hasLevel ? node2.attrs.level : this.options.levels[0];
|
|
21428
|
-
return [`h${level}`, mergeAttributes(this.options.HTMLAttributes, HTMLAttributes), 0];
|
|
21429
|
-
},
|
|
21430
|
-
addCommands() {
|
|
21431
|
-
return {
|
|
21432
|
-
setHeading: (attributes) => ({ commands: commands2 }) => {
|
|
21433
|
-
if (!this.options.levels.includes(attributes.level)) {
|
|
21434
|
-
return false;
|
|
21435
|
-
}
|
|
21436
|
-
return commands2.setNode(this.name, attributes);
|
|
21437
|
-
},
|
|
21438
|
-
toggleHeading: (attributes) => ({ commands: commands2 }) => {
|
|
21439
|
-
if (!this.options.levels.includes(attributes.level)) {
|
|
21440
|
-
return false;
|
|
21441
|
-
}
|
|
21442
|
-
return commands2.toggleNode(this.name, "paragraph", attributes);
|
|
21443
|
-
}
|
|
21444
|
-
};
|
|
21445
|
-
},
|
|
21446
|
-
addKeyboardShortcuts() {
|
|
21447
|
-
return this.options.levels.reduce((items, level) => ({
|
|
21448
|
-
...items,
|
|
21449
|
-
...{
|
|
21450
|
-
[`Mod-Alt-${level}`]: () => this.editor.commands.toggleHeading({ level })
|
|
21451
|
-
}
|
|
21452
|
-
}), {});
|
|
21453
|
-
},
|
|
21454
|
-
addInputRules() {
|
|
21455
|
-
return this.options.levels.map((level) => {
|
|
21456
|
-
return textblockTypeInputRule({
|
|
21457
|
-
find: new RegExp(`^(#{${Math.min(...this.options.levels)},${level}})\\s$`),
|
|
21458
|
-
type: this.type,
|
|
21459
|
-
getAttributes: {
|
|
21460
|
-
level
|
|
21461
|
-
}
|
|
21462
|
-
});
|
|
21463
|
-
});
|
|
21464
|
-
}
|
|
21465
|
-
});
|
|
21466
|
-
|
|
21467
19250
|
// src/TemplateAnnotation.ts
|
|
19251
|
+
import Heading from "@tiptap/extension-heading";
|
|
21468
19252
|
var HeadingWithTemplate = Heading.extend({
|
|
21469
19253
|
addAttributes() {
|
|
21470
19254
|
return {
|
|
@@ -21902,7 +19686,8 @@ import {
|
|
|
21902
19686
|
} from "@bendyline/squisq/doc";
|
|
21903
19687
|
|
|
21904
19688
|
// src/asciiDiagram/AsciiDiagramExtension.ts
|
|
21905
|
-
import {
|
|
19689
|
+
import { Extension as Extension4 } from "@tiptap/core";
|
|
19690
|
+
import { Plugin as Plugin4, PluginKey as PluginKey4 } from "@tiptap/pm/state";
|
|
21906
19691
|
import { Decoration as Decoration4, DecorationSet as DecorationSet4 } from "@tiptap/pm/view";
|
|
21907
19692
|
import { createRoot as createRoot2 } from "react-dom/client";
|
|
21908
19693
|
import { createElement as createElement8 } from "react";
|
|
@@ -21927,7 +19712,8 @@ import {
|
|
|
21927
19712
|
} from "@bendyline/squisq/doc";
|
|
21928
19713
|
|
|
21929
19714
|
// src/asciiDiagram/RepairableDiagramExtension.ts
|
|
21930
|
-
import {
|
|
19715
|
+
import { Extension as Extension3 } from "@tiptap/core";
|
|
19716
|
+
import { Plugin as Plugin3, PluginKey as PluginKey3 } from "@tiptap/pm/state";
|
|
21931
19717
|
import { Decoration as Decoration3, DecorationSet as DecorationSet3 } from "@tiptap/pm/view";
|
|
21932
19718
|
import { isEligibleAsciiFenceLang, isRepairableDiagram } from "@bendyline/squisq/doc";
|
|
21933
19719
|
|
|
@@ -21960,7 +19746,7 @@ function mapFenceEntries(tr, previous, doc) {
|
|
|
21960
19746
|
}
|
|
21961
19747
|
|
|
21962
19748
|
// src/asciiDiagram/RepairableDiagramExtension.ts
|
|
21963
|
-
var REPAIRABLE_KEY = new
|
|
19749
|
+
var REPAIRABLE_KEY = new PluginKey3("squisq-repairable-diagram");
|
|
21964
19750
|
var cache = /* @__PURE__ */ new WeakMap();
|
|
21965
19751
|
function fenceLangOf(node2) {
|
|
21966
19752
|
const lang = node2.attrs.language;
|
|
@@ -22028,7 +19814,7 @@ function applyState(tr, prev, editor, doc, onRepair) {
|
|
|
22028
19814
|
});
|
|
22029
19815
|
return { entries, seq, decorations: buildDecorations2(doc, entries, editor, onRepair) };
|
|
22030
19816
|
}
|
|
22031
|
-
var RepairableDiagramExtension =
|
|
19817
|
+
var RepairableDiagramExtension = Extension3.create({
|
|
22032
19818
|
name: "squisqRepairableDiagram",
|
|
22033
19819
|
addOptions() {
|
|
22034
19820
|
return { enabled: true };
|
|
@@ -22038,7 +19824,7 @@ var RepairableDiagramExtension = Extension.create({
|
|
|
22038
19824
|
if (this.options.enabled === false) return [];
|
|
22039
19825
|
const onRepair = this.options.onRepair;
|
|
22040
19826
|
return [
|
|
22041
|
-
new
|
|
19827
|
+
new Plugin3({
|
|
22042
19828
|
key: REPAIRABLE_KEY,
|
|
22043
19829
|
state: {
|
|
22044
19830
|
init: (_config, state) => {
|
|
@@ -22351,7 +20137,7 @@ function containFenceWidgetEvents(container) {
|
|
|
22351
20137
|
}
|
|
22352
20138
|
|
|
22353
20139
|
// src/asciiDiagram/AsciiDiagramExtension.ts
|
|
22354
|
-
var ASCII_DIAGRAM_KEY = new
|
|
20140
|
+
var ASCII_DIAGRAM_KEY = new PluginKey4("squisq-ascii-diagram");
|
|
22355
20141
|
var detectCache = /* @__PURE__ */ new WeakMap();
|
|
22356
20142
|
var parseCache = /* @__PURE__ */ new WeakMap();
|
|
22357
20143
|
function fenceLangOf2(node2) {
|
|
@@ -22486,7 +20272,7 @@ function applyState2(tr, prev, editor, doc, textChannel) {
|
|
|
22486
20272
|
decorations: buildDecorations3(doc, entries, prunedSourceVisible, editor, textChannel)
|
|
22487
20273
|
};
|
|
22488
20274
|
}
|
|
22489
|
-
var AsciiDiagramExtension =
|
|
20275
|
+
var AsciiDiagramExtension = Extension4.create({
|
|
22490
20276
|
name: "squisqAsciiDiagram",
|
|
22491
20277
|
addOptions() {
|
|
22492
20278
|
return {
|
|
@@ -22497,7 +20283,7 @@ var AsciiDiagramExtension = Extension.create({
|
|
|
22497
20283
|
const editor = this.editor;
|
|
22498
20284
|
if (this.options.enabled === false) return [];
|
|
22499
20285
|
return [
|
|
22500
|
-
new
|
|
20286
|
+
new Plugin4({
|
|
22501
20287
|
key: ASCII_DIAGRAM_KEY,
|
|
22502
20288
|
state: {
|
|
22503
20289
|
init: (_config, state) => {
|
|
@@ -23692,14 +21478,14 @@ function addAdapterNode(source, model2) {
|
|
|
23692
21478
|
result = appendStatement(source, " New task: 3: User");
|
|
23693
21479
|
break;
|
|
23694
21480
|
case "kanban": {
|
|
23695
|
-
const
|
|
23696
|
-
if (!
|
|
21481
|
+
const first = model2.nodes[0];
|
|
21482
|
+
if (!first) {
|
|
23697
21483
|
result = appendStatement(source, ` todo[To do]
|
|
23698
21484
|
${id}[New task]`);
|
|
23699
21485
|
} else {
|
|
23700
|
-
const line = sourceLine(
|
|
21486
|
+
const line = sourceLine(first) ?? 1;
|
|
23701
21487
|
const lines2 = linesOf(source);
|
|
23702
|
-
lines2.splice(line, 0, `${String(
|
|
21488
|
+
lines2.splice(line, 0, `${String(first.origin?.indent ?? " ")}${id}[New task]`);
|
|
23703
21489
|
result = sourceResult(source, lines2);
|
|
23704
21490
|
}
|
|
23705
21491
|
break;
|
|
@@ -25386,7 +23172,8 @@ function MermaidShapeThumb({ shape }) {
|
|
|
25386
23172
|
import { useEffect as useEffect30, useMemo as useMemo30, useState as useState39 } from "react";
|
|
25387
23173
|
|
|
25388
23174
|
// src/mermaid/MermaidDiagramExtension.ts
|
|
25389
|
-
import {
|
|
23175
|
+
import { Extension as Extension5 } from "@tiptap/core";
|
|
23176
|
+
import { Plugin as Plugin5, PluginKey as PluginKey5 } from "@tiptap/pm/state";
|
|
25390
23177
|
import { Decoration as Decoration5, DecorationSet as DecorationSet5 } from "@tiptap/pm/view";
|
|
25391
23178
|
import { createElement as createElement9 } from "react";
|
|
25392
23179
|
import { createRoot as createRoot3 } from "react-dom/client";
|
|
@@ -25733,7 +23520,7 @@ function setMermaidFlowchartDirection(source, direction) {
|
|
|
25733
23520
|
|
|
25734
23521
|
// src/mermaid/MermaidDiagramWidget.tsx
|
|
25735
23522
|
import { DEFAULT_THEME as DEFAULT_THEME3 } from "@bendyline/squisq/doc";
|
|
25736
|
-
import { Fragment as
|
|
23523
|
+
import { Fragment as Fragment14, jsx as jsx48, jsxs as jsxs37 } from "react/jsx-runtime";
|
|
25737
23524
|
var MIN_DIAGRAM_HEIGHT2 = 160;
|
|
25738
23525
|
var DEFAULT_DIAGRAM_HEIGHT2 = 420;
|
|
25739
23526
|
var DIRECTION_PICKER_WIDTH = 344;
|
|
@@ -26394,7 +24181,7 @@ function MermaidPropertiesPalette({
|
|
|
26394
24181
|
}
|
|
26395
24182
|
),
|
|
26396
24183
|
/* @__PURE__ */ jsx48("span", { children: property.label })
|
|
26397
|
-
] }) : /* @__PURE__ */ jsxs37(
|
|
24184
|
+
] }) : /* @__PURE__ */ jsxs37(Fragment14, { children: [
|
|
26398
24185
|
/* @__PURE__ */ jsx48("span", { children: property.label }),
|
|
26399
24186
|
property.type === "select" ? /* @__PURE__ */ jsx48(
|
|
26400
24187
|
"select",
|
|
@@ -26485,22 +24272,22 @@ function MermaidDirectionThumbnail({
|
|
|
26485
24272
|
}) {
|
|
26486
24273
|
const horizontal = direction === "LR" || direction === "RL";
|
|
26487
24274
|
const reversed = direction === "RL" || direction === "BT";
|
|
26488
|
-
const
|
|
24275
|
+
const first = horizontal ? { x: reversed ? 79 : 7, y: 21 } : { x: 43, y: reversed ? 39 : 3 };
|
|
26489
24276
|
const second = horizontal ? { x: reversed ? 7 : 79, y: 21 } : { x: 43, y: reversed ? 3 : 39 };
|
|
26490
24277
|
const path = direction === "LR" ? "M41 32H75" : direction === "RL" ? "M79 32H45" : direction === "TB" ? "M60 25V35" : "M60 39V29";
|
|
26491
24278
|
const arrow = direction === "LR" ? "75,32 68,28 68,36" : direction === "RL" ? "45,32 52,28 52,36" : direction === "TB" ? "60,35 56,28 64,28" : "60,29 56,36 64,36";
|
|
26492
24279
|
return /* @__PURE__ */ jsxs37("svg", { viewBox: "0 0 120 64", "aria-hidden": "true", children: [
|
|
26493
|
-
/* @__PURE__ */ jsx48("rect", { x:
|
|
24280
|
+
/* @__PURE__ */ jsx48("rect", { x: first.x, y: first.y, width: "34", height: "22", rx: "3" }),
|
|
26494
24281
|
/* @__PURE__ */ jsx48("rect", { x: second.x, y: second.y, width: "34", height: "22", rx: "3" }),
|
|
26495
24282
|
/* @__PURE__ */ jsx48("path", { d: path }),
|
|
26496
24283
|
/* @__PURE__ */ jsx48("polygon", { points: arrow }),
|
|
26497
|
-
/* @__PURE__ */ jsx48("text", { x:
|
|
24284
|
+
/* @__PURE__ */ jsx48("text", { x: first.x + 17, y: first.y + 14, children: "A" }),
|
|
26498
24285
|
/* @__PURE__ */ jsx48("text", { x: second.x + 17, y: second.y + 14, children: "B" })
|
|
26499
24286
|
] });
|
|
26500
24287
|
}
|
|
26501
24288
|
|
|
26502
24289
|
// src/mermaid/MermaidDiagramExtension.ts
|
|
26503
|
-
var MERMAID_DIAGRAM_KEY = new
|
|
24290
|
+
var MERMAID_DIAGRAM_KEY = new PluginKey5(
|
|
26504
24291
|
"squisq-mermaid-diagram"
|
|
26505
24292
|
);
|
|
26506
24293
|
function fenceLanguage(node2) {
|
|
@@ -26604,7 +24391,7 @@ function applyState3(tr, previous, editor, doc, themeStore) {
|
|
|
26604
24391
|
decorations: buildDecorations4(doc, entries, prunedSourceVisible, editor, themeStore)
|
|
26605
24392
|
};
|
|
26606
24393
|
}
|
|
26607
|
-
var MermaidDiagramExtension =
|
|
24394
|
+
var MermaidDiagramExtension = Extension5.create({
|
|
26608
24395
|
name: "squisqMermaidDiagram",
|
|
26609
24396
|
addOptions() {
|
|
26610
24397
|
return { enabled: true };
|
|
@@ -26614,7 +24401,7 @@ var MermaidDiagramExtension = Extension.create({
|
|
|
26614
24401
|
const editor = this.editor;
|
|
26615
24402
|
const themeStore = this.options.themeStore;
|
|
26616
24403
|
return [
|
|
26617
|
-
new
|
|
24404
|
+
new Plugin5({
|
|
26618
24405
|
key: MERMAID_DIAGRAM_KEY,
|
|
26619
24406
|
state: {
|
|
26620
24407
|
init: (_config, state) => {
|
|
@@ -26666,7 +24453,8 @@ function useMermaidDiagramData(editor, blockId) {
|
|
|
26666
24453
|
}
|
|
26667
24454
|
|
|
26668
24455
|
// src/codeSnippet/CodeSnippetExtension.ts
|
|
26669
|
-
import {
|
|
24456
|
+
import { Extension as Extension6 } from "@tiptap/core";
|
|
24457
|
+
import { Plugin as Plugin6, PluginKey as PluginKey6 } from "@tiptap/pm/state";
|
|
26670
24458
|
import { Decoration as Decoration6, DecorationSet as DecorationSet6 } from "@tiptap/pm/view";
|
|
26671
24459
|
import { createElement as createElement10 } from "react";
|
|
26672
24460
|
import { createRoot as createRoot4 } from "react-dom/client";
|
|
@@ -26819,7 +24607,7 @@ function CodeSnippetWidget({
|
|
|
26819
24607
|
}
|
|
26820
24608
|
|
|
26821
24609
|
// src/codeSnippet/CodeSnippetExtension.ts
|
|
26822
|
-
var CODE_SNIPPET_KEY = new
|
|
24610
|
+
var CODE_SNIPPET_KEY = new PluginKey6("squisq-code-snippet");
|
|
26823
24611
|
function isCodeSnippetNode(node2) {
|
|
26824
24612
|
const language = node2.attrs.language;
|
|
26825
24613
|
return node2.type.name === "codeBlock" && isCodeSnippetFenceLanguage(typeof language === "string" ? language : null);
|
|
@@ -26915,7 +24703,7 @@ function applyState4(tr, previous, editor, doc) {
|
|
|
26915
24703
|
decorations: buildDecorations5(doc, entries, editor, focusBlockId)
|
|
26916
24704
|
};
|
|
26917
24705
|
}
|
|
26918
|
-
var CodeSnippetExtension =
|
|
24706
|
+
var CodeSnippetExtension = Extension6.create({
|
|
26919
24707
|
name: "squisqCodeSnippet",
|
|
26920
24708
|
addOptions() {
|
|
26921
24709
|
return { enabled: true };
|
|
@@ -26924,7 +24712,7 @@ var CodeSnippetExtension = Extension.create({
|
|
|
26924
24712
|
if (this.options.enabled === false) return [];
|
|
26925
24713
|
const editor = this.editor;
|
|
26926
24714
|
return [
|
|
26927
|
-
new
|
|
24715
|
+
new Plugin6({
|
|
26928
24716
|
key: CODE_SNIPPET_KEY,
|
|
26929
24717
|
state: {
|
|
26930
24718
|
init: (_config, state) => {
|
|
@@ -26973,7 +24761,8 @@ function replaceCodeSnippetText(editor, blockId, nextText) {
|
|
|
26973
24761
|
import { useEffect as useEffect33, useMemo as useMemo32, useState as useState43 } from "react";
|
|
26974
24762
|
|
|
26975
24763
|
// src/treeview/TreeViewExtension.ts
|
|
26976
|
-
import {
|
|
24764
|
+
import { Extension as Extension7 } from "@tiptap/core";
|
|
24765
|
+
import { Plugin as Plugin7, PluginKey as PluginKey7 } from "@tiptap/pm/state";
|
|
26977
24766
|
import { Decoration as Decoration7, DecorationSet as DecorationSet7 } from "@tiptap/pm/view";
|
|
26978
24767
|
import { createRoot as createRoot5 } from "react-dom/client";
|
|
26979
24768
|
import { createElement as createElement11 } from "react";
|
|
@@ -27529,7 +25318,7 @@ function TreeRowView({
|
|
|
27529
25318
|
}
|
|
27530
25319
|
|
|
27531
25320
|
// src/treeview/TreeViewExtension.ts
|
|
27532
|
-
var TREEVIEW_KEY = new
|
|
25321
|
+
var TREEVIEW_KEY = new PluginKey7("squisq-treeview");
|
|
27533
25322
|
var detectCache2 = /* @__PURE__ */ new WeakMap();
|
|
27534
25323
|
var parseCache2 = /* @__PURE__ */ new WeakMap();
|
|
27535
25324
|
function fenceLangOf3(node2) {
|
|
@@ -27636,7 +25425,7 @@ function applyState5(tr, prev, editor, doc) {
|
|
|
27636
25425
|
});
|
|
27637
25426
|
return { entries, seq, decorations: buildDecorations6(doc, entries, editor) };
|
|
27638
25427
|
}
|
|
27639
|
-
var TreeViewExtension =
|
|
25428
|
+
var TreeViewExtension = Extension7.create({
|
|
27640
25429
|
name: "squisqTreeView",
|
|
27641
25430
|
addOptions() {
|
|
27642
25431
|
return { enabled: true };
|
|
@@ -27645,7 +25434,7 @@ var TreeViewExtension = Extension.create({
|
|
|
27645
25434
|
const editor = this.editor;
|
|
27646
25435
|
if (this.options.enabled === false) return [];
|
|
27647
25436
|
return [
|
|
27648
|
-
new
|
|
25437
|
+
new Plugin7({
|
|
27649
25438
|
key: TREEVIEW_KEY,
|
|
27650
25439
|
state: {
|
|
27651
25440
|
init: (_config, state) => {
|
|
@@ -27707,7 +25496,8 @@ function shouldPasteAsTreeFence(text) {
|
|
|
27707
25496
|
import { useEffect as useEffect35, useMemo as useMemo34, useRef as useRef37, useState as useState45 } from "react";
|
|
27708
25497
|
|
|
27709
25498
|
// src/timeline/TimelineViewExtension.ts
|
|
27710
|
-
import {
|
|
25499
|
+
import { Extension as Extension8 } from "@tiptap/core";
|
|
25500
|
+
import { Plugin as Plugin8, PluginKey as PluginKey8 } from "@tiptap/pm/state";
|
|
27711
25501
|
import { Decoration as Decoration8, DecorationSet as DecorationSet8 } from "@tiptap/pm/view";
|
|
27712
25502
|
import { createElement as createElement12 } from "react";
|
|
27713
25503
|
import { createRoot as createRoot6 } from "react-dom/client";
|
|
@@ -28128,30 +25918,30 @@ function applyOp3(editor, blockId, op, verifyResult) {
|
|
|
28128
25918
|
...result.trackId ? { trackId: result.trackId } : {}
|
|
28129
25919
|
};
|
|
28130
25920
|
}
|
|
28131
|
-
function applyTimelineCommand(editor, blockId,
|
|
25921
|
+
function applyTimelineCommand(editor, blockId, command) {
|
|
28132
25922
|
if (!editor.isEditable) return READ_ONLY;
|
|
28133
|
-
switch (
|
|
25923
|
+
switch (command.kind) {
|
|
28134
25924
|
case "addTrack":
|
|
28135
25925
|
return applyOp3(
|
|
28136
25926
|
editor,
|
|
28137
25927
|
blockId,
|
|
28138
25928
|
(timeline) => addTimelineTrackOp(timeline, {
|
|
28139
|
-
id:
|
|
28140
|
-
label:
|
|
28141
|
-
eventId:
|
|
28142
|
-
eventLabel:
|
|
25929
|
+
id: command.id,
|
|
25930
|
+
label: command.label,
|
|
25931
|
+
eventId: command.eventId,
|
|
25932
|
+
eventLabel: command.eventLabel
|
|
28143
25933
|
})
|
|
28144
25934
|
);
|
|
28145
25935
|
case "updateTrack": {
|
|
28146
|
-
const expectedLabel = sanitizeTimelineText(
|
|
25936
|
+
const expectedLabel = sanitizeTimelineText(command.label);
|
|
28147
25937
|
return applyOp3(
|
|
28148
25938
|
editor,
|
|
28149
25939
|
blockId,
|
|
28150
25940
|
(timeline) => ({
|
|
28151
|
-
timeline: updateTimelineTrackOp(timeline,
|
|
25941
|
+
timeline: updateTimelineTrackOp(timeline, command.trackId, command.label)
|
|
28152
25942
|
}),
|
|
28153
25943
|
(timeline) => timeline.tracks.some(
|
|
28154
|
-
(track) => track.id ===
|
|
25944
|
+
(track) => track.id === command.trackId && track.label === expectedLabel
|
|
28155
25945
|
)
|
|
28156
25946
|
);
|
|
28157
25947
|
}
|
|
@@ -28159,19 +25949,19 @@ function applyTimelineCommand(editor, blockId, command2) {
|
|
|
28159
25949
|
return applyOp3(
|
|
28160
25950
|
editor,
|
|
28161
25951
|
blockId,
|
|
28162
|
-
(timeline) => ({ timeline: removeTimelineTrackOp(timeline,
|
|
28163
|
-
(timeline) => !hasTrack(timeline,
|
|
25952
|
+
(timeline) => ({ timeline: removeTimelineTrackOp(timeline, command.trackId) }),
|
|
25953
|
+
(timeline) => !hasTrack(timeline, command.trackId)
|
|
28164
25954
|
);
|
|
28165
25955
|
case "addEvent":
|
|
28166
25956
|
return applyOp3(editor, blockId, (timeline) => {
|
|
28167
|
-
const result = addTimelineEventOp(timeline,
|
|
28168
|
-
id:
|
|
28169
|
-
label:
|
|
28170
|
-
description:
|
|
28171
|
-
side:
|
|
28172
|
-
descriptionSide:
|
|
28173
|
-
callout:
|
|
28174
|
-
marker:
|
|
25957
|
+
const result = addTimelineEventOp(timeline, command.trackId, command.position, {
|
|
25958
|
+
id: command.id,
|
|
25959
|
+
label: command.label,
|
|
25960
|
+
description: command.description,
|
|
25961
|
+
side: command.side,
|
|
25962
|
+
descriptionSide: command.descriptionSide,
|
|
25963
|
+
callout: command.callout,
|
|
25964
|
+
marker: command.marker
|
|
28175
25965
|
});
|
|
28176
25966
|
return result;
|
|
28177
25967
|
});
|
|
@@ -28180,25 +25970,25 @@ function applyTimelineCommand(editor, blockId, command2) {
|
|
|
28180
25970
|
editor,
|
|
28181
25971
|
blockId,
|
|
28182
25972
|
(timeline) => ({
|
|
28183
|
-
timeline: updateTimelineEventOp(timeline,
|
|
25973
|
+
timeline: updateTimelineEventOp(timeline, command.eventId, command.patch)
|
|
28184
25974
|
}),
|
|
28185
|
-
(timeline) => hasEvent(timeline,
|
|
25975
|
+
(timeline) => hasEvent(timeline, command.eventId)
|
|
28186
25976
|
);
|
|
28187
25977
|
case "removeEvent":
|
|
28188
25978
|
return applyOp3(
|
|
28189
25979
|
editor,
|
|
28190
25980
|
blockId,
|
|
28191
|
-
(timeline) => ({ timeline: removeTimelineEventOp(timeline,
|
|
28192
|
-
(timeline) => !hasEvent(timeline,
|
|
25981
|
+
(timeline) => ({ timeline: removeTimelineEventOp(timeline, command.eventId) }),
|
|
25982
|
+
(timeline) => !hasEvent(timeline, command.eventId)
|
|
28193
25983
|
);
|
|
28194
25984
|
}
|
|
28195
|
-
const exhaustive =
|
|
25985
|
+
const exhaustive = command;
|
|
28196
25986
|
void exhaustive;
|
|
28197
25987
|
return NOT_APPLIED;
|
|
28198
25988
|
}
|
|
28199
25989
|
|
|
28200
25990
|
// src/timeline/TimelineEditorWidget.tsx
|
|
28201
|
-
import { Fragment as
|
|
25991
|
+
import { Fragment as Fragment15, jsx as jsx51, jsxs as jsxs40 } from "react/jsx-runtime";
|
|
28202
25992
|
var clamp01 = (value) => Math.max(0, Math.min(1, value));
|
|
28203
25993
|
function TimelineEditorWidget({ editor, blockId }) {
|
|
28204
25994
|
const view = useTimelineData(editor, blockId);
|
|
@@ -28210,8 +26000,8 @@ function TimelineEditorWidget({ editor, blockId }) {
|
|
|
28210
26000
|
const suppressClickEventId = useRef36(null);
|
|
28211
26001
|
const [announcement, setAnnouncement] = useState44("");
|
|
28212
26002
|
const dispatch = useCallback37(
|
|
28213
|
-
(
|
|
28214
|
-
const result = applyTimelineCommand(editor, blockId,
|
|
26003
|
+
(command) => {
|
|
26004
|
+
const result = applyTimelineCommand(editor, blockId, command);
|
|
28215
26005
|
if (result.reason === "read-only") setAnnouncement("Timeline is read only.");
|
|
28216
26006
|
if (result.reason === "unsafe-source") {
|
|
28217
26007
|
setAnnouncement("Visual editing is paused until the timeline source is repaired.");
|
|
@@ -28421,7 +26211,7 @@ function TimelineEditorWidget({ editor, blockId }) {
|
|
|
28421
26211
|
onFinish: () => setEditingTrackId(null)
|
|
28422
26212
|
}
|
|
28423
26213
|
),
|
|
28424
|
-
editable ? /* @__PURE__ */ jsxs40(
|
|
26214
|
+
editable ? /* @__PURE__ */ jsxs40(Fragment15, { children: [
|
|
28425
26215
|
/* @__PURE__ */ jsx51(
|
|
28426
26216
|
"button",
|
|
28427
26217
|
{
|
|
@@ -28919,7 +26709,7 @@ function navigateTrackPoints(event) {
|
|
|
28919
26709
|
}
|
|
28920
26710
|
|
|
28921
26711
|
// src/timeline/TimelineViewExtension.ts
|
|
28922
|
-
var TIMELINE_VIEW_KEY = new
|
|
26712
|
+
var TIMELINE_VIEW_KEY = new PluginKey8("squisq-timeline-view");
|
|
28923
26713
|
var detectCache3 = /* @__PURE__ */ new WeakMap();
|
|
28924
26714
|
var parseCache3 = /* @__PURE__ */ new WeakMap();
|
|
28925
26715
|
function fenceLangOf4(node2) {
|
|
@@ -29016,7 +26806,7 @@ function applyState6(tr, previous, editor, doc) {
|
|
|
29016
26806
|
});
|
|
29017
26807
|
return { entries, seq, decorations: buildDecorations7(doc, entries, editor) };
|
|
29018
26808
|
}
|
|
29019
|
-
var TimelineViewExtension =
|
|
26809
|
+
var TimelineViewExtension = Extension8.create({
|
|
29020
26810
|
name: "squisqTimelineView",
|
|
29021
26811
|
addOptions() {
|
|
29022
26812
|
return { enabled: true };
|
|
@@ -29025,7 +26815,7 @@ var TimelineViewExtension = Extension.create({
|
|
|
29025
26815
|
const editor = this.editor;
|
|
29026
26816
|
if (this.options.enabled === false) return [];
|
|
29027
26817
|
return [
|
|
29028
|
-
new
|
|
26818
|
+
new Plugin8({
|
|
29029
26819
|
key: TIMELINE_VIEW_KEY,
|
|
29030
26820
|
state: {
|
|
29031
26821
|
init: (_config, state) => {
|
|
@@ -29280,7 +27070,7 @@ function persistFromWrite(bodyMd, state) {
|
|
|
29280
27070
|
// src/WysiwygEditor.tsx
|
|
29281
27071
|
import { useCallback as useCallback38, useEffect as useEffect39, useMemo as useMemo35, useRef as useRef40, useState as useState49 } from "react";
|
|
29282
27072
|
import { useEditor as useEditor2, EditorContent as EditorContent2 } from "@tiptap/react";
|
|
29283
|
-
import { Selection
|
|
27073
|
+
import { Selection } from "@tiptap/pm/state";
|
|
29284
27074
|
import StarterKit2 from "@tiptap/starter-kit";
|
|
29285
27075
|
import Table from "@tiptap/extension-table";
|
|
29286
27076
|
import TableRow from "@tiptap/extension-table-row";
|
|
@@ -29313,11 +27103,12 @@ function createMermaidThemeStore(initialTheme) {
|
|
|
29313
27103
|
}
|
|
29314
27104
|
|
|
29315
27105
|
// src/blockTagActivity.ts
|
|
29316
|
-
import {
|
|
27106
|
+
import { Extension as Extension9 } from "@tiptap/core";
|
|
27107
|
+
import { Plugin as Plugin9, PluginKey as PluginKey9 } from "@tiptap/pm/state";
|
|
29317
27108
|
import { Decoration as Decoration9, DecorationSet as DecorationSet9 } from "@tiptap/pm/view";
|
|
29318
27109
|
var BLOCK_TAG_SELECTED_CLASS = "squisq-block-tags--selected";
|
|
29319
27110
|
var BLOCK_TAG_HOVERED_CLASS = "squisq-block-tags--hovered";
|
|
29320
|
-
var BLOCK_TAG_ACTIVITY_KEY = new
|
|
27111
|
+
var BLOCK_TAG_ACTIVITY_KEY = new PluginKey9(
|
|
29321
27112
|
"squisq-block-tag-activity"
|
|
29322
27113
|
);
|
|
29323
27114
|
function isHeadingElement(element) {
|
|
@@ -29420,11 +27211,11 @@ function setHoveredPosition(view, hoveredPosition) {
|
|
|
29420
27211
|
view.state.tr.setMeta(BLOCK_TAG_ACTIVITY_KEY, { hoveredPosition }).setMeta("addToHistory", false)
|
|
29421
27212
|
);
|
|
29422
27213
|
}
|
|
29423
|
-
var BlockTagActivityExtension =
|
|
27214
|
+
var BlockTagActivityExtension = Extension9.create({
|
|
29424
27215
|
name: "squisqBlockTagActivity",
|
|
29425
27216
|
addProseMirrorPlugins() {
|
|
29426
27217
|
return [
|
|
29427
|
-
new
|
|
27218
|
+
new Plugin9({
|
|
29428
27219
|
key: BLOCK_TAG_ACTIVITY_KEY,
|
|
29429
27220
|
state: {
|
|
29430
27221
|
init: (_config, state) => createPluginState(state.doc, state.selection.from, null),
|
|
@@ -29460,6 +27251,7 @@ var BlockTagActivityExtension = Extension.create({
|
|
|
29460
27251
|
});
|
|
29461
27252
|
|
|
29462
27253
|
// src/InlineIcon.ts
|
|
27254
|
+
import { Node as Node2, mergeAttributes } from "@tiptap/core";
|
|
29463
27255
|
var InlineIcon = Node2.create({
|
|
29464
27256
|
name: "inlineIcon",
|
|
29465
27257
|
group: "inline",
|
|
@@ -29525,8 +27317,8 @@ function normalizeMalformedAssetUrl(src) {
|
|
|
29525
27317
|
}
|
|
29526
27318
|
|
|
29527
27319
|
// src/ImageNodeView.tsx
|
|
29528
|
-
import { Fragment as
|
|
29529
|
-
function ImageComponent({ node: node2, selected, editor, updateAttributes
|
|
27320
|
+
import { Fragment as Fragment16, jsx as jsx53, jsxs as jsxs42 } from "react/jsx-runtime";
|
|
27321
|
+
function ImageComponent({ node: node2, selected, editor, updateAttributes }) {
|
|
29530
27322
|
const { src, alt, title, width } = node2.attrs;
|
|
29531
27323
|
const { mediaProvider, imageDisplayMode, openImageEdit, mediaRevision } = useEditorContext();
|
|
29532
27324
|
const [resolvedSrc, setResolvedSrc] = useState47(src);
|
|
@@ -29584,7 +27376,7 @@ function ImageComponent({ node: node2, selected, editor, updateAttributes: updat
|
|
|
29584
27376
|
const w = Math.round(finalWidth);
|
|
29585
27377
|
const h2 = naturalW > 0 && naturalH > 0 ? Math.round(w * naturalH / naturalW) : null;
|
|
29586
27378
|
setPreviewWidth(null);
|
|
29587
|
-
|
|
27379
|
+
updateAttributes({ width: w, height: h2 });
|
|
29588
27380
|
};
|
|
29589
27381
|
window.addEventListener("mousemove", onMove);
|
|
29590
27382
|
window.addEventListener("mouseup", onUp);
|
|
@@ -29594,7 +27386,7 @@ function ImageComponent({ node: node2, selected, editor, updateAttributes: updat
|
|
|
29594
27386
|
event.preventDefault();
|
|
29595
27387
|
event.stopPropagation();
|
|
29596
27388
|
setPreviewWidth(null);
|
|
29597
|
-
|
|
27389
|
+
updateAttributes({ width: null, height: null });
|
|
29598
27390
|
};
|
|
29599
27391
|
const baseStyle = isThumbnail ? {
|
|
29600
27392
|
maxWidth: "100px",
|
|
@@ -29653,7 +27445,7 @@ function ImageComponent({ node: node2, selected, editor, updateAttributes: updat
|
|
|
29653
27445
|
]
|
|
29654
27446
|
}
|
|
29655
27447
|
),
|
|
29656
|
-
showResize && /* @__PURE__ */ jsxs42(
|
|
27448
|
+
showResize && /* @__PURE__ */ jsxs42(Fragment16, { children: [
|
|
29657
27449
|
/* @__PURE__ */ jsx53(
|
|
29658
27450
|
"span",
|
|
29659
27451
|
{
|
|
@@ -29715,6 +27507,7 @@ var ImageWithMediaProvider = Image.extend({
|
|
|
29715
27507
|
});
|
|
29716
27508
|
|
|
29717
27509
|
// src/tiptap/TiptapVideo.tsx
|
|
27510
|
+
import { Node as Node3, mergeAttributes as mergeAttributes2 } from "@tiptap/core";
|
|
29718
27511
|
import { NodeViewWrapper as NodeViewWrapper2, ReactNodeViewRenderer as ReactNodeViewRenderer2 } from "@tiptap/react";
|
|
29719
27512
|
|
|
29720
27513
|
// src/tiptap/useResolvedMediaSrc.ts
|
|
@@ -29761,7 +27554,7 @@ function normalizeVideoPlacement(value) {
|
|
|
29761
27554
|
function normalizeLockToBlock(value) {
|
|
29762
27555
|
return value !== false && value !== "false" && value !== 0 && value !== "0";
|
|
29763
27556
|
}
|
|
29764
|
-
function VideoNodeView({ node: node2, updateAttributes
|
|
27557
|
+
function VideoNodeView({ node: node2, updateAttributes, selected }) {
|
|
29765
27558
|
const {
|
|
29766
27559
|
src,
|
|
29767
27560
|
width,
|
|
@@ -29799,7 +27592,7 @@ function VideoNodeView({ node: node2, updateAttributes: updateAttributes2, selec
|
|
|
29799
27592
|
"aria-pressed": placement === option.value,
|
|
29800
27593
|
title: option.title,
|
|
29801
27594
|
onMouseDown: (event) => event.preventDefault(),
|
|
29802
|
-
onClick: () =>
|
|
27595
|
+
onClick: () => updateAttributes({ placement: option.value }),
|
|
29803
27596
|
children: option.label
|
|
29804
27597
|
},
|
|
29805
27598
|
option.value
|
|
@@ -29813,7 +27606,7 @@ function VideoNodeView({ node: node2, updateAttributes: updateAttributes2, selec
|
|
|
29813
27606
|
"aria-pressed": lockToBlock,
|
|
29814
27607
|
title: lockToBlock ? "Locked to this block; turn off for independent document timing" : "Document-timed; turn on to follow this block",
|
|
29815
27608
|
onMouseDown: (event) => event.preventDefault(),
|
|
29816
|
-
onClick: () =>
|
|
27609
|
+
onClick: () => updateAttributes({ lockToBlock: !lockToBlock }),
|
|
29817
27610
|
children: "Lock to block"
|
|
29818
27611
|
}
|
|
29819
27612
|
)
|
|
@@ -29838,7 +27631,7 @@ function VideoNodeView({ node: node2, updateAttributes: updateAttributes2, selec
|
|
|
29838
27631
|
}
|
|
29839
27632
|
);
|
|
29840
27633
|
}
|
|
29841
|
-
var TiptapVideo =
|
|
27634
|
+
var TiptapVideo = Node3.create({
|
|
29842
27635
|
name: "video",
|
|
29843
27636
|
group: "block",
|
|
29844
27637
|
atom: true,
|
|
@@ -29914,19 +27707,20 @@ var TiptapVideo = Node2.create({
|
|
|
29914
27707
|
return [{ tag: "video" }];
|
|
29915
27708
|
},
|
|
29916
27709
|
renderHTML({ HTMLAttributes }) {
|
|
29917
|
-
return ["video",
|
|
27710
|
+
return ["video", mergeAttributes2(this.options.HTMLAttributes, HTMLAttributes)];
|
|
29918
27711
|
},
|
|
29919
27712
|
addNodeView() {
|
|
29920
27713
|
return ReactNodeViewRenderer2(VideoNodeView);
|
|
29921
27714
|
},
|
|
29922
27715
|
addCommands() {
|
|
29923
27716
|
return {
|
|
29924
|
-
setVideo: (attrs) => ({ commands
|
|
27717
|
+
setVideo: (attrs) => ({ commands }) => commands.insertContent({ type: this.name, attrs })
|
|
29925
27718
|
};
|
|
29926
27719
|
}
|
|
29927
27720
|
});
|
|
29928
27721
|
|
|
29929
27722
|
// src/tiptap/TiptapAudio.tsx
|
|
27723
|
+
import { Node as Node4, mergeAttributes as mergeAttributes3 } from "@tiptap/core";
|
|
29930
27724
|
import { NodeViewWrapper as NodeViewWrapper3, ReactNodeViewRenderer as ReactNodeViewRenderer3 } from "@tiptap/react";
|
|
29931
27725
|
import { jsx as jsx55 } from "react/jsx-runtime";
|
|
29932
27726
|
function AudioNodeView({ node: node2 }) {
|
|
@@ -29934,7 +27728,7 @@ function AudioNodeView({ node: node2 }) {
|
|
|
29934
27728
|
const resolvedSrc = useResolvedMediaSrc(src ?? "");
|
|
29935
27729
|
return /* @__PURE__ */ jsx55(NodeViewWrapper3, { as: "span", className: "squisq-inline-audio-player", "data-drag-handle": true, draggable: true, children: /* @__PURE__ */ jsx55("audio", { src: resolvedSrc || void 0, controls, preload: "metadata" }) });
|
|
29936
27730
|
}
|
|
29937
|
-
var TiptapAudio =
|
|
27731
|
+
var TiptapAudio = Node4.create({
|
|
29938
27732
|
name: "audio",
|
|
29939
27733
|
// Block-level so each recording lives on its own line in the WYSIWYG —
|
|
29940
27734
|
// matches how the recorder inserts the tag (on a fresh line) and
|
|
@@ -29961,14 +27755,14 @@ var TiptapAudio = Node2.create({
|
|
|
29961
27755
|
return [{ tag: "audio" }];
|
|
29962
27756
|
},
|
|
29963
27757
|
renderHTML({ HTMLAttributes }) {
|
|
29964
|
-
return ["audio",
|
|
27758
|
+
return ["audio", mergeAttributes3(this.options.HTMLAttributes, HTMLAttributes)];
|
|
29965
27759
|
},
|
|
29966
27760
|
addNodeView() {
|
|
29967
27761
|
return ReactNodeViewRenderer3(AudioNodeView);
|
|
29968
27762
|
},
|
|
29969
27763
|
addCommands() {
|
|
29970
27764
|
return {
|
|
29971
|
-
setAudio: (attrs) => ({ commands
|
|
27765
|
+
setAudio: (attrs) => ({ commands }) => commands.insertContent({ type: this.name, attrs })
|
|
29972
27766
|
};
|
|
29973
27767
|
}
|
|
29974
27768
|
});
|
|
@@ -29978,7 +27772,7 @@ import { profileBlockContents as profileBlockContents2, recommendTemplatesForBlo
|
|
|
29978
27772
|
|
|
29979
27773
|
// src/MentionExtension.tsx
|
|
29980
27774
|
import Mention from "@tiptap/extension-mention";
|
|
29981
|
-
import { PluginKey as
|
|
27775
|
+
import { PluginKey as PluginKey10 } from "@tiptap/pm/state";
|
|
29982
27776
|
var FALLBACK_KIND = "mention";
|
|
29983
27777
|
function buildMentionExtension(getProvider) {
|
|
29984
27778
|
return Mention.configure({
|
|
@@ -30034,7 +27828,7 @@ function buildMentionExtension(getProvider) {
|
|
|
30034
27828
|
char: "@",
|
|
30035
27829
|
// Custom plugin key so the mention suggestion doesn't collide
|
|
30036
27830
|
// with any future `:` or `/` popovers.
|
|
30037
|
-
pluginKey: new
|
|
27831
|
+
pluginKey: new PluginKey10("mentionSuggestion"),
|
|
30038
27832
|
command: ({
|
|
30039
27833
|
editor,
|
|
30040
27834
|
range,
|
|
@@ -30929,7 +28723,7 @@ function insertImageNode(view, src, alt) {
|
|
|
30929
28723
|
function moveSelectionToDropPoint(view, event) {
|
|
30930
28724
|
const coords = view.posAtCoords({ left: event.clientX, top: event.clientY });
|
|
30931
28725
|
if (!coords) return;
|
|
30932
|
-
const tr = view.state.tr.setSelection(
|
|
28726
|
+
const tr = view.state.tr.setSelection(Selection.near(view.state.doc.resolve(coords.pos)));
|
|
30933
28727
|
view.dispatch(tr);
|
|
30934
28728
|
}
|
|
30935
28729
|
|
|
@@ -31144,7 +28938,7 @@ function sameEntries(a, b) {
|
|
|
31144
28938
|
}
|
|
31145
28939
|
|
|
31146
28940
|
// src/InlinePreviewGutter.tsx
|
|
31147
|
-
import { Fragment as
|
|
28941
|
+
import { Fragment as Fragment17, jsx as jsx57, jsxs as jsxs45 } from "react/jsx-runtime";
|
|
31148
28942
|
function isAnnotated(block) {
|
|
31149
28943
|
const annotation = block.sourceHeading?.templateAnnotation;
|
|
31150
28944
|
if (!annotation) return false;
|
|
@@ -31265,30 +29059,30 @@ function getTemplateDefaults(templateName, headingText2, bodyText, contents, ima
|
|
|
31265
29059
|
return tableData ?? { headers: ["Column"], rows: [["Data"]] };
|
|
31266
29060
|
}
|
|
31267
29061
|
case "imageWithCaption": {
|
|
31268
|
-
const
|
|
29062
|
+
const first = images[0];
|
|
31269
29063
|
return {
|
|
31270
|
-
imageSrc:
|
|
31271
|
-
imageAlt:
|
|
29064
|
+
imageSrc: first?.src ?? "",
|
|
29065
|
+
imageAlt: first?.alt ?? headingText2,
|
|
31272
29066
|
caption: bodyText || headingText2,
|
|
31273
29067
|
captionPosition: "bottom"
|
|
31274
29068
|
};
|
|
31275
29069
|
}
|
|
31276
29070
|
case "leftFeature":
|
|
31277
29071
|
case "rightFeature": {
|
|
31278
|
-
const
|
|
29072
|
+
const first = images[0];
|
|
31279
29073
|
return {
|
|
31280
|
-
imageSrc:
|
|
31281
|
-
imageAlt:
|
|
31282
|
-
imageWidth:
|
|
31283
|
-
imageHeight:
|
|
29074
|
+
imageSrc: first?.src ?? "",
|
|
29075
|
+
imageAlt: first?.alt ?? headingText2,
|
|
29076
|
+
imageWidth: first?.width,
|
|
29077
|
+
imageHeight: first?.height,
|
|
31284
29078
|
title: headingText2,
|
|
31285
29079
|
body: bodyText
|
|
31286
29080
|
};
|
|
31287
29081
|
}
|
|
31288
29082
|
case "videoWithCaption": {
|
|
31289
|
-
const
|
|
29083
|
+
const first = images[0];
|
|
31290
29084
|
return {
|
|
31291
|
-
videoSrc:
|
|
29085
|
+
videoSrc: first?.src ?? "",
|
|
31292
29086
|
caption: bodyText || headingText2,
|
|
31293
29087
|
captionPosition: "bottom"
|
|
31294
29088
|
};
|
|
@@ -31524,7 +29318,7 @@ function InlinePreviewGutter({
|
|
|
31524
29318
|
children: [
|
|
31525
29319
|
/* @__PURE__ */ jsxs45("div", { className: "squisq-inline-preview-card-label", children: [
|
|
31526
29320
|
/* @__PURE__ */ jsx57("span", { className: "squisq-inline-preview-card-template", children: templateLabel(item.template) }),
|
|
31527
|
-
item.headingText && /* @__PURE__ */ jsxs45(
|
|
29321
|
+
item.headingText && /* @__PURE__ */ jsxs45(Fragment17, { children: [
|
|
31528
29322
|
/* @__PURE__ */ jsx57("span", { className: "squisq-inline-preview-card-sep", children: "\u2014" }),
|
|
31529
29323
|
/* @__PURE__ */ jsx57("span", { className: "squisq-inline-preview-card-title", children: item.headingText })
|
|
31530
29324
|
] })
|
|
@@ -32572,7 +30366,7 @@ function CodeContextSectionView({
|
|
|
32572
30366
|
}
|
|
32573
30367
|
|
|
32574
30368
|
// src/codeContext/CodeContextZones.tsx
|
|
32575
|
-
import { Fragment as
|
|
30369
|
+
import { Fragment as Fragment18, jsx as jsx60 } from "react/jsx-runtime";
|
|
32576
30370
|
function CodeContextZones({ options }) {
|
|
32577
30371
|
const { monacoEditor } = useEditorContext();
|
|
32578
30372
|
const [manager, setManager] = useState53(null);
|
|
@@ -32641,7 +30435,7 @@ function CodeContextZones({ options }) {
|
|
|
32641
30435
|
[monacoEditor]
|
|
32642
30436
|
);
|
|
32643
30437
|
if (!manager) return null;
|
|
32644
|
-
return /* @__PURE__ */ jsx60(
|
|
30438
|
+
return /* @__PURE__ */ jsx60(Fragment18, { children: resolved.map(({ section }) => {
|
|
32645
30439
|
const domNode = manager.getDomNode(section.id);
|
|
32646
30440
|
if (!domNode) return null;
|
|
32647
30441
|
return createPortal10(
|
|
@@ -33065,15 +30859,14 @@ function collectEmbeddedMedia(block) {
|
|
|
33065
30859
|
(block.contents ?? []).forEach((node2) => visit(node2, void 0));
|
|
33066
30860
|
return out;
|
|
33067
30861
|
}
|
|
33068
|
-
function
|
|
30862
|
+
function collectEmbeddedMediaSchedule(doc) {
|
|
33069
30863
|
const schedule = [];
|
|
33070
30864
|
const visit = (blocks) => {
|
|
33071
30865
|
for (const block of blocks) {
|
|
33072
30866
|
collectEmbeddedMedia(block).forEach((media, index2) => {
|
|
33073
|
-
if (media.kind !== "video") return;
|
|
33074
30867
|
schedule.push({
|
|
33075
30868
|
id: `embedded:${block.id}:${index2}`,
|
|
33076
|
-
kind:
|
|
30869
|
+
kind: media.kind,
|
|
33077
30870
|
src: media.src,
|
|
33078
30871
|
absoluteStart: block.startTime,
|
|
33079
30872
|
absoluteEnd: block.startTime + block.duration,
|
|
@@ -33089,6 +30882,27 @@ function collectEmbeddedVideoSchedule(doc) {
|
|
|
33089
30882
|
visit(doc.blocks);
|
|
33090
30883
|
return schedule;
|
|
33091
30884
|
}
|
|
30885
|
+
function collectEmbeddedVideoSchedule(doc) {
|
|
30886
|
+
return collectEmbeddedMediaSchedule(doc).filter((clip) => clip.kind === "video");
|
|
30887
|
+
}
|
|
30888
|
+
function collectTimelinePlaybackSchedule(doc, scheduled) {
|
|
30889
|
+
const scheduledSources = new Set(scheduled.map((clip) => clip.src));
|
|
30890
|
+
const narration = doc.audio.segments.map((segment, index2) => {
|
|
30891
|
+
if (scheduledSources.has(segment.src)) return null;
|
|
30892
|
+
return {
|
|
30893
|
+
id: `narration:${index2}`,
|
|
30894
|
+
kind: "audio",
|
|
30895
|
+
src: segment.src,
|
|
30896
|
+
absoluteStart: Math.max(0, segment.startTime),
|
|
30897
|
+
absoluteEnd: Math.max(0, segment.startTime) + Math.max(0, segment.duration),
|
|
30898
|
+
sourceIn: 0,
|
|
30899
|
+
anchor: "document"
|
|
30900
|
+
};
|
|
30901
|
+
}).filter(
|
|
30902
|
+
(clip) => clip !== null && clip.absoluteEnd > clip.absoluteStart
|
|
30903
|
+
);
|
|
30904
|
+
return [...scheduled, ...collectEmbeddedMediaSchedule(doc), ...narration];
|
|
30905
|
+
}
|
|
33092
30906
|
|
|
33093
30907
|
// src/TimelineBlockPreview.tsx
|
|
33094
30908
|
import { memo } from "react";
|
|
@@ -33130,11 +30944,30 @@ function advanceTime(prev, dt, total) {
|
|
|
33130
30944
|
if (total <= 0) return 0;
|
|
33131
30945
|
return Math.min(total, Math.max(0, prev + dt));
|
|
33132
30946
|
}
|
|
30947
|
+
function playTimelineMediaAt(root, time) {
|
|
30948
|
+
if (!root) return;
|
|
30949
|
+
root.querySelectorAll("audio[data-clip-id], video[data-clip-id]").forEach((el) => {
|
|
30950
|
+
const start = Number(el.dataset.absStart);
|
|
30951
|
+
const end = Number(el.dataset.absEnd);
|
|
30952
|
+
if (!Number.isFinite(start) || !Number.isFinite(end) || time < start || time >= end) return;
|
|
30953
|
+
try {
|
|
30954
|
+
const pending = el.play();
|
|
30955
|
+
pending?.catch(() => {
|
|
30956
|
+
});
|
|
30957
|
+
} catch {
|
|
30958
|
+
}
|
|
30959
|
+
});
|
|
30960
|
+
}
|
|
33133
30961
|
function useTimelineClock(total) {
|
|
33134
30962
|
const [currentTime, setCurrentTime] = useState54(0);
|
|
33135
30963
|
const [isPlaying, setIsPlaying] = useState54(false);
|
|
33136
30964
|
const rafRef = useRef45(null);
|
|
33137
30965
|
const lastRef = useRef45(0);
|
|
30966
|
+
const currentTimeRef = useRef45(0);
|
|
30967
|
+
const isPlayingRef = useRef45(false);
|
|
30968
|
+
const mediaHostRef = useRef45(null);
|
|
30969
|
+
currentTimeRef.current = currentTime;
|
|
30970
|
+
isPlayingRef.current = isPlaying;
|
|
33138
30971
|
useEffect44(() => {
|
|
33139
30972
|
setCurrentTime((t) => Math.min(t, Math.max(0, total)));
|
|
33140
30973
|
}, [total]);
|
|
@@ -33146,7 +30979,9 @@ function useTimelineClock(total) {
|
|
|
33146
30979
|
lastRef.current = now;
|
|
33147
30980
|
setCurrentTime((prev) => {
|
|
33148
30981
|
const next = advanceTime(prev, dt, total);
|
|
30982
|
+
currentTimeRef.current = next;
|
|
33149
30983
|
if (next >= total) {
|
|
30984
|
+
isPlayingRef.current = false;
|
|
33150
30985
|
setIsPlaying(false);
|
|
33151
30986
|
return total;
|
|
33152
30987
|
}
|
|
@@ -33159,17 +30994,34 @@ function useTimelineClock(total) {
|
|
|
33159
30994
|
if (rafRef.current != null) cancelAnimationFrame(rafRef.current);
|
|
33160
30995
|
};
|
|
33161
30996
|
}, [isPlaying, total]);
|
|
30997
|
+
const registerMediaHost = useCallback43((host) => {
|
|
30998
|
+
mediaHostRef.current = host;
|
|
30999
|
+
}, []);
|
|
33162
31000
|
const play = useCallback43(() => {
|
|
33163
|
-
|
|
31001
|
+
const target = total > 0 && currentTimeRef.current >= total ? 0 : currentTimeRef.current;
|
|
31002
|
+
currentTimeRef.current = target;
|
|
31003
|
+
playTimelineMediaAt(mediaHostRef.current, target);
|
|
31004
|
+
setCurrentTime(target);
|
|
31005
|
+
isPlayingRef.current = true;
|
|
33164
31006
|
setIsPlaying(true);
|
|
33165
31007
|
}, [total]);
|
|
33166
|
-
const pause = useCallback43(() =>
|
|
33167
|
-
|
|
31008
|
+
const pause = useCallback43(() => {
|
|
31009
|
+
isPlayingRef.current = false;
|
|
31010
|
+
setIsPlaying(false);
|
|
31011
|
+
}, []);
|
|
31012
|
+
const toggle = useCallback43(() => {
|
|
31013
|
+
if (isPlayingRef.current) pause();
|
|
31014
|
+
else play();
|
|
31015
|
+
}, [pause, play]);
|
|
33168
31016
|
const seek = useCallback43(
|
|
33169
|
-
(t) =>
|
|
31017
|
+
(t) => {
|
|
31018
|
+
const next = Math.min(Math.max(0, t), Math.max(0, total));
|
|
31019
|
+
currentTimeRef.current = next;
|
|
31020
|
+
setCurrentTime(next);
|
|
31021
|
+
},
|
|
33170
31022
|
[total]
|
|
33171
31023
|
);
|
|
33172
|
-
return { currentTime, isPlaying, play, pause, toggle, seek };
|
|
31024
|
+
return { currentTime, isPlaying, play, pause, toggle, seek, registerMediaHost };
|
|
33173
31025
|
}
|
|
33174
31026
|
|
|
33175
31027
|
// src/timelineMediaLabel.ts
|
|
@@ -33183,7 +31035,7 @@ function timelineMediaLabel(src, kind) {
|
|
|
33183
31035
|
// src/TimelineItemMenu.tsx
|
|
33184
31036
|
import { useEffect as useEffect45, useLayoutEffect as useLayoutEffect8, useRef as useRef46, useState as useState55 } from "react";
|
|
33185
31037
|
import { createPortal as createPortal11 } from "react-dom";
|
|
33186
|
-
import { Fragment as
|
|
31038
|
+
import { Fragment as Fragment19, jsx as jsx63, jsxs as jsxs49 } from "react/jsx-runtime";
|
|
33187
31039
|
function TimelineItemMenu({
|
|
33188
31040
|
anchor,
|
|
33189
31041
|
target,
|
|
@@ -33387,7 +31239,7 @@ function VideoMenu({
|
|
|
33387
31239
|
}
|
|
33388
31240
|
)
|
|
33389
31241
|
] }),
|
|
33390
|
-
placed && /* @__PURE__ */ jsxs49(
|
|
31242
|
+
placed && /* @__PURE__ */ jsxs49(Fragment19, { children: [
|
|
33391
31243
|
/* @__PURE__ */ jsxs49("label", { className: "squisq-timeline-item-menu-check", children: [
|
|
33392
31244
|
/* @__PURE__ */ jsx63(
|
|
33393
31245
|
"input",
|
|
@@ -33405,7 +31257,7 @@ function VideoMenu({
|
|
|
33405
31257
|
),
|
|
33406
31258
|
/* @__PURE__ */ jsx63("span", { children: "Lock to block" })
|
|
33407
31259
|
] }),
|
|
33408
|
-
placement === "picture-in-picture" && /* @__PURE__ */ jsxs49(
|
|
31260
|
+
placement === "picture-in-picture" && /* @__PURE__ */ jsxs49(Fragment19, { children: [
|
|
33409
31261
|
/* @__PURE__ */ jsxs49("label", { className: "squisq-timeline-item-menu-field", children: [
|
|
33410
31262
|
/* @__PURE__ */ jsx63("span", { className: "squisq-timeline-item-menu-label", children: "PIP size" }),
|
|
33411
31263
|
/* @__PURE__ */ jsxs49(
|
|
@@ -33606,10 +31458,10 @@ function headingLine(block) {
|
|
|
33606
31458
|
}
|
|
33607
31459
|
function TimelineTrack({
|
|
33608
31460
|
height = 160,
|
|
31461
|
+
basePath = "/",
|
|
33609
31462
|
doc: docProp,
|
|
33610
31463
|
clock,
|
|
33611
|
-
schedule
|
|
33612
|
-
videoVisible = false
|
|
31464
|
+
schedule
|
|
33613
31465
|
}) {
|
|
33614
31466
|
const {
|
|
33615
31467
|
doc: contextDoc,
|
|
@@ -33643,10 +31495,15 @@ function TimelineTrack({
|
|
|
33643
31495
|
[doc]
|
|
33644
31496
|
);
|
|
33645
31497
|
const clips = schedule ?? derivedClips;
|
|
31498
|
+
const playbackClips = useMemo41(
|
|
31499
|
+
() => doc ? collectTimelinePlaybackSchedule(doc, clips) : clips,
|
|
31500
|
+
[clips, doc]
|
|
31501
|
+
);
|
|
33646
31502
|
const total = useMemo41(() => doc ? getDocPlaybackDuration(doc) : 0, [doc]);
|
|
33647
31503
|
const width = Math.max(total * pxPerSecond, 200);
|
|
33648
31504
|
const internalClock = useTimelineClock(total);
|
|
33649
|
-
const
|
|
31505
|
+
const activeClock = clock ?? internalClock;
|
|
31506
|
+
const { currentTime, isPlaying, play, pause, seek } = activeClock;
|
|
33650
31507
|
const startPlay = useCallback44(() => {
|
|
33651
31508
|
setDrag(null);
|
|
33652
31509
|
play();
|
|
@@ -34250,13 +32107,13 @@ function TimelineTrack({
|
|
|
34250
32107
|
}
|
|
34251
32108
|
)
|
|
34252
32109
|
] }) }),
|
|
34253
|
-
/* @__PURE__ */ jsx64("div", { className: "squisq-timeline-media-host", "aria-hidden": true, children: /* @__PURE__ */ jsx64(MediaContext5.Provider, { value: mediaProvider ?? null, children: /* @__PURE__ */ jsx64(
|
|
32110
|
+
/* @__PURE__ */ jsx64("div", { ref: activeClock.registerMediaHost, className: "squisq-timeline-media-host", "aria-hidden": true, children: /* @__PURE__ */ jsx64(MediaContext5.Provider, { value: mediaProvider ?? null, children: /* @__PURE__ */ jsx64(
|
|
34254
32111
|
MediaClipLayer,
|
|
34255
32112
|
{
|
|
34256
|
-
schedule:
|
|
32113
|
+
schedule: playbackClips,
|
|
34257
32114
|
currentTime,
|
|
34258
32115
|
isPlaying,
|
|
34259
|
-
basePath
|
|
32116
|
+
basePath
|
|
34260
32117
|
}
|
|
34261
32118
|
) }) }),
|
|
34262
32119
|
itemMenu && itemMenuTarget && /* @__PURE__ */ jsx64(
|
|
@@ -35473,8 +33330,8 @@ function PresentationModeControl() {
|
|
|
35473
33330
|
useLayoutEffect9(() => {
|
|
35474
33331
|
if (!open || !anchor) return;
|
|
35475
33332
|
const checked = menuRef.current?.querySelector('[aria-checked="true"]');
|
|
35476
|
-
const
|
|
35477
|
-
(checked ??
|
|
33333
|
+
const first = menuRef.current?.querySelector('[role="menuitemradio"]');
|
|
33334
|
+
(checked ?? first)?.focus();
|
|
35478
33335
|
}, [anchor, open]);
|
|
35479
33336
|
return /* @__PURE__ */ jsxs54("div", { className: "squisq-presentation-control", children: [
|
|
35480
33337
|
/* @__PURE__ */ jsx69(
|
|
@@ -35897,7 +33754,7 @@ function PrintPreview({
|
|
|
35897
33754
|
}
|
|
35898
33755
|
|
|
35899
33756
|
// src/PreviewPanel.tsx
|
|
35900
|
-
import { Fragment as
|
|
33757
|
+
import { Fragment as Fragment20, jsx as jsx72, jsxs as jsxs57 } from "react/jsx-runtime";
|
|
35901
33758
|
function PreviewPanel({
|
|
35902
33759
|
basePath = "/",
|
|
35903
33760
|
className,
|
|
@@ -36130,7 +33987,7 @@ function PreviewPanel({
|
|
|
36130
33987
|
basePath,
|
|
36131
33988
|
audioMode: previewProjection?.contentDoc.audio?.segments?.length ? "media" : "synthetic",
|
|
36132
33989
|
showControls: !audience,
|
|
36133
|
-
muted:
|
|
33990
|
+
muted: audience,
|
|
36134
33991
|
forceViewport: activeViewport,
|
|
36135
33992
|
displayMode: activeDisplayMode,
|
|
36136
33993
|
theme: activeTheme,
|
|
@@ -36160,7 +34017,7 @@ function PreviewPanel({
|
|
|
36160
34017
|
minHeight: 0,
|
|
36161
34018
|
background: presentation?.activeTarget ? activeTheme.colors.background : void 0
|
|
36162
34019
|
};
|
|
36163
|
-
return /* @__PURE__ */ jsxs57(
|
|
34020
|
+
return /* @__PURE__ */ jsxs57(Fragment20, { children: [
|
|
36164
34021
|
/* @__PURE__ */ jsx72(
|
|
36165
34022
|
"div",
|
|
36166
34023
|
{
|
|
@@ -36659,7 +34516,7 @@ ${formatSize(entry.size)}`,
|
|
|
36659
34516
|
|
|
36660
34517
|
// src/DropZoneOverlay.tsx
|
|
36661
34518
|
import { useState as useState63 } from "react";
|
|
36662
|
-
import { Fragment as
|
|
34519
|
+
import { Fragment as Fragment21, jsx as jsx74, jsxs as jsxs59 } from "react/jsx-runtime";
|
|
36663
34520
|
function DropZoneOverlay({
|
|
36664
34521
|
dragContentType,
|
|
36665
34522
|
zoneProps,
|
|
@@ -36680,7 +34537,7 @@ function DropZoneOverlay({
|
|
|
36680
34537
|
variant: "media"
|
|
36681
34538
|
}
|
|
36682
34539
|
),
|
|
36683
|
-
showText && /* @__PURE__ */ jsxs59(
|
|
34540
|
+
showText && /* @__PURE__ */ jsxs59(Fragment21, { children: [
|
|
36684
34541
|
/* @__PURE__ */ jsx74(
|
|
36685
34542
|
DropZone,
|
|
36686
34543
|
{
|
|
@@ -37159,7 +35016,7 @@ import {
|
|
|
37159
35016
|
createMediaProviderFromContainer
|
|
37160
35017
|
} from "@bendyline/squisq/storage";
|
|
37161
35018
|
import { MediaContext as MediaContext6, useMediaClipDurations } from "@bendyline/squisq-react";
|
|
37162
|
-
import { Fragment as
|
|
35019
|
+
import { Fragment as Fragment22, jsx as jsx77, jsxs as jsxs60 } from "react/jsx-runtime";
|
|
37163
35020
|
function EditorShell({
|
|
37164
35021
|
initialMarkdown = "",
|
|
37165
35022
|
initialView = "wysiwyg",
|
|
@@ -37318,7 +35175,7 @@ function EditorShell({
|
|
|
37318
35175
|
function UseModeToolbarControls({ allowPrint }) {
|
|
37319
35176
|
const printMode = usePrintMode();
|
|
37320
35177
|
if (printMode.active) return /* @__PURE__ */ jsx77(PrintPreviewToolbar, {});
|
|
37321
|
-
return /* @__PURE__ */ jsxs60(
|
|
35178
|
+
return /* @__PURE__ */ jsxs60(Fragment22, { children: [
|
|
37322
35179
|
/* @__PURE__ */ jsx77(PreviewToolbarControls, {}),
|
|
37323
35180
|
/* @__PURE__ */ jsx77(PresentationModeControl, {}),
|
|
37324
35181
|
allowPrint && /* @__PURE__ */ jsx77(PrintModeControl, {})
|
|
@@ -37882,7 +35739,7 @@ ${snippet}` : snippet);
|
|
|
37882
35739
|
doc: timelineDoc,
|
|
37883
35740
|
clock: timelineClock,
|
|
37884
35741
|
schedule: timelineSchedule,
|
|
37885
|
-
|
|
35742
|
+
basePath
|
|
37886
35743
|
}
|
|
37887
35744
|
),
|
|
37888
35745
|
statusBarVisible && !isImageMode && /* @__PURE__ */ jsx77(StatusBar, { slotRight: statusBarSlotRight }),
|