@superdoc-dev/cli 0.2.0-next.137 → 0.2.0-next.139
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +436 -284
- package/package.json +8 -8
package/dist/index.js
CHANGED
|
@@ -135979,7 +135979,7 @@ var init_remark_gfm_CjV8kaUy_es = __esm(() => {
|
|
|
135979
135979
|
init_remark_gfm_z_sDF4ss_es();
|
|
135980
135980
|
});
|
|
135981
135981
|
|
|
135982
|
-
// ../../packages/superdoc/dist/chunks/src-
|
|
135982
|
+
// ../../packages/superdoc/dist/chunks/src-D6jkx7VE.es.js
|
|
135983
135983
|
function deleteProps(obj, propOrProps) {
|
|
135984
135984
|
const props = typeof propOrProps === "string" ? [propOrProps] : propOrProps;
|
|
135985
135985
|
const removeNested = (target, pathParts, index2 = 0) => {
|
|
@@ -138677,6 +138677,60 @@ function getSuperdocVersion() {
|
|
|
138677
138677
|
return "unknown";
|
|
138678
138678
|
}
|
|
138679
138679
|
}
|
|
138680
|
+
function getFocusMeta(tr) {
|
|
138681
|
+
return tr.getMeta(CustomSelectionPluginKey);
|
|
138682
|
+
}
|
|
138683
|
+
function setFocusMeta(tr, value) {
|
|
138684
|
+
return tr.setMeta(CustomSelectionPluginKey, value);
|
|
138685
|
+
}
|
|
138686
|
+
function getFocusState(state) {
|
|
138687
|
+
return CustomSelectionPluginKey.getState(state);
|
|
138688
|
+
}
|
|
138689
|
+
function mapPreservedSelection(selection, tr) {
|
|
138690
|
+
if (!selection || !tr.docChanged)
|
|
138691
|
+
return selection;
|
|
138692
|
+
if (typeof selection.from !== "number" || typeof selection.to !== "number")
|
|
138693
|
+
return null;
|
|
138694
|
+
const from$1 = tr.mapping.map(selection.from, -1);
|
|
138695
|
+
const to = tr.mapping.map(selection.to, 1);
|
|
138696
|
+
if (from$1 >= to)
|
|
138697
|
+
return null;
|
|
138698
|
+
try {
|
|
138699
|
+
return TextSelection2.create(tr.doc, from$1, to);
|
|
138700
|
+
} catch {
|
|
138701
|
+
return null;
|
|
138702
|
+
}
|
|
138703
|
+
}
|
|
138704
|
+
function applySelectionCleanup(editor, tr) {
|
|
138705
|
+
let cleaned = tr.setMeta(CustomSelectionPluginKey, DEFAULT_SELECTION_STATE);
|
|
138706
|
+
const sel = cleaned.selection;
|
|
138707
|
+
if (sel && sel instanceof TextSelection2 && !sel.empty)
|
|
138708
|
+
try {
|
|
138709
|
+
const collapsed = TextSelection2.create(cleaned.doc, sel.head);
|
|
138710
|
+
cleaned = cleaned.setSelection(collapsed);
|
|
138711
|
+
} catch {}
|
|
138712
|
+
editor.setOptions({
|
|
138713
|
+
preservedSelection: null,
|
|
138714
|
+
lastSelection: null
|
|
138715
|
+
});
|
|
138716
|
+
return cleaned;
|
|
138717
|
+
}
|
|
138718
|
+
function createHistoryDispatch(editor, dispatch) {
|
|
138719
|
+
if (!dispatch)
|
|
138720
|
+
return dispatch;
|
|
138721
|
+
return (historyTr) => {
|
|
138722
|
+
dispatch(applySelectionCleanup(editor, historyTr));
|
|
138723
|
+
};
|
|
138724
|
+
}
|
|
138725
|
+
function runSelectionCleanupAfterCollabHistory(editor) {
|
|
138726
|
+
const view = editor?.view;
|
|
138727
|
+
const state = editor?.state;
|
|
138728
|
+
if (!view || !state)
|
|
138729
|
+
return;
|
|
138730
|
+
let tr = applySelectionCleanup(editor, state.tr);
|
|
138731
|
+
tr = tr.setMeta("addToHistory", false);
|
|
138732
|
+
view.dispatch(tr);
|
|
138733
|
+
}
|
|
138680
138734
|
function getNodeIdCandidates(node3) {
|
|
138681
138735
|
const attrs = node3.attrs ?? {};
|
|
138682
138736
|
const candidateFields = [
|
|
@@ -169874,30 +169928,6 @@ function replaceCommand(wrap4, moveForward) {
|
|
|
169874
169928
|
return true;
|
|
169875
169929
|
};
|
|
169876
169930
|
}
|
|
169877
|
-
function getFocusMeta(tr) {
|
|
169878
|
-
return tr.getMeta(CustomSelectionPluginKey);
|
|
169879
|
-
}
|
|
169880
|
-
function setFocusMeta(tr, value) {
|
|
169881
|
-
return tr.setMeta(CustomSelectionPluginKey, value);
|
|
169882
|
-
}
|
|
169883
|
-
function getFocusState(state) {
|
|
169884
|
-
return CustomSelectionPluginKey.getState(state);
|
|
169885
|
-
}
|
|
169886
|
-
function mapPreservedSelection(selection, tr) {
|
|
169887
|
-
if (!selection || !tr.docChanged)
|
|
169888
|
-
return selection;
|
|
169889
|
-
if (typeof selection.from !== "number" || typeof selection.to !== "number")
|
|
169890
|
-
return null;
|
|
169891
|
-
const from$1 = tr.mapping.map(selection.from, -1);
|
|
169892
|
-
const to = tr.mapping.map(selection.to, 1);
|
|
169893
|
-
if (from$1 >= to)
|
|
169894
|
-
return null;
|
|
169895
|
-
try {
|
|
169896
|
-
return TextSelection2.create(tr.doc, from$1, to);
|
|
169897
|
-
} catch {
|
|
169898
|
-
return null;
|
|
169899
|
-
}
|
|
169900
|
-
}
|
|
169901
169931
|
function charOffsetToPosition(doc$2, charOffset, blockSep, leafSep) {
|
|
169902
169932
|
const docSize = doc$2.content.size;
|
|
169903
169933
|
if (charOffset <= 0)
|
|
@@ -181922,19 +181952,31 @@ function safeCleanup(fn, context) {
|
|
|
181922
181952
|
}
|
|
181923
181953
|
}
|
|
181924
181954
|
function createHiddenHost(doc$2, widthPx) {
|
|
181955
|
+
const wrapper = doc$2.createElement("div");
|
|
181956
|
+
wrapper.className = "presentation-editor__hidden-host-wrapper";
|
|
181957
|
+
wrapper.style.setProperty("position", "fixed");
|
|
181958
|
+
wrapper.style.setProperty("left", "-9999px");
|
|
181959
|
+
wrapper.style.setProperty("top", "0");
|
|
181960
|
+
wrapper.style.setProperty("width", "1px");
|
|
181961
|
+
wrapper.style.setProperty("height", "1px");
|
|
181962
|
+
wrapper.style.setProperty("overflow", "hidden");
|
|
181963
|
+
wrapper.style.setProperty("opacity", "0");
|
|
181964
|
+
wrapper.style.setProperty("z-index", "-1");
|
|
181965
|
+
wrapper.style.setProperty("pointer-events", "none");
|
|
181925
181966
|
const host = doc$2.createElement("div");
|
|
181926
181967
|
host.className = "presentation-editor__hidden-host";
|
|
181927
|
-
host.style.setProperty("position", "
|
|
181928
|
-
host.style.setProperty("left", "
|
|
181968
|
+
host.style.setProperty("position", "absolute");
|
|
181969
|
+
host.style.setProperty("left", "0");
|
|
181929
181970
|
host.style.setProperty("top", "0");
|
|
181930
181971
|
if (widthPx >= 0)
|
|
181931
181972
|
host.style.setProperty("width", `${widthPx}px`);
|
|
181932
181973
|
host.style.setProperty("overflow-anchor", "none");
|
|
181933
|
-
host.style.setProperty("pointer-events", "none");
|
|
181934
|
-
host.style.setProperty("opacity", "0");
|
|
181935
|
-
host.style.setProperty("z-index", "-1");
|
|
181936
181974
|
host.style.setProperty("user-select", "none");
|
|
181937
|
-
|
|
181975
|
+
wrapper.appendChild(host);
|
|
181976
|
+
return {
|
|
181977
|
+
wrapper,
|
|
181978
|
+
host
|
|
181979
|
+
};
|
|
181938
181980
|
}
|
|
181939
181981
|
function getFallbackCursorColor(clientId, fallbackColors) {
|
|
181940
181982
|
return fallbackColors[clientId % fallbackColors.length];
|
|
@@ -191765,9 +191807,13 @@ function getAdjacentLineClientTarget(editor, coords, direction) {
|
|
|
191765
191807
|
const clientY = rect.top + rect.height / 2;
|
|
191766
191808
|
if (!Number.isFinite(clientY))
|
|
191767
191809
|
return null;
|
|
191810
|
+
const pmStart = Number(adjacentLine.dataset?.pmStart);
|
|
191811
|
+
const pmEnd = Number(adjacentLine.dataset?.pmEnd);
|
|
191768
191812
|
return {
|
|
191769
191813
|
clientY,
|
|
191770
|
-
pageIndex: Number.isFinite(pageIndex) ? pageIndex : undefined
|
|
191814
|
+
pageIndex: Number.isFinite(pageIndex) ? pageIndex : undefined,
|
|
191815
|
+
pmStart: Number.isFinite(pmStart) ? pmStart : undefined,
|
|
191816
|
+
pmEnd: Number.isFinite(pmEnd) ? pmEnd : undefined
|
|
191771
191817
|
};
|
|
191772
191818
|
}
|
|
191773
191819
|
function getHitFromLayoutCoords(editor, goalX, clientY, coords, pageIndex) {
|
|
@@ -191838,6 +191884,33 @@ function findAdjacentLineElement(currentLine, direction) {
|
|
|
191838
191884
|
return getEdgeLineFromFragment(pageFragments[0], direction);
|
|
191839
191885
|
return getEdgeLineFromFragment(pageFragments[pageFragments.length - 1], direction);
|
|
191840
191886
|
}
|
|
191887
|
+
function resolvePositionAtGoalX(editor, pmStart, pmEnd, goalX) {
|
|
191888
|
+
const presentationEditor = editor.presentationEditor;
|
|
191889
|
+
let bestPos = pmStart;
|
|
191890
|
+
let bestDist = Infinity;
|
|
191891
|
+
let lo = pmStart;
|
|
191892
|
+
let hi = pmEnd;
|
|
191893
|
+
while (lo <= hi) {
|
|
191894
|
+
const mid = Math.floor((lo + hi) / 2);
|
|
191895
|
+
const rect = presentationEditor.computeCaretLayoutRect(mid);
|
|
191896
|
+
if (!rect || !Number.isFinite(rect.x)) {
|
|
191897
|
+
lo = mid + 1;
|
|
191898
|
+
continue;
|
|
191899
|
+
}
|
|
191900
|
+
const dist = Math.abs(rect.x - goalX);
|
|
191901
|
+
if (dist < bestDist) {
|
|
191902
|
+
bestDist = dist;
|
|
191903
|
+
bestPos = mid;
|
|
191904
|
+
}
|
|
191905
|
+
if (rect.x < goalX)
|
|
191906
|
+
lo = mid + 1;
|
|
191907
|
+
else if (rect.x > goalX)
|
|
191908
|
+
hi = mid - 1;
|
|
191909
|
+
else
|
|
191910
|
+
break;
|
|
191911
|
+
}
|
|
191912
|
+
return { pos: bestPos };
|
|
191913
|
+
}
|
|
191841
191914
|
function getEdgeLineFromFragment(fragment2, direction) {
|
|
191842
191915
|
if (!fragment2)
|
|
191843
191916
|
return null;
|
|
@@ -193339,7 +193412,14 @@ var Node$13 = class Node$14 {
|
|
|
193339
193412
|
typeOver = true;
|
|
193340
193413
|
}
|
|
193341
193414
|
}
|
|
193342
|
-
if (
|
|
193415
|
+
if (added.some((n) => n.nodeName == "BR") && (view.input.lastKeyCode == 8 || view.input.lastKeyCode == 46)) {
|
|
193416
|
+
for (let node3 of added)
|
|
193417
|
+
if (node3.nodeName == "BR" && node3.parentNode) {
|
|
193418
|
+
let after = node3.nextSibling;
|
|
193419
|
+
if (after && after.nodeType == 1 && after.contentEditable == "false")
|
|
193420
|
+
node3.parentNode.removeChild(node3);
|
|
193421
|
+
}
|
|
193422
|
+
} else if (gecko && added.length) {
|
|
193343
193423
|
let brs = added.filter((n) => n.nodeName == "BR");
|
|
193344
193424
|
if (brs.length == 2) {
|
|
193345
193425
|
let [a2, b$1] = brs;
|
|
@@ -193355,13 +193435,6 @@ var Node$13 = class Node$14 {
|
|
|
193355
193435
|
br2.remove();
|
|
193356
193436
|
}
|
|
193357
193437
|
}
|
|
193358
|
-
} else if ((chrome || safari) && added.some((n) => n.nodeName == "BR") && (view.input.lastKeyCode == 8 || view.input.lastKeyCode == 46)) {
|
|
193359
|
-
for (let node3 of added)
|
|
193360
|
-
if (node3.nodeName == "BR" && node3.parentNode) {
|
|
193361
|
-
let after = node3.nextSibling;
|
|
193362
|
-
if (after && after.nodeType == 1 && after.contentEditable == "false")
|
|
193363
|
-
node3.parentNode.removeChild(node3);
|
|
193364
|
-
}
|
|
193365
193438
|
}
|
|
193366
193439
|
let readSel = null;
|
|
193367
193440
|
if (from$1 < 0 && newSel && view.input.lastFocus > Date.now() - 200 && Math.max(view.input.lastTouch, view.input.lastClick.time) < Date.now() - 300 && selectionCollapsed(sel) && (readSel = selectionFromDOM(view)) && readSel.eq(Selection.near(view.state.doc.resolve(0), 1))) {
|
|
@@ -195220,7 +195293,32 @@ var Node$13 = class Node$14 {
|
|
|
195220
195293
|
static create(config2) {
|
|
195221
195294
|
return new Extension2(config2);
|
|
195222
195295
|
}
|
|
195223
|
-
},
|
|
195296
|
+
}, isKeyboardInvocation = (event) => {
|
|
195297
|
+
return event.type === "contextmenu" && typeof event.detail === "number" && event.detail === 0 && (event.button === 0 || event.button === undefined) && event.clientX === 0 && event.clientY === 0;
|
|
195298
|
+
}, prefersNativeMenu = (event) => {
|
|
195299
|
+
if (!event)
|
|
195300
|
+
return false;
|
|
195301
|
+
if (event.ctrlKey || event.metaKey)
|
|
195302
|
+
return true;
|
|
195303
|
+
return isKeyboardInvocation(event);
|
|
195304
|
+
}, shouldAllowNativeContextMenu = (event) => {
|
|
195305
|
+
return prefersNativeMenu(event);
|
|
195306
|
+
}, DEFAULT_SELECTION_STATE, normalizeSelectionState = (state = {}) => ({
|
|
195307
|
+
...DEFAULT_SELECTION_STATE,
|
|
195308
|
+
...state
|
|
195309
|
+
}), CustomSelectionPluginKey, handleClickOutside = (event, editor) => {
|
|
195310
|
+
const editorElem = editor?.options?.element;
|
|
195311
|
+
if (!editorElem)
|
|
195312
|
+
return;
|
|
195313
|
+
if (!editorElem?.contains(event.target))
|
|
195314
|
+
editor.setOptions({ focusTarget: event.target });
|
|
195315
|
+
else
|
|
195316
|
+
editor.setOptions({ focusTarget: null });
|
|
195317
|
+
}, isToolbarInput = (target) => {
|
|
195318
|
+
return !!target?.closest(".button-text-input") || target?.classList?.contains("button-text-input");
|
|
195319
|
+
}, isToolbarButton = (target) => {
|
|
195320
|
+
return !!target?.closest(".toolbar-button") || target?.classList?.contains("toolbar-button");
|
|
195321
|
+
}, CustomSelection, History, createUndoPlugin = () => {
|
|
195224
195322
|
return yUndoPlugin();
|
|
195225
195323
|
}, Attribute2 = class {
|
|
195226
195324
|
static getAttributesFromExtensions(extensions) {
|
|
@@ -201762,32 +201860,7 @@ var Node$13 = class Node$14 {
|
|
|
201762
201860
|
}
|
|
201763
201861
|
});
|
|
201764
201862
|
return { decorations };
|
|
201765
|
-
},
|
|
201766
|
-
return event.type === "contextmenu" && typeof event.detail === "number" && event.detail === 0 && (event.button === 0 || event.button === undefined) && event.clientX === 0 && event.clientY === 0;
|
|
201767
|
-
}, prefersNativeMenu = (event) => {
|
|
201768
|
-
if (!event)
|
|
201769
|
-
return false;
|
|
201770
|
-
if (event.ctrlKey || event.metaKey)
|
|
201771
|
-
return true;
|
|
201772
|
-
return isKeyboardInvocation(event);
|
|
201773
|
-
}, shouldAllowNativeContextMenu = (event) => {
|
|
201774
|
-
return prefersNativeMenu(event);
|
|
201775
|
-
}, DEFAULT_SELECTION_STATE, normalizeSelectionState = (state = {}) => ({
|
|
201776
|
-
...DEFAULT_SELECTION_STATE,
|
|
201777
|
-
...state
|
|
201778
|
-
}), CustomSelectionPluginKey, handleClickOutside = (event, editor) => {
|
|
201779
|
-
const editorElem = editor?.options?.element;
|
|
201780
|
-
if (!editorElem)
|
|
201781
|
-
return;
|
|
201782
|
-
if (!editorElem?.contains(event.target))
|
|
201783
|
-
editor.setOptions({ focusTarget: event.target });
|
|
201784
|
-
else
|
|
201785
|
-
editor.setOptions({ focusTarget: null });
|
|
201786
|
-
}, isToolbarInput = (target) => {
|
|
201787
|
-
return !!target?.closest(".button-text-input") || target?.classList?.contains("button-text-input");
|
|
201788
|
-
}, isToolbarButton = (target) => {
|
|
201789
|
-
return !!target?.closest(".toolbar-button") || target?.classList?.contains("toolbar-button");
|
|
201790
|
-
}, CustomSelection, LinkedStyles, FORMATTING_MARK_NAMES, getLinkedStyle = (styleId, styles = []) => {
|
|
201863
|
+
}, LinkedStyles, FORMATTING_MARK_NAMES, getLinkedStyle = (styleId, styles = []) => {
|
|
201791
201864
|
const linkedStyle = styles.find((style2) => style2.id === styleId);
|
|
201792
201865
|
const basedOn = linkedStyle?.definition?.attrs?.basedOn;
|
|
201793
201866
|
return {
|
|
@@ -219696,7 +219769,7 @@ var Node$13 = class Node$14 {
|
|
|
219696
219769
|
return false;
|
|
219697
219770
|
return Boolean(checker(attrs));
|
|
219698
219771
|
}, SuperToolbar, ICONS, TEXTS, tableActionsOptions;
|
|
219699
|
-
var
|
|
219772
|
+
var init_src_D6jkx7VE_es = __esm(() => {
|
|
219700
219773
|
init_rolldown_runtime_B2q5OVn9_es();
|
|
219701
219774
|
init_SuperConverter_BQCVReWb_es();
|
|
219702
219775
|
init_jszip_ChlR43oI_es();
|
|
@@ -221017,6 +221090,209 @@ ${err.toString()}`);
|
|
|
221017
221090
|
}
|
|
221018
221091
|
}
|
|
221019
221092
|
};
|
|
221093
|
+
DEFAULT_SELECTION_STATE = Object.freeze({
|
|
221094
|
+
focused: false,
|
|
221095
|
+
preservedSelection: null,
|
|
221096
|
+
showVisualSelection: false,
|
|
221097
|
+
skipFocusReset: false
|
|
221098
|
+
});
|
|
221099
|
+
CustomSelectionPluginKey = new PluginKey("CustomSelection");
|
|
221100
|
+
CustomSelection = Extension.create({
|
|
221101
|
+
name: "customSelection",
|
|
221102
|
+
addPmPlugins() {
|
|
221103
|
+
const editor = this.editor;
|
|
221104
|
+
return [new Plugin({
|
|
221105
|
+
key: CustomSelectionPluginKey,
|
|
221106
|
+
state: {
|
|
221107
|
+
init: () => ({ ...DEFAULT_SELECTION_STATE }),
|
|
221108
|
+
apply: (tr, value) => {
|
|
221109
|
+
const meta2 = getFocusMeta(tr);
|
|
221110
|
+
const nextState = meta2 !== undefined ? normalizeSelectionState({
|
|
221111
|
+
...value,
|
|
221112
|
+
...meta2
|
|
221113
|
+
}) : value;
|
|
221114
|
+
if (!nextState?.preservedSelection)
|
|
221115
|
+
return nextState;
|
|
221116
|
+
if (!tr.docChanged)
|
|
221117
|
+
return nextState;
|
|
221118
|
+
const mappedSelection = mapPreservedSelection(nextState.preservedSelection, tr);
|
|
221119
|
+
if (!mappedSelection)
|
|
221120
|
+
return {
|
|
221121
|
+
...nextState,
|
|
221122
|
+
preservedSelection: null,
|
|
221123
|
+
showVisualSelection: false
|
|
221124
|
+
};
|
|
221125
|
+
return {
|
|
221126
|
+
...nextState,
|
|
221127
|
+
preservedSelection: mappedSelection
|
|
221128
|
+
};
|
|
221129
|
+
}
|
|
221130
|
+
},
|
|
221131
|
+
view: () => {
|
|
221132
|
+
const clickHandler = (event) => handleClickOutside(event, editor);
|
|
221133
|
+
document?.addEventListener("mousedown", clickHandler);
|
|
221134
|
+
return { destroy: () => {
|
|
221135
|
+
document?.removeEventListener("mousedown", clickHandler);
|
|
221136
|
+
} };
|
|
221137
|
+
},
|
|
221138
|
+
props: {
|
|
221139
|
+
handleDOMEvents: {
|
|
221140
|
+
contextmenu: (view, event) => {
|
|
221141
|
+
if (shouldAllowNativeContextMenu(event))
|
|
221142
|
+
return false;
|
|
221143
|
+
event.preventDefault();
|
|
221144
|
+
const { selection } = view.state;
|
|
221145
|
+
if (!selection.empty)
|
|
221146
|
+
view.dispatch(setFocusMeta(view.state.tr, {
|
|
221147
|
+
focused: true,
|
|
221148
|
+
preservedSelection: selection,
|
|
221149
|
+
showVisualSelection: true,
|
|
221150
|
+
skipFocusReset: true
|
|
221151
|
+
}));
|
|
221152
|
+
setTimeout(() => {
|
|
221153
|
+
view.focus();
|
|
221154
|
+
}, 0);
|
|
221155
|
+
return false;
|
|
221156
|
+
},
|
|
221157
|
+
mousedown: (view, event) => {
|
|
221158
|
+
if (event.button === 2) {
|
|
221159
|
+
if (shouldAllowNativeContextMenu(event))
|
|
221160
|
+
return false;
|
|
221161
|
+
const { selection: selection$1 } = view.state;
|
|
221162
|
+
if (!selection$1.empty) {
|
|
221163
|
+
view.dispatch(setFocusMeta(view.state.tr, {
|
|
221164
|
+
focused: true,
|
|
221165
|
+
preservedSelection: selection$1,
|
|
221166
|
+
showVisualSelection: true,
|
|
221167
|
+
skipFocusReset: true
|
|
221168
|
+
}));
|
|
221169
|
+
this.editor.setOptions({
|
|
221170
|
+
lastSelection: selection$1,
|
|
221171
|
+
preservedSelection: selection$1
|
|
221172
|
+
});
|
|
221173
|
+
}
|
|
221174
|
+
return false;
|
|
221175
|
+
}
|
|
221176
|
+
const { selection } = view.state;
|
|
221177
|
+
const target = event.target;
|
|
221178
|
+
const isElement$2 = target instanceof Element;
|
|
221179
|
+
const isToolbarBtn = isElement$2 && isToolbarButton(target);
|
|
221180
|
+
const isToolbarInp = isElement$2 && isToolbarInput(target);
|
|
221181
|
+
this.editor.setOptions({ focusTarget: target });
|
|
221182
|
+
if (isToolbarInp && !selection.empty) {
|
|
221183
|
+
view.dispatch(setFocusMeta(view.state.tr, {
|
|
221184
|
+
focused: true,
|
|
221185
|
+
preservedSelection: selection,
|
|
221186
|
+
showVisualSelection: true,
|
|
221187
|
+
skipFocusReset: false
|
|
221188
|
+
}));
|
|
221189
|
+
this.editor.setOptions({
|
|
221190
|
+
lastSelection: selection,
|
|
221191
|
+
preservedSelection: selection
|
|
221192
|
+
});
|
|
221193
|
+
return false;
|
|
221194
|
+
}
|
|
221195
|
+
if (isToolbarBtn && !isToolbarInp) {
|
|
221196
|
+
if (!selection.empty) {
|
|
221197
|
+
this.editor.setOptions({ lastSelection: selection });
|
|
221198
|
+
view.dispatch(setFocusMeta(view.state.tr, {
|
|
221199
|
+
focused: true,
|
|
221200
|
+
preservedSelection: selection,
|
|
221201
|
+
showVisualSelection: true,
|
|
221202
|
+
skipFocusReset: false
|
|
221203
|
+
}));
|
|
221204
|
+
}
|
|
221205
|
+
return false;
|
|
221206
|
+
}
|
|
221207
|
+
if (!isToolbarBtn && !isToolbarInp) {
|
|
221208
|
+
view.dispatch(setFocusMeta(view.state.tr, {
|
|
221209
|
+
focused: false,
|
|
221210
|
+
preservedSelection: null,
|
|
221211
|
+
showVisualSelection: false,
|
|
221212
|
+
skipFocusReset: false
|
|
221213
|
+
}));
|
|
221214
|
+
if (!selection.empty && !this.editor.options.element?.contains(target)) {
|
|
221215
|
+
this.editor.setOptions({ lastSelection: selection });
|
|
221216
|
+
const clearSelectionTr = view.state.tr.setSelection(TextSelection2.create(view.state.doc, 0));
|
|
221217
|
+
view.dispatch(clearSelectionTr);
|
|
221218
|
+
}
|
|
221219
|
+
}
|
|
221220
|
+
},
|
|
221221
|
+
focus: (view) => {
|
|
221222
|
+
const target = this.editor.options.focusTarget;
|
|
221223
|
+
const isElement$2 = target instanceof Element;
|
|
221224
|
+
const isToolbarBtn = isElement$2 && isToolbarButton(target);
|
|
221225
|
+
const isToolbarInp = isElement$2 && isToolbarInput(target);
|
|
221226
|
+
const focusState = getFocusState(view.state);
|
|
221227
|
+
if (focusState?.skipFocusReset) {
|
|
221228
|
+
view.dispatch(setFocusMeta(view.state.tr, normalizeSelectionState({
|
|
221229
|
+
...focusState,
|
|
221230
|
+
skipFocusReset: false
|
|
221231
|
+
})));
|
|
221232
|
+
return false;
|
|
221233
|
+
}
|
|
221234
|
+
if (!isToolbarBtn && !isToolbarInp)
|
|
221235
|
+
view.dispatch(setFocusMeta(view.state.tr, {
|
|
221236
|
+
focused: false,
|
|
221237
|
+
preservedSelection: null,
|
|
221238
|
+
showVisualSelection: false,
|
|
221239
|
+
skipFocusReset: false
|
|
221240
|
+
}));
|
|
221241
|
+
},
|
|
221242
|
+
blur: (view) => {
|
|
221243
|
+
const target = this.editor.options.focusTarget;
|
|
221244
|
+
const isElement$2 = target instanceof Element;
|
|
221245
|
+
const isToolbarBtn = isElement$2 && isToolbarButton(target);
|
|
221246
|
+
const isToolbarInp = isElement$2 && isToolbarInput(target);
|
|
221247
|
+
const state = getFocusState(view.state);
|
|
221248
|
+
if (state?.skipFocusReset)
|
|
221249
|
+
return false;
|
|
221250
|
+
if (isToolbarBtn || isToolbarInp)
|
|
221251
|
+
view.dispatch(setFocusMeta(view.state.tr, {
|
|
221252
|
+
focused: true,
|
|
221253
|
+
preservedSelection: state.preservedSelection || view.state.selection,
|
|
221254
|
+
showVisualSelection: true,
|
|
221255
|
+
skipFocusReset: false
|
|
221256
|
+
}));
|
|
221257
|
+
else {
|
|
221258
|
+
view.dispatch(setFocusMeta(view.state.tr, {
|
|
221259
|
+
focused: false,
|
|
221260
|
+
preservedSelection: null,
|
|
221261
|
+
showVisualSelection: false,
|
|
221262
|
+
skipFocusReset: false
|
|
221263
|
+
}));
|
|
221264
|
+
this.editor.setOptions({
|
|
221265
|
+
preservedSelection: null,
|
|
221266
|
+
lastSelection: null
|
|
221267
|
+
});
|
|
221268
|
+
}
|
|
221269
|
+
}
|
|
221270
|
+
},
|
|
221271
|
+
decorations: (state) => {
|
|
221272
|
+
const { selection, doc: doc$2 } = state;
|
|
221273
|
+
const focusState = getFocusState(state);
|
|
221274
|
+
if (!(focusState.showVisualSelection && (focusState.preservedSelection || !selection.empty && focusState.focused)))
|
|
221275
|
+
return null;
|
|
221276
|
+
const targetSelection = focusState.preservedSelection || selection;
|
|
221277
|
+
if (targetSelection.empty)
|
|
221278
|
+
return null;
|
|
221279
|
+
return DecorationSet.create(doc$2, [Decoration.inline(targetSelection.from, targetSelection.to, { class: "sd-custom-selection" })]);
|
|
221280
|
+
}
|
|
221281
|
+
}
|
|
221282
|
+
})];
|
|
221283
|
+
},
|
|
221284
|
+
addCommands() {
|
|
221285
|
+
return { restorePreservedSelection: () => ({ tr, state }) => {
|
|
221286
|
+
const focusState = getFocusState(state);
|
|
221287
|
+
if (focusState.preservedSelection)
|
|
221288
|
+
return tr.setSelection(focusState.preservedSelection);
|
|
221289
|
+
const lastSelection = this.editor.options.lastSelection;
|
|
221290
|
+
if (lastSelection)
|
|
221291
|
+
return tr.setSelection(lastSelection);
|
|
221292
|
+
return tr;
|
|
221293
|
+
} };
|
|
221294
|
+
}
|
|
221295
|
+
});
|
|
221020
221296
|
History = Extension.create({
|
|
221021
221297
|
name: "history",
|
|
221022
221298
|
addOptions() {
|
|
@@ -221035,18 +221311,22 @@ ${err.toString()}`);
|
|
|
221035
221311
|
undo: () => ({ state, dispatch, tr }) => {
|
|
221036
221312
|
if (this.editor.options.collaborationProvider && this.editor.options.ydoc) {
|
|
221037
221313
|
tr.setMeta("preventDispatch", true);
|
|
221038
|
-
|
|
221314
|
+
const result = undo$1(state);
|
|
221315
|
+
runSelectionCleanupAfterCollabHistory(this.editor);
|
|
221316
|
+
return result;
|
|
221039
221317
|
}
|
|
221040
221318
|
tr.setMeta("inputType", "historyUndo");
|
|
221041
|
-
return undo(state, dispatch);
|
|
221319
|
+
return undo(state, createHistoryDispatch(this.editor, dispatch));
|
|
221042
221320
|
},
|
|
221043
221321
|
redo: () => ({ state, dispatch, tr }) => {
|
|
221044
221322
|
if (this.editor.options.collaborationProvider && this.editor.options.ydoc) {
|
|
221045
221323
|
tr.setMeta("preventDispatch", true);
|
|
221046
|
-
|
|
221324
|
+
const result = redo$1(state);
|
|
221325
|
+
runSelectionCleanupAfterCollabHistory(this.editor);
|
|
221326
|
+
return result;
|
|
221047
221327
|
}
|
|
221048
221328
|
tr.setMeta("inputType", "historyRedo");
|
|
221049
|
-
return redo(state, dispatch);
|
|
221329
|
+
return redo(state, createHistoryDispatch(this.editor, dispatch));
|
|
221050
221330
|
}
|
|
221051
221331
|
};
|
|
221052
221332
|
},
|
|
@@ -231085,204 +231365,6 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
231085
231365
|
})];
|
|
231086
231366
|
}
|
|
231087
231367
|
});
|
|
231088
|
-
DEFAULT_SELECTION_STATE = Object.freeze({
|
|
231089
|
-
focused: false,
|
|
231090
|
-
preservedSelection: null,
|
|
231091
|
-
showVisualSelection: false,
|
|
231092
|
-
skipFocusReset: false
|
|
231093
|
-
});
|
|
231094
|
-
CustomSelectionPluginKey = new PluginKey("CustomSelection");
|
|
231095
|
-
CustomSelection = Extension.create({
|
|
231096
|
-
name: "customSelection",
|
|
231097
|
-
addPmPlugins() {
|
|
231098
|
-
const editor = this.editor;
|
|
231099
|
-
return [new Plugin({
|
|
231100
|
-
key: CustomSelectionPluginKey,
|
|
231101
|
-
state: {
|
|
231102
|
-
init: () => ({ ...DEFAULT_SELECTION_STATE }),
|
|
231103
|
-
apply: (tr, value) => {
|
|
231104
|
-
const meta2 = getFocusMeta(tr);
|
|
231105
|
-
const nextState = meta2 !== undefined ? normalizeSelectionState({
|
|
231106
|
-
...value,
|
|
231107
|
-
...meta2
|
|
231108
|
-
}) : value;
|
|
231109
|
-
if (!nextState?.preservedSelection)
|
|
231110
|
-
return nextState;
|
|
231111
|
-
if (!tr.docChanged)
|
|
231112
|
-
return nextState;
|
|
231113
|
-
const mappedSelection = mapPreservedSelection(nextState.preservedSelection, tr);
|
|
231114
|
-
if (!mappedSelection)
|
|
231115
|
-
return {
|
|
231116
|
-
...nextState,
|
|
231117
|
-
preservedSelection: null,
|
|
231118
|
-
showVisualSelection: false
|
|
231119
|
-
};
|
|
231120
|
-
return {
|
|
231121
|
-
...nextState,
|
|
231122
|
-
preservedSelection: mappedSelection
|
|
231123
|
-
};
|
|
231124
|
-
}
|
|
231125
|
-
},
|
|
231126
|
-
view: () => {
|
|
231127
|
-
const clickHandler = (event) => handleClickOutside(event, editor);
|
|
231128
|
-
document?.addEventListener("mousedown", clickHandler);
|
|
231129
|
-
return { destroy: () => {
|
|
231130
|
-
document?.removeEventListener("mousedown", clickHandler);
|
|
231131
|
-
} };
|
|
231132
|
-
},
|
|
231133
|
-
props: {
|
|
231134
|
-
handleDOMEvents: {
|
|
231135
|
-
contextmenu: (view, event) => {
|
|
231136
|
-
if (shouldAllowNativeContextMenu(event))
|
|
231137
|
-
return false;
|
|
231138
|
-
event.preventDefault();
|
|
231139
|
-
const { selection } = view.state;
|
|
231140
|
-
if (!selection.empty)
|
|
231141
|
-
view.dispatch(setFocusMeta(view.state.tr, {
|
|
231142
|
-
focused: true,
|
|
231143
|
-
preservedSelection: selection,
|
|
231144
|
-
showVisualSelection: true,
|
|
231145
|
-
skipFocusReset: true
|
|
231146
|
-
}));
|
|
231147
|
-
setTimeout(() => {
|
|
231148
|
-
view.focus();
|
|
231149
|
-
}, 0);
|
|
231150
|
-
return false;
|
|
231151
|
-
},
|
|
231152
|
-
mousedown: (view, event) => {
|
|
231153
|
-
if (event.button === 2) {
|
|
231154
|
-
if (shouldAllowNativeContextMenu(event))
|
|
231155
|
-
return false;
|
|
231156
|
-
const { selection: selection$1 } = view.state;
|
|
231157
|
-
if (!selection$1.empty) {
|
|
231158
|
-
view.dispatch(setFocusMeta(view.state.tr, {
|
|
231159
|
-
focused: true,
|
|
231160
|
-
preservedSelection: selection$1,
|
|
231161
|
-
showVisualSelection: true,
|
|
231162
|
-
skipFocusReset: true
|
|
231163
|
-
}));
|
|
231164
|
-
this.editor.setOptions({
|
|
231165
|
-
lastSelection: selection$1,
|
|
231166
|
-
preservedSelection: selection$1
|
|
231167
|
-
});
|
|
231168
|
-
}
|
|
231169
|
-
return false;
|
|
231170
|
-
}
|
|
231171
|
-
const { selection } = view.state;
|
|
231172
|
-
const target = event.target;
|
|
231173
|
-
const isElement$2 = target instanceof Element;
|
|
231174
|
-
const isToolbarBtn = isElement$2 && isToolbarButton(target);
|
|
231175
|
-
const isToolbarInp = isElement$2 && isToolbarInput(target);
|
|
231176
|
-
this.editor.setOptions({ focusTarget: target });
|
|
231177
|
-
if (isToolbarInp && !selection.empty) {
|
|
231178
|
-
view.dispatch(setFocusMeta(view.state.tr, {
|
|
231179
|
-
focused: true,
|
|
231180
|
-
preservedSelection: selection,
|
|
231181
|
-
showVisualSelection: true,
|
|
231182
|
-
skipFocusReset: false
|
|
231183
|
-
}));
|
|
231184
|
-
this.editor.setOptions({
|
|
231185
|
-
lastSelection: selection,
|
|
231186
|
-
preservedSelection: selection
|
|
231187
|
-
});
|
|
231188
|
-
return false;
|
|
231189
|
-
}
|
|
231190
|
-
if (isToolbarBtn && !isToolbarInp) {
|
|
231191
|
-
if (!selection.empty) {
|
|
231192
|
-
this.editor.setOptions({ lastSelection: selection });
|
|
231193
|
-
view.dispatch(setFocusMeta(view.state.tr, {
|
|
231194
|
-
focused: true,
|
|
231195
|
-
preservedSelection: selection,
|
|
231196
|
-
showVisualSelection: true,
|
|
231197
|
-
skipFocusReset: false
|
|
231198
|
-
}));
|
|
231199
|
-
}
|
|
231200
|
-
return false;
|
|
231201
|
-
}
|
|
231202
|
-
if (!isToolbarBtn && !isToolbarInp) {
|
|
231203
|
-
view.dispatch(setFocusMeta(view.state.tr, {
|
|
231204
|
-
focused: false,
|
|
231205
|
-
preservedSelection: null,
|
|
231206
|
-
showVisualSelection: false,
|
|
231207
|
-
skipFocusReset: false
|
|
231208
|
-
}));
|
|
231209
|
-
if (!selection.empty && !this.editor.options.element?.contains(target)) {
|
|
231210
|
-
this.editor.setOptions({ lastSelection: selection });
|
|
231211
|
-
const clearSelectionTr = view.state.tr.setSelection(TextSelection2.create(view.state.doc, 0));
|
|
231212
|
-
view.dispatch(clearSelectionTr);
|
|
231213
|
-
}
|
|
231214
|
-
}
|
|
231215
|
-
},
|
|
231216
|
-
focus: (view) => {
|
|
231217
|
-
const target = this.editor.options.focusTarget;
|
|
231218
|
-
const isElement$2 = target instanceof Element;
|
|
231219
|
-
const isToolbarBtn = isElement$2 && isToolbarButton(target);
|
|
231220
|
-
const isToolbarInp = isElement$2 && isToolbarInput(target);
|
|
231221
|
-
const focusState = getFocusState(view.state);
|
|
231222
|
-
if (focusState?.skipFocusReset) {
|
|
231223
|
-
view.dispatch(setFocusMeta(view.state.tr, normalizeSelectionState({
|
|
231224
|
-
...focusState,
|
|
231225
|
-
skipFocusReset: false
|
|
231226
|
-
})));
|
|
231227
|
-
return false;
|
|
231228
|
-
}
|
|
231229
|
-
if (!isToolbarBtn && !isToolbarInp)
|
|
231230
|
-
view.dispatch(setFocusMeta(view.state.tr, {
|
|
231231
|
-
focused: false,
|
|
231232
|
-
preservedSelection: null,
|
|
231233
|
-
showVisualSelection: false,
|
|
231234
|
-
skipFocusReset: false
|
|
231235
|
-
}));
|
|
231236
|
-
},
|
|
231237
|
-
blur: (view) => {
|
|
231238
|
-
const target = this.editor.options.focusTarget;
|
|
231239
|
-
const isElement$2 = target instanceof Element;
|
|
231240
|
-
const isToolbarBtn = isElement$2 && isToolbarButton(target);
|
|
231241
|
-
const isToolbarInp = isElement$2 && isToolbarInput(target);
|
|
231242
|
-
const state = getFocusState(view.state);
|
|
231243
|
-
if (state?.skipFocusReset)
|
|
231244
|
-
return false;
|
|
231245
|
-
if (isToolbarBtn || isToolbarInp)
|
|
231246
|
-
view.dispatch(setFocusMeta(view.state.tr, {
|
|
231247
|
-
focused: true,
|
|
231248
|
-
preservedSelection: state.preservedSelection || view.state.selection,
|
|
231249
|
-
showVisualSelection: true,
|
|
231250
|
-
skipFocusReset: false
|
|
231251
|
-
}));
|
|
231252
|
-
else
|
|
231253
|
-
view.dispatch(setFocusMeta(view.state.tr, {
|
|
231254
|
-
focused: false,
|
|
231255
|
-
preservedSelection: null,
|
|
231256
|
-
showVisualSelection: false,
|
|
231257
|
-
skipFocusReset: false
|
|
231258
|
-
}));
|
|
231259
|
-
}
|
|
231260
|
-
},
|
|
231261
|
-
decorations: (state) => {
|
|
231262
|
-
const { selection, doc: doc$2 } = state;
|
|
231263
|
-
const focusState = getFocusState(state);
|
|
231264
|
-
if (!(focusState.showVisualSelection && (focusState.preservedSelection || !selection.empty && focusState.focused)))
|
|
231265
|
-
return null;
|
|
231266
|
-
const targetSelection = focusState.preservedSelection || selection;
|
|
231267
|
-
if (targetSelection.empty)
|
|
231268
|
-
return null;
|
|
231269
|
-
return DecorationSet.create(doc$2, [Decoration.inline(targetSelection.from, targetSelection.to, { class: "sd-custom-selection" })]);
|
|
231270
|
-
}
|
|
231271
|
-
}
|
|
231272
|
-
})];
|
|
231273
|
-
},
|
|
231274
|
-
addCommands() {
|
|
231275
|
-
return { restorePreservedSelection: () => ({ tr, state }) => {
|
|
231276
|
-
const focusState = getFocusState(state);
|
|
231277
|
-
if (focusState.preservedSelection)
|
|
231278
|
-
return tr.setSelection(focusState.preservedSelection);
|
|
231279
|
-
const lastSelection = this.editor.options.lastSelection;
|
|
231280
|
-
if (lastSelection)
|
|
231281
|
-
return tr.setSelection(lastSelection);
|
|
231282
|
-
return tr;
|
|
231283
|
-
} };
|
|
231284
|
-
}
|
|
231285
|
-
});
|
|
231286
231368
|
LinkedStyles = Extension.create({
|
|
231287
231369
|
name: "linkedStyles",
|
|
231288
231370
|
priority: 1,
|
|
@@ -238568,6 +238650,7 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
238568
238650
|
#selectionOverlay;
|
|
238569
238651
|
#permissionOverlay = null;
|
|
238570
238652
|
#hiddenHost;
|
|
238653
|
+
#hiddenHostWrapper;
|
|
238571
238654
|
#layoutOptions;
|
|
238572
238655
|
#layoutState = {
|
|
238573
238656
|
blocks: [],
|
|
@@ -238590,6 +238673,7 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
238590
238673
|
#pendingMapping = null;
|
|
238591
238674
|
#isRerendering = false;
|
|
238592
238675
|
#selectionSync = new SelectionSyncCoordinator;
|
|
238676
|
+
#shouldScrollSelectionIntoView = false;
|
|
238593
238677
|
#epochMapper = new EpochPositionMapper;
|
|
238594
238678
|
#layoutEpoch = 0;
|
|
238595
238679
|
#htmlAnnotationHeights = /* @__PURE__ */ new Map;
|
|
@@ -238808,11 +238892,13 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
238808
238892
|
clip: "rect(1px, 1px, 1px, 1px)"
|
|
238809
238893
|
});
|
|
238810
238894
|
this.#visibleHost.appendChild(this.#ariaLiveRegion);
|
|
238811
|
-
|
|
238895
|
+
const { wrapper: hiddenHostWrapper, host: hiddenHost } = createHiddenHost(doc$2, this.#layoutOptions.pageSize?.w ?? DEFAULT_PAGE_SIZE.w);
|
|
238896
|
+
this.#hiddenHostWrapper = hiddenHostWrapper;
|
|
238897
|
+
this.#hiddenHost = hiddenHost;
|
|
238812
238898
|
if (doc$2.body)
|
|
238813
|
-
doc$2.body.appendChild(this.#
|
|
238899
|
+
doc$2.body.appendChild(this.#hiddenHostWrapper);
|
|
238814
238900
|
else
|
|
238815
|
-
this.#visibleHost.appendChild(this.#
|
|
238901
|
+
this.#visibleHost.appendChild(this.#hiddenHostWrapper);
|
|
238816
238902
|
const { layoutEngineOptions: _layoutEngineOptions, element: _element, ...editorOptions } = options;
|
|
238817
238903
|
const normalizedEditorProps = {
|
|
238818
238904
|
...editorOptions.editorProps ?? {},
|
|
@@ -239752,6 +239838,7 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
239752
239838
|
this.#applyZoom();
|
|
239753
239839
|
this.#domPainter?.setZoom?.(zoom);
|
|
239754
239840
|
this.emit("zoomChange", { zoom });
|
|
239841
|
+
this.#shouldScrollSelectionIntoView = true;
|
|
239755
239842
|
this.#scheduleSelectionUpdate();
|
|
239756
239843
|
if (this.#remoteCursorManager?.hasRemoteCursors()) {
|
|
239757
239844
|
this.#remoteCursorManager.markDirty();
|
|
@@ -239833,7 +239920,7 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
239833
239920
|
this.#dragDropManager = null;
|
|
239834
239921
|
this.#selectionOverlay?.remove();
|
|
239835
239922
|
this.#painterHost?.remove();
|
|
239836
|
-
this.#
|
|
239923
|
+
this.#hiddenHostWrapper?.remove();
|
|
239837
239924
|
this.#hoverOverlay = null;
|
|
239838
239925
|
this.#hoverTooltip = null;
|
|
239839
239926
|
this.#modeBanner?.remove();
|
|
@@ -239909,6 +239996,7 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
239909
239996
|
}
|
|
239910
239997
|
};
|
|
239911
239998
|
const handleSelection = () => {
|
|
239999
|
+
this.#shouldScrollSelectionIntoView = true;
|
|
239912
240000
|
this.#scheduleSelectionUpdate({ immediate: true });
|
|
239913
240001
|
this.#updateLocalAwarenessCursor();
|
|
239914
240002
|
this.#scheduleA11ySelectionAnnouncement();
|
|
@@ -240120,6 +240208,7 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
240120
240208
|
this.#dragDropManager.bind();
|
|
240121
240209
|
}
|
|
240122
240210
|
#focusEditorAfterImageSelection() {
|
|
240211
|
+
this.#shouldScrollSelectionIntoView = true;
|
|
240123
240212
|
this.#scheduleSelectionUpdate();
|
|
240124
240213
|
if (document.activeElement instanceof HTMLElement)
|
|
240125
240214
|
document.activeElement.blur();
|
|
@@ -240935,6 +241024,8 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
240935
241024
|
this.#setSelectedStructuredContentInlineClass(elements, id2);
|
|
240936
241025
|
}
|
|
240937
241026
|
#updateSelection() {
|
|
241027
|
+
const shouldScrollIntoView = this.#shouldScrollSelectionIntoView;
|
|
241028
|
+
this.#shouldScrollSelectionIntoView = false;
|
|
240938
241029
|
if ((this.#headerFooterSession?.session?.mode ?? "body") !== "body") {
|
|
240939
241030
|
this.#clearSelectedFieldAnnotationClass();
|
|
240940
241031
|
return;
|
|
@@ -241010,6 +241101,8 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
241010
241101
|
if (process$1$1.env.NODE_ENV === "development")
|
|
241011
241102
|
console.warn("[PresentationEditor] Failed to render caret overlay:", error);
|
|
241012
241103
|
}
|
|
241104
|
+
if (shouldScrollIntoView)
|
|
241105
|
+
this.#scrollActiveEndIntoView(caretLayout.pageIndex);
|
|
241013
241106
|
return;
|
|
241014
241107
|
}
|
|
241015
241108
|
const domRects = this.#computeSelectionRectsFromDom(from$1, to);
|
|
@@ -241042,6 +241135,59 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
241042
241135
|
if (process$1$1.env.NODE_ENV === "development")
|
|
241043
241136
|
console.warn("[PresentationEditor] Failed to render selection rects:", error);
|
|
241044
241137
|
}
|
|
241138
|
+
if (shouldScrollIntoView) {
|
|
241139
|
+
const head = activeEditor?.view?.state?.selection?.head ?? to;
|
|
241140
|
+
const headLayout = this.#computeCaretLayoutRect(head);
|
|
241141
|
+
if (headLayout)
|
|
241142
|
+
this.#scrollActiveEndIntoView(headLayout.pageIndex);
|
|
241143
|
+
}
|
|
241144
|
+
}
|
|
241145
|
+
#scrollScreenRectIntoView(screenTop, screenBottom) {
|
|
241146
|
+
const scrollContainer = this.#scrollContainer;
|
|
241147
|
+
if (!scrollContainer)
|
|
241148
|
+
return;
|
|
241149
|
+
let containerTop;
|
|
241150
|
+
let containerBottom;
|
|
241151
|
+
if (scrollContainer instanceof Window) {
|
|
241152
|
+
containerTop = 0;
|
|
241153
|
+
containerBottom = scrollContainer.innerHeight;
|
|
241154
|
+
} else {
|
|
241155
|
+
const r$1 = scrollContainer.getBoundingClientRect();
|
|
241156
|
+
containerTop = r$1.top;
|
|
241157
|
+
containerBottom = r$1.bottom;
|
|
241158
|
+
}
|
|
241159
|
+
const SCROLL_MARGIN = 20;
|
|
241160
|
+
if (screenBottom > containerBottom - SCROLL_MARGIN) {
|
|
241161
|
+
const delta = screenBottom - containerBottom + SCROLL_MARGIN;
|
|
241162
|
+
if (scrollContainer instanceof Window)
|
|
241163
|
+
scrollContainer.scrollBy({ top: delta });
|
|
241164
|
+
else
|
|
241165
|
+
scrollContainer.scrollTop += delta;
|
|
241166
|
+
} else if (screenTop < containerTop + SCROLL_MARGIN) {
|
|
241167
|
+
const delta = containerTop + SCROLL_MARGIN - screenTop;
|
|
241168
|
+
if (scrollContainer instanceof Window)
|
|
241169
|
+
scrollContainer.scrollBy({ top: -delta });
|
|
241170
|
+
else
|
|
241171
|
+
scrollContainer.scrollTop -= delta;
|
|
241172
|
+
}
|
|
241173
|
+
}
|
|
241174
|
+
#scrollActiveEndIntoView(pageIndex) {
|
|
241175
|
+
if (!!!this.#painterHost.querySelector(`[data-page-index="${pageIndex}"]`)) {
|
|
241176
|
+
this.#scrollPageIntoView(pageIndex);
|
|
241177
|
+
return;
|
|
241178
|
+
}
|
|
241179
|
+
const caretEl = this.#localSelectionLayer?.querySelector(".presentation-editor__selection-caret");
|
|
241180
|
+
if (caretEl) {
|
|
241181
|
+
const r$1 = caretEl.getBoundingClientRect();
|
|
241182
|
+
this.#scrollScreenRectIntoView(r$1.top, r$1.bottom);
|
|
241183
|
+
return;
|
|
241184
|
+
}
|
|
241185
|
+
const sel = this.getActiveEditor()?.view?.state?.selection;
|
|
241186
|
+
const headRect = !sel || sel.head >= sel.anchor ? this.#localSelectionLayer?.lastElementChild : this.#localSelectionLayer?.firstElementChild;
|
|
241187
|
+
if (headRect) {
|
|
241188
|
+
const r$1 = headRect.getBoundingClientRect();
|
|
241189
|
+
this.#scrollScreenRectIntoView(r$1.top, r$1.bottom);
|
|
241190
|
+
}
|
|
241045
241191
|
}
|
|
241046
241192
|
#updatePermissionOverlay() {
|
|
241047
241193
|
const overlay = this.#permissionOverlay;
|
|
@@ -249652,7 +249798,13 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
249652
249798
|
const adjacent = getAdjacentLineClientTarget(editor, coords, event.key === "ArrowUp" ? -1 : 1);
|
|
249653
249799
|
if (!adjacent)
|
|
249654
249800
|
return false;
|
|
249655
|
-
|
|
249801
|
+
let hit = getHitFromLayoutCoords(editor, goalX, adjacent.clientY, coords, adjacent.pageIndex);
|
|
249802
|
+
if (adjacent.pmStart != null && adjacent.pmEnd != null) {
|
|
249803
|
+
const TOLERANCE = 5;
|
|
249804
|
+
const hitPos = hit?.pos;
|
|
249805
|
+
if (!hit || !Number.isFinite(hitPos) || hitPos < adjacent.pmStart - TOLERANCE || hitPos > adjacent.pmEnd + TOLERANCE)
|
|
249806
|
+
hit = resolvePositionAtGoalX(editor, adjacent.pmStart, adjacent.pmEnd, goalX);
|
|
249807
|
+
}
|
|
249656
249808
|
if (!hit || !Number.isFinite(hit.pos))
|
|
249657
249809
|
return false;
|
|
249658
249810
|
const selection = buildSelection(view.state, hit.pos, event.shiftKey);
|
|
@@ -253389,7 +253541,7 @@ var init_zipper_DqXT7uTa_es = __esm(() => {
|
|
|
253389
253541
|
|
|
253390
253542
|
// ../../packages/superdoc/dist/super-editor.es.js
|
|
253391
253543
|
var init_super_editor_es = __esm(() => {
|
|
253392
|
-
|
|
253544
|
+
init_src_D6jkx7VE_es();
|
|
253393
253545
|
init_SuperConverter_BQCVReWb_es();
|
|
253394
253546
|
init_jszip_ChlR43oI_es();
|
|
253395
253547
|
init_xml_js_DLE8mr0n_es();
|
|
@@ -280505,7 +280657,7 @@ var init_awareness = __esm(() => {
|
|
|
280505
280657
|
};
|
|
280506
280658
|
});
|
|
280507
280659
|
|
|
280508
|
-
// ../../node_modules/.pnpm/y-prosemirror@1.3.7_prosemirror-model@1.25.4_prosemirror-state@1.4.4_prosemirror-view@
|
|
280660
|
+
// ../../node_modules/.pnpm/y-prosemirror@1.3.7_prosemirror-model@1.25.4_prosemirror-state@1.4.4_prosemirror-view@1_4cc29e23e769b0d152b4b8d1fb5406d2/node_modules/y-prosemirror/src/plugins/keys.js
|
|
280509
280661
|
var ySyncPluginKey2, yUndoPluginKey2, yCursorPluginKey2;
|
|
280510
280662
|
var init_keys = __esm(() => {
|
|
280511
280663
|
init_dist5();
|
|
@@ -280514,18 +280666,18 @@ var init_keys = __esm(() => {
|
|
|
280514
280666
|
yCursorPluginKey2 = new PluginKey2("yjs-cursor");
|
|
280515
280667
|
});
|
|
280516
280668
|
|
|
280517
|
-
// ../../node_modules/.pnpm/y-prosemirror@1.3.7_prosemirror-model@1.25.4_prosemirror-state@1.4.4_prosemirror-view@
|
|
280669
|
+
// ../../node_modules/.pnpm/y-prosemirror@1.3.7_prosemirror-model@1.25.4_prosemirror-state@1.4.4_prosemirror-view@1_4cc29e23e769b0d152b4b8d1fb5406d2/node_modules/y-prosemirror/src/plugins/cursor-plugin.js
|
|
280518
280670
|
var init_cursor_plugin = __esm(() => {
|
|
280519
280671
|
init_awareness();
|
|
280520
280672
|
});
|
|
280521
280673
|
|
|
280522
|
-
// ../../node_modules/.pnpm/y-prosemirror@1.3.7_prosemirror-model@1.25.4_prosemirror-state@1.4.4_prosemirror-view@
|
|
280674
|
+
// ../../node_modules/.pnpm/y-prosemirror@1.3.7_prosemirror-model@1.25.4_prosemirror-state@1.4.4_prosemirror-view@1_4cc29e23e769b0d152b4b8d1fb5406d2/node_modules/y-prosemirror/src/plugins/undo-plugin.js
|
|
280523
280675
|
var defaultProtectedNodes2;
|
|
280524
280676
|
var init_undo_plugin = __esm(() => {
|
|
280525
280677
|
defaultProtectedNodes2 = new Set(["paragraph"]);
|
|
280526
280678
|
});
|
|
280527
280679
|
|
|
280528
|
-
// ../../node_modules/.pnpm/y-prosemirror@1.3.7_prosemirror-model@1.25.4_prosemirror-state@1.4.4_prosemirror-view@
|
|
280680
|
+
// ../../node_modules/.pnpm/y-prosemirror@1.3.7_prosemirror-model@1.25.4_prosemirror-state@1.4.4_prosemirror-view@1_4cc29e23e769b0d152b4b8d1fb5406d2/node_modules/y-prosemirror/src/y-prosemirror.js
|
|
280529
280681
|
var init_y_prosemirror = __esm(() => {
|
|
280530
280682
|
init_cursor_plugin();
|
|
280531
280683
|
init_undo_plugin();
|
|
@@ -394732,12 +394884,12 @@ class DetachedWindowAPI {
|
|
|
394732
394884
|
}
|
|
394733
394885
|
|
|
394734
394886
|
// ../../node_modules/.pnpm/happy-dom@20.4.0/node_modules/happy-dom/lib/window/Window.js
|
|
394735
|
-
var
|
|
394887
|
+
var Window2;
|
|
394736
394888
|
var init_Window = __esm(() => {
|
|
394737
394889
|
init_BrowserWindow();
|
|
394738
394890
|
init_DetachedBrowser();
|
|
394739
394891
|
init_PropertySymbol();
|
|
394740
|
-
|
|
394892
|
+
Window2 = class Window2 extends BrowserWindow {
|
|
394741
394893
|
happyDOM;
|
|
394742
394894
|
constructor(options2) {
|
|
394743
394895
|
const browser3 = new DetachedBrowser(BrowserWindow, {
|
|
@@ -394770,7 +394922,7 @@ var GlobalWindow;
|
|
|
394770
394922
|
var init_GlobalWindow = __esm(() => {
|
|
394771
394923
|
init_PropertySymbol();
|
|
394772
394924
|
init_Window();
|
|
394773
|
-
GlobalWindow = class GlobalWindow extends
|
|
394925
|
+
GlobalWindow = class GlobalWindow extends Window2 {
|
|
394774
394926
|
Array = globalThis.Array;
|
|
394775
394927
|
ArrayBuffer = globalThis.ArrayBuffer;
|
|
394776
394928
|
Boolean = globalThis.Boolean;
|
|
@@ -395022,7 +395174,7 @@ var init_lib20 = __esm(() => {
|
|
|
395022
395174
|
|
|
395023
395175
|
// src/lib/dom-environment.ts
|
|
395024
395176
|
function createCliDomEnvironment() {
|
|
395025
|
-
const window3 = new
|
|
395177
|
+
const window3 = new Window2;
|
|
395026
395178
|
return {
|
|
395027
395179
|
document: window3.document,
|
|
395028
395180
|
dispose() {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@superdoc-dev/cli",
|
|
3
|
-
"version": "0.2.0-next.
|
|
3
|
+
"version": "0.2.0-next.139",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"bin": {
|
|
6
6
|
"superdoc": "./dist/index.js"
|
|
@@ -21,20 +21,20 @@
|
|
|
21
21
|
"@types/node": "22.19.2",
|
|
22
22
|
"typescript": "^5.9.2",
|
|
23
23
|
"@superdoc/document-api": "0.0.1",
|
|
24
|
-
"@superdoc/
|
|
24
|
+
"@superdoc/super-editor": "0.0.1",
|
|
25
25
|
"superdoc": "1.18.0",
|
|
26
|
-
"@superdoc/
|
|
26
|
+
"@superdoc/pm-adapter": "0.0.0"
|
|
27
27
|
},
|
|
28
28
|
"module": "src/index.ts",
|
|
29
29
|
"publishConfig": {
|
|
30
30
|
"access": "public"
|
|
31
31
|
},
|
|
32
32
|
"optionalDependencies": {
|
|
33
|
-
"@superdoc-dev/cli-darwin-arm64": "0.2.0-next.
|
|
34
|
-
"@superdoc-dev/cli-
|
|
35
|
-
"@superdoc-dev/cli-
|
|
36
|
-
"@superdoc-dev/cli-
|
|
37
|
-
"@superdoc-dev/cli-
|
|
33
|
+
"@superdoc-dev/cli-darwin-arm64": "0.2.0-next.139",
|
|
34
|
+
"@superdoc-dev/cli-linux-x64": "0.2.0-next.139",
|
|
35
|
+
"@superdoc-dev/cli-darwin-x64": "0.2.0-next.139",
|
|
36
|
+
"@superdoc-dev/cli-windows-x64": "0.2.0-next.139",
|
|
37
|
+
"@superdoc-dev/cli-linux-arm64": "0.2.0-next.139"
|
|
38
38
|
},
|
|
39
39
|
"scripts": {
|
|
40
40
|
"dev": "bun run src/index.ts",
|