superdoc 1.0.0-beta.70 → 1.0.0-beta.72
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-Li0IVylM.cjs → PdfViewer-BxCLl7Q6.cjs} +1 -1
- package/dist/chunks/{PdfViewer-DSqV0wBl.es.js → PdfViewer-Dg-qiC1A.es.js} +1 -1
- package/dist/chunks/{index-atbbnwyB.es.js → index-B1AqHbuy.es.js} +3 -3
- package/dist/chunks/{index-CJCOemVA.cjs → index-CAQDtLex.cjs} +3 -3
- package/dist/chunks/{index-DruHtc6s-CBCtA0Ud.cjs → index-qXb-Hmel-BPsIpdLY.cjs} +1 -1
- package/dist/chunks/{index-DruHtc6s-CPc5HSle.es.js → index-qXb-Hmel-DwJhkxdW.es.js} +1 -1
- package/dist/chunks/{super-editor.es-4JNmJF9G.es.js → super-editor.es-DPl3-zTR.es.js} +257 -16
- package/dist/chunks/{super-editor.es-CzBIlSB8.cjs → super-editor.es-DxG6ckVG.cjs} +257 -16
- package/dist/style.css +7 -8
- package/dist/super-editor/ai-writer.es.js +2 -2
- package/dist/super-editor/chunks/{converter-B4HiY8pI.js → converter-JlOFMM88.js} +1 -1
- package/dist/super-editor/chunks/{docx-zipper-D7YJSyKT.js → docx-zipper-BVmpz1K_.js} +1 -1
- package/dist/super-editor/chunks/{editor-C9smgNs-.js → editor-CNzx36Ms.js} +198 -7
- package/dist/super-editor/chunks/{index-DruHtc6s.js → index-qXb-Hmel.js} +1 -1
- package/dist/super-editor/chunks/{toolbar-BuJaDiNO.js → toolbar-DAhwzyFV.js} +2 -2
- package/dist/super-editor/converter.es.js +1 -1
- package/dist/super-editor/docx-zipper.es.js +2 -2
- package/dist/super-editor/editor.es.js +3 -3
- package/dist/super-editor/file-zipper.es.js +1 -1
- package/dist/super-editor/style.css +7 -8
- package/dist/super-editor/super-editor.es.js +66 -16
- 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 +259 -18
- package/dist/superdoc.umd.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const vue = require("./vue-jWLMl8Ts.cjs");
|
|
4
|
-
const superdoc = require("./index-
|
|
4
|
+
const superdoc = require("./index-CAQDtLex.cjs");
|
|
5
5
|
function self(vars) {
|
|
6
6
|
const {
|
|
7
7
|
opacityDisabled,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { y as defineComponent, z as h, O as Transition, a0 as process$1, J as watchEffect, a as computed, r as ref, j as onMounted, W as onUnmounted, b as createElementBlock, o as openBlock, f as createBaseVNode, e as createCommentVNode, u as createVNode, v as unref } from "./vue-Dysv_7z5.es.js";
|
|
2
|
-
import { d as derived, c, a as cB, f as fadeInTransition, b as cM, N as NBaseLoading, w as warnOnce, u as useConfig, e as useTheme, p as pxfy, g as createKey, h as useThemeClass, i as useCompitable, _ as _export_sfc, j as useSuperdocStore, s as storeToRefs, k as useSelection } from "./index-
|
|
2
|
+
import { d as derived, c, a as cB, f as fadeInTransition, b as cM, N as NBaseLoading, w as warnOnce, u as useConfig, e as useTheme, p as pxfy, g as createKey, h as useThemeClass, i as useCompitable, _ as _export_sfc, j as useSuperdocStore, s as storeToRefs, k as useSelection } from "./index-B1AqHbuy.es.js";
|
|
3
3
|
function self(vars) {
|
|
4
4
|
const {
|
|
5
5
|
opacityDisabled,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { q as index, C as CommentsPluginKey, h as TrackChangesBasePluginKey, E as Editor, n as getRichTextExtensions, f as SuperInput, P as PresentationEditor, e as SuperEditor, A as AIWriter, g as SuperToolbar, i as createZip } from "./super-editor.es-
|
|
1
|
+
import { q as index, C as CommentsPluginKey, h as TrackChangesBasePluginKey, E as Editor, n as getRichTextExtensions, f as SuperInput, P as PresentationEditor, e as SuperEditor, A as AIWriter, g as SuperToolbar, i as createZip } from "./super-editor.es-DPl3-zTR.es.js";
|
|
2
2
|
import { B as BlankDOCX } from "./blank-docx-ABm6XYAA.es.js";
|
|
3
3
|
import { E as EventEmitter } from "./eventemitter3-CcXAdeql.es.js";
|
|
4
4
|
import { HocuspocusProvider, HocuspocusProviderWebsocket } from "@hocuspocus/provider";
|
|
@@ -17251,7 +17251,7 @@ const _sfc_main = {
|
|
|
17251
17251
|
__name: "SuperDoc",
|
|
17252
17252
|
emits: ["selection-update"],
|
|
17253
17253
|
setup(__props, { emit: __emit }) {
|
|
17254
|
-
const PdfViewer = defineAsyncComponent(() => import("./PdfViewer-
|
|
17254
|
+
const PdfViewer = defineAsyncComponent(() => import("./PdfViewer-Dg-qiC1A.es.js"));
|
|
17255
17255
|
const superdocStore = useSuperdocStore();
|
|
17256
17256
|
const commentsStore = useCommentsStore();
|
|
17257
17257
|
const {
|
|
@@ -18140,7 +18140,7 @@ class SuperDoc extends EventEmitter {
|
|
|
18140
18140
|
this.config.colors = shuffleArray(this.config.colors);
|
|
18141
18141
|
this.userColorMap = /* @__PURE__ */ new Map();
|
|
18142
18142
|
this.colorIndex = 0;
|
|
18143
|
-
this.version = "1.0.0-beta.
|
|
18143
|
+
this.version = "1.0.0-beta.72";
|
|
18144
18144
|
this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
|
|
18145
18145
|
this.superdocId = config.superdocId || v4();
|
|
18146
18146
|
this.colors = this.config.colors;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
const superEditor_es = require("./super-editor.es-
|
|
2
|
+
const superEditor_es = require("./super-editor.es-DxG6ckVG.cjs");
|
|
3
3
|
const blankDocx = require("./blank-docx-DfW3Eeh2.cjs");
|
|
4
4
|
const eventemitter3 = require("./eventemitter3-DQmQUge-.cjs");
|
|
5
5
|
const provider = require("@hocuspocus/provider");
|
|
@@ -17268,7 +17268,7 @@ const _sfc_main = {
|
|
|
17268
17268
|
__name: "SuperDoc",
|
|
17269
17269
|
emits: ["selection-update"],
|
|
17270
17270
|
setup(__props, { emit: __emit }) {
|
|
17271
|
-
const PdfViewer = vue.defineAsyncComponent(() => Promise.resolve().then(() => require("./PdfViewer-
|
|
17271
|
+
const PdfViewer = vue.defineAsyncComponent(() => Promise.resolve().then(() => require("./PdfViewer-BxCLl7Q6.cjs")));
|
|
17272
17272
|
const superdocStore = useSuperdocStore();
|
|
17273
17273
|
const commentsStore = useCommentsStore();
|
|
17274
17274
|
const {
|
|
@@ -18157,7 +18157,7 @@ class SuperDoc extends eventemitter3.EventEmitter {
|
|
|
18157
18157
|
this.config.colors = shuffleArray(this.config.colors);
|
|
18158
18158
|
this.userColorMap = /* @__PURE__ */ new Map();
|
|
18159
18159
|
this.colorIndex = 0;
|
|
18160
|
-
this.version = "1.0.0-beta.
|
|
18160
|
+
this.version = "1.0.0-beta.72";
|
|
18161
18161
|
this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
|
|
18162
18162
|
this.superdocId = config.superdocId || uuid.v4();
|
|
18163
18163
|
this.colors = this.config.colors;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const superEditor_es = require("./super-editor.es-
|
|
3
|
+
const superEditor_es = require("./super-editor.es-DxG6ckVG.cjs");
|
|
4
4
|
const indexCvBqQJbG = require("./index-CvBqQJbG-Dwm0THD7.cjs");
|
|
5
5
|
function bail(error) {
|
|
6
6
|
if (error) {
|
|
@@ -42309,7 +42309,7 @@ const _SuperConverter = class _SuperConverter2 {
|
|
|
42309
42309
|
static getStoredSuperdocVersion(docx) {
|
|
42310
42310
|
return _SuperConverter2.getStoredCustomProperty(docx, "SuperdocVersion");
|
|
42311
42311
|
}
|
|
42312
|
-
static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.0.0-beta.
|
|
42312
|
+
static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.0.0-beta.72") {
|
|
42313
42313
|
return _SuperConverter2.setStoredCustomProperty(docx, "SuperdocVersion", version2, false);
|
|
42314
42314
|
}
|
|
42315
42315
|
/**
|
|
@@ -59498,7 +59498,7 @@ const isHeadless = (editor) => {
|
|
|
59498
59498
|
const shouldSkipNodeView = (editor) => {
|
|
59499
59499
|
return isHeadless(editor);
|
|
59500
59500
|
};
|
|
59501
|
-
const summaryVersion = "1.0.0-beta.
|
|
59501
|
+
const summaryVersion = "1.0.0-beta.72";
|
|
59502
59502
|
const nodeKeys = ["group", "content", "marks", "inline", "atom", "defining", "code", "tableRole", "summary"];
|
|
59503
59503
|
const markKeys = ["group", "inclusive", "excludes", "spanning", "code"];
|
|
59504
59504
|
function mapAttributes(attrs) {
|
|
@@ -60287,7 +60287,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
60287
60287
|
{ default: remarkStringify },
|
|
60288
60288
|
{ default: remarkGfm }
|
|
60289
60289
|
] = await Promise.all([
|
|
60290
|
-
import("./index-
|
|
60290
|
+
import("./index-qXb-Hmel-DwJhkxdW.es.js"),
|
|
60291
60291
|
import("./index-DRCvimau-Cw339678.es.js"),
|
|
60292
60292
|
import("./index-C_x_N6Uh-DJn8hIEt.es.js"),
|
|
60293
60293
|
import("./index-D_sWOSiG-DE96TaT5.es.js"),
|
|
@@ -60492,7 +60492,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
60492
60492
|
* Process collaboration migrations
|
|
60493
60493
|
*/
|
|
60494
60494
|
processCollaborationMigrations() {
|
|
60495
|
-
console.debug("[checkVersionMigrations] Current editor version", "1.0.0-beta.
|
|
60495
|
+
console.debug("[checkVersionMigrations] Current editor version", "1.0.0-beta.72");
|
|
60496
60496
|
if (!this.options.ydoc) return;
|
|
60497
60497
|
const metaMap = this.options.ydoc.getMap("meta");
|
|
60498
60498
|
let docVersion = metaMap.get("version");
|
|
@@ -85069,6 +85069,109 @@ const _PresentationEditor = class _PresentationEditor2 extends EventEmitter$1 {
|
|
|
85069
85069
|
const activeEditor = this.getActiveEditor();
|
|
85070
85070
|
return activeEditor.commands;
|
|
85071
85071
|
}
|
|
85072
|
+
/**
|
|
85073
|
+
* Get the ProseMirror editor state for the currently active editor (header/footer-aware).
|
|
85074
|
+
*
|
|
85075
|
+
* This property dynamically returns the state from the appropriate editor instance:
|
|
85076
|
+
* - In body mode, returns the main editor's state
|
|
85077
|
+
* - In header/footer mode, returns the active header/footer editor's state
|
|
85078
|
+
*
|
|
85079
|
+
* This enables components like SlashMenu and context menus to access document
|
|
85080
|
+
* state, selection, and schema information in the correct editing context.
|
|
85081
|
+
*
|
|
85082
|
+
* @returns The EditorState for the active editor
|
|
85083
|
+
*
|
|
85084
|
+
* @example
|
|
85085
|
+
* ```typescript
|
|
85086
|
+
* const { selection, doc } = presentationEditor.state;
|
|
85087
|
+
* const selectedText = doc.textBetween(selection.from, selection.to);
|
|
85088
|
+
* ```
|
|
85089
|
+
*/
|
|
85090
|
+
get state() {
|
|
85091
|
+
return this.getActiveEditor().state;
|
|
85092
|
+
}
|
|
85093
|
+
/**
|
|
85094
|
+
* Check if the editor is currently editable (header/footer-aware).
|
|
85095
|
+
*
|
|
85096
|
+
* This property checks the editable state of the currently active editor:
|
|
85097
|
+
* - In body mode, returns whether the main editor is editable
|
|
85098
|
+
* - In header/footer mode, returns whether the header/footer editor is editable
|
|
85099
|
+
*
|
|
85100
|
+
* The editor may be non-editable due to:
|
|
85101
|
+
* - Document mode set to 'viewing'
|
|
85102
|
+
* - Explicit `editable: false` option
|
|
85103
|
+
* - Editor not fully initialized
|
|
85104
|
+
*
|
|
85105
|
+
* @returns true if the active editor accepts input, false otherwise
|
|
85106
|
+
*
|
|
85107
|
+
* @example
|
|
85108
|
+
* ```typescript
|
|
85109
|
+
* if (presentationEditor.isEditable) {
|
|
85110
|
+
* presentationEditor.commands.insertText('Hello');
|
|
85111
|
+
* }
|
|
85112
|
+
* ```
|
|
85113
|
+
*/
|
|
85114
|
+
get isEditable() {
|
|
85115
|
+
return this.getActiveEditor().isEditable;
|
|
85116
|
+
}
|
|
85117
|
+
/**
|
|
85118
|
+
* Get the editor options for the currently active editor (header/footer-aware).
|
|
85119
|
+
*
|
|
85120
|
+
* This property returns the options object from the appropriate editor instance,
|
|
85121
|
+
* providing access to configuration like document mode, AI settings, and custom
|
|
85122
|
+
* slash menu configuration.
|
|
85123
|
+
*
|
|
85124
|
+
* @returns The options object for the active editor
|
|
85125
|
+
*
|
|
85126
|
+
* @example
|
|
85127
|
+
* ```typescript
|
|
85128
|
+
* const { documentMode, isAiEnabled } = presentationEditor.options;
|
|
85129
|
+
* ```
|
|
85130
|
+
*/
|
|
85131
|
+
get options() {
|
|
85132
|
+
return this.getActiveEditor().options;
|
|
85133
|
+
}
|
|
85134
|
+
/**
|
|
85135
|
+
* Dispatch a ProseMirror transaction to the currently active editor (header/footer-aware).
|
|
85136
|
+
*
|
|
85137
|
+
* This method routes transactions to the appropriate editor instance:
|
|
85138
|
+
* - In body mode, dispatches to the main editor
|
|
85139
|
+
* - In header/footer mode, dispatches to the active header/footer editor
|
|
85140
|
+
*
|
|
85141
|
+
* Use this for direct state manipulation when commands are insufficient.
|
|
85142
|
+
* For most use cases, prefer using `commands` or `dispatchInActiveEditor`.
|
|
85143
|
+
*
|
|
85144
|
+
* @param tr - The ProseMirror transaction to dispatch
|
|
85145
|
+
*
|
|
85146
|
+
* @example
|
|
85147
|
+
* ```typescript
|
|
85148
|
+
* const { state } = presentationEditor;
|
|
85149
|
+
* const tr = state.tr.insertText('Hello', state.selection.from);
|
|
85150
|
+
* presentationEditor.dispatch(tr);
|
|
85151
|
+
* ```
|
|
85152
|
+
*/
|
|
85153
|
+
dispatch(tr) {
|
|
85154
|
+
const activeEditor = this.getActiveEditor();
|
|
85155
|
+
activeEditor.view?.dispatch(tr);
|
|
85156
|
+
}
|
|
85157
|
+
/**
|
|
85158
|
+
* Focus the editor, routing focus to the appropriate editing surface.
|
|
85159
|
+
*
|
|
85160
|
+
* In PresentationEditor, the actual ProseMirror EditorView is hidden and input
|
|
85161
|
+
* is bridged from the visible layout surface. This method focuses the hidden
|
|
85162
|
+
* editor view to enable keyboard input while the visual focus remains on the
|
|
85163
|
+
* rendered presentation.
|
|
85164
|
+
*
|
|
85165
|
+
* @example
|
|
85166
|
+
* ```typescript
|
|
85167
|
+
* // After closing a modal, restore focus to the editor
|
|
85168
|
+
* presentationEditor.focus();
|
|
85169
|
+
* ```
|
|
85170
|
+
*/
|
|
85171
|
+
focus() {
|
|
85172
|
+
const activeEditor = this.getActiveEditor();
|
|
85173
|
+
activeEditor.view?.focus();
|
|
85174
|
+
}
|
|
85072
85175
|
/**
|
|
85073
85176
|
* Returns the currently active editor (body or header/footer session).
|
|
85074
85177
|
*
|
|
@@ -85534,6 +85637,74 @@ const _PresentationEditor = class _PresentationEditor2 extends EventEmitter$1 {
|
|
|
85534
85637
|
getLayoutOptions() {
|
|
85535
85638
|
return { ...__privateGet$1(this, _layoutOptions) };
|
|
85536
85639
|
}
|
|
85640
|
+
/**
|
|
85641
|
+
* Get the page styles for the section containing the current caret position.
|
|
85642
|
+
*
|
|
85643
|
+
* In multi-section documents, different sections can have different page sizes,
|
|
85644
|
+
* margins, and orientations. This method returns the styles for the section
|
|
85645
|
+
* where the caret is currently located, enabling section-aware UI components
|
|
85646
|
+
* like rulers to display accurate information.
|
|
85647
|
+
*
|
|
85648
|
+
* @returns Object containing:
|
|
85649
|
+
* - pageSize: { width, height } in inches
|
|
85650
|
+
* - pageMargins: { left, right, top, bottom } in inches
|
|
85651
|
+
* - sectionIndex: The current section index (0-based)
|
|
85652
|
+
* - orientation: 'portrait' or 'landscape'
|
|
85653
|
+
*
|
|
85654
|
+
* Falls back to document-level defaults if section info is unavailable.
|
|
85655
|
+
*
|
|
85656
|
+
* @example
|
|
85657
|
+
* ```typescript
|
|
85658
|
+
* const sectionStyles = presentation.getCurrentSectionPageStyles();
|
|
85659
|
+
* console.log(`Section ${sectionStyles.sectionIndex}: ${sectionStyles.pageSize.width}" x ${sectionStyles.pageSize.height}"`);
|
|
85660
|
+
* ```
|
|
85661
|
+
*/
|
|
85662
|
+
getCurrentSectionPageStyles() {
|
|
85663
|
+
const PPI2 = 96;
|
|
85664
|
+
const layout = __privateGet$1(this, _layoutState).layout;
|
|
85665
|
+
const pageIndex = __privateMethod$1(this, _PresentationEditor_instances, getCurrentPageIndex_fn).call(this);
|
|
85666
|
+
const page = layout?.pages?.[pageIndex];
|
|
85667
|
+
const converterStyles = __privateGet$1(this, _editor3).converter?.pageStyles ?? {};
|
|
85668
|
+
const defaultMargins = converterStyles.pageMargins ?? { left: 1, right: 1, top: 1, bottom: 1 };
|
|
85669
|
+
const safeMargins = {
|
|
85670
|
+
left: typeof defaultMargins.left === "number" ? defaultMargins.left : 1,
|
|
85671
|
+
right: typeof defaultMargins.right === "number" ? defaultMargins.right : 1,
|
|
85672
|
+
top: typeof defaultMargins.top === "number" ? defaultMargins.top : 1,
|
|
85673
|
+
bottom: typeof defaultMargins.bottom === "number" ? defaultMargins.bottom : 1
|
|
85674
|
+
};
|
|
85675
|
+
if (!page) {
|
|
85676
|
+
return {
|
|
85677
|
+
pageSize: { width: 8.5, height: 11 },
|
|
85678
|
+
pageMargins: safeMargins,
|
|
85679
|
+
sectionIndex: 0,
|
|
85680
|
+
orientation: "portrait"
|
|
85681
|
+
};
|
|
85682
|
+
}
|
|
85683
|
+
const pageOrientation = page.orientation === "landscape" || page.orientation === "portrait" ? page.orientation : "portrait";
|
|
85684
|
+
const standardPortrait = { w: 8.5 * PPI2, h: 11 * PPI2 };
|
|
85685
|
+
const standardLandscape = { w: 11 * PPI2, h: 8.5 * PPI2 };
|
|
85686
|
+
const orientationDefault = pageOrientation === "landscape" ? standardLandscape : standardPortrait;
|
|
85687
|
+
const pageWidthPx = page.size?.w ?? orientationDefault.w;
|
|
85688
|
+
const pageHeightPx = page.size?.h ?? orientationDefault.h;
|
|
85689
|
+
const marginLeftPx = page.margins?.left ?? safeMargins.left * PPI2;
|
|
85690
|
+
const marginRightPx = page.margins?.right ?? safeMargins.right * PPI2;
|
|
85691
|
+
const marginTopPx = page.margins?.top ?? safeMargins.top * PPI2;
|
|
85692
|
+
const marginBottomPx = page.margins?.bottom ?? safeMargins.bottom * PPI2;
|
|
85693
|
+
return {
|
|
85694
|
+
pageSize: {
|
|
85695
|
+
width: pageWidthPx / PPI2,
|
|
85696
|
+
height: pageHeightPx / PPI2
|
|
85697
|
+
},
|
|
85698
|
+
pageMargins: {
|
|
85699
|
+
left: marginLeftPx / PPI2,
|
|
85700
|
+
right: marginRightPx / PPI2,
|
|
85701
|
+
top: marginTopPx / PPI2,
|
|
85702
|
+
bottom: marginBottomPx / PPI2
|
|
85703
|
+
},
|
|
85704
|
+
sectionIndex: page.sectionIndex ?? 0,
|
|
85705
|
+
orientation: pageOrientation
|
|
85706
|
+
};
|
|
85707
|
+
}
|
|
85537
85708
|
/**
|
|
85538
85709
|
* Get current remote cursor states (normalized to absolute PM positions).
|
|
85539
85710
|
* Returns an array of cursor states for all remote collaborators, excluding the local user.
|
|
@@ -88428,9 +88599,26 @@ getCurrentPageIndex_fn = function() {
|
|
|
88428
88599
|
}
|
|
88429
88600
|
const layout = __privateGet$1(this, _layoutState).layout;
|
|
88430
88601
|
const selection = __privateGet$1(this, _editor3).state?.selection;
|
|
88431
|
-
if (!layout || !selection)
|
|
88602
|
+
if (!layout || !selection) {
|
|
88603
|
+
return 0;
|
|
88604
|
+
}
|
|
88432
88605
|
const rects = selectionToRects(layout, __privateGet$1(this, _layoutState).blocks, __privateGet$1(this, _layoutState).measures, selection.from, selection.to) ?? [];
|
|
88433
|
-
|
|
88606
|
+
if (rects.length > 0) {
|
|
88607
|
+
return rects[0]?.pageIndex ?? 0;
|
|
88608
|
+
}
|
|
88609
|
+
const pos = selection.from;
|
|
88610
|
+
for (let pageIdx = 0; pageIdx < layout.pages.length; pageIdx++) {
|
|
88611
|
+
const page = layout.pages[pageIdx];
|
|
88612
|
+
for (const fragment of page.fragments) {
|
|
88613
|
+
const frag = fragment;
|
|
88614
|
+
if (frag.pmStart != null && frag.pmEnd != null) {
|
|
88615
|
+
if (pos >= frag.pmStart && pos <= frag.pmEnd) {
|
|
88616
|
+
return pageIdx;
|
|
88617
|
+
}
|
|
88618
|
+
}
|
|
88619
|
+
}
|
|
88620
|
+
}
|
|
88621
|
+
return 0;
|
|
88434
88622
|
};
|
|
88435
88623
|
findRegionForPage_fn = function(kind, pageIndex) {
|
|
88436
88624
|
const map22 = kind === "header" ? __privateGet$1(this, _headerRegions) : __privateGet$1(this, _footerRegions);
|
|
@@ -89848,6 +90036,9 @@ const processAiHighlights = (editor, doc2, highlightColor, customClass = null) =
|
|
|
89848
90036
|
};
|
|
89849
90037
|
function getEditorSurfaceElement(editor) {
|
|
89850
90038
|
if (!editor) return null;
|
|
90039
|
+
if (typeof editor.hitTest === "function" && editor.element instanceof HTMLElement) {
|
|
90040
|
+
return editor.element;
|
|
90041
|
+
}
|
|
89851
90042
|
return editor.presentationEditor?.element ?? editor.view?.dom ?? editor.options?.element ?? null;
|
|
89852
90043
|
}
|
|
89853
90044
|
function getSurfaceRelativePoint(editor, eventLocation = {}) {
|
|
@@ -122992,7 +123183,7 @@ const _sfc_main$8 = {
|
|
|
122992
123183
|
onMounted(() => {
|
|
122993
123184
|
if (!props.editor) return;
|
|
122994
123185
|
document.addEventListener("keydown", handleGlobalKeyDown);
|
|
122995
|
-
document.addEventListener("
|
|
123186
|
+
document.addEventListener("pointerdown", handleGlobalOutsideClick);
|
|
122996
123187
|
props.editor.on("update", handleEditorUpdate);
|
|
122997
123188
|
slashMenuOpenHandler = async (event) => {
|
|
122998
123189
|
const readOnly = !props.editor?.isEditable;
|
|
@@ -123026,7 +123217,7 @@ const _sfc_main$8 = {
|
|
|
123026
123217
|
});
|
|
123027
123218
|
onBeforeUnmount(() => {
|
|
123028
123219
|
document.removeEventListener("keydown", handleGlobalKeyDown);
|
|
123029
|
-
document.removeEventListener("
|
|
123220
|
+
document.removeEventListener("pointerdown", handleGlobalOutsideClick);
|
|
123030
123221
|
cleanupCustomItems();
|
|
123031
123222
|
if (props.editor) {
|
|
123032
123223
|
try {
|
|
@@ -123050,7 +123241,7 @@ const _sfc_main$8 = {
|
|
|
123050
123241
|
ref: menuRef,
|
|
123051
123242
|
class: "slash-menu",
|
|
123052
123243
|
style: normalizeStyle(menuPosition.value),
|
|
123053
|
-
|
|
123244
|
+
onPointerdown: _cache[2] || (_cache[2] = withModifiers(() => {
|
|
123054
123245
|
}, ["stop"]))
|
|
123055
123246
|
}, [
|
|
123056
123247
|
withDirectives(createBaseVNode("input", {
|
|
@@ -123162,6 +123353,7 @@ const _sfc_main$6 = {
|
|
|
123162
123353
|
const rulerHandleActiveColor = ref$1("#2563EB66");
|
|
123163
123354
|
const pageSize = ref$1(null);
|
|
123164
123355
|
const pageMargins = ref$1(null);
|
|
123356
|
+
const currentSectionIndex = ref$1(0);
|
|
123165
123357
|
const isDragging = ref$1(false);
|
|
123166
123358
|
const currentHandle = ref$1(null);
|
|
123167
123359
|
const leftHandle = reactive({ side: "left", x: 0 });
|
|
@@ -123169,9 +123361,29 @@ const _sfc_main$6 = {
|
|
|
123169
123361
|
const showVerticalIndicator = ref$1(false);
|
|
123170
123362
|
const initialX = ref$1(0);
|
|
123171
123363
|
let offsetX = 0;
|
|
123172
|
-
|
|
123173
|
-
|
|
123174
|
-
|
|
123364
|
+
let selectionUpdateHandler = null;
|
|
123365
|
+
const getPresentationEditor = () => {
|
|
123366
|
+
return props.editor?.presentationEditor ?? null;
|
|
123367
|
+
};
|
|
123368
|
+
const updateRulerForCurrentSection = () => {
|
|
123369
|
+
if (!props.editor || props.editor.options?.mode !== "docx") return;
|
|
123370
|
+
const presentationEditor = getPresentationEditor();
|
|
123371
|
+
let docSize, docMargins, sectionIndex;
|
|
123372
|
+
if (presentationEditor && typeof presentationEditor.getCurrentSectionPageStyles === "function") {
|
|
123373
|
+
const sectionStyles = presentationEditor.getCurrentSectionPageStyles();
|
|
123374
|
+
docSize = sectionStyles.pageSize;
|
|
123375
|
+
docMargins = sectionStyles.pageMargins;
|
|
123376
|
+
sectionIndex = sectionStyles.sectionIndex;
|
|
123377
|
+
} else {
|
|
123378
|
+
const styles = props.editor.getPageStyles();
|
|
123379
|
+
docSize = styles.pageSize ?? { width: 8.5, height: 11 };
|
|
123380
|
+
docMargins = styles.pageMargins ?? { left: 1, right: 1, top: 1, bottom: 1 };
|
|
123381
|
+
sectionIndex = 0;
|
|
123382
|
+
}
|
|
123383
|
+
if (pageSize.value && currentSectionIndex.value === sectionIndex) {
|
|
123384
|
+
return;
|
|
123385
|
+
}
|
|
123386
|
+
currentSectionIndex.value = sectionIndex;
|
|
123175
123387
|
pageSize.value = docSize;
|
|
123176
123388
|
pageMargins.value = docMargins;
|
|
123177
123389
|
const definition = generateRulerDefinition({
|
|
@@ -123185,7 +123397,7 @@ const _sfc_main$6 = {
|
|
|
123185
123397
|
});
|
|
123186
123398
|
leftHandle.x = definition.leftMarginPx;
|
|
123187
123399
|
rightHandle.x = definition.rightMarginPx;
|
|
123188
|
-
|
|
123400
|
+
rulerDefinition.value = definition;
|
|
123189
123401
|
};
|
|
123190
123402
|
const getTickStyle = computed(() => (tick) => {
|
|
123191
123403
|
return {
|
|
@@ -123239,7 +123451,8 @@ const _sfc_main$6 = {
|
|
|
123239
123451
|
const marginValue = getNewMarginValue();
|
|
123240
123452
|
emit("margin-change", {
|
|
123241
123453
|
side: currentHandle.value.side,
|
|
123242
|
-
value: marginValue
|
|
123454
|
+
value: marginValue,
|
|
123455
|
+
sectionIndex: currentSectionIndex.value
|
|
123243
123456
|
});
|
|
123244
123457
|
}
|
|
123245
123458
|
};
|
|
@@ -123263,12 +123476,40 @@ const _sfc_main$6 = {
|
|
|
123263
123476
|
"--ruler-width": `${width}px`
|
|
123264
123477
|
};
|
|
123265
123478
|
});
|
|
123479
|
+
const handleSelectionUpdate = () => {
|
|
123480
|
+
if (isDragging.value) return;
|
|
123481
|
+
updateRulerForCurrentSection();
|
|
123482
|
+
};
|
|
123483
|
+
const setupEditorListeners = () => {
|
|
123484
|
+
if (!props.editor) return;
|
|
123485
|
+
selectionUpdateHandler = handleSelectionUpdate;
|
|
123486
|
+
props.editor.on("selectionUpdate", selectionUpdateHandler);
|
|
123487
|
+
};
|
|
123488
|
+
const cleanupEditorListeners = () => {
|
|
123489
|
+
if (!props.editor || !selectionUpdateHandler) return;
|
|
123490
|
+
props.editor.off("selectionUpdate", selectionUpdateHandler);
|
|
123491
|
+
selectionUpdateHandler = null;
|
|
123492
|
+
};
|
|
123493
|
+
watch(
|
|
123494
|
+
() => props.editor,
|
|
123495
|
+
(newEditor, oldEditor) => {
|
|
123496
|
+
if (oldEditor && selectionUpdateHandler) {
|
|
123497
|
+
oldEditor.off("selectionUpdate", selectionUpdateHandler);
|
|
123498
|
+
}
|
|
123499
|
+
if (newEditor) {
|
|
123500
|
+
setupEditorListeners();
|
|
123501
|
+
updateRulerForCurrentSection();
|
|
123502
|
+
}
|
|
123503
|
+
}
|
|
123504
|
+
);
|
|
123266
123505
|
onMounted(() => {
|
|
123267
|
-
|
|
123506
|
+
updateRulerForCurrentSection();
|
|
123507
|
+
setupEditorListeners();
|
|
123268
123508
|
window.addEventListener("mousemove", handleMouseMove2);
|
|
123269
123509
|
window.addEventListener("mouseup", handleMouseUp);
|
|
123270
123510
|
});
|
|
123271
123511
|
onUnmounted(() => {
|
|
123512
|
+
cleanupEditorListeners();
|
|
123272
123513
|
window.removeEventListener("mousemove", handleMouseMove2);
|
|
123273
123514
|
window.removeEventListener("mouseup", handleMouseUp);
|
|
123274
123515
|
});
|
|
@@ -123309,7 +123550,7 @@ const _sfc_main$6 = {
|
|
|
123309
123550
|
};
|
|
123310
123551
|
}
|
|
123311
123552
|
};
|
|
123312
|
-
const Ruler = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["__scopeId", "data-v-
|
|
123553
|
+
const Ruler = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["__scopeId", "data-v-0d1b9cd1"]]);
|
|
123313
123554
|
const _sfc_main$5 = {
|
|
123314
123555
|
__name: "GenericPopover",
|
|
123315
123556
|
props: {
|