mirror of
https://github.com/zadam/trilium.git
synced 2025-06-06 18:08:33 +02:00
renamed Listener() to Event()
This commit is contained in:
parent
e000fb4579
commit
880f4ad711
@ -83,7 +83,7 @@ class AppContext extends Component {
|
|||||||
return $(el).closest(".component").prop('component');
|
return $(el).closest(".component").prop('component');
|
||||||
}
|
}
|
||||||
|
|
||||||
async protectedSessionStartedListener() {
|
async protectedSessionStartedEvent() {
|
||||||
await treeCache.loadInitialTree();
|
await treeCache.loadInitialTree();
|
||||||
|
|
||||||
this.triggerEvent('treeCacheReloaded');
|
this.triggerEvent('treeCacheReloaded');
|
||||||
|
@ -29,13 +29,13 @@ export default class Entrypoints extends Component {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
openDevToolsListener() {
|
openDevToolsEvent() {
|
||||||
if (utils.isElectron()) {
|
if (utils.isElectron()) {
|
||||||
require('electron').remote.getCurrentWindow().toggleDevTools();
|
require('electron').remote.getCurrentWindow().toggleDevTools();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
findInTextListener() {
|
findInTextEvent() {
|
||||||
if (!utils.isElectron()) {
|
if (!utils.isElectron()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -58,7 +58,7 @@ export default class Entrypoints extends Component {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
async createNoteIntoDayNoteListener() {
|
async createNoteIntoDayNoteEvent() {
|
||||||
const todayNote = await dateNoteService.getTodayNote();
|
const todayNote = await dateNoteService.getTodayNote();
|
||||||
|
|
||||||
const {note} = await server.post(`notes/${todayNote.noteId}/children?target=into`, {
|
const {note} = await server.post(`notes/${todayNote.noteId}/children?target=into`, {
|
||||||
@ -77,7 +77,7 @@ export default class Entrypoints extends Component {
|
|||||||
appContext.triggerEvent('focusAndSelectTitle');
|
appContext.triggerEvent('focusAndSelectTitle');
|
||||||
}
|
}
|
||||||
|
|
||||||
async toggleNoteHoistingListener() {
|
async toggleNoteHoistingEvent() {
|
||||||
const note = appContext.tabManager.getActiveTabNote();
|
const note = appContext.tabManager.getActiveTabNote();
|
||||||
|
|
||||||
const hoistedNoteId = hoistedNoteService.getHoistedNoteId();
|
const hoistedNoteId = hoistedNoteService.getHoistedNoteId();
|
||||||
@ -93,11 +93,11 @@ export default class Entrypoints extends Component {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
copyWithoutFormattingListener() {
|
copyWithoutFormattingEvent() {
|
||||||
utils.copySelectionToClipboard();
|
utils.copySelectionToClipboard();
|
||||||
}
|
}
|
||||||
|
|
||||||
toggleFullscreenListener() {
|
toggleFullscreenEvent() {
|
||||||
if (utils.isElectron()) {
|
if (utils.isElectron()) {
|
||||||
const win = require('electron').remote.getCurrentWindow();
|
const win = require('electron').remote.getCurrentWindow();
|
||||||
|
|
||||||
@ -111,7 +111,7 @@ export default class Entrypoints extends Component {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
toggleZenModeListener() {
|
toggleZenModeEvent() {
|
||||||
if (!this.zenModeActive) {
|
if (!this.zenModeActive) {
|
||||||
$(".hide-in-zen-mode,.gutter").addClass("hidden-by-zen-mode");
|
$(".hide-in-zen-mode,.gutter").addClass("hidden-by-zen-mode");
|
||||||
$("#container").addClass("zen-mode");
|
$("#container").addClass("zen-mode");
|
||||||
@ -125,11 +125,11 @@ export default class Entrypoints extends Component {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
reloadFrontendAppListener() {
|
reloadFrontendAppEvent() {
|
||||||
utils.reloadApp();
|
utils.reloadApp();
|
||||||
}
|
}
|
||||||
|
|
||||||
logoutListener() {
|
logoutEvent() {
|
||||||
const $logoutForm = $('<form action="logout" method="POST">')
|
const $logoutForm = $('<form action="logout" method="POST">')
|
||||||
.append($(`<input type="hidden" name="_csrf" value="${glob.csrfToken}"/>`));
|
.append($(`<input type="hidden" name="_csrf" value="${glob.csrfToken}"/>`));
|
||||||
|
|
||||||
@ -137,27 +137,27 @@ export default class Entrypoints extends Component {
|
|||||||
$logoutForm.trigger('submit');
|
$logoutForm.trigger('submit');
|
||||||
}
|
}
|
||||||
|
|
||||||
showOptionsListener() {
|
showOptionsEvent() {
|
||||||
import("../dialogs/options.js").then(d => d.showDialog())
|
import("../dialogs/options.js").then(d => d.showDialog())
|
||||||
}
|
}
|
||||||
|
|
||||||
showHelpListener() {
|
showHelpEvent() {
|
||||||
import("../dialogs/help.js").then(d => d.showDialog())
|
import("../dialogs/help.js").then(d => d.showDialog())
|
||||||
}
|
}
|
||||||
|
|
||||||
showSQLConsoleListener() {
|
showSQLConsoleEvent() {
|
||||||
import("../dialogs/sql_console.js").then(d => d.showDialog())
|
import("../dialogs/sql_console.js").then(d => d.showDialog())
|
||||||
}
|
}
|
||||||
|
|
||||||
showBackendLogListener() {
|
showBackendLogEvent() {
|
||||||
import("../dialogs/backend_log.js").then(d => d.showDialog())
|
import("../dialogs/backend_log.js").then(d => d.showDialog())
|
||||||
}
|
}
|
||||||
|
|
||||||
backInNoteHistoryListener() {
|
backInNoteHistoryEvent() {
|
||||||
window.history.back();
|
window.history.back();
|
||||||
}
|
}
|
||||||
|
|
||||||
forwardInNoteHistoryListener() {
|
forwardInNoteHistoryEvent() {
|
||||||
window.history.forward();
|
window.history.forward();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -41,7 +41,7 @@ export async function initSpellCheck() {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
new ContextMenuListener(async (info) => {
|
new ContextMenuEvent(async (info) => {
|
||||||
await contextMenuBuilder.showPopupMenu(info);
|
await contextMenuBuilder.showPopupMenu(info);
|
||||||
});
|
});
|
||||||
}
|
}
|
@ -98,7 +98,7 @@ class TabContext extends Component {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async entitiesReloadedListener({loadResults}) {
|
async entitiesReloadedEvent({loadResults}) {
|
||||||
if (loadResults.isNoteReloaded(this.noteId)) {
|
if (loadResults.isNoteReloaded(this.noteId)) {
|
||||||
const note = await treeCache.getNote(this.noteId);
|
const note = await treeCache.getNote(this.noteId);
|
||||||
|
|
||||||
|
@ -99,7 +99,7 @@ export default class TabManager extends Component {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
tabNoteSwitchedListener({tabId}) {
|
tabNoteSwitchedEvent({tabId}) {
|
||||||
if (tabId === this.activeTabId) {
|
if (tabId === this.activeTabId) {
|
||||||
this.setCurrentNotePathToHash();
|
this.setCurrentNotePathToHash();
|
||||||
}
|
}
|
||||||
@ -228,7 +228,7 @@ export default class TabManager extends Component {
|
|||||||
this.openAndActivateEmptyTab();
|
this.openAndActivateEmptyTab();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
this.activateNextTabListener();
|
this.activateNextTabEvent();
|
||||||
}
|
}
|
||||||
|
|
||||||
this.children = this.children.filter(tc => tc.tabId !== tabId);
|
this.children = this.children.filter(tc => tc.tabId !== tabId);
|
||||||
@ -238,7 +238,7 @@ export default class TabManager extends Component {
|
|||||||
this.tabsUpdate.scheduleUpdate();
|
this.tabsUpdate.scheduleUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
tabReorderListener({tabIdsInOrder}) {
|
tabReorderEvent({tabIdsInOrder}) {
|
||||||
const order = {};
|
const order = {};
|
||||||
|
|
||||||
for (const i in tabIdsInOrder) {
|
for (const i in tabIdsInOrder) {
|
||||||
@ -250,39 +250,39 @@ export default class TabManager extends Component {
|
|||||||
this.tabsUpdate.scheduleUpdate();
|
this.tabsUpdate.scheduleUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
activateNextTabListener() {
|
activateNextTabEvent() {
|
||||||
const oldIdx = this.tabContexts.findIndex(tc => tc.tabId === this.activeTabId);
|
const oldIdx = this.tabContexts.findIndex(tc => tc.tabId === this.activeTabId);
|
||||||
const newActiveTabId = this.tabContexts[oldIdx === this.tabContexts.length - 1 ? 0 : oldIdx + 1].tabId;
|
const newActiveTabId = this.tabContexts[oldIdx === this.tabContexts.length - 1 ? 0 : oldIdx + 1].tabId;
|
||||||
|
|
||||||
this.activateTab(newActiveTabId);
|
this.activateTab(newActiveTabId);
|
||||||
}
|
}
|
||||||
|
|
||||||
activatePreviousTabListener() {
|
activatePreviousTabEvent() {
|
||||||
const oldIdx = this.tabContexts.findIndex(tc => tc.tabId === this.activeTabId);
|
const oldIdx = this.tabContexts.findIndex(tc => tc.tabId === this.activeTabId);
|
||||||
const newActiveTabId = this.tabContexts[oldIdx === 0 ? this.tabContexts.length - 1 : oldIdx - 1].tabId;
|
const newActiveTabId = this.tabContexts[oldIdx === 0 ? this.tabContexts.length - 1 : oldIdx - 1].tabId;
|
||||||
|
|
||||||
this.activateTab(newActiveTabId);
|
this.activateTab(newActiveTabId);
|
||||||
}
|
}
|
||||||
|
|
||||||
closeActiveTabListener() {
|
closeActiveTabEvent() {
|
||||||
this.removeTab(this.activeTabId);
|
this.removeTab(this.activeTabId);
|
||||||
}
|
}
|
||||||
|
|
||||||
beforeUnloadListener() {
|
beforeUnloadEvent() {
|
||||||
this.tabsUpdate.updateNowIfNecessary();
|
this.tabsUpdate.updateNowIfNecessary();
|
||||||
}
|
}
|
||||||
|
|
||||||
openNewTabListener() {
|
openNewTabEvent() {
|
||||||
this.openAndActivateEmptyTab();
|
this.openAndActivateEmptyTab();
|
||||||
}
|
}
|
||||||
|
|
||||||
async removeAllTabsListener() {
|
async removeAllTabsEvent() {
|
||||||
for (const tabIdToRemove of this.tabContexts.map(tc => tc.tabId)) {
|
for (const tabIdToRemove of this.tabContexts.map(tc => tc.tabId)) {
|
||||||
await this.removeTab(tabIdToRemove);
|
await this.removeTab(tabIdToRemove);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async removeAllTabsExceptForThisListener({tabId}) {
|
async removeAllTabsExceptForThisEvent({tabId}) {
|
||||||
for (const tabIdToRemove of this.tabContexts.map(tc => tc.tabId)) {
|
for (const tabIdToRemove of this.tabContexts.map(tc => tc.tabId)) {
|
||||||
if (tabIdToRemove !== tabId) {
|
if (tabIdToRemove !== tabId) {
|
||||||
await this.removeTab(tabIdToRemove);
|
await this.removeTab(tabIdToRemove);
|
||||||
@ -290,7 +290,7 @@ export default class TabManager extends Component {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async hoistedNoteChangedListener({hoistedNoteId}) {
|
async hoistedNoteChangedEvent({hoistedNoteId}) {
|
||||||
if (hoistedNoteId === 'root') {
|
if (hoistedNoteId === 'root') {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -33,15 +33,15 @@ export default class ZoomService extends Component {
|
|||||||
return require('electron').webFrame.getZoomFactor();
|
return require('electron').webFrame.getZoomFactor();
|
||||||
}
|
}
|
||||||
|
|
||||||
zoomOutListener() {
|
zoomOutEvent() {
|
||||||
this.setZoomFactorAndSave(this.getCurrentZoom() - 0.1);
|
this.setZoomFactorAndSave(this.getCurrentZoom() - 0.1);
|
||||||
}
|
}
|
||||||
|
|
||||||
zoomInListener() {
|
zoomInEvent() {
|
||||||
this.setZoomFactorAndSave(this.getCurrentZoom() + 0.1);
|
this.setZoomFactorAndSave(this.getCurrentZoom() + 0.1);
|
||||||
}
|
}
|
||||||
|
|
||||||
setZoomFactorAndSaveListener({zoomFactor}) {
|
setZoomFactorAndSaveEvent({zoomFactor}) {
|
||||||
this.setZoomFactorAndSave(zoomFactor);
|
this.setZoomFactorAndSave(zoomFactor);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -98,7 +98,7 @@ export default class AttributesWidget extends CollapsibleWidget {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
entitiesReloadedListener({loadResults}) {
|
entitiesReloadedEvent({loadResults}) {
|
||||||
if (loadResults.getAttributes().find(attr => attr.noteId === this.noteId)) {
|
if (loadResults.getAttributes().find(attr => attr.noteId === this.noteId)) {
|
||||||
this.refresh();
|
this.refresh();
|
||||||
}
|
}
|
||||||
|
@ -67,7 +67,7 @@ export default class LinkMapWidget extends CollapsibleWidget {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
entitiesReloadedListener({loadResults}) {
|
entitiesReloadedEvent({loadResults}) {
|
||||||
if (loadResults.getAttributes().find(attr => attr.type === 'relation' && (attr.noteId === this.noteId || attr.value === this.noteId))) {
|
if (loadResults.getAttributes().find(attr => attr.type === 'relation' && (attr.noteId === this.noteId || attr.value === this.noteId))) {
|
||||||
this.refresh();
|
this.refresh();
|
||||||
}
|
}
|
||||||
|
@ -164,7 +164,7 @@ export default class NoteDetailWidget extends TabAwareWidget {
|
|||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
|
|
||||||
async focusOnDetailListener({tabId}) {
|
async focusOnDetailEvent({tabId}) {
|
||||||
if (this.tabContext.tabId === tabId) {
|
if (this.tabContext.tabId === tabId) {
|
||||||
await this.refresh();
|
await this.refresh();
|
||||||
|
|
||||||
@ -173,19 +173,19 @@ export default class NoteDetailWidget extends TabAwareWidget {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async beforeNoteSwitchListener({tabId}) {
|
async beforeNoteSwitchEvent({tabId}) {
|
||||||
if (this.isTab(tabId)) {
|
if (this.isTab(tabId)) {
|
||||||
await this.spacedUpdate.updateNowIfNecessary();
|
await this.spacedUpdate.updateNowIfNecessary();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async beforeTabRemoveListener({tabId}) {
|
async beforeTabRemoveEvent({tabId}) {
|
||||||
if (this.isTab(tabId)) {
|
if (this.isTab(tabId)) {
|
||||||
await this.spacedUpdate.updateNowIfNecessary();
|
await this.spacedUpdate.updateNowIfNecessary();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async printActiveNoteListener() {
|
async printActiveNoteEvent() {
|
||||||
if (!this.tabContext.isActive()) {
|
if (!this.tabContext.isActive()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -203,11 +203,11 @@ export default class NoteDetailWidget extends TabAwareWidget {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
hoistedNoteChangedListener() {
|
hoistedNoteChangedEvent() {
|
||||||
this.refresh();
|
this.refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
async entitiesReloadedListener({loadResults}) {
|
async entitiesReloadedEvent({loadResults}) {
|
||||||
// we should test what happens when the loaded note is deleted
|
// we should test what happens when the loaded note is deleted
|
||||||
|
|
||||||
if (loadResults.isNoteContentReloaded(this.noteId, this.componentId)) {
|
if (loadResults.isNoteContentReloaded(this.noteId, this.componentId)) {
|
||||||
@ -215,11 +215,11 @@ export default class NoteDetailWidget extends TabAwareWidget {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
beforeUnloadListener() {
|
beforeUnloadEvent() {
|
||||||
this.spacedUpdate.updateNowIfNecessary();
|
this.spacedUpdate.updateNowIfNecessary();
|
||||||
}
|
}
|
||||||
|
|
||||||
autoBookDisabledListener() {
|
autoBookDisabledEvent() {
|
||||||
this.refresh();
|
this.refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -67,7 +67,7 @@ export default class NoteInfoWidget extends CollapsibleWidget {
|
|||||||
.attr("title", note.mime);
|
.attr("title", note.mime);
|
||||||
}
|
}
|
||||||
|
|
||||||
entitiesReloadedListener({loadResults}) {
|
entitiesReloadedEvent({loadResults}) {
|
||||||
if (loadResults.isNoteReloaded(this.noteId)) {
|
if (loadResults.isNoteReloaded(this.noteId)) {
|
||||||
this.refresh();
|
this.refresh();
|
||||||
}
|
}
|
||||||
|
@ -70,7 +70,7 @@ class NoteRevisionsWidget extends CollapsibleWidget {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
entitiesReloadedListener({loadResults}) {
|
entitiesReloadedEvent({loadResults}) {
|
||||||
if (loadResults.hasNoteRevisionForNote(this.noteId)) {
|
if (loadResults.hasNoteRevisionForNote(this.noteId)) {
|
||||||
this.refresh();
|
this.refresh();
|
||||||
}
|
}
|
||||||
|
@ -54,25 +54,25 @@ export default class NoteTitleWidget extends TabAwareWidget {
|
|||||||
this.$noteTitle.prop("readonly", note.isProtected && !protectedSessionHolder.isProtectedSessionAvailable());
|
this.$noteTitle.prop("readonly", note.isProtected && !protectedSessionHolder.isProtectedSessionAvailable());
|
||||||
}
|
}
|
||||||
|
|
||||||
async beforeNoteSwitchListener({tabId}) {
|
async beforeNoteSwitchEvent({tabId}) {
|
||||||
if (this.isTab(tabId)) {
|
if (this.isTab(tabId)) {
|
||||||
await this.spacedUpdate.updateNowIfNecessary();
|
await this.spacedUpdate.updateNowIfNecessary();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async beforeTabRemoveListener({tabId}) {
|
async beforeTabRemoveEvent({tabId}) {
|
||||||
if (this.isTab(tabId)) {
|
if (this.isTab(tabId)) {
|
||||||
await this.spacedUpdate.updateNowIfNecessary();
|
await this.spacedUpdate.updateNowIfNecessary();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
focusOnTitleListener() {
|
focusOnTitleEvent() {
|
||||||
if (this.tabContext && this.tabContext.isActive()) {
|
if (this.tabContext && this.tabContext.isActive()) {
|
||||||
this.$noteTitle.trigger('focus');
|
this.$noteTitle.trigger('focus');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
focusAndSelectTitleListener() {
|
focusAndSelectTitleEvent() {
|
||||||
if (this.tabContext && this.tabContext.isActive()) {
|
if (this.tabContext && this.tabContext.isActive()) {
|
||||||
this.$noteTitle
|
this.$noteTitle
|
||||||
.trigger('focus')
|
.trigger('focus')
|
||||||
@ -80,7 +80,7 @@ export default class NoteTitleWidget extends TabAwareWidget {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
beforeUnloadListener() {
|
beforeUnloadEvent() {
|
||||||
this.spacedUpdate.updateNowIfNecessary();
|
this.spacedUpdate.updateNowIfNecessary();
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -33,7 +33,7 @@ export default class NoteTreeWidget extends TabAwareWidget {
|
|||||||
constructor(appContext, parent) {
|
constructor(appContext, parent) {
|
||||||
super(appContext, parent);
|
super(appContext, parent);
|
||||||
|
|
||||||
window.glob.cutIntoNote = () => this.cutIntoNoteListener();
|
window.glob.cutIntoNote = () => this.cutIntoNoteEvent();
|
||||||
|
|
||||||
this.tree = null;
|
this.tree = null;
|
||||||
}
|
}
|
||||||
@ -285,7 +285,7 @@ export default class NoteTreeWidget extends TabAwareWidget {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async scrollToActiveNoteListener() {
|
async scrollToActiveNoteEvent() {
|
||||||
const activeContext = appContext.tabManager.getActiveTabContext();
|
const activeContext = appContext.tabManager.getActiveTabContext();
|
||||||
|
|
||||||
if (activeContext && activeContext.notePath) {
|
if (activeContext && activeContext.notePath) {
|
||||||
@ -406,9 +406,9 @@ export default class NoteTreeWidget extends TabAwareWidget {
|
|||||||
await this.tree.reload(notes);
|
await this.tree.reload(notes);
|
||||||
}
|
}
|
||||||
|
|
||||||
createTopLevelNoteListener() { noteCreateService.createNewTopLevelNote(); }
|
createTopLevelNoteEvent() { noteCreateService.createNewTopLevelNote(); }
|
||||||
|
|
||||||
collapseTreeListener() { this.collapseTree(); }
|
collapseTreeEvent() { this.collapseTree(); }
|
||||||
|
|
||||||
isEnabled() {
|
isEnabled() {
|
||||||
return this.tabContext && this.tabContext.isActive();
|
return this.tabContext && this.tabContext.isActive();
|
||||||
@ -448,7 +448,7 @@ export default class NoteTreeWidget extends TabAwareWidget {
|
|||||||
toastService.showMessage("Saved search note refreshed.");
|
toastService.showMessage("Saved search note refreshed.");
|
||||||
}
|
}
|
||||||
|
|
||||||
async entitiesReloadedListener({loadResults}) {
|
async entitiesReloadedEvent({loadResults}) {
|
||||||
const noteIdsToUpdate = new Set();
|
const noteIdsToUpdate = new Set();
|
||||||
const noteIdsToReload = new Set();
|
const noteIdsToReload = new Set();
|
||||||
|
|
||||||
@ -547,7 +547,7 @@ export default class NoteTreeWidget extends TabAwareWidget {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async createNoteAfterListener() {
|
async createNoteAfterEvent() {
|
||||||
const node = this.getActiveNode();
|
const node = this.getActiveNode();
|
||||||
const parentNoteId = node.data.parentNoteId;
|
const parentNoteId = node.data.parentNoteId;
|
||||||
const isProtected = await treeService.getParentProtectedStatus(node);
|
const isProtected = await treeService.getParentProtectedStatus(node);
|
||||||
@ -564,7 +564,7 @@ export default class NoteTreeWidget extends TabAwareWidget {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async createNoteIntoListener() {
|
async createNoteIntoEvent() {
|
||||||
const node = this.getActiveNode();
|
const node = this.getActiveNode();
|
||||||
|
|
||||||
if (node) {
|
if (node) {
|
||||||
@ -575,7 +575,7 @@ export default class NoteTreeWidget extends TabAwareWidget {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async cutIntoNoteListener() {
|
async cutIntoNoteEvent() {
|
||||||
const node = this.getActiveNode();
|
const node = this.getActiveNode();
|
||||||
|
|
||||||
if (node) {
|
if (node) {
|
||||||
@ -610,11 +610,11 @@ export default class NoteTreeWidget extends TabAwareWidget {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
hoistedNoteChangedListener() {
|
hoistedNoteChangedEvent() {
|
||||||
this.reloadTreeFromCache();
|
this.reloadTreeFromCache();
|
||||||
}
|
}
|
||||||
|
|
||||||
treeCacheReloadedListener() {
|
treeCacheReloadedEvent() {
|
||||||
this.reloadTreeFromCache();
|
this.reloadTreeFromCache();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -66,7 +66,7 @@ export default class SearchBoxWidget extends BasicWidget {
|
|||||||
});
|
});
|
||||||
|
|
||||||
this.$doSearchButton.on('click', () => this.doSearch()); // keep long form because of argument
|
this.$doSearchButton.on('click', () => this.doSearch()); // keep long form because of argument
|
||||||
this.$resetSearchButton.on('click', () => this.resetSearchListener());
|
this.$resetSearchButton.on('click', () => this.resetSearchEvent());
|
||||||
|
|
||||||
this.$saveSearchButton.on('click', () => this.saveSearch());
|
this.$saveSearchButton.on('click', () => this.saveSearch());
|
||||||
|
|
||||||
@ -120,10 +120,10 @@ export default class SearchBoxWidget extends BasicWidget {
|
|||||||
content: JSON.stringify({ searchString: searchString })
|
content: JSON.stringify({ searchString: searchString })
|
||||||
});
|
});
|
||||||
|
|
||||||
this.resetSearchListener();
|
this.resetSearchEvent();
|
||||||
}
|
}
|
||||||
|
|
||||||
showSearchListener() {
|
showSearchEvent() {
|
||||||
utils.saveFocusedElement();
|
utils.saveFocusedElement();
|
||||||
|
|
||||||
this.$searchBox.slideDown();
|
this.$searchBox.slideDown();
|
||||||
@ -142,32 +142,32 @@ export default class SearchBoxWidget extends BasicWidget {
|
|||||||
this.$searchInput.trigger('focus');
|
this.$searchInput.trigger('focus');
|
||||||
}
|
}
|
||||||
|
|
||||||
hideSearchListener() {
|
hideSearchEvent() {
|
||||||
this.resetSearchListener();
|
this.resetSearchEvent();
|
||||||
|
|
||||||
this.$searchBox.slideUp();
|
this.$searchBox.slideUp();
|
||||||
|
|
||||||
this.triggerEvent('hideSearchResults');
|
this.triggerEvent('hideSearchResults');
|
||||||
}
|
}
|
||||||
|
|
||||||
toggleSearchListener() {
|
toggleSearchEvent() {
|
||||||
if (this.$searchBox.is(":hidden")) {
|
if (this.$searchBox.is(":hidden")) {
|
||||||
this.showSearchListener();
|
this.showSearchEvent();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
this.hideSearchListener();
|
this.hideSearchEvent();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
searchNotesListener() {
|
searchNotesEvent() {
|
||||||
this.toggleSearchListener();
|
this.toggleSearchEvent();
|
||||||
}
|
}
|
||||||
|
|
||||||
resetSearchListener() {
|
resetSearchEvent() {
|
||||||
this.$searchInput.val("");
|
this.$searchInput.val("");
|
||||||
}
|
}
|
||||||
|
|
||||||
searchInSubtreeListener({noteId}) {
|
searchInSubtreeEvent({noteId}) {
|
||||||
noteId = noteId || appContext.tabManager.getActiveTabNoteId();
|
noteId = noteId || appContext.tabManager.getActiveTabNoteId();
|
||||||
|
|
||||||
this.toggle(true);
|
this.toggle(true);
|
||||||
|
@ -39,7 +39,7 @@ export default class SearchResultsWidget extends BasicWidget {
|
|||||||
return this.$widget;
|
return this.$widget;
|
||||||
}
|
}
|
||||||
|
|
||||||
async searchForResultsListener({searchText}) {
|
async searchForResultsEvent({searchText}) {
|
||||||
this.toggle(true);
|
this.toggle(true);
|
||||||
|
|
||||||
const response = await server.get('search/' + encodeURIComponent(searchText));
|
const response = await server.get('search/' + encodeURIComponent(searchText));
|
||||||
@ -68,7 +68,7 @@ export default class SearchResultsWidget extends BasicWidget {
|
|||||||
toastService.showMessage("Search finished successfully.");
|
toastService.showMessage("Search finished successfully.");
|
||||||
}
|
}
|
||||||
|
|
||||||
hideSearchResultsListener() {
|
hideSearchResultsEvent() {
|
||||||
this.$searchResults.hide();
|
this.$searchResults.hide();
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -18,7 +18,7 @@ export default class SidePaneContainer extends FlexContainer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sidebarVisibilityChangedListener({side, show}) {
|
sidebarVisibilityChangedEvent({side, show}) {
|
||||||
if (this.side === side) {
|
if (this.side === side) {
|
||||||
this.toggle(show);
|
this.toggle(show);
|
||||||
|
|
||||||
|
@ -68,7 +68,7 @@ export default class SidePaneToggles extends BasicWidget {
|
|||||||
this.triggerEvent('sidebarVisibilityChanged', {side, show});
|
this.triggerEvent('sidebarVisibilityChanged', {side, show});
|
||||||
}
|
}
|
||||||
|
|
||||||
initialRenderCompleteListener() {
|
initialRenderCompleteEvent() {
|
||||||
splitService.setupSplit(this.paneVisible.left, this.paneVisible.right);
|
splitService.setupSplit(this.paneVisible.left, this.paneVisible.right);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -61,7 +61,7 @@ export default class SimilarNotesWidget extends CollapsibleWidget {
|
|||||||
this.$body.empty().append($list);
|
this.$body.empty().append($list);
|
||||||
}
|
}
|
||||||
|
|
||||||
entitiesReloadedListener({loadResults}) {
|
entitiesReloadedEvent({loadResults}) {
|
||||||
if (this.note && this.title !== this.note.title) {
|
if (this.note && this.title !== this.note.title) {
|
||||||
this.rendered = false;
|
this.rendered = false;
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@ import BasicWidget from "./basic_widget.js";
|
|||||||
import appContext from "../services/app_context.js";
|
import appContext from "../services/app_context.js";
|
||||||
|
|
||||||
export default class TabAwareWidget extends BasicWidget {
|
export default class TabAwareWidget extends BasicWidget {
|
||||||
setTabContextListener({tabContext}) {
|
setTabContextEvent({tabContext}) {
|
||||||
/** @var {TabContext} */
|
/** @var {TabContext} */
|
||||||
this.tabContext = tabContext;
|
this.tabContext = tabContext;
|
||||||
|
|
||||||
@ -29,7 +29,7 @@ export default class TabAwareWidget extends BasicWidget {
|
|||||||
return this.tabContext && this.tabContext.notePath;
|
return this.tabContext && this.tabContext.notePath;
|
||||||
}
|
}
|
||||||
|
|
||||||
tabNoteSwitchedListener({tabId, notePath}) {
|
tabNoteSwitchedEvent({tabId, notePath}) {
|
||||||
// if notePath does not match then the tabContext has been switched to another note in the mean time
|
// if notePath does not match then the tabContext has been switched to another note in the mean time
|
||||||
if (this.isTab(tabId) && this.notePath === notePath) {
|
if (this.isTab(tabId) && this.notePath === notePath) {
|
||||||
this.noteSwitched();
|
this.noteSwitched();
|
||||||
@ -68,17 +68,17 @@ export default class TabAwareWidget extends BasicWidget {
|
|||||||
|
|
||||||
refreshWithNote(note, notePath) {}
|
refreshWithNote(note, notePath) {}
|
||||||
|
|
||||||
activeTabChangedListener() {
|
activeTabChangedEvent() {
|
||||||
this.tabContext = appContext.tabManager.getActiveTabContext();
|
this.tabContext = appContext.tabManager.getActiveTabContext();
|
||||||
|
|
||||||
this.activeTabChanged();
|
this.activeTabChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
treeCacheReloadedListener() {
|
treeCacheReloadedEvent() {
|
||||||
this.refresh();
|
this.refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
lazyLoadedListener() {
|
lazyLoadedEvent() {
|
||||||
if (!this.tabContext) { // has not been loaded yet
|
if (!this.tabContext) { // has not been loaded yet
|
||||||
this.tabContext = appContext.tabManager.getActiveTabContext();
|
this.tabContext = appContext.tabManager.getActiveTabContext();
|
||||||
}
|
}
|
||||||
|
@ -48,7 +48,7 @@ export default class TabCachingWidget extends TabAwareWidget {
|
|||||||
widget.toggle(widget.isEnabled());
|
widget.toggle(widget.isEnabled());
|
||||||
}
|
}
|
||||||
|
|
||||||
tabRemovedListener({tabId}) {
|
tabRemovedEvent({tabId}) {
|
||||||
const widget = this.widgets[tabId];
|
const widget = this.widgets[tabId];
|
||||||
|
|
||||||
if (widget) {
|
if (widget) {
|
||||||
|
File diff suppressed because one or more lines are too long
@ -215,7 +215,7 @@ export default class TextTypeWidget extends TypeWidget {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
addTextToActiveEditorListener(text) {
|
addTextToActiveEditorEvent(text) {
|
||||||
if (!this.isActive()) {
|
if (!this.isActive()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -244,7 +244,7 @@ export default class TextTypeWidget extends TypeWidget {
|
|||||||
return !selection.isCollapsed;
|
return !selection.isCollapsed;
|
||||||
}
|
}
|
||||||
|
|
||||||
async executeInActiveEditorListener({callback}) {
|
async executeInActiveEditorEvent({callback}) {
|
||||||
if (!this.isActive()) {
|
if (!this.isActive()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -50,7 +50,7 @@ export default class WhatLinksHereWidget extends CollapsibleWidget {
|
|||||||
this.$body.empty().append($list);
|
this.$body.empty().append($list);
|
||||||
}
|
}
|
||||||
|
|
||||||
entitiesReloadedListener({loadResults}) {
|
entitiesReloadedEvent({loadResults}) {
|
||||||
if (loadResults.getAttributes().find(attr => attr.type === 'relation' && attr.value === this.noteId)) {
|
if (loadResults.getAttributes().find(attr => attr.type === 'relation' && attr.value === this.noteId)) {
|
||||||
this.refresh();
|
this.refresh();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user