fix: do not recreate template note unnecessarily
This commit is contained in:
@@ -64,16 +64,18 @@ export class Editor {
|
|||||||
* Reverts the editor to a blank state, removing any existing note from view,
|
* Reverts the editor to a blank state, removing any existing note from view,
|
||||||
* and creating a placeholder note.
|
* and creating a placeholder note.
|
||||||
*/
|
*/
|
||||||
async reset(noteTitle?: string) {
|
async reset(noteTitle = '') {
|
||||||
const note = await this.application.createTemplateItem(
|
const note = await this.application.createTemplateItem(
|
||||||
ContentType.Note,
|
ContentType.Note,
|
||||||
{
|
{
|
||||||
text: '',
|
text: '',
|
||||||
title: noteTitle || '',
|
title: noteTitle,
|
||||||
references: []
|
references: []
|
||||||
}
|
}
|
||||||
);
|
) as SNNote;
|
||||||
this.setNote(note as SNNote, true);
|
if (!this.isTemplateNote || this.note.title !== note.title) {
|
||||||
|
this.setNote(note as SNNote, true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user