Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions src/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,16 @@ chrome.runtime.onInstalled.addListener((details) => {
chrome.storage.local.remove(oldOptionName);
}
}
/**
* Ensure updated structure of highlighter objects
*/
for (const highlighterIndex of currentOptions.highlighter) {
for (const attributeName of Object.keys(defaultOptions.highlighter)) {
if (!(attributeName in currentOptions.highlighter[highlighterIndex])) {
chrome.storage.local.set({ highlighter: defaultOptions.highlighter });
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

we only want to change the specific attribute that's new, not ALL attributes to the default

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

const newHighlighter = []
 for (const highlighterIndex of currentOptions.highlighter) {
     const newHighlighterItem = currentOptions.highlighter[highlighterIndex]
        for (const attributeName of Object.keys(defaultOptions.highlighter)) {
          if (!(attributeName in currentOptions.highlighter[highlighterIndex])) {
             newHighlighterItem[attributeName] = defaultOptions.highlighter[attributeName]
         }
     }
   append
 }
 set
 

}
}
}
/**
* Convert any non-hex colors to hex.
*/
Expand Down