mirror of
https://github.com/zadam/trilium.git
synced 2025-11-05 04:45:47 +01:00
fixed switch between autobook and text
This commit is contained in:
@@ -19,10 +19,18 @@ export default class Component {
|
||||
|
||||
let propagateToChildren = true;
|
||||
|
||||
const start = Date.now();
|
||||
|
||||
if (typeof fun === 'function') {
|
||||
propagateToChildren = await fun.call(this, data) !== false;
|
||||
}
|
||||
|
||||
const end = Date.now();
|
||||
|
||||
if (end - start > 10) {
|
||||
console.log(`Event ${name} in component ${this.componentId} took ${end-start}ms`);
|
||||
}
|
||||
|
||||
if (propagateToChildren) {
|
||||
const promise = this.triggerChildren(name, data, sync);
|
||||
|
||||
|
||||
@@ -143,7 +143,7 @@ export default class NoteDetailWidget extends TabAwareWidget {
|
||||
typeWidget.eventReceived('setTabContext', {tabContext: this.tabContext});
|
||||
}
|
||||
|
||||
async getWidgetType(disableAutoBook) {
|
||||
async getWidgetType() {
|
||||
const note = this.tabContext.note;
|
||||
|
||||
if (!note) {
|
||||
@@ -152,7 +152,7 @@ export default class NoteDetailWidget extends TabAwareWidget {
|
||||
|
||||
let type = note.type;
|
||||
|
||||
if (type === 'text' && !disableAutoBook
|
||||
if (type === 'text' && !this.tabContext.autoBookDisabled
|
||||
&& note.hasChildren()
|
||||
&& utils.isDesktop()) {
|
||||
|
||||
@@ -224,4 +224,8 @@ export default class NoteDetailWidget extends TabAwareWidget {
|
||||
beforeUnloadListener() {
|
||||
this.spacedUpdate.updateNowIfNecessary();
|
||||
}
|
||||
|
||||
autoBookDisabledListener() {
|
||||
this.refresh();
|
||||
}
|
||||
}
|
||||
@@ -200,7 +200,9 @@ export default class BookTypeWidget extends TypeWidget {
|
||||
|
||||
if (this.isAutoBook()) {
|
||||
const $addTextLink = $('<a href="javascript:">here</a>').on('click', () => {
|
||||
// FIXME
|
||||
this.tabContext.autoBookDisabled = true;
|
||||
|
||||
this.trigger('autoBookDisabled');
|
||||
});
|
||||
|
||||
this.$content.append($('<div class="note-book-auto-message"></div>')
|
||||
|
||||
Reference in New Issue
Block a user