Skip to content

Commit

Permalink
Make a copy of DEFAULT_NEW_RULE when "Add New Link" button is clicked.
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthew Chan committed Jun 27, 2022
1 parent 5c1d7ea commit 6c71ad2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ export default class Linkify extends Plugin {
// Creates new LinkifyViewPlugins and registers them.
refreshExtensions() {
this.viewPlugins.splice(0, this.viewPlugins.length, ... this.settings.rules.map(createViewPlugin));
this.app.workspace.updateOptions()
this.app.workspace.updateOptions();
}

// Opens linkified text as a link.
Expand Down Expand Up @@ -204,7 +204,7 @@ class LinkifySettingTab extends PluginSettingTab {
new Setting(containerEl)
.addButton((button) => button
.setButtonText("Add New Link").onClick(async () => {
this.plugin.settings.rules.push(DEFAULT_NEW_RULE);
this.plugin.settings.rules.push({... DEFAULT_NEW_RULE});
await this.plugin.saveSettings();
this.display();
}));
Expand Down

0 comments on commit 6c71ad2

Please sign in to comment.