@harbour-enterprises/superdoc 0.22.0-next.3 → 0.22.0-next.5
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-CvFw8S_D.cjs → PdfViewer-Badqoc1e.cjs} +1 -1
- package/dist/chunks/{PdfViewer-D95oFKMa.es.js → PdfViewer-dsL5uHg1.es.js} +1 -1
- package/dist/chunks/{index-DgH1cx2c.es.js → index-DBNzXf1D.es.js} +2 -2
- package/dist/chunks/{index-Ct4VrAay.cjs → index-DVrbZM76.cjs} +2 -2
- package/dist/chunks/{super-editor.es-WUoM0FI7.es.js → super-editor.es-DruRanWK.es.js} +170 -67
- package/dist/chunks/{super-editor.es-CIDcWgLs.cjs → super-editor.es-p3eqHXlj.cjs} +170 -67
- package/dist/core/types/index.d.ts.map +1 -1
- package/dist/super-editor/ai-writer.es.js +2 -2
- package/dist/super-editor/chunks/{converter-DBwwYo1I.js → converter-DujfV3Zn.js} +46 -34
- package/dist/super-editor/chunks/{docx-zipper-BCI-3XE9.js → docx-zipper-DccEqL60.js} +73 -12
- package/dist/super-editor/chunks/{editor-W3rw5KHF.js → editor-Dq3xPdti.js} +54 -24
- package/dist/super-editor/chunks/{toolbar-CFfRuTi3.js → toolbar-u5oyT_9K.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/src/core/DocxZipper.d.ts +1 -1
- package/dist/super-editor/src/core/super-converter/exporter.d.ts +1 -0
- package/dist/super-editor/src/extensions/custom-selection/custom-selection.d.ts +5 -0
- package/dist/super-editor/super-editor.es.js +6 -6
- 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 +170 -67
- package/dist/superdoc.umd.js.map +1 -1
- package/package.json +1 -1
package/dist/superdoc.umd.js
CHANGED
|
@@ -38345,6 +38345,51 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
38345
38345
|
gutter: "0"
|
|
38346
38346
|
})
|
|
38347
38347
|
});
|
|
38348
|
+
const ensureSectionLayoutDefaults = (sectPr, converter) => {
|
|
38349
|
+
if (!sectPr) {
|
|
38350
|
+
return {
|
|
38351
|
+
type: "element",
|
|
38352
|
+
name: "w:sectPr",
|
|
38353
|
+
elements: []
|
|
38354
|
+
};
|
|
38355
|
+
}
|
|
38356
|
+
if (!sectPr.elements) sectPr.elements = [];
|
|
38357
|
+
const ensureChild = (name) => {
|
|
38358
|
+
let child = sectPr.elements.find((n) => n.name === name);
|
|
38359
|
+
if (!child) {
|
|
38360
|
+
child = {
|
|
38361
|
+
type: "element",
|
|
38362
|
+
name,
|
|
38363
|
+
elements: [],
|
|
38364
|
+
attributes: {}
|
|
38365
|
+
};
|
|
38366
|
+
sectPr.elements.push(child);
|
|
38367
|
+
} else {
|
|
38368
|
+
if (!child.elements) child.elements = [];
|
|
38369
|
+
if (!child.attributes) child.attributes = {};
|
|
38370
|
+
}
|
|
38371
|
+
return child;
|
|
38372
|
+
};
|
|
38373
|
+
const pageSize = converter?.pageStyles?.pageSize;
|
|
38374
|
+
const pgSz = ensureChild("w:pgSz");
|
|
38375
|
+
if (pageSize?.width != null) pgSz.attributes["w:w"] = String(inchesToTwips(pageSize.width));
|
|
38376
|
+
if (pageSize?.height != null) pgSz.attributes["w:h"] = String(inchesToTwips(pageSize.height));
|
|
38377
|
+
if (pgSz.attributes["w:w"] == null) pgSz.attributes["w:w"] = DEFAULT_SECTION_PROPS_TWIPS.pageSize.width;
|
|
38378
|
+
if (pgSz.attributes["w:h"] == null) pgSz.attributes["w:h"] = DEFAULT_SECTION_PROPS_TWIPS.pageSize.height;
|
|
38379
|
+
const pageMargins = converter?.pageStyles?.pageMargins;
|
|
38380
|
+
const pgMar = ensureChild("w:pgMar");
|
|
38381
|
+
if (pageMargins) {
|
|
38382
|
+
Object.entries(pageMargins).forEach(([key2, value]) => {
|
|
38383
|
+
const converted = inchesToTwips(value);
|
|
38384
|
+
if (converted != null) pgMar.attributes[`w:${key2}`] = String(converted);
|
|
38385
|
+
});
|
|
38386
|
+
}
|
|
38387
|
+
Object.entries(DEFAULT_SECTION_PROPS_TWIPS.pageMargins).forEach(([key2, value]) => {
|
|
38388
|
+
const attrKey = `w:${key2}`;
|
|
38389
|
+
if (pgMar.attributes[attrKey] == null) pgMar.attributes[attrKey] = value;
|
|
38390
|
+
});
|
|
38391
|
+
return sectPr;
|
|
38392
|
+
};
|
|
38348
38393
|
const isLineBreakOnlyRun = (node) => {
|
|
38349
38394
|
if (!node) return false;
|
|
38350
38395
|
if (node.type === "lineBreak" || node.type === "hardBreak") return true;
|
|
@@ -38407,6 +38452,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
38407
38452
|
} else if (!sectPr.elements) {
|
|
38408
38453
|
sectPr = { ...sectPr, elements: [] };
|
|
38409
38454
|
}
|
|
38455
|
+
sectPr = ensureSectionLayoutDefaults(sectPr, params2.converter);
|
|
38410
38456
|
if (params2.converter) {
|
|
38411
38457
|
const hasHeader = sectPr.elements?.some((n) => n.name === "w:headerReference");
|
|
38412
38458
|
const hasDefaultHeader = params2.converter.headerIds?.default;
|
|
@@ -38420,40 +38466,6 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
38420
38466
|
const defaultFooter = generateDefaultHeaderFooter("footer", params2.converter.footerIds?.default);
|
|
38421
38467
|
sectPr.elements.push(defaultFooter);
|
|
38422
38468
|
}
|
|
38423
|
-
const newMargins = params2.converter.pageStyles?.pageMargins;
|
|
38424
|
-
if (newMargins) {
|
|
38425
|
-
let sectPrMargins = sectPr.elements.find((n) => n.name === "w:pgMar");
|
|
38426
|
-
if (!sectPrMargins) {
|
|
38427
|
-
sectPrMargins = {
|
|
38428
|
-
type: "element",
|
|
38429
|
-
name: "w:pgMar",
|
|
38430
|
-
attributes: {}
|
|
38431
|
-
};
|
|
38432
|
-
sectPr.elements.push(sectPrMargins);
|
|
38433
|
-
} else if (!sectPrMargins.attributes) {
|
|
38434
|
-
sectPrMargins.attributes = {};
|
|
38435
|
-
}
|
|
38436
|
-
Object.entries(newMargins).forEach(([key2, value]) => {
|
|
38437
|
-
const convertedValue = inchesToTwips(value);
|
|
38438
|
-
sectPrMargins.attributes[`w:${key2}`] = convertedValue;
|
|
38439
|
-
});
|
|
38440
|
-
}
|
|
38441
|
-
let sectPrPgSz = sectPr.elements.find((n) => n.name === "w:pgSz");
|
|
38442
|
-
if (!sectPrPgSz) {
|
|
38443
|
-
sectPrPgSz = {
|
|
38444
|
-
type: "element",
|
|
38445
|
-
name: "w:pgSz",
|
|
38446
|
-
attributes: {}
|
|
38447
|
-
};
|
|
38448
|
-
sectPr.elements.push(sectPrPgSz);
|
|
38449
|
-
} else if (!sectPrPgSz.attributes) {
|
|
38450
|
-
sectPrPgSz.attributes = {};
|
|
38451
|
-
}
|
|
38452
|
-
const pageSize = params2.converter.pageStyles?.pageSize;
|
|
38453
|
-
const widthInches = pageSize?.width;
|
|
38454
|
-
const heightInches = pageSize?.height;
|
|
38455
|
-
sectPrPgSz.attributes["w:w"] = widthInches ? String(inchesToTwips(widthInches)) : sectPrPgSz.attributes["w:w"] ?? DEFAULT_SECTION_PROPS_TWIPS.pageSize.width;
|
|
38456
|
-
sectPrPgSz.attributes["w:h"] = heightInches ? String(inchesToTwips(heightInches)) : sectPrPgSz.attributes["w:h"] ?? DEFAULT_SECTION_PROPS_TWIPS.pageSize.height;
|
|
38457
38469
|
}
|
|
38458
38470
|
const elements = translateChildNodes(params2);
|
|
38459
38471
|
if (params2.isHeaderFooter) {
|
|
@@ -43982,14 +43994,19 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
43982
43994
|
/**
|
|
43983
43995
|
* Update [Content_Types].xml with extensions of new Image annotations
|
|
43984
43996
|
*/
|
|
43985
|
-
async updateContentTypes(docx, media, fromJson) {
|
|
43997
|
+
async updateContentTypes(docx, media, fromJson, updatedDocs = {}) {
|
|
43998
|
+
const additionalPartNames = Object.keys(updatedDocs || {});
|
|
43986
43999
|
const newMediaTypes = Object.keys(media).map((name) => {
|
|
43987
44000
|
return this.getFileExtension(name);
|
|
43988
44001
|
}).filter(Boolean);
|
|
43989
44002
|
const contentTypesPath = "[Content_Types].xml";
|
|
43990
44003
|
let contentTypesXml;
|
|
43991
44004
|
if (fromJson) {
|
|
43992
|
-
|
|
44005
|
+
if (Array.isArray(docx.files)) {
|
|
44006
|
+
contentTypesXml = docx.files.find((file) => file.name === contentTypesPath)?.content || "";
|
|
44007
|
+
} else {
|
|
44008
|
+
contentTypesXml = docx.files?.[contentTypesPath] || "";
|
|
44009
|
+
}
|
|
43993
44010
|
} else contentTypesXml = await docx.file(contentTypesPath).async("string");
|
|
43994
44011
|
let typesString = "";
|
|
43995
44012
|
const defaultMediaTypes = getContentTypesFromXml(contentTypesXml);
|
|
@@ -44015,24 +44032,39 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
44015
44032
|
const hasCommentsExtensible = types2.elements?.some(
|
|
44016
44033
|
(el) => el.name === "Override" && el.attributes.PartName === "/word/commentsExtensible.xml"
|
|
44017
44034
|
);
|
|
44018
|
-
|
|
44035
|
+
const hasFile = (filename) => {
|
|
44036
|
+
if (!docx?.files) return false;
|
|
44037
|
+
if (!fromJson) return Boolean(docx.files[filename]);
|
|
44038
|
+
if (Array.isArray(docx.files)) return docx.files.some((file) => file.name === filename);
|
|
44039
|
+
return Boolean(docx.files[filename]);
|
|
44040
|
+
};
|
|
44041
|
+
if (hasFile("word/comments.xml")) {
|
|
44019
44042
|
const commentsDef = `<Override PartName="/word/comments.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.comments+xml" />`;
|
|
44020
44043
|
if (!hasComments) typesString += commentsDef;
|
|
44021
44044
|
}
|
|
44022
|
-
if (
|
|
44045
|
+
if (hasFile("word/commentsExtended.xml")) {
|
|
44023
44046
|
const commentsExtendedDef = `<Override PartName="/word/commentsExtended.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.commentsExtended+xml" />`;
|
|
44024
44047
|
if (!hasCommentsExtended) typesString += commentsExtendedDef;
|
|
44025
44048
|
}
|
|
44026
|
-
if (
|
|
44049
|
+
if (hasFile("word/commentsIds.xml")) {
|
|
44027
44050
|
const commentsIdsDef = `<Override PartName="/word/commentsIds.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.commentsIds+xml" />`;
|
|
44028
44051
|
if (!hasCommentsIds) typesString += commentsIdsDef;
|
|
44029
44052
|
}
|
|
44030
|
-
if (
|
|
44053
|
+
if (hasFile("word/commentsExtensible.xml")) {
|
|
44031
44054
|
const commentsExtendedDef = `<Override PartName="/word/commentsExtensible.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.commentsExtensible+xml" />`;
|
|
44032
44055
|
if (!hasCommentsExtensible) typesString += commentsExtendedDef;
|
|
44033
44056
|
}
|
|
44034
|
-
|
|
44035
|
-
|
|
44057
|
+
const partNames = new Set(additionalPartNames);
|
|
44058
|
+
if (docx?.files) {
|
|
44059
|
+
if (fromJson && Array.isArray(docx.files)) {
|
|
44060
|
+
docx.files.forEach((file) => partNames.add(file.name));
|
|
44061
|
+
} else {
|
|
44062
|
+
Object.keys(docx.files).forEach((key2) => partNames.add(key2));
|
|
44063
|
+
}
|
|
44064
|
+
}
|
|
44065
|
+
partNames.forEach((name) => {
|
|
44066
|
+
if (name.includes(".rels")) return;
|
|
44067
|
+
if (!name.includes("header") && !name.includes("footer")) return;
|
|
44036
44068
|
const hasExtensible = types2.elements?.some(
|
|
44037
44069
|
(el) => el.name === "Override" && el.attributes.PartName === `/${name}`
|
|
44038
44070
|
);
|
|
@@ -44043,7 +44075,48 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
44043
44075
|
}
|
|
44044
44076
|
});
|
|
44045
44077
|
const beginningString = '<Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types">';
|
|
44046
|
-
|
|
44078
|
+
let updatedContentTypesXml = contentTypesXml.replace(beginningString, `${beginningString}${typesString}`);
|
|
44079
|
+
let relationshipsXml = updatedDocs["word/_rels/document.xml.rels"];
|
|
44080
|
+
if (!relationshipsXml) {
|
|
44081
|
+
if (fromJson) {
|
|
44082
|
+
if (Array.isArray(docx.files)) {
|
|
44083
|
+
relationshipsXml = docx.files.find((file) => file.name === "word/_rels/document.xml.rels")?.content;
|
|
44084
|
+
} else {
|
|
44085
|
+
relationshipsXml = docx.files?.["word/_rels/document.xml.rels"];
|
|
44086
|
+
}
|
|
44087
|
+
} else {
|
|
44088
|
+
relationshipsXml = await docx.file("word/_rels/document.xml.rels")?.async("string");
|
|
44089
|
+
}
|
|
44090
|
+
}
|
|
44091
|
+
if (relationshipsXml) {
|
|
44092
|
+
try {
|
|
44093
|
+
const relJson = xmljs.xml2js(relationshipsXml, { compact: false });
|
|
44094
|
+
const relationships = relJson.elements?.find((el) => el.name === "Relationships");
|
|
44095
|
+
relationships?.elements?.forEach((rel) => {
|
|
44096
|
+
const type2 = rel.attributes?.Type;
|
|
44097
|
+
const target = rel.attributes?.Target;
|
|
44098
|
+
if (!type2 || !target) return;
|
|
44099
|
+
const isHeader = type2.includes("/header");
|
|
44100
|
+
const isFooter = type2.includes("/footer");
|
|
44101
|
+
if (!isHeader && !isFooter) return;
|
|
44102
|
+
let sanitizedTarget = target.replace(/^\.\//, "");
|
|
44103
|
+
if (sanitizedTarget.startsWith("../")) sanitizedTarget = sanitizedTarget.slice(3);
|
|
44104
|
+
if (sanitizedTarget.startsWith("/")) sanitizedTarget = sanitizedTarget.slice(1);
|
|
44105
|
+
const partName = sanitizedTarget.startsWith("word/") ? sanitizedTarget : `word/${sanitizedTarget}`;
|
|
44106
|
+
partNames.add(partName);
|
|
44107
|
+
});
|
|
44108
|
+
} catch (error) {
|
|
44109
|
+
console.warn("Failed to parse document relationships while updating content types", error);
|
|
44110
|
+
}
|
|
44111
|
+
}
|
|
44112
|
+
partNames.forEach((name) => {
|
|
44113
|
+
if (name.includes(".rels")) return;
|
|
44114
|
+
if (!name.includes("header") && !name.includes("footer")) return;
|
|
44115
|
+
if (updatedContentTypesXml.includes(`PartName="/${name}"`)) return;
|
|
44116
|
+
const type2 = name.includes("header") ? "header" : "footer";
|
|
44117
|
+
const extendedDef = `<Override PartName="/${name}" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.${type2}+xml"/>`;
|
|
44118
|
+
updatedContentTypesXml = updatedContentTypesXml.replace("</Types>", `${extendedDef}</Types>`);
|
|
44119
|
+
});
|
|
44047
44120
|
if (fromJson) return updatedContentTypesXml;
|
|
44048
44121
|
docx.file(contentTypesPath, updatedContentTypesXml);
|
|
44049
44122
|
}
|
|
@@ -44084,7 +44157,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
44084
44157
|
for (const [fontName, fontUintArray] of Object.entries(fonts)) {
|
|
44085
44158
|
zip.file(fontName, fontUintArray);
|
|
44086
44159
|
}
|
|
44087
|
-
await this.updateContentTypes(zip, media);
|
|
44160
|
+
await this.updateContentTypes(zip, media, false, updatedDocs);
|
|
44088
44161
|
return zip;
|
|
44089
44162
|
}
|
|
44090
44163
|
/**
|
|
@@ -44110,7 +44183,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
44110
44183
|
Object.keys(media).forEach((path) => {
|
|
44111
44184
|
unzippedOriginalDocx.file(path, media[path]);
|
|
44112
44185
|
});
|
|
44113
|
-
await this.updateContentTypes(unzippedOriginalDocx, media);
|
|
44186
|
+
await this.updateContentTypes(unzippedOriginalDocx, media, false, updatedDocs);
|
|
44114
44187
|
return unzippedOriginalDocx;
|
|
44115
44188
|
}
|
|
44116
44189
|
}
|
|
@@ -55768,9 +55841,11 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
55768
55841
|
item.editor.view.dom.setAttribute("documentmode", documentMode);
|
|
55769
55842
|
});
|
|
55770
55843
|
if (isEditMode) {
|
|
55771
|
-
const pm =
|
|
55772
|
-
pm
|
|
55773
|
-
|
|
55844
|
+
const pm = editor.view?.dom || editor.options.element?.querySelector?.(".ProseMirror");
|
|
55845
|
+
if (pm) {
|
|
55846
|
+
pm.classList.add("header-footer-edit");
|
|
55847
|
+
pm.setAttribute("aria-readonly", true);
|
|
55848
|
+
}
|
|
55774
55849
|
}
|
|
55775
55850
|
if (focusedSectionEditor) {
|
|
55776
55851
|
focusedSectionEditor.view.focus();
|
|
@@ -58382,7 +58457,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
58382
58457
|
setDocumentMode(documentMode) {
|
|
58383
58458
|
let cleanedMode = documentMode?.toLowerCase() || "editing";
|
|
58384
58459
|
if (!this.extensionService || !this.state) return;
|
|
58385
|
-
const pm =
|
|
58460
|
+
const pm = this.view?.dom || this.options.element?.querySelector?.(".ProseMirror");
|
|
58386
58461
|
if (this.options.role === "viewer") cleanedMode = "viewing";
|
|
58387
58462
|
if (this.options.role === "suggester" && cleanedMode === "editing") cleanedMode = "suggesting";
|
|
58388
58463
|
if (cleanedMode === "viewing") {
|
|
@@ -58870,7 +58945,8 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
58870
58945
|
files: this.options.content
|
|
58871
58946
|
},
|
|
58872
58947
|
media,
|
|
58873
|
-
true
|
|
58948
|
+
true,
|
|
58949
|
+
updatedDocs
|
|
58874
58950
|
);
|
|
58875
58951
|
return updatedDocs;
|
|
58876
58952
|
}
|
|
@@ -59356,9 +59432,11 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
59356
59432
|
isEditMode: false,
|
|
59357
59433
|
documentMode: this.options.documentMode
|
|
59358
59434
|
});
|
|
59359
|
-
const pm =
|
|
59360
|
-
pm
|
|
59361
|
-
|
|
59435
|
+
const pm = this.view?.dom || this.options.element?.querySelector?.(".ProseMirror");
|
|
59436
|
+
if (pm) {
|
|
59437
|
+
pm.classList.remove("header-footer-edit");
|
|
59438
|
+
pm.setAttribute("aria-readonly", false);
|
|
59439
|
+
}
|
|
59362
59440
|
}
|
|
59363
59441
|
setWordSelection(view, pos);
|
|
59364
59442
|
}
|
|
@@ -61427,6 +61505,16 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
61427
61505
|
return prefersNativeMenu(event);
|
|
61428
61506
|
};
|
|
61429
61507
|
const shouldBypassContextMenu = shouldAllowNativeContextMenu;
|
|
61508
|
+
const DEFAULT_SELECTION_STATE = Object.freeze({
|
|
61509
|
+
focused: false,
|
|
61510
|
+
preservedSelection: null,
|
|
61511
|
+
showVisualSelection: false,
|
|
61512
|
+
skipFocusReset: false
|
|
61513
|
+
});
|
|
61514
|
+
const normalizeSelectionState = (state2 = {}) => ({
|
|
61515
|
+
...DEFAULT_SELECTION_STATE,
|
|
61516
|
+
...state2
|
|
61517
|
+
});
|
|
61430
61518
|
const CustomSelectionPluginKey = new PluginKey("CustomSelection");
|
|
61431
61519
|
const handleClickOutside = (event, editor) => {
|
|
61432
61520
|
const editorElem = editor?.options?.element;
|
|
@@ -61464,11 +61552,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
61464
61552
|
const customSelectionPlugin = new Plugin({
|
|
61465
61553
|
key: CustomSelectionPluginKey,
|
|
61466
61554
|
state: {
|
|
61467
|
-
init: () => ({
|
|
61468
|
-
focused: false,
|
|
61469
|
-
preservedSelection: null,
|
|
61470
|
-
showVisualSelection: false
|
|
61471
|
-
}),
|
|
61555
|
+
init: () => ({ ...DEFAULT_SELECTION_STATE }),
|
|
61472
61556
|
apply: (tr, value) => {
|
|
61473
61557
|
const meta = getFocusMeta(tr);
|
|
61474
61558
|
if (meta !== void 0) {
|
|
@@ -61499,7 +61583,8 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
61499
61583
|
setFocusMeta(view.state.tr, {
|
|
61500
61584
|
focused: true,
|
|
61501
61585
|
preservedSelection: selection,
|
|
61502
|
-
showVisualSelection: true
|
|
61586
|
+
showVisualSelection: true,
|
|
61587
|
+
skipFocusReset: true
|
|
61503
61588
|
})
|
|
61504
61589
|
);
|
|
61505
61590
|
}
|
|
@@ -61520,7 +61605,8 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
61520
61605
|
setFocusMeta(view.state.tr, {
|
|
61521
61606
|
focused: true,
|
|
61522
61607
|
preservedSelection: selection2,
|
|
61523
|
-
showVisualSelection: true
|
|
61608
|
+
showVisualSelection: true,
|
|
61609
|
+
skipFocusReset: true
|
|
61524
61610
|
})
|
|
61525
61611
|
);
|
|
61526
61612
|
this.editor.setOptions({
|
|
@@ -61543,7 +61629,8 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
61543
61629
|
setFocusMeta(view.state.tr, {
|
|
61544
61630
|
focused: true,
|
|
61545
61631
|
preservedSelection: selection,
|
|
61546
|
-
showVisualSelection: true
|
|
61632
|
+
showVisualSelection: true,
|
|
61633
|
+
skipFocusReset: false
|
|
61547
61634
|
})
|
|
61548
61635
|
);
|
|
61549
61636
|
this.editor.setOptions({
|
|
@@ -61561,7 +61648,8 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
61561
61648
|
setFocusMeta(view.state.tr, {
|
|
61562
61649
|
focused: true,
|
|
61563
61650
|
preservedSelection: selection,
|
|
61564
|
-
showVisualSelection: true
|
|
61651
|
+
showVisualSelection: true,
|
|
61652
|
+
skipFocusReset: false
|
|
61565
61653
|
})
|
|
61566
61654
|
);
|
|
61567
61655
|
}
|
|
@@ -61572,7 +61660,8 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
61572
61660
|
setFocusMeta(view.state.tr, {
|
|
61573
61661
|
focused: false,
|
|
61574
61662
|
preservedSelection: null,
|
|
61575
|
-
showVisualSelection: false
|
|
61663
|
+
showVisualSelection: false,
|
|
61664
|
+
skipFocusReset: false
|
|
61576
61665
|
})
|
|
61577
61666
|
);
|
|
61578
61667
|
if (!selection.empty && !this.editor.options.element?.contains(target)) {
|
|
@@ -61589,12 +61678,20 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
61589
61678
|
const isElement2 = target instanceof Element;
|
|
61590
61679
|
const isToolbarBtn = isElement2 && isToolbarButton(target);
|
|
61591
61680
|
const isToolbarInp = isElement2 && isToolbarInput(target);
|
|
61681
|
+
const focusState = getFocusState(view.state);
|
|
61682
|
+
if (focusState?.skipFocusReset) {
|
|
61683
|
+
view.dispatch(
|
|
61684
|
+
setFocusMeta(view.state.tr, normalizeSelectionState({ ...focusState, skipFocusReset: false }))
|
|
61685
|
+
);
|
|
61686
|
+
return false;
|
|
61687
|
+
}
|
|
61592
61688
|
if (!isToolbarBtn && !isToolbarInp) {
|
|
61593
61689
|
view.dispatch(
|
|
61594
61690
|
setFocusMeta(view.state.tr, {
|
|
61595
61691
|
focused: false,
|
|
61596
61692
|
preservedSelection: null,
|
|
61597
|
-
showVisualSelection: false
|
|
61693
|
+
showVisualSelection: false,
|
|
61694
|
+
skipFocusReset: false
|
|
61598
61695
|
})
|
|
61599
61696
|
);
|
|
61600
61697
|
}
|
|
@@ -61605,12 +61702,16 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
61605
61702
|
const isToolbarBtn = isElement2 && isToolbarButton(target);
|
|
61606
61703
|
const isToolbarInp = isElement2 && isToolbarInput(target);
|
|
61607
61704
|
const state2 = getFocusState(view.state);
|
|
61705
|
+
if (state2?.skipFocusReset) {
|
|
61706
|
+
return false;
|
|
61707
|
+
}
|
|
61608
61708
|
if (isToolbarBtn || isToolbarInp) {
|
|
61609
61709
|
view.dispatch(
|
|
61610
61710
|
setFocusMeta(view.state.tr, {
|
|
61611
61711
|
focused: true,
|
|
61612
61712
|
preservedSelection: state2.preservedSelection || view.state.selection,
|
|
61613
|
-
showVisualSelection: true
|
|
61713
|
+
showVisualSelection: true,
|
|
61714
|
+
skipFocusReset: false
|
|
61614
61715
|
})
|
|
61615
61716
|
);
|
|
61616
61717
|
} else {
|
|
@@ -61618,7 +61719,8 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
61618
61719
|
setFocusMeta(view.state.tr, {
|
|
61619
61720
|
focused: false,
|
|
61620
61721
|
preservedSelection: null,
|
|
61621
|
-
showVisualSelection: false
|
|
61722
|
+
showVisualSelection: false,
|
|
61723
|
+
skipFocusReset: false
|
|
61622
61724
|
})
|
|
61623
61725
|
);
|
|
61624
61726
|
}
|
|
@@ -77393,7 +77495,8 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
77393
77495
|
const prevSelection = prevState.selection;
|
|
77394
77496
|
if (selection.from !== prevSelection.from || selection.to !== prevSelection.to) {
|
|
77395
77497
|
setTimeout(() => {
|
|
77396
|
-
const
|
|
77498
|
+
const searchRoot = editorView?.dom;
|
|
77499
|
+
const selectedResizableWrapper = searchRoot?.querySelector(".sd-editor-resizable-wrapper");
|
|
77397
77500
|
if (selectedResizableWrapper) {
|
|
77398
77501
|
showResizeHandles(view2, selectedResizableWrapper);
|
|
77399
77502
|
} else {
|