|
@@ -1094,7 +1094,7 @@
|
|
|
|
|
|
|
|
let NOTES_WEB_STYLESHEET, MASK_WEB_STYLESHEET, HIGHLIGHTS_WEB_STYLESHEET;
|
|
let NOTES_WEB_STYLESHEET, MASK_WEB_STYLESHEET, HIGHLIGHTS_WEB_STYLESHEET;
|
|
|
let selectedNote, anchorElement, maskNoteElement, maskPageElement, highlightSelectionMode, removeHighlightMode, resizingNoteMode, movingNoteMode, highlightColor, collapseNoteTimeout, cuttingOuterMode, cuttingMode, cuttingTouchTarget, cuttingPath, cuttingPathIndex, previousContent;
|
|
let selectedNote, anchorElement, maskNoteElement, maskPageElement, highlightSelectionMode, removeHighlightMode, resizingNoteMode, movingNoteMode, highlightColor, collapseNoteTimeout, cuttingOuterMode, cuttingMode, cuttingTouchTarget, cuttingPath, cuttingPathIndex, previousContent;
|
|
|
- let removedElements = [], removedElementIndex = 0, initScriptContent, pageResources, pageUrl, pageCompressContent, includeInfobar, openInfobar, infobarPositionAbsolute, infobarPositionTop, infobarPositionBottom, infobarPositionLeft, infobarPositionRight;
|
|
|
|
|
|
|
+ let removedElements = [], removedElementIndex = 0, pageResources, pageUrl, pageCompressContent, includeInfobar, openInfobar, infobarPositionAbsolute, infobarPositionTop, infobarPositionBottom, infobarPositionLeft, infobarPositionRight;
|
|
|
|
|
|
|
|
globalThis.zip = singlefile.helper.zip;
|
|
globalThis.zip = singlefile.helper.zip;
|
|
|
initEventListeners();
|
|
initEventListeners();
|
|
@@ -1197,9 +1197,6 @@
|
|
|
infobarPositionLeft = message.infobarPositionLeft;
|
|
infobarPositionLeft = message.infobarPositionLeft;
|
|
|
infobarPositionRight = message.infobarPositionRight;
|
|
infobarPositionRight = message.infobarPositionRight;
|
|
|
let content = getContent(message.compressHTML);
|
|
let content = getContent(message.compressHTML);
|
|
|
- if (initScriptContent) {
|
|
|
|
|
- content = content.replace(/<script data-template-shadow-root src.*?<\/script>/g, initScriptContent);
|
|
|
|
|
- }
|
|
|
|
|
let filename;
|
|
let filename;
|
|
|
const pageOptions = loadOptionsFromPage(document);
|
|
const pageOptions = loadOptionsFromPage(document);
|
|
|
if (pageOptions) {
|
|
if (pageOptions) {
|
|
@@ -1242,7 +1239,9 @@
|
|
|
window.parent.postMessage(JSON.stringify({
|
|
window.parent.postMessage(JSON.stringify({
|
|
|
method: "setContent",
|
|
method: "setContent",
|
|
|
content,
|
|
content,
|
|
|
- filename
|
|
|
|
|
|
|
+ filename,
|
|
|
|
|
+ title: document.title,
|
|
|
|
|
+ url: pageUrl
|
|
|
}), "*");
|
|
}), "*");
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -1315,7 +1314,6 @@
|
|
|
const { docContent, origDocContent, resources, url } = await singlefile.helper.extract(content, {
|
|
const { docContent, origDocContent, resources, url } = await singlefile.helper.extract(content, {
|
|
|
password,
|
|
password,
|
|
|
prompt,
|
|
prompt,
|
|
|
- shadowRootScriptURL: new URL("/lib/single-file-extension-editor-init.js", document.baseURI).href,
|
|
|
|
|
zipOptions
|
|
zipOptions
|
|
|
});
|
|
});
|
|
|
pageResources = resources;
|
|
pageResources = resources;
|
|
@@ -1323,6 +1321,8 @@
|
|
|
pageCompressContent = true;
|
|
pageCompressContent = true;
|
|
|
const contentDocument = (new DOMParser()).parseFromString(docContent, "text/html");
|
|
const contentDocument = (new DOMParser()).parseFromString(docContent, "text/html");
|
|
|
if (detectSavedPage(contentDocument)) {
|
|
if (detectSavedPage(contentDocument)) {
|
|
|
|
|
+ const { saveUrl } = singlefile.helper.extractInfobarData(contentDocument);
|
|
|
|
|
+ pageUrl = saveUrl;
|
|
|
await singlefile.helper.display(document, docContent, { disableFramePointerEvents: true });
|
|
await singlefile.helper.display(document, docContent, { disableFramePointerEvents: true });
|
|
|
singlefile.helper.fixInvalidNesting(document);
|
|
singlefile.helper.fixInvalidNesting(document);
|
|
|
const infobarElement = document.querySelector(singlefile.helper.INFOBAR_TAGNAME);
|
|
const infobarElement = document.querySelector(singlefile.helper.INFOBAR_TAGNAME);
|
|
@@ -1356,11 +1356,6 @@
|
|
|
}), "*");
|
|
}), "*");
|
|
|
}
|
|
}
|
|
|
} else {
|
|
} else {
|
|
|
- const initScriptContentMatch = content.match(/<script data-template-shadow-root.*<\/script>/);
|
|
|
|
|
- if (initScriptContentMatch && initScriptContentMatch[0]) {
|
|
|
|
|
- initScriptContent = initScriptContentMatch[0];
|
|
|
|
|
- }
|
|
|
|
|
- content = content.replace(/<script data-template-shadow-root.*<\/script>/g, "<script data-template-shadow-root src=/lib/single-file-extension-editor-init.js></script>");
|
|
|
|
|
const contentDocument = (new DOMParser()).parseFromString(content, "text/html");
|
|
const contentDocument = (new DOMParser()).parseFromString(content, "text/html");
|
|
|
if (detectSavedPage(contentDocument)) {
|
|
if (detectSavedPage(contentDocument)) {
|
|
|
if (contentDocument.doctype) {
|
|
if (contentDocument.doctype) {
|