@harbour-enterprises/superdoc 0.28.0-next.7 → 0.28.0-next.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/{PdfViewer-Bs6lahtW.cjs → PdfViewer-B13bR8VJ.cjs} +1 -1
- package/dist/chunks/{PdfViewer-Dk0kxvT5.es.js → PdfViewer-DRCcOt2t.es.js} +1 -1
- package/dist/chunks/{index-DrY82WYq.cjs → index-DcpSDyC4.cjs} +2 -2
- package/dist/chunks/{index-DW9wEJ6m.es.js → index-KRsMbx-o.es.js} +2 -2
- package/dist/chunks/{super-editor.es-BqTmBqM7.cjs → super-editor.es-BnJV-Q-L.cjs} +135 -59
- package/dist/chunks/{super-editor.es-Cv1NFWG8.es.js → super-editor.es-DKQa7RQl.es.js} +135 -59
- package/dist/core/types/index.d.ts.map +1 -1
- package/dist/super-editor/ai-writer.es.js +1 -1
- package/dist/super-editor/chunks/{editor-D8CLRqpz.js → editor-DdEaVosL.js} +144 -67
- package/dist/super-editor/chunks/{toolbar-lCqYD_z-.js → toolbar-CTt4vWNb.js} +1 -1
- package/dist/super-editor/editor.es.js +1 -1
- package/dist/super-editor/super-editor/src/core/commands/decreaseListIndent.d.ts +1 -1
- package/dist/super-editor/super-editor/src/core/commands/increaseListIndent.d.ts +1 -1
- package/dist/super-editor/super-editor/src/core/commands/list-helpers/list-indent-helpers.d.ts +3 -0
- package/dist/super-editor/super-editor.es.js +20 -20
- package/dist/super-editor/toolbar.es.js +2 -2
- package/dist/super-editor.cjs +1 -1
- package/dist/super-editor.es.js +1 -1
- package/dist/superdoc.cjs +2 -2
- package/dist/superdoc.es.js +2 -2
- package/dist/superdoc.umd.js +134 -58
- package/dist/superdoc.umd.js.map +1 -1
- package/package.json +1 -1
package/dist/superdoc.umd.js
CHANGED
|
@@ -56186,38 +56186,93 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
56186
56186
|
if (dispatch) dispatch(tr);
|
|
56187
56187
|
return true;
|
|
56188
56188
|
};
|
|
56189
|
-
const
|
|
56189
|
+
const LIST_NODE_NAMES = /* @__PURE__ */ new Set(["orderedList", "bulletList"]);
|
|
56190
|
+
const parseLevel = (value) => {
|
|
56191
|
+
if (typeof value === "number") return value;
|
|
56192
|
+
const parsed = parseInt(value, 10);
|
|
56193
|
+
return Number.isNaN(parsed) ? 0 : parsed;
|
|
56194
|
+
};
|
|
56195
|
+
const resolveParentList = ($pos) => {
|
|
56196
|
+
if (!$pos) return null;
|
|
56197
|
+
for (let depth = $pos.depth; depth >= 0; depth--) {
|
|
56198
|
+
const node2 = $pos.node(depth);
|
|
56199
|
+
if (node2?.type && LIST_NODE_NAMES.has(node2.type.name)) {
|
|
56200
|
+
return node2;
|
|
56201
|
+
}
|
|
56202
|
+
}
|
|
56203
|
+
return null;
|
|
56204
|
+
};
|
|
56205
|
+
const collectTargetListItemPositions = (state2, fallbackPos) => {
|
|
56206
|
+
const doc2 = state2?.doc;
|
|
56207
|
+
const listItemType = state2?.schema?.nodes?.listItem;
|
|
56208
|
+
if (!doc2 || !listItemType) {
|
|
56209
|
+
return typeof fallbackPos === "number" ? [fallbackPos] : [];
|
|
56210
|
+
}
|
|
56211
|
+
const candidates = [];
|
|
56212
|
+
const { from: from2, to } = state2.selection;
|
|
56213
|
+
doc2.nodesBetween(from2, to, (node2, pos) => {
|
|
56214
|
+
if (node2.type === listItemType) {
|
|
56215
|
+
const size2 = typeof node2.nodeSize === "number" ? node2.nodeSize : 0;
|
|
56216
|
+
candidates.push({ node: node2, pos, end: pos + size2 });
|
|
56217
|
+
}
|
|
56218
|
+
});
|
|
56219
|
+
if (!candidates.length && typeof fallbackPos === "number") {
|
|
56220
|
+
return [fallbackPos];
|
|
56221
|
+
}
|
|
56222
|
+
const filtered = candidates.filter(({ pos, end: end2 }) => {
|
|
56223
|
+
return !candidates.some((other) => other.pos > pos && other.pos < end2);
|
|
56224
|
+
});
|
|
56225
|
+
const sorted = filtered.map(({ pos }) => pos).sort((a2, b2) => a2 - b2);
|
|
56226
|
+
return sorted.filter((pos, index2) => index2 === 0 || pos !== sorted[index2 - 1]);
|
|
56227
|
+
};
|
|
56228
|
+
const decreaseListIndent = (_targetPositions) => ({ editor, tr }) => {
|
|
56190
56229
|
const { state: state2 } = editor;
|
|
56191
56230
|
const currentItem = ListHelpers.getCurrentListItem && ListHelpers.getCurrentListItem(state2) || findParentNode((n) => n.type && n.type.name === "listItem")(state2.selection);
|
|
56192
|
-
|
|
56193
|
-
const
|
|
56194
|
-
const
|
|
56195
|
-
|
|
56196
|
-
|
|
56197
|
-
const
|
|
56198
|
-
|
|
56199
|
-
|
|
56200
|
-
|
|
56201
|
-
|
|
56202
|
-
|
|
56203
|
-
|
|
56204
|
-
|
|
56205
|
-
|
|
56206
|
-
|
|
56207
|
-
|
|
56208
|
-
|
|
56209
|
-
|
|
56210
|
-
|
|
56211
|
-
|
|
56212
|
-
|
|
56231
|
+
const parentOrderedHelper = ListHelpers.getParentOrderedList && ListHelpers.getParentOrderedList(state2);
|
|
56232
|
+
const parentBulletHelper = ListHelpers.getParentBulletList && ListHelpers.getParentBulletList(state2);
|
|
56233
|
+
const targetPositions = _targetPositions || collectTargetListItemPositions(state2, currentItem?.pos);
|
|
56234
|
+
if (!targetPositions.length) return false;
|
|
56235
|
+
let parentListsMap = {};
|
|
56236
|
+
const mappedNodes = targetPositions.map((originalPos) => {
|
|
56237
|
+
const mappedPos = tr.mapping ? tr.mapping.map(originalPos) : originalPos;
|
|
56238
|
+
const node2 = tr.doc && tr.doc.nodeAt(mappedPos) || (currentItem && originalPos === currentItem.pos ? currentItem.node : null);
|
|
56239
|
+
return { originalPos, mappedPos, node: node2 };
|
|
56240
|
+
});
|
|
56241
|
+
const validNodes = mappedNodes.filter(({ node: node2 }) => node2 && node2.type.name === "listItem");
|
|
56242
|
+
validNodes.forEach(({ mappedPos, node: node2 }) => {
|
|
56243
|
+
const attrs = node2.attrs || {};
|
|
56244
|
+
const currLevel = parseLevel(attrs.level);
|
|
56245
|
+
if (currLevel <= 0) {
|
|
56246
|
+
return;
|
|
56247
|
+
}
|
|
56248
|
+
const newLevel = currLevel - 1;
|
|
56249
|
+
const $pos = tr.doc ? tr.doc.resolve(mappedPos) : null;
|
|
56250
|
+
const parentListNode = resolveParentList($pos) || parentOrderedHelper?.node || parentBulletHelper?.node || parentOrderedHelper || parentBulletHelper;
|
|
56251
|
+
parentListsMap[mappedPos] = parentListNode;
|
|
56252
|
+
if (!parentListNode) {
|
|
56253
|
+
return;
|
|
56254
|
+
}
|
|
56255
|
+
const fallbackListId = parentListNode.attrs?.listId ?? null;
|
|
56256
|
+
let numId = fallbackListId ?? attrs.numId ?? null;
|
|
56257
|
+
let createdNewId = false;
|
|
56258
|
+
if (numId == null && ListHelpers.getNewListId) {
|
|
56259
|
+
numId = ListHelpers.getNewListId(editor);
|
|
56260
|
+
createdNewId = numId != null;
|
|
56261
|
+
}
|
|
56262
|
+
if (createdNewId && numId != null && ListHelpers.generateNewListDefinition) {
|
|
56263
|
+
ListHelpers.generateNewListDefinition({
|
|
56264
|
+
numId,
|
|
56265
|
+
listType: parentListNode.type,
|
|
56266
|
+
editor
|
|
56267
|
+
});
|
|
56268
|
+
}
|
|
56269
|
+
tr.setNodeMarkup(mappedPos, null, {
|
|
56270
|
+
...attrs,
|
|
56271
|
+
level: newLevel,
|
|
56272
|
+
numId
|
|
56213
56273
|
});
|
|
56214
|
-
}
|
|
56215
|
-
tr.setNodeMarkup(currentItem.pos, null, {
|
|
56216
|
-
...attrs,
|
|
56217
|
-
level: newLevel,
|
|
56218
|
-
numId
|
|
56219
56274
|
});
|
|
56220
|
-
return true;
|
|
56275
|
+
return Object.values(parentListsMap).length ? !Object.values(parentListsMap).every((pos) => !pos) : true;
|
|
56221
56276
|
};
|
|
56222
56277
|
function isVisuallyEmptyParagraph(node2) {
|
|
56223
56278
|
if (!node2 || node2.type.name !== "paragraph") return false;
|
|
@@ -56459,30 +56514,49 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
56459
56514
|
tr.setSelection(TextSelection$1.near($pos));
|
|
56460
56515
|
return true;
|
|
56461
56516
|
};
|
|
56462
|
-
const increaseListIndent = () => ({ editor, tr }) => {
|
|
56517
|
+
const increaseListIndent = (_targetPositions) => ({ editor, tr }) => {
|
|
56463
56518
|
const { state: state2 } = editor;
|
|
56464
56519
|
const currentItem = ListHelpers.getCurrentListItem && ListHelpers.getCurrentListItem(state2) || findParentNode((n) => n.type && n.type.name === "listItem")(state2.selection);
|
|
56465
|
-
|
|
56466
|
-
const
|
|
56467
|
-
const
|
|
56468
|
-
|
|
56469
|
-
|
|
56470
|
-
const
|
|
56471
|
-
|
|
56472
|
-
|
|
56473
|
-
|
|
56474
|
-
|
|
56475
|
-
|
|
56476
|
-
|
|
56477
|
-
|
|
56520
|
+
const parentOrderedHelper = ListHelpers.getParentOrderedList && ListHelpers.getParentOrderedList(state2);
|
|
56521
|
+
const parentBulletHelper = ListHelpers.getParentBulletList && ListHelpers.getParentBulletList(state2);
|
|
56522
|
+
const targetPositions = _targetPositions || collectTargetListItemPositions(state2, currentItem?.pos);
|
|
56523
|
+
if (!targetPositions.length) return false;
|
|
56524
|
+
let parentListsMap = {};
|
|
56525
|
+
const mappedNodes = targetPositions.map((originalPos) => {
|
|
56526
|
+
const mappedPos = tr.mapping ? tr.mapping.map(originalPos) : originalPos;
|
|
56527
|
+
const node2 = tr.doc && tr.doc.nodeAt(mappedPos) || (currentItem && originalPos === currentItem.pos ? currentItem.node : null);
|
|
56528
|
+
return { originalPos, mappedPos, node: node2 };
|
|
56529
|
+
});
|
|
56530
|
+
const validNodes = mappedNodes.filter(({ node: node2 }) => node2 && node2.type.name === "listItem");
|
|
56531
|
+
validNodes.forEach(({ mappedPos, node: node2 }) => {
|
|
56532
|
+
const attrs = node2.attrs || {};
|
|
56533
|
+
const currentLevel = parseLevel(attrs.level);
|
|
56534
|
+
const newLevel = currentLevel + 1;
|
|
56535
|
+
const $pos = tr.doc ? tr.doc.resolve(mappedPos) : null;
|
|
56536
|
+
const parentListNode = resolveParentList($pos) || parentOrderedHelper?.node || parentBulletHelper?.node || parentOrderedHelper || parentBulletHelper;
|
|
56537
|
+
parentListsMap[mappedPos] = parentListNode;
|
|
56538
|
+
if (!parentListNode) {
|
|
56539
|
+
return;
|
|
56478
56540
|
}
|
|
56479
|
-
|
|
56480
|
-
|
|
56481
|
-
|
|
56482
|
-
|
|
56483
|
-
|
|
56541
|
+
let numId = attrs.numId;
|
|
56542
|
+
if (numId == null) {
|
|
56543
|
+
const fallbackListId = parentListNode.attrs?.listId ?? null;
|
|
56544
|
+
numId = fallbackListId ?? (ListHelpers.getNewListId ? ListHelpers.getNewListId(editor) : null);
|
|
56545
|
+
if (numId != null && ListHelpers.generateNewListDefinition) {
|
|
56546
|
+
ListHelpers.generateNewListDefinition({
|
|
56547
|
+
numId,
|
|
56548
|
+
listType: parentListNode.type,
|
|
56549
|
+
editor
|
|
56550
|
+
});
|
|
56551
|
+
}
|
|
56552
|
+
}
|
|
56553
|
+
tr.setNodeMarkup(mappedPos, null, {
|
|
56554
|
+
...attrs,
|
|
56555
|
+
level: newLevel,
|
|
56556
|
+
numId
|
|
56557
|
+
});
|
|
56484
56558
|
});
|
|
56485
|
-
return true;
|
|
56559
|
+
return Object.values(parentListsMap).length ? !Object.values(parentListsMap).every((pos) => !pos) : true;
|
|
56486
56560
|
};
|
|
56487
56561
|
const isList = (n) => !!n && (n.type?.name === "orderedList" || n.type?.name === "bulletList");
|
|
56488
56562
|
const findNodePosition = (doc2, targetNode) => {
|
|
@@ -75391,10 +75465,12 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
75391
75465
|
() => {
|
|
75392
75466
|
const span = document.createElement("span");
|
|
75393
75467
|
span.classList.add("track-delete-widget");
|
|
75394
|
-
span.contentEditable = false;
|
|
75395
75468
|
return span;
|
|
75396
75469
|
},
|
|
75397
|
-
{
|
|
75470
|
+
{
|
|
75471
|
+
ignoreSelection: true,
|
|
75472
|
+
key: "stable-key"
|
|
75473
|
+
}
|
|
75398
75474
|
);
|
|
75399
75475
|
decorations.push(decorationWidget);
|
|
75400
75476
|
}
|
|
@@ -115020,11 +115096,11 @@ ${style2}
|
|
|
115020
115096
|
* @returns {void}
|
|
115021
115097
|
*/
|
|
115022
115098
|
increaseTextIndent: ({ item, argument }) => {
|
|
115023
|
-
|
|
115024
|
-
|
|
115025
|
-
|
|
115026
|
-
if (
|
|
115027
|
-
return this.activeEditor.commands.increaseListIndent();
|
|
115099
|
+
const command2 = item.command;
|
|
115100
|
+
const { state: state2 } = this.activeEditor;
|
|
115101
|
+
const listItemsInSelection = collectTargetListItemPositions(state2);
|
|
115102
|
+
if (listItemsInSelection.length) {
|
|
115103
|
+
return this.activeEditor.commands.increaseListIndent(listItemsInSelection);
|
|
115028
115104
|
}
|
|
115029
115105
|
if (command2 in this.activeEditor.commands) {
|
|
115030
115106
|
this.activeEditor.commands[command2](argument);
|
|
@@ -115040,9 +115116,9 @@ ${style2}
|
|
|
115040
115116
|
decreaseTextIndent: ({ item, argument }) => {
|
|
115041
115117
|
let command2 = item.command;
|
|
115042
115118
|
let { state: state2 } = this.activeEditor;
|
|
115043
|
-
|
|
115044
|
-
if (
|
|
115045
|
-
return this.activeEditor.commands.decreaseListIndent();
|
|
115119
|
+
const listItemsInSelection = collectTargetListItemPositions(state2);
|
|
115120
|
+
if (listItemsInSelection.length) {
|
|
115121
|
+
return this.activeEditor.commands.decreaseListIndent(listItemsInSelection);
|
|
115046
115122
|
}
|
|
115047
115123
|
if (command2 in this.activeEditor.commands) {
|
|
115048
115124
|
this.activeEditor.commands[command2](argument);
|