diff --git a/src/public/javascripts/services/note_tooltip.js b/src/public/javascripts/services/note_tooltip.js
index 799c783b2..f6a027545 100644
--- a/src/public/javascripts/services/note_tooltip.js
+++ b/src/public/javascripts/services/note_tooltip.js
@@ -70,6 +70,10 @@ function mouseLeaveHandler() {
}
async function renderTooltip(note, noteComplement) {
+ if (note.isDeleted) {
+ return '
Note has been deleted.
';
+ }
+
const attributes = await note.getAttributes();
let content = '';
diff --git a/src/public/javascripts/services/tab_context.js b/src/public/javascripts/services/tab_context.js
index 602a0fc7e..421ceb7a5 100644
--- a/src/public/javascripts/services/tab_context.js
+++ b/src/public/javascripts/services/tab_context.js
@@ -25,19 +25,28 @@ class TabContext extends Component {
}
async setNote(inputNotePath, triggerSwitchEvent = true) {
- const notePath = await treeService.resolveNotePath(inputNotePath);
+ const noteId = treeService.getNoteIdFromNotePath(inputNotePath);
+ let notePath;
- if (!notePath) {
- console.error(`Cannot resolve note path ${inputNotePath}`);
- return;
+ if ((await treeCache.getNote(noteId)).isDeleted) {
+ // no point in trying to resolve canonical notePath
+ notePath = inputNotePath;
}
+ else {
+ notePath = await treeService.resolveNotePath(inputNotePath);
- if (notePath === this.notePath) {
- return;
- }
+ if (!notePath) {
+ console.error(`Cannot resolve note path ${inputNotePath}`);
+ return;
+ }
- if (await hoistedNoteService.checkNoteAccess(notePath) === false) {
- return; // note is outside of hoisted subtree and user chose not to unhoist
+ if (notePath === this.notePath) {
+ return;
+ }
+
+ if (await hoistedNoteService.checkNoteAccess(notePath) === false) {
+ return; // note is outside of hoisted subtree and user chose not to unhoist
+ }
}
await this.triggerEvent('beforeNoteSwitch', {tabContext: this});
@@ -45,7 +54,7 @@ class TabContext extends Component {
utils.closeActiveDialog();
this.notePath = notePath;
- this.noteId = treeService.getNoteIdFromNotePath(notePath);
+ this.noteId = noteId;
this.autoBookDisabled = false;
diff --git a/src/public/javascripts/widgets/note_detail.js b/src/public/javascripts/widgets/note_detail.js
index ccd4e9919..c3491dbda 100644
--- a/src/public/javascripts/widgets/note_detail.js
+++ b/src/public/javascripts/widgets/note_detail.js
@@ -17,6 +17,7 @@ import BookTypeWidget from "./type_widgets/book.js";
import appContext from "../services/app_context.js";
import keyboardActionsService from "../services/keyboard_actions.js";
import noteCreateService from "../services/note_create.js";
+import DeletedTypeWidget from "./type_widgets/deleted.js";
const TPL = `
@@ -33,6 +34,7 @@ const TPL = `
const typeWidgetClasses = {
'empty': EmptyTypeWidget,
+ 'deleted': DeletedTypeWidget,
'text': TextTypeWidget,
'code': CodeTypeWidget,
'file': FileTypeWidget,
@@ -157,6 +159,8 @@ export default class NoteDetailWidget extends TabAwareWidget {
if (!note) {
return "empty";
+ } else if (note.isDeleted) {
+ return "deleted";
}
let type = note.type;
diff --git a/src/public/javascripts/widgets/screen_container.js b/src/public/javascripts/widgets/screen_container.js
index 9ad93c44f..8893f0b60 100644
--- a/src/public/javascripts/widgets/screen_container.js
+++ b/src/public/javascripts/widgets/screen_container.js
@@ -7,7 +7,7 @@ export default class ScreenContainer extends FlexContainer {
this.screenName = screenName;
}
- activeScreenChangedEvent({activeScreen}) {console.log("Active screen", activeScreen);
+ activeScreenChangedEvent({activeScreen}) {
if (activeScreen === this.screenName) {
this.$widget.removeClass('d-none');
}
diff --git a/src/public/javascripts/widgets/type_widgets/deleted.js b/src/public/javascripts/widgets/type_widgets/deleted.js
new file mode 100644
index 000000000..cbf4cb903
--- /dev/null
+++ b/src/public/javascripts/widgets/type_widgets/deleted.js
@@ -0,0 +1,20 @@
+import TypeWidget from "./type_widget.js";
+
+const TPL = `
+
+
+
+ This note has been deleted.
+
+
+
`;
+
+export default class DeletedTypeWidget extends TypeWidget {
+ static getType() { return "deleted"; }
+
+ doRender() {
+ this.$widget = $(TPL);
+
+ return this.$widget;
+ }
+}
\ No newline at end of file