浏览代码

update `single-file-core`

Gildas 3 周之前
父节点
当前提交
b71c5ca1c0

文件差异内容过多而无法显示
+ 0 - 0
lib/single-file-bootstrap.js


文件差异内容过多而无法显示
+ 0 - 0
lib/single-file-extension-background.js


文件差异内容过多而无法显示
+ 0 - 0
lib/single-file-extension-editor-helper.js


+ 6 - 11
lib/single-file-extension-editor.js

@@ -1094,7 +1094,7 @@
 
 		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 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;
 		initEventListeners();
@@ -1197,9 +1197,6 @@
 					infobarPositionLeft = message.infobarPositionLeft;
 					infobarPositionRight = message.infobarPositionRight;
 					let content = getContent(message.compressHTML);
-					if (initScriptContent) {
-						content = content.replace(/<script data-template-shadow-root src.*?<\/script>/g, initScriptContent);
-					}
 					let filename;
 					const pageOptions = loadOptionsFromPage(document);
 					if (pageOptions) {
@@ -1242,7 +1239,9 @@
 							window.parent.postMessage(JSON.stringify({
 								method: "setContent",
 								content,
-								filename
+								filename,
+								title: document.title,
+								url: pageUrl
 							}), "*");
 						}
 					}
@@ -1315,7 +1314,6 @@
 				const { docContent, origDocContent, resources, url } = await singlefile.helper.extract(content, {
 					password,
 					prompt,
-					shadowRootScriptURL: new URL("/lib/single-file-extension-editor-init.js", document.baseURI).href,
 					zipOptions
 				});
 				pageResources = resources;
@@ -1323,6 +1321,8 @@
 				pageCompressContent = true;
 				const contentDocument = (new DOMParser()).parseFromString(docContent, "text/html");
 				if (detectSavedPage(contentDocument)) {
+					const { saveUrl } = singlefile.helper.extractInfobarData(contentDocument);
+					pageUrl = saveUrl;
 					await singlefile.helper.display(document, docContent, { disableFramePointerEvents: true });
 					singlefile.helper.fixInvalidNesting(document);
 					const infobarElement = document.querySelector(singlefile.helper.INFOBAR_TAGNAME);
@@ -1356,11 +1356,6 @@
 					}), "*");
 				}
 			} 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");
 				if (detectSavedPage(contentDocument)) {
 					if (contentDocument.doctype) {

文件差异内容过多而无法显示
+ 0 - 0
lib/single-file-extension.js


文件差异内容过多而无法显示
+ 0 - 0
lib/single-file-frames.js


文件差异内容过多而无法显示
+ 0 - 0
lib/single-file-hooks-frames.js


文件差异内容过多而无法显示
+ 0 - 0
lib/single-file.js


+ 4 - 4
package-lock.json

@@ -9,7 +9,7 @@
 			"version": "1.2.4",
 			"license": "AGPL-3.0-or-later",
 			"dependencies": {
-				"single-file-core": "1.5.68"
+				"single-file-core": "1.5.70"
 			},
 			"devDependencies": {
 				"@rollup/plugin-node-resolve": "16.0.3",
@@ -1642,9 +1642,9 @@
 			}
 		},
 		"node_modules/single-file-core": {
-			"version": "1.5.68",
-			"resolved": "https://registry.npmjs.org/single-file-core/-/single-file-core-1.5.68.tgz",
-			"integrity": "sha512-SjAZ6hqcj9F1HnYs1Wu179wYfktFUw7GG2Tsyyw0OUWloDuRd30n+JxW39uMXW/ISfhwP4TmReCeo5Tkki0lgg==",
+			"version": "1.5.70",
+			"resolved": "https://registry.npmjs.org/single-file-core/-/single-file-core-1.5.70.tgz",
+			"integrity": "sha512-dF1B1VZ8EZeKYviK2yALta2rjFqtHzUEtmlgCg4P1v//k/YVfq2WtJOrBctMtHcpAFUWXwmgdVGLv27HYYfAnw==",
 			"license": "AGPL-3.0-or-later"
 		},
 		"node_modules/smob": {

+ 1 - 1
package.json

@@ -10,7 +10,7 @@
 	},
 	"type": "module",
 	"dependencies": {
-		"single-file-core": "1.5.68"
+		"single-file-core": "1.5.70"
 	},
 	"devDependencies": {
 		"eslint": "^9.39.1",

部分文件因为文件数量过多而无法显示