fix: reset isTemplateNote when setting a new note (#439)

* fix: reset isTemplateNote when setting a new note

* refactor: simplify code

* refecator: use default argument
This commit is contained in:
Radek Czemerys
2020-07-30 18:00:22 +02:00
committed by GitHub
parent 70c427e1b0
commit 11ac38856f

View File

@@ -68,8 +68,7 @@ export class Editor {
references: [] references: []
} }
); );
this.isTemplateNote = true; this.setNote(note as SNNote, true);
this.setNote(note as SNNote);
} }
/** /**
@@ -97,8 +96,9 @@ export class Editor {
/** /**
* Sets the editor contents by setting its note. * Sets the editor contents by setting its note.
*/ */
public setNote(note: SNNote) { public setNote(note: SNNote, isTemplate = false) {
this.note = note; this.note = note;
this.isTemplateNote = isTemplate;
if (this._onNoteChange) { if (this._onNoteChange) {
this._onNoteChange(); this._onNoteChange();
} }