method preparePromptsForImport added. see #65
This commit is contained in:
parent
4fc29355d8
commit
47dbf0c808
1 changed files with 15 additions and 0 deletions
|
|
@ -167,6 +167,21 @@ export function preparePromptsForExport(prompts){
|
|||
return output;
|
||||
}
|
||||
|
||||
export async function preparePromptsForImport(prompts){
|
||||
const output = await getPrompts();
|
||||
prompts.forEach(prompt => {
|
||||
if(output.some(p => p.id == prompt.id)){
|
||||
Object.keys(prompt).forEach(key => {
|
||||
output.find(p => p.id == prompt.id)[key] = prompt[key];
|
||||
})
|
||||
}else{
|
||||
output.push(prompt);
|
||||
}
|
||||
});
|
||||
//console.log(">>>>>>>>>>> preparePromptsForImport: " + JSON.stringify(output));
|
||||
return output;
|
||||
}
|
||||
|
||||
async function getDefaultPrompts_withProps() {
|
||||
let prefs = await browser.storage.sync.get({_default_prompts_properties: null}); //production
|
||||
let defaultPrompts_prop = [...defaultPrompts];
|
||||
|
|
|
|||
Loading…
Reference in a new issue