mirror of
https://github.com/zadam/trilium.git
synced 2025-06-06 09:58:32 +02:00
event fixes WIP
This commit is contained in:
parent
e10d23289e
commit
091eb8f791
@ -4,12 +4,12 @@ import utils from "../services/utils.js";
|
|||||||
const $dialog = $("#note-source-dialog");
|
const $dialog = $("#note-source-dialog");
|
||||||
const $noteSource = $("#note-source");
|
const $noteSource = $("#note-source");
|
||||||
|
|
||||||
export function showDialog() {
|
export async function showDialog() {
|
||||||
utils.openDialog($dialog);
|
utils.openDialog($dialog);
|
||||||
|
|
||||||
const noteText = appContext.tabManager.getActiveTabNote().content;
|
const noteCompletement = await appContext.tabManager.getActiveTabContext().getNoteComplement();
|
||||||
|
|
||||||
$noteSource.text(formatHtml(noteText));
|
$noteSource.text(formatHtml(noteCompletement.content));
|
||||||
}
|
}
|
||||||
|
|
||||||
function formatHtml(str) {
|
function formatHtml(str) {
|
||||||
|
@ -102,8 +102,7 @@ export default class NoteDetailWidget extends TabAwareWidget {
|
|||||||
|
|
||||||
const typeWidget = this.typeWidgets[this.type] = new clazz();
|
const typeWidget = this.typeWidgets[this.type] = new clazz();
|
||||||
typeWidget.spacedUpdate = this.spacedUpdate;
|
typeWidget.spacedUpdate = this.spacedUpdate;
|
||||||
|
typeWidget.setParent(this);
|
||||||
this.child(typeWidget);
|
|
||||||
|
|
||||||
const $renderedWidget = typeWidget.render();
|
const $renderedWidget = typeWidget.render();
|
||||||
keyboardActionsService.updateDisplayedShortcuts($renderedWidget);
|
keyboardActionsService.updateDisplayedShortcuts($renderedWidget);
|
||||||
@ -112,10 +111,7 @@ export default class NoteDetailWidget extends TabAwareWidget {
|
|||||||
|
|
||||||
await typeWidget.handleEvent('setTabContext', {tabContext: this.tabContext});
|
await typeWidget.handleEvent('setTabContext', {tabContext: this.tabContext});
|
||||||
|
|
||||||
typeWidget.handleEvent('tabNoteSwitched', {
|
this.child(typeWidget);
|
||||||
tabId: this.tabContext.tabId,
|
|
||||||
notePath: this.notePath
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this.setupClasses();
|
this.setupClasses();
|
||||||
|
@ -421,7 +421,7 @@ export default class NoteTreeWidget extends TabAwareWidget {
|
|||||||
collapseTreeCommand() { this.collapseTree(); }
|
collapseTreeCommand() { this.collapseTree(); }
|
||||||
|
|
||||||
isEnabled() {
|
isEnabled() {
|
||||||
return this.tabContext && this.tabContext.isActive();
|
return !!this.tabContext;
|
||||||
}
|
}
|
||||||
|
|
||||||
async refresh() {
|
async refresh() {
|
||||||
|
@ -80,6 +80,8 @@ export default class TabAwareWidget extends BasicWidget {
|
|||||||
setTabContextEvent({tabContext}) {
|
setTabContextEvent({tabContext}) {
|
||||||
/** @var {TabContext} */
|
/** @var {TabContext} */
|
||||||
this.tabContext = tabContext;
|
this.tabContext = tabContext;
|
||||||
|
|
||||||
|
this.refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
async newTabOpenedEvent({tabContext}) {
|
async newTabOpenedEvent({tabContext}) {
|
||||||
|
@ -143,7 +143,7 @@ export default class TextTypeWidget extends TypeWidget {
|
|||||||
async doRefresh(note) {
|
async doRefresh(note) {
|
||||||
this.textEditor.isReadOnly = await note.hasLabel('readOnly');
|
this.textEditor.isReadOnly = await note.hasLabel('readOnly');
|
||||||
|
|
||||||
const noteComplement = await this.tabContext.getNoteComplement();
|
const noteComplement = await treeCache.getNoteComplement(note.noteId);
|
||||||
|
|
||||||
await this.spacedUpdate.allowUpdateWithoutChange(() => {
|
await this.spacedUpdate.allowUpdateWithoutChange(() => {
|
||||||
this.textEditor.setData(noteComplement.content);
|
this.textEditor.setData(noteComplement.content);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user