This commit is contained in:
zadam 2020-02-27 14:35:12 +01:00
parent 5e3c85f891
commit cd4b1235a7
12 changed files with 11 additions and 73 deletions

View File

@ -40,13 +40,13 @@ export default class TabCachingWidget extends TabAwareWidget {
if (!widget) { if (!widget) {
widget = this.widgets[this.tabContext.tabId] = this.widgetFactory(); widget = this.widgets[this.tabContext.tabId] = this.widgetFactory();
this.child(widget);
const $renderedWidget = widget.render(); const $renderedWidget = widget.render();
keyboardActionsService.updateDisplayedShortcuts($renderedWidget);
this.$widget.after($renderedWidget); this.$widget.after($renderedWidget);
keyboardActionsService.updateDisplayedShortcuts($renderedWidget);
this.child(widget); // add as child only once it is ready (also rendered)
widget.handleEvent('setTabContext', {tabContext: this.tabContext}); widget.handleEvent('setTabContext', {tabContext: this.tabContext});
} }

View File

@ -293,15 +293,7 @@ export default class BookTypeWidget extends TypeWidget {
} }
} }
getContent() {}
focus() {}
cleanup() { cleanup() {
this.$content.empty(); this.$content.empty();
} }
scrollToTop() {
this.$widget.scrollTop(0);
}
} }

View File

@ -132,8 +132,4 @@ export default class CodeTypeWidget extends TypeWidget {
}); });
} }
} }
scrollToTop() {
this.$widget.scrollTop(0);
}
} }

View File

@ -38,12 +38,4 @@ export default class EmptyTypeWidget extends TypeWidget {
doRefresh(note) { doRefresh(note) {
this.$autoComplete.trigger('focus'); this.$autoComplete.trigger('focus');
} }
getContent() {}
focus() {}
cleanup() {}
scrollToTop() {}
} }

View File

@ -144,12 +144,4 @@ export default class FileTypeWidget extends TypeWidget {
getFileUrl() { getFileUrl() {
return utils.getUrlForDownload("api/notes/" + this.noteId + "/download"); return utils.getUrlForDownload("api/notes/" + this.noteId + "/download");
} }
getContent() {}
focus() {}
cleanup() {}
scrollToTop() {}
} }

View File

@ -147,16 +147,6 @@ class ImageTypeWidget extends TypeWidget {
getFileUrl() { getFileUrl() {
return utils.getUrlForDownload(`api/notes/${this.noteId}/download`); return utils.getUrlForDownload(`api/notes/${this.noteId}/download`);
} }
getContent() {}
focus() {}
cleanup() {}
scrollToTop() {
this.$widget.scrollTop(0);
}
} }
export default ImageTypeWidget export default ImageTypeWidget

View File

@ -39,14 +39,4 @@ export default class ProtectedSessionTypeWidget extends TypeWidget {
return this.$widget; return this.$widget;
} }
getContent() {}
focus() {}
cleanup() {}
scrollToTop() {
this.$widget.scrollTop(0);
}
} }

View File

@ -640,8 +640,4 @@ export default class RelationMapTypeWidget extends TypeWidget {
getContent() { getContent() {
return JSON.stringify(this.mapData); return JSON.stringify(this.mapData);
} }
focus() {}
scrollToTop() {}
} }

View File

@ -37,15 +37,7 @@ export default class RenderTypeWidget extends TypeWidget {
} }
} }
getContent() {}
focus() {}
cleanup() { cleanup() {
this.$noteDetailRenderContent.empty(); this.$noteDetailRenderContent.empty();
} }
scrollToTop() {
this.$widget.scrollTop(0);
}
} }

View File

@ -48,10 +48,4 @@ export default class SearchTypeWidget extends TypeWidget {
searchString: this.$searchString.val() searchString: this.$searchString.val()
}); });
} }
focus() {}
cleanup() {}
scrollToTop() {}
} }

View File

@ -186,10 +186,6 @@ export default class TextTypeWidget extends TypeWidget {
} }
} }
scrollToTop() {
this.$widget.scrollTop(0);
}
insertDateTimeToTextCommand() { insertDateTimeToTextCommand() {
const date = new Date(); const date = new Date();
const dateString = utils.formatDateTime(date); const dateString = utils.formatDateTime(date);

View File

@ -28,4 +28,12 @@ export default class TypeWidget extends TabAwareWidget {
isActive() { isActive() {
return this.$widget.is(":visible"); return this.$widget.is(":visible");
} }
getContent() {}
focus() {}
scrollToTop() {
this.$widget.scrollTop(0);
}
} }