Skip to content

Commit

Permalink
fix: do not recreate template note unnecessarily
Browse files Browse the repository at this point in the history
  • Loading branch information
arielsvg committed Aug 14, 2020
1 parent 27ec6f9 commit 4e86a2e
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions app/assets/javascripts/ui_models/editor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,16 +64,18 @@ export class Editor {
* Reverts the editor to a blank state, removing any existing note from view,
* and creating a placeholder note.
*/
async reset(noteTitle?: string) {
async reset(noteTitle = '') {
const note = await this.application.createTemplateItem(
ContentType.Note,
{
text: '',
title: noteTitle || '',
title: noteTitle,
references: []
}
);
this.setNote(note as SNNote, true);
) as SNNote;
if (!this.isTemplateNote || this.note.title !== note.title) {
this.setNote(note as SNNote, true);
}
}

/**
Expand Down

0 comments on commit 4e86a2e

Please sign in to comment.