@harbour-enterprises/superdoc 1.12.0-next.2 → 1.12.0-next.4
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-VC8DtAtQ.cjs → PdfViewer-BBMla6g2.cjs} +2 -2
- package/dist/chunks/{PdfViewer-CvN7TiN6.es.js → PdfViewer-BQhqiF7E.es.js} +2 -2
- package/dist/chunks/{SuperConverter-CnYGsgJe.es.js → SuperConverter-Bi2TMhFE.es.js} +2 -1
- package/dist/chunks/{SuperConverter-C7uk1CCI.cjs → SuperConverter-h-xXL41t.cjs} +2 -1
- package/dist/chunks/{index-BHy3981o.es.js → index-27ZZTkLo.es.js} +98 -16
- package/dist/chunks/{index-CwvjmOKo.es.js → index-BUXiEJwg.es.js} +4 -4
- package/dist/chunks/{index-hVM6xpiG.cjs → index-BVzD9h27.cjs} +98 -16
- package/dist/chunks/{index-Cn8x6Vrq.cjs → index-BZDsBGT9.cjs} +4 -4
- package/dist/super-editor/components/slash-menu/menuItems.d.ts.map +1 -1
- package/dist/super-editor/converter.cjs +1 -1
- package/dist/super-editor/converter.es.js +1 -1
- package/dist/super-editor/core/utilities/clipboardUtils.d.ts +8 -0
- package/dist/super-editor/core/utilities/clipboardUtils.d.ts.map +1 -1
- package/dist/super-editor.cjs +2 -2
- package/dist/super-editor.es.js +3 -3
- package/dist/superdoc.cjs +3 -3
- package/dist/superdoc.es.js +3 -3
- package/dist/superdoc.umd.js +99 -17
- package/dist/superdoc.umd.js.map +1 -1
- package/package.json +1 -1
package/dist/superdoc.umd.js
CHANGED
|
@@ -6143,6 +6143,60 @@
|
|
|
6143
6143
|
}
|
|
6144
6144
|
return { dom, contentDOM };
|
|
6145
6145
|
}
|
|
6146
|
+
async function ensureClipboardPermission() {
|
|
6147
|
+
if (typeof navigator === "undefined" || !navigator.clipboard) {
|
|
6148
|
+
return false;
|
|
6149
|
+
}
|
|
6150
|
+
if (!navigator.permissions || typeof navigator.permissions.query !== "function") {
|
|
6151
|
+
return true;
|
|
6152
|
+
}
|
|
6153
|
+
try {
|
|
6154
|
+
const status = await navigator.permissions.query({ name: "clipboard-read" });
|
|
6155
|
+
if (status.state === "granted") {
|
|
6156
|
+
return true;
|
|
6157
|
+
}
|
|
6158
|
+
if (status.state === "prompt") {
|
|
6159
|
+
try {
|
|
6160
|
+
await navigator.clipboard.readText();
|
|
6161
|
+
return true;
|
|
6162
|
+
} catch {
|
|
6163
|
+
return false;
|
|
6164
|
+
}
|
|
6165
|
+
}
|
|
6166
|
+
return false;
|
|
6167
|
+
} catch {
|
|
6168
|
+
return false;
|
|
6169
|
+
}
|
|
6170
|
+
}
|
|
6171
|
+
async function readClipboardRaw() {
|
|
6172
|
+
let html2 = "";
|
|
6173
|
+
let text2 = "";
|
|
6174
|
+
const hasPermission = await ensureClipboardPermission();
|
|
6175
|
+
if (!navigator.clipboard) {
|
|
6176
|
+
return { html: html2, text: text2 || "" };
|
|
6177
|
+
}
|
|
6178
|
+
if (hasPermission && navigator.clipboard.read) {
|
|
6179
|
+
try {
|
|
6180
|
+
const items = await navigator.clipboard.read();
|
|
6181
|
+
for (const item of items) {
|
|
6182
|
+
if (item.types.includes("text/html")) {
|
|
6183
|
+
html2 = await (await item.getType("text/html")).text();
|
|
6184
|
+
}
|
|
6185
|
+
if (item.types.includes("text/plain")) {
|
|
6186
|
+
text2 = await (await item.getType("text/plain")).text();
|
|
6187
|
+
}
|
|
6188
|
+
}
|
|
6189
|
+
} catch {
|
|
6190
|
+
}
|
|
6191
|
+
}
|
|
6192
|
+
if (!text2 && navigator.clipboard.readText) {
|
|
6193
|
+
try {
|
|
6194
|
+
text2 = await navigator.clipboard.readText();
|
|
6195
|
+
} catch {
|
|
6196
|
+
}
|
|
6197
|
+
}
|
|
6198
|
+
return { html: html2, text: text2 || "" };
|
|
6199
|
+
}
|
|
6146
6200
|
const PIXELS_PER_INCH$2 = 96;
|
|
6147
6201
|
function inchesToTwips(inches) {
|
|
6148
6202
|
if (inches == null) return;
|
|
@@ -34309,7 +34363,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
34309
34363
|
const COMMUNITY_LICENSE_KEY = "community-and-eval-agplv3";
|
|
34310
34364
|
function getSuperdocVersion() {
|
|
34311
34365
|
try {
|
|
34312
|
-
return true ? "1.12.0-next.
|
|
34366
|
+
return true ? "1.12.0-next.4" : "unknown";
|
|
34313
34367
|
} catch {
|
|
34314
34368
|
return "unknown";
|
|
34315
34369
|
}
|
|
@@ -37580,7 +37634,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
37580
37634
|
static getStoredSuperdocVersion(docx) {
|
|
37581
37635
|
return SuperConverter.getStoredCustomProperty(docx, "SuperdocVersion");
|
|
37582
37636
|
}
|
|
37583
|
-
static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.12.0-next.
|
|
37637
|
+
static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.12.0-next.4") {
|
|
37584
37638
|
return SuperConverter.setStoredCustomProperty(docx, "SuperdocVersion", version2, false);
|
|
37585
37639
|
}
|
|
37586
37640
|
/**
|
|
@@ -65026,7 +65080,7 @@ ${err.toString()}`);
|
|
|
65026
65080
|
return false;
|
|
65027
65081
|
}
|
|
65028
65082
|
};
|
|
65029
|
-
const summaryVersion = "1.12.0-next.
|
|
65083
|
+
const summaryVersion = "1.12.0-next.4";
|
|
65030
65084
|
const nodeKeys = ["group", "content", "marks", "inline", "atom", "defining", "code", "tableRole", "summary"];
|
|
65031
65085
|
const markKeys = ["group", "inclusive", "excludes", "spanning", "code"];
|
|
65032
65086
|
function mapAttributes(attrs) {
|
|
@@ -67832,7 +67886,7 @@ ${err.toString()}`);
|
|
|
67832
67886
|
* Process collaboration migrations
|
|
67833
67887
|
*/
|
|
67834
67888
|
processCollaborationMigrations() {
|
|
67835
|
-
console.debug("[checkVersionMigrations] Current editor version", "1.12.0-next.
|
|
67889
|
+
console.debug("[checkVersionMigrations] Current editor version", "1.12.0-next.4");
|
|
67836
67890
|
if (!this.options.ydoc) return;
|
|
67837
67891
|
const metaMap = this.options.ydoc.getMap("meta");
|
|
67838
67892
|
let docVersion = metaMap.get("version");
|
|
@@ -72792,7 +72846,6 @@ ${o}
|
|
|
72792
72846
|
overflow: "visible",
|
|
72793
72847
|
boxSizing: "border-box"
|
|
72794
72848
|
};
|
|
72795
|
-
const TEXT_LINE_Z_INDEX = "100000";
|
|
72796
72849
|
const lineStyles = (lineHeight2) => ({
|
|
72797
72850
|
lineHeight: `${lineHeight2}px`,
|
|
72798
72851
|
height: `${lineHeight2}px`,
|
|
@@ -72803,8 +72856,7 @@ ${o}
|
|
|
72803
72856
|
// The primary fix uses accurate font metrics from Canvas API, but this
|
|
72804
72857
|
// provides defense-in-depth against any remaining sub-pixel rendering
|
|
72805
72858
|
// differences between measurement and display.
|
|
72806
|
-
overflow: "visible"
|
|
72807
|
-
zIndex: TEXT_LINE_Z_INDEX
|
|
72859
|
+
overflow: "visible"
|
|
72808
72860
|
});
|
|
72809
72861
|
const PRINT_STYLES = `
|
|
72810
72862
|
@media print {
|
|
@@ -78257,6 +78309,7 @@ ${o}
|
|
|
78257
78309
|
if (run2.distRight) {
|
|
78258
78310
|
img2.style.marginRight = `${run2.distRight}px`;
|
|
78259
78311
|
}
|
|
78312
|
+
img2.style.position = "relative";
|
|
78260
78313
|
img2.style.zIndex = "1";
|
|
78261
78314
|
assertPmPositions(run2, "inline image run");
|
|
78262
78315
|
if (run2.pmStart != null) {
|
|
@@ -78519,6 +78572,8 @@ ${o}
|
|
|
78519
78572
|
if (!this.doc) {
|
|
78520
78573
|
throw new Error("DomPainter: document is not available");
|
|
78521
78574
|
}
|
|
78575
|
+
const lineRange = computeLinePmRange$1(block, line);
|
|
78576
|
+
let runsForLine = sliceRunsForLine$1(block, line);
|
|
78522
78577
|
const el = this.doc.createElement("div");
|
|
78523
78578
|
el.classList.add(CLASS_NAMES$1.line);
|
|
78524
78579
|
applyStyles$2(el, lineStyles(line.lineHeight));
|
|
@@ -78533,14 +78588,12 @@ ${o}
|
|
|
78533
78588
|
} else {
|
|
78534
78589
|
el.style.textAlign = "left";
|
|
78535
78590
|
}
|
|
78536
|
-
const lineRange = computeLinePmRange$1(block, line);
|
|
78537
78591
|
if (lineRange.pmStart != null) {
|
|
78538
78592
|
el.dataset.pmStart = String(lineRange.pmStart);
|
|
78539
78593
|
}
|
|
78540
78594
|
if (lineRange.pmEnd != null) {
|
|
78541
78595
|
el.dataset.pmEnd = String(lineRange.pmEnd);
|
|
78542
78596
|
}
|
|
78543
|
-
let runsForLine = sliceRunsForLine$1(block, line);
|
|
78544
78597
|
const trackedConfig = this.resolveTrackedChangesConfig(block);
|
|
78545
78598
|
if (runsForLine.length === 0) {
|
|
78546
78599
|
const span = this.doc.createElement("span");
|
|
@@ -150022,6 +150075,24 @@ ${style2}
|
|
|
150022
150075
|
return null;
|
|
150023
150076
|
}
|
|
150024
150077
|
}
|
|
150078
|
+
const createPasteEventShim = (clipboard) => {
|
|
150079
|
+
const html2 = clipboard?.html || "";
|
|
150080
|
+
const text2 = clipboard?.text || "";
|
|
150081
|
+
return {
|
|
150082
|
+
type: "paste",
|
|
150083
|
+
preventDefault: () => {
|
|
150084
|
+
},
|
|
150085
|
+
stopPropagation: () => {
|
|
150086
|
+
},
|
|
150087
|
+
clipboardData: {
|
|
150088
|
+
getData: (type) => {
|
|
150089
|
+
if (type === "text/html") return html2;
|
|
150090
|
+
if (type === "text/plain") return text2;
|
|
150091
|
+
return "";
|
|
150092
|
+
}
|
|
150093
|
+
}
|
|
150094
|
+
};
|
|
150095
|
+
};
|
|
150025
150096
|
const isModuleEnabled = (editorOptions, moduleName) => {
|
|
150026
150097
|
switch (moduleName) {
|
|
150027
150098
|
case "ai":
|
|
@@ -150238,13 +150309,24 @@ ${style2}
|
|
|
150238
150309
|
label: TEXTS.paste,
|
|
150239
150310
|
icon: ICONS.paste,
|
|
150240
150311
|
isDefault: true,
|
|
150241
|
-
action: (editor2) => {
|
|
150242
|
-
const
|
|
150243
|
-
if (
|
|
150244
|
-
|
|
150245
|
-
|
|
150246
|
-
|
|
150247
|
-
|
|
150312
|
+
action: async (editor2) => {
|
|
150313
|
+
const { view } = editor2 ?? {};
|
|
150314
|
+
if (!view) return;
|
|
150315
|
+
view.dom.focus();
|
|
150316
|
+
const { html: html2, text: text2 } = await readClipboardRaw();
|
|
150317
|
+
const handled = html2 ? handleClipboardPaste({ editor: editor2, view }, html2) : false;
|
|
150318
|
+
if (!handled) {
|
|
150319
|
+
const pasteEvent = createPasteEventShim({ html: html2, text: text2 });
|
|
150320
|
+
if (html2 && typeof view.pasteHTML === "function") {
|
|
150321
|
+
view.pasteHTML(html2, pasteEvent);
|
|
150322
|
+
return;
|
|
150323
|
+
}
|
|
150324
|
+
if (text2 && typeof view.pasteText === "function") {
|
|
150325
|
+
view.pasteText(text2, pasteEvent);
|
|
150326
|
+
return;
|
|
150327
|
+
}
|
|
150328
|
+
if (text2 && editor2.commands?.insertContent) {
|
|
150329
|
+
editor2.commands.insertContent(text2, { contentType: "text" });
|
|
150248
150330
|
}
|
|
150249
150331
|
}
|
|
150250
150332
|
},
|
|
@@ -158470,7 +158552,7 @@ ${reason}`);
|
|
|
158470
158552
|
this.config.colors = shuffleArray(this.config.colors);
|
|
158471
158553
|
this.userColorMap = /* @__PURE__ */ new Map();
|
|
158472
158554
|
this.colorIndex = 0;
|
|
158473
|
-
this.version = "1.12.0-next.
|
|
158555
|
+
this.version = "1.12.0-next.4";
|
|
158474
158556
|
this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
|
|
158475
158557
|
this.superdocId = config2.superdocId || v4();
|
|
158476
158558
|
this.colors = this.config.colors;
|