فهرست منبع

pass url to editor

Gildas 3 ماه پیش
والد
کامیت
96284e7e60
3فایلهای تغییر یافته به همراه7 افزوده شده و 4 حذف شده
  1. 3 2
      src/core/bg/downloads.js
  2. 2 1
      src/core/bg/editor.js
  3. 2 1
      src/core/common/download.js

+ 3 - 2
src/core/bg/downloads.js

@@ -187,7 +187,7 @@ async function downloadContent(contents, tab, incognito, message) {
 			let response;
 			if (message.openEditor) {
 				ui.onEdit(tabId);
-				await editor.open({ tabIndex: tab.index + 1, filename: message.filename, content: contents.join("") });
+				await editor.open({ tabIndex: tab.index + 1, filename: message.filename, content: contents.join(""), url: message.originalUrl });
 			} else if (message.saveToClipboard) {
 				message.content = contents.join("");
 				saveToClipboard(message);
@@ -320,7 +320,8 @@ async function downloadCompressedContent(message, tab) {
 					extractDataFromPage: message.extractDataFromPage,
 					insertTextBody: message.insertTextBody,
 					insertMetaCSP: message.insertMetaCSP,
-					embeddedImage: message.embeddedImage
+					embeddedImage: message.embeddedImage,
+					url: message.originalUrl
 				});
 			} else if (message.foregroundSave || !message.backgroundSave || message.sharePage) {
 				const response = await downloadPageForeground(message.taskId, message.filename, blob, pageData.mimeType, tabId, {

+ 2 - 1
src/core/bg/editor.js

@@ -39,13 +39,14 @@ export {
 	EDITOR_URL
 };
 
-async function open({ tabIndex, content, filename, compressContent, selfExtractingArchive, extractDataFromPage, insertTextBody, insertMetaCSP, embeddedImage }) {
+async function open({ tabIndex, content, filename, compressContent, selfExtractingArchive, extractDataFromPage, insertTextBody, insertMetaCSP, embeddedImage, url }) {
 	const createTabProperties = { active: true, url: EDITOR_PAGE_URL };
 	if (tabIndex != null) {
 		createTabProperties.index = tabIndex;
 	}
 	const tab = await browser.tabs.create(createTabProperties);
 	tabsData.set(tab.id, {
+		url,
 		content,
 		filename,
 		compressContent,

+ 2 - 1
src/core/common/download.js

@@ -121,7 +121,8 @@ async function downloadPage(pageData, options) {
 		infobarPositionTop: options.infobarPositionTop,
 		infobarPositionBottom: options.infobarPositionBottom,
 		infobarPositionLeft: options.infobarPositionLeft,
-		infobarPositionRight: options.infobarPositionRight
+		infobarPositionRight: options.infobarPositionRight,
+		originalUrl: options.url
 	};
 	const pingInterval = setInterval(() => {
 		browser.runtime.sendMessage({ method: "ping" }).then(() => { });