From df63426c9fba298eea16cdda7e8514fc45e7f42e Mon Sep 17 00:00:00 2001 From: "YUKI \"Piro\" Hiroshi" Date: Mon, 27 Jul 2020 18:26:54 +0900 Subject: [PATCH] Copy tabs correctly even if there is any placeholder for content fields like `%DESCRIPTION%` #12 --- common/commands.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/common/commands.js b/common/commands.js index 8c79e0d..07e6491 100644 --- a/common/commands.js +++ b/common/commands.js @@ -176,11 +176,12 @@ export async function fillPlaceHolders(format, tab, indentLevel) { Permissions.isPermittedTab(tab) && /%(AUTHOR|DESC(?:RIPTION)?|KEYWORDS)(?:_HTML(?:IFIED)?)?%/i.test(format)) { log('trying to get data from content ', tab.id); - params = await browser.tabs.executeScript(tab.id, { + let paramsFromContent = await browser.tabs.executeScript(tab.id, { file: '/common/get-content-text.js' }); - if (Array.isArray(params)) - params = params[0]; + if (Array.isArray(paramsFromContent)) + paramsFromContent = paramsFromContent[0]; + params = { ...params, ...paramsFromContent }; log('params ', params); }