Skip to content

Commit

Permalink
Copy tabs correctly even if there is any placeholder for content fiel…
Browse files Browse the repository at this point in the history
…ds like `%DESCRIPTION%` #12
  • Loading branch information
piroor committed Jul 27, 2020
1 parent c8793af commit df63426
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions common/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down

1 comment on commit df63426

@DavidMcRitchie
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you.

Please sign in to comment.