Skip to content

Build your personal knowledge base with Trilium Notes

renamed Listener() to Event()

zadam880f4ad711cb
diff --git a/src/public/javascripts/services/app_context.js b/src/public/javascripts/services/app_context.js
index 79349981aa..cbc5bc1646 100644
--- a/src/public/javascripts/services/app_context.js
+++ b/src/public/javascripts/services/app_context.js
@@ -83,7 +83,7 @@ class AppContext extends Component {
return $(el).closest(".component").prop('component');
}
- async protectedSessionStartedListener() {
+ async protectedSessionStartedEvent() {
await treeCache.loadInitialTree();
this.triggerEvent('treeCacheReloaded');
diff --git a/src/public/javascripts/services/entrypoints.js b/src/public/javascripts/services/entrypoints.js
index 0206884fb6..c3d02c151a 100644
--- a/src/public/javascripts/services/entrypoints.js
+++ b/src/public/javascripts/services/entrypoints.js
@@ -29,13 +29,13 @@ export default class Entrypoints extends Component {
});
}
- openDevToolsListener() {
+ openDevToolsEvent() {
if (utils.isElectron()) {
require('electron').remote.getCurrentWindow().toggleDevTools();
}
}
- findInTextListener() {
+ findInTextEvent() {
if (!utils.isElectron()) {
return;
}
@@ -58,7 +58,7 @@ export default class Entrypoints extends Component {
- async createNoteIntoDayNoteListener() {
+ async createNoteIntoDayNoteEvent() {
const todayNote = await dateNoteService.getTodayNote();
const {note} = await server.post(`notes/${todayNote.noteId}/children?target=into`, {
@@ -77,7 +77,7 @@ export default class Entrypoints extends Component {
appContext.triggerEvent('focusAndSelectTitle');
}
- async toggleNoteHoistingListener() {
+ async toggleNoteHoistingEvent() {
const note = appContext.tabManager.getActiveTabNote();
const hoistedNoteId = hoistedNoteService.getHoistedNoteId();
@@ -93,11 +93,11 @@ export default class Entrypoints extends Component {
}
}
- copyWithoutFormattingListener() {
+ copyWithoutFormattingEvent() {
utils.copySelectionToClipboard();
}
- toggleFullscreenListener() {
+ toggleFullscreenEvent() {
if (utils.isElectron()) {
const win = require('electron').remote.getCurrentWindow();
@@ -111,7 +111,7 @@ export default class Entrypoints extends Component {
}
}
- toggleZenModeListener() {
+ toggleZenModeEvent() {
if (!this.zenModeActive) {
$(".hide-in-zen-mode,.gutter").addClass("hidden-by-zen-mode");
$("#container").addClass("zen-mode");
@@ -125,11 +125,11 @@ export default class Entrypoints extends Component {
}
}
- reloadFrontendAppListener() {
+ reloadFrontendAppEvent() {
utils.reloadApp();
}
- logoutListener() {
+ logoutEvent() {
const $logoutForm = $('<form action="logout" method="POST">')
.append($(`<input type="hidden" name="_csrf" value="${glob.csrfToken}"/>`));
@@ -137,27 +137,27 @@ export default class Entrypoints extends Component {
$logoutForm.trigger('submit');
}
- showOptionsListener() {
+ showOptionsEvent() {
import("../dialogs/options.js").then(d => d.showDialog())
}
- showHelpListener() {
+ showHelpEvent() {
import("../dialogs/help.js").then(d => d.showDialog())
}
- showSQLConsoleListener() {
+ showSQLConsoleEvent() {
import("../dialogs/sql_console.js").then(d => d.showDialog())
}
- showBackendLogListener() {
+ showBackendLogEvent() {
import("../dialogs/backend_log.js").then(d => d.showDialog())
}
- backInNoteHistoryListener() {
+ backInNoteHistoryEvent() {
window.history.back();
}
- forwardInNoteHistoryListener() {
+ forwardInNoteHistoryEvent() {
window.history.forward();
}
}
diff --git a/src/public/javascripts/services/spell_check.js b/src/public/javascripts/services/spell_check.js
index 8407d37ec0..f0979bed88 100644
--- a/src/public/javascripts/services/spell_check.js
+++ b/src/public/javascripts/services/spell_check.js
@@ -41,7 +41,7 @@ export async function initSpellCheck() {
});
});
- new ContextMenuListener(async (info) => {
+ new ContextMenuEvent(async (info) => {
await contextMenuBuilder.showPopupMenu(info);
});
}
\ No newline at end of file
diff --git a/src/public/javascripts/services/tab_context.js b/src/public/javascripts/services/tab_context.js
index 20bf8bfb2a..12ac88574d 100644
--- a/src/public/javascripts/services/tab_context.js
+++ b/src/public/javascripts/services/tab_context.js
@@ -98,7 +98,7 @@ class TabContext extends Component {
}
}
- async entitiesReloadedListener({loadResults}) {
+ async entitiesReloadedEvent({loadResults}) {
if (loadResults.isNoteReloaded(this.noteId)) {
const note = await treeCache.getNote(this.noteId);
diff --git a/src/public/javascripts/services/tab_manager.js b/src/public/javascripts/services/tab_manager.js
index c4264849cf..b2472904fc 100644
--- a/src/public/javascripts/services/tab_manager.js
+++ b/src/public/javascripts/services/tab_manager.js
@@ -99,7 +99,7 @@ export default class TabManager extends Component {
});
}
- tabNoteSwitchedListener({tabId}) {
+ tabNoteSwitchedEvent({tabId}) {
if (tabId === this.activeTabId) {
this.setCurrentNotePathToHash();
}
@@ -228,7 +228,7 @@ export default class TabManager extends Component {
this.openAndActivateEmptyTab();
}
else {
- this.activateNextTabListener();
+ this.activateNextTabEvent();
}
this.children = this.children.filter(tc => tc.tabId !== tabId);
@@ -238,7 +238,7 @@ export default class TabManager extends Component {
this.tabsUpdate.scheduleUpdate();
}
- tabReorderListener({tabIdsInOrder}) {
+ tabReorderEvent({tabIdsInOrder}) {
const order = {};
for (const i in tabIdsInOrder) {
@@ -250,39 +250,39 @@ export default class TabManager extends Component {
this.tabsUpdate.scheduleUpdate();
}
- activateNextTabListener() {
+ activateNextTabEvent() {
const oldIdx = this.tabContexts.findIndex(tc => tc.tabId === this.activeTabId);
const newActiveTabId = this.tabContexts[oldIdx === this.tabContexts.length - 1 ? 0 : oldIdx + 1].tabId;
this.activateTab(newActiveTabId);
}
- activatePreviousTabListener() {
+ activatePreviousTabEvent() {
const oldIdx = this.tabContexts.findIndex(tc => tc.tabId === this.activeTabId);
const newActiveTabId = this.tabContexts[oldIdx === 0 ? this.tabContexts.length - 1 : oldIdx - 1].tabId;
this.activateTab(newActiveTabId);
}
- closeActiveTabListener() {
+ closeActiveTabEvent() {
this.removeTab(this.activeTabId);
}
- beforeUnloadListener() {
+ beforeUnloadEvent() {
this.tabsUpdate.updateNowIfNecessary();
}
- openNewTabListener() {
+ openNewTabEvent() {
this.openAndActivateEmptyTab();
}
- async removeAllTabsListener() {
+ async removeAllTabsEvent() {
for (const tabIdToRemove of this.tabContexts.map(tc => tc.tabId)) {
await this.removeTab(tabIdToRemove);
}
}
- async removeAllTabsExceptForThisListener({tabId}) {
+ async removeAllTabsExceptForThisEvent({tabId}) {
for (const tabIdToRemove of this.tabContexts.map(tc => tc.tabId)) {
if (tabIdToRemove !== tabId) {
await this.removeTab(tabIdToRemove);
@@ -290,7 +290,7 @@ export default class TabManager extends Component {
}
}
- async hoistedNoteChangedListener({hoistedNoteId}) {
+ async hoistedNoteChangedEvent({hoistedNoteId}) {
if (hoistedNoteId === 'root') {
return;
}
diff --git a/src/public/javascripts/services/zoom.js b/src/public/javascripts/services/zoom.js
index f0fa83c66b..58d4aa88ba 100644
--- a/src/public/javascripts/services/zoom.js
+++ b/src/public/javascripts/services/zoom.js
@@ -33,15 +33,15 @@ export default class ZoomService extends Component {
return require('electron').webFrame.getZoomFactor();
}
- zoomOutListener() {
+ zoomOutEvent() {
this.setZoomFactorAndSave(this.getCurrentZoom() - 0.1);
}
- zoomInListener() {
+ zoomInEvent() {
this.setZoomFactorAndSave(this.getCurrentZoom() + 0.1);
}
- setZoomFactorAndSaveListener({zoomFactor}) {
+ setZoomFactorAndSaveEvent({zoomFactor}) {
this.setZoomFactorAndSave(zoomFactor);
}
}
\ No newline at end of file
diff --git a/src/public/javascripts/widgets/attributes.js b/src/public/javascripts/widgets/attributes.js
index ab28b97e2f..dd00bd394c 100644
--- a/src/public/javascripts/widgets/attributes.js
+++ b/src/public/javascripts/widgets/attributes.js
@@ -98,7 +98,7 @@ export default class AttributesWidget extends CollapsibleWidget {
}
}
- entitiesReloadedListener({loadResults}) {
+ entitiesReloadedEvent({loadResults}) {
if (loadResults.getAttributes().find(attr => attr.noteId === this.noteId)) {
this.refresh();
}
diff --git a/src/public/javascripts/widgets/link_map.js b/src/public/javascripts/widgets/link_map.js
index 744e4ef604..0a7ab77fdf 100644
--- a/src/public/javascripts/widgets/link_map.js
+++ b/src/public/javascripts/widgets/link_map.js
@@ -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))) {
this.refresh();
}
diff --git a/src/public/javascripts/widgets/note_detail.js b/src/public/javascripts/widgets/note_detail.js
index 7d2f5e02fb..4251f2a083 100644
--- a/src/public/javascripts/widgets/note_detail.js
+++ b/src/public/javascripts/widgets/note_detail.js
@@ -164,7 +164,7 @@ export default class NoteDetailWidget extends TabAwareWidget {
return type;
}
- async focusOnDetailListener({tabId}) {
+ async focusOnDetailEvent({tabId}) {
if (this.tabContext.tabId === tabId) {
await this.refresh();
@@ -173,19 +173,19 @@ export default class NoteDetailWidget extends TabAwareWidget {
}
}
- async beforeNoteSwitchListener({tabId}) {
+ async beforeNoteSwitchEvent({tabId}) {
if (this.isTab(tabId)) {
await this.spacedUpdate.updateNowIfNecessary();
}
}
- async beforeTabRemoveListener({tabId}) {
+ async beforeTabRemoveEvent({tabId}) {
if (this.isTab(tabId)) {
await this.spacedUpdate.updateNowIfNecessary();
}
}
- async printActiveNoteListener() {
+ async printActiveNoteEvent() {
if (!this.tabContext.isActive()) {
return;
}
@@ -203,11 +203,11 @@ export default class NoteDetailWidget extends TabAwareWidget {
});
}
- hoistedNoteChangedListener() {
+ hoistedNoteChangedEvent() {
this.refresh();
}
- async entitiesReloadedListener({loadResults}) {
+ async entitiesReloadedEvent({loadResults}) {
// we should test what happens when the loaded note is deleted
if (loadResults.isNoteContentReloaded(this.noteId, this.componentId)) {
@@ -215,11 +215,11 @@ export default class NoteDetailWidget extends TabAwareWidget {
}
}
- beforeUnloadListener() {
+ beforeUnloadEvent() {
this.spacedUpdate.updateNowIfNecessary();
}
- autoBookDisabledListener() {
+ autoBookDisabledEvent() {
this.refresh();
}
diff --git a/src/public/javascripts/widgets/note_info.js b/src/public/javascripts/widgets/note_info.js
index a56dc97076..7eac5f9ff6 100644
--- a/src/public/javascripts/widgets/note_info.js
+++ b/src/public/javascripts/widgets/note_info.js
@@ -67,7 +67,7 @@ export default class NoteInfoWidget extends CollapsibleWidget {
.attr("title", note.mime);
}
- entitiesReloadedListener({loadResults}) {
+ entitiesReloadedEvent({loadResults}) {
if (loadResults.isNoteReloaded(this.noteId)) {
this.refresh();
}
diff --git a/src/public/javascripts/widgets/note_revisions.js b/src/public/javascripts/widgets/note_revisions.js
index d3aeb0013d..e2c8c08d92 100644
--- a/src/public/javascripts/widgets/note_revisions.js
+++ b/src/public/javascripts/widgets/note_revisions.js
@@ -70,7 +70,7 @@ class NoteRevisionsWidget extends CollapsibleWidget {
}
}
- entitiesReloadedListener({loadResults}) {
+ entitiesReloadedEvent({loadResults}) {
if (loadResults.hasNoteRevisionForNote(this.noteId)) {
this.refresh();
}
diff --git a/src/public/javascripts/widgets/note_title.js b/src/public/javascripts/widgets/note_title.js
index 03d9f5b0a2..e0dc5e4e38 100644
--- a/src/public/javascripts/widgets/note_title.js
+++ b/src/public/javascripts/widgets/note_title.js
@@ -54,25 +54,25 @@ export default class NoteTitleWidget extends TabAwareWidget {
this.$noteTitle.prop("readonly", note.isProtected && !protectedSessionHolder.isProtectedSessionAvailable());
}
- async beforeNoteSwitchListener({tabId}) {
+ async beforeNoteSwitchEvent({tabId}) {
if (this.isTab(tabId)) {
await this.spacedUpdate.updateNowIfNecessary();
}
}
- async beforeTabRemoveListener({tabId}) {
+ async beforeTabRemoveEvent({tabId}) {
if (this.isTab(tabId)) {
await this.spacedUpdate.updateNowIfNecessary();
}
}
- focusOnTitleListener() {
+ focusOnTitleEvent() {
if (this.tabContext && this.tabContext.isActive()) {
this.$noteTitle.trigger('focus');
}
}
- focusAndSelectTitleListener() {
+ focusAndSelectTitleEvent() {
if (this.tabContext && this.tabContext.isActive()) {
this.$noteTitle
.trigger('focus')
@@ -80,7 +80,7 @@ export default class NoteTitleWidget extends TabAwareWidget {
}
}
- beforeUnloadListener() {
+ beforeUnloadEvent() {
this.spacedUpdate.updateNowIfNecessary();
}
}
\ No newline at end of file
diff --git a/src/public/javascripts/widgets/note_tree.js b/src/public/javascripts/widgets/note_tree.js
index 8dd54194a8..771c0ca3e1 100644
--- a/src/public/javascripts/widgets/note_tree.js
+++ b/src/public/javascripts/widgets/note_tree.js
@@ -33,7 +33,7 @@ export default class NoteTreeWidget extends TabAwareWidget {
constructor(appContext, parent) {
super(appContext, parent);
- window.glob.cutIntoNote = () => this.cutIntoNoteListener();
+ window.glob.cutIntoNote = () => this.cutIntoNoteEvent();
this.tree = null;
}
@@ -285,7 +285,7 @@ export default class NoteTreeWidget extends TabAwareWidget {
}
}
- async scrollToActiveNoteListener() {
+ async scrollToActiveNoteEvent() {
const activeContext = appContext.tabManager.getActiveTabContext();
if (activeContext && activeContext.notePath) {
@@ -406,9 +406,9 @@ export default class NoteTreeWidget extends TabAwareWidget {
await this.tree.reload(notes);
}
- createTopLevelNoteListener() { noteCreateService.createNewTopLevelNote(); }
+ createTopLevelNoteEvent() { noteCreateService.createNewTopLevelNote(); }
- collapseTreeListener() { this.collapseTree(); }
+ collapseTreeEvent() { this.collapseTree(); }
isEnabled() {
return this.tabContext && this.tabContext.isActive();
@@ -448,7 +448,7 @@ export default class NoteTreeWidget extends TabAwareWidget {
toastService.showMessage("Saved search note refreshed.");
}
- async entitiesReloadedListener({loadResults}) {
+ async entitiesReloadedEvent({loadResults}) {
const noteIdsToUpdate = 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 parentNoteId = node.data.parentNoteId;
const isProtected = await treeService.getParentProtectedStatus(node);
@@ -564,7 +564,7 @@ export default class NoteTreeWidget extends TabAwareWidget {
});
}
- async createNoteIntoListener() {
+ async createNoteIntoEvent() {
const node = this.getActiveNode();
if (node) {
@@ -575,7 +575,7 @@ export default class NoteTreeWidget extends TabAwareWidget {
}
}
- async cutIntoNoteListener() {
+ async cutIntoNoteEvent() {
const node = this.getActiveNode();
if (node) {
@@ -610,11 +610,11 @@ export default class NoteTreeWidget extends TabAwareWidget {
}
}
- hoistedNoteChangedListener() {
+ hoistedNoteChangedEvent() {
this.reloadTreeFromCache();
}
- treeCacheReloadedListener() {
+ treeCacheReloadedEvent() {
this.reloadTreeFromCache();
}
diff --git a/src/public/javascripts/widgets/search_box.js b/src/public/javascripts/widgets/search_box.js
index db2823a7a5..637053df5c 100644
--- a/src/public/javascripts/widgets/search_box.js
+++ b/src/public/javascripts/widgets/search_box.js
@@ -66,7 +66,7 @@ export default class SearchBoxWidget extends BasicWidget {
});
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());
@@ -120,10 +120,10 @@ export default class SearchBoxWidget extends BasicWidget {
content: JSON.stringify({ searchString: searchString })
});
- this.resetSearchListener();
+ this.resetSearchEvent();
}
- showSearchListener() {
+ showSearchEvent() {
utils.saveFocusedElement();
this.$searchBox.slideDown();
@@ -142,32 +142,32 @@ export default class SearchBoxWidget extends BasicWidget {
this.$searchInput.trigger('focus');
}
- hideSearchListener() {
- this.resetSearchListener();
+ hideSearchEvent() {
+ this.resetSearchEvent();
this.$searchBox.slideUp();
this.triggerEvent('hideSearchResults');
}
- toggleSearchListener() {
+ toggleSearchEvent() {
if (this.$searchBox.is(":hidden")) {
- this.showSearchListener();
+ this.showSearchEvent();
}
else {
- this.hideSearchListener();
+ this.hideSearchEvent();
}
}
- searchNotesListener() {
- this.toggleSearchListener();
+ searchNotesEvent() {
+ this.toggleSearchEvent();
}
- resetSearchListener() {
+ resetSearchEvent() {
this.$searchInput.val("");
}
- searchInSubtreeListener({noteId}) {
+ searchInSubtreeEvent({noteId}) {
noteId = noteId || appContext.tabManager.getActiveTabNoteId();
this.toggle(true);
diff --git a/src/public/javascripts/widgets/search_results.js b/src/public/javascripts/widgets/search_results.js
index c19ec0cbe8..fad5a801d0 100644
--- a/src/public/javascripts/widgets/search_results.js
+++ b/src/public/javascripts/widgets/search_results.js
@@ -39,7 +39,7 @@ export default class SearchResultsWidget extends BasicWidget {
return this.$widget;
}
- async searchForResultsListener({searchText}) {
+ async searchForResultsEvent({searchText}) {
this.toggle(true);
const response = await server.get('search/' + encodeURIComponent(searchText));
@@ -68,7 +68,7 @@ export default class SearchResultsWidget extends BasicWidget {
toastService.showMessage("Search finished successfully.");
}
- hideSearchResultsListener() {
+ hideSearchResultsEvent() {
this.$searchResults.hide();
}
}
\ No newline at end of file
diff --git a/src/public/javascripts/widgets/side_pane_container.js b/src/public/javascripts/widgets/side_pane_container.js
index c3db27faa4..5fc8e5e719 100644
--- a/src/public/javascripts/widgets/side_pane_container.js
+++ b/src/public/javascripts/widgets/side_pane_container.js
@@ -18,7 +18,7 @@ export default class SidePaneContainer extends FlexContainer {
}
}
- sidebarVisibilityChangedListener({side, show}) {
+ sidebarVisibilityChangedEvent({side, show}) {
if (this.side === side) {
this.toggle(show);
diff --git a/src/public/javascripts/widgets/side_pane_toggles.js b/src/public/javascripts/widgets/side_pane_toggles.js
index b4e47592b0..91c5396c19 100644
--- a/src/public/javascripts/widgets/side_pane_toggles.js
+++ b/src/public/javascripts/widgets/side_pane_toggles.js
@@ -68,7 +68,7 @@ export default class SidePaneToggles extends BasicWidget {
this.triggerEvent('sidebarVisibilityChanged', {side, show});
}
- initialRenderCompleteListener() {
+ initialRenderCompleteEvent() {
splitService.setupSplit(this.paneVisible.left, this.paneVisible.right);
}
}
diff --git a/src/public/javascripts/widgets/similar_notes.js b/src/public/javascripts/widgets/similar_notes.js
index 22095b40f1..05f77b9623 100644
--- a/src/public/javascripts/widgets/similar_notes.js
+++ b/src/public/javascripts/widgets/similar_notes.js
@@ -61,7 +61,7 @@ export default class SimilarNotesWidget extends CollapsibleWidget {
this.$body.empty().append($list);
}
- entitiesReloadedListener({loadResults}) {
+ entitiesReloadedEvent({loadResults}) {
if (this.note && this.title !== this.note.title) {
this.rendered = false;
diff --git a/src/public/javascripts/widgets/tab_aware_widget.js b/src/public/javascripts/widgets/tab_aware_widget.js
index c6eff4f1b9..333c21c09a 100644
--- a/src/public/javascripts/widgets/tab_aware_widget.js
+++ b/src/public/javascripts/widgets/tab_aware_widget.js
@@ -2,7 +2,7 @@ import BasicWidget from "./basic_widget.js";
import appContext from "../services/app_context.js";
export default class TabAwareWidget extends BasicWidget {
- setTabContextListener({tabContext}) {
+ setTabContextEvent({tabContext}) {
/** @var {TabContext} */
this.tabContext = tabContext;
@@ -29,7 +29,7 @@ export default class TabAwareWidget extends BasicWidget {
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 (this.isTab(tabId) && this.notePath === notePath) {
this.noteSwitched();
@@ -68,17 +68,17 @@ export default class TabAwareWidget extends BasicWidget {
refreshWithNote(note, notePath) {}
- activeTabChangedListener() {
+ activeTabChangedEvent() {
this.tabContext = appContext.tabManager.getActiveTabContext();
this.activeTabChanged();
}
- treeCacheReloadedListener() {
+ treeCacheReloadedEvent() {
this.refresh();
}
- lazyLoadedListener() {
+ lazyLoadedEvent() {
if (!this.tabContext) { // has not been loaded yet
this.tabContext = appContext.tabManager.getActiveTabContext();
}
diff --git a/src/public/javascripts/widgets/tab_caching_widget.js b/src/public/javascripts/widgets/tab_caching_widget.js
index 0e3dd6b0cc..051d061ae9 100644
--- a/src/public/javascripts/widgets/tab_caching_widget.js
+++ b/src/public/javascripts/widgets/tab_caching_widget.js
@@ -48,7 +48,7 @@ export default class TabCachingWidget extends TabAwareWidget {
widget.toggle(widget.isEnabled());
}
- tabRemovedListener({tabId}) {
+ tabRemovedEvent({tabId}) {
const widget = this.widgets[tabId];
if (widget) {
diff --git a/src/public/javascripts/widgets/tab_row.js b/src/public/javascripts/widgets/tab_row.js
index 1ea1a80e2c..001a15942d 100644
--- a/src/public/javascripts/widgets/tab_row.js
+++ b/src/public/javascripts/widgets/tab_row.js
@@ -11,7 +11,7 @@ import utils from "../services/utils.js";
import keyboardActionService from "../services/keyboard_actions.js";
import appContext from "../services/app_context.js";
-!function(i, e){"function"==typeof define&&define.amd?define("jquery-bridget/jquery-bridget",["jquery"],function(t){return e(i,t)}):"object"==typeof module&&module.exports?module.exports=e(i,require("jquery")):i.jQueryBridget=e(i,i.jQuery)}(window,function(t, i){"use strict";var c=Array.prototype.slice,e=t.console,p=void 0===e?function(){}:function(t){e.error(t)};function n(d, o, u){(u=u||i||t.jQuery)&&(o.prototype.option||(o.prototype.option=function(t){u.isPlainObject(t)&&(this.options=u.extend(!0,this.options,t))}),u.fn[d]=function(t){if("string"==typeof t){var i=c.call(arguments,1);return s=i,a="$()."+d+'("'+(r=t)+'")',(e=this).each(function(t, i){var e=u.data(i,d);if(e){var n=e[r];if(n&&"_"!=r.charAt(0)){var o=n.apply(e,s);h=void 0===h?o:h}else p(a+" is not a valid method")}else p(d+" not initialized. Cannot call methods, i.e. "+a)}),void 0!==h?h:e}var e,r,s,h,a,n;return n=t,this.each(function(t, i){var e=u.data(i,d);e?(e.option(n),e._init()):(e=new o(i,n),u.data(i,d,e))}),this},r(u))}function r(t){!t||t&&t.bridget||(t.bridget=n)}return r(i||t.jQuery),n}),function(t, i){"use strict";"function"==typeof define&&define.amd?define("get-size/get-size",[],function(){return i()}):"object"==typeof module&&module.exports?module.exports=i():t.getSize=i()}(window,function(){"use strict";function m(t){var i=parseFloat(t);return-1==t.indexOf("%")&&!isNaN(i)&&i}var e="undefined"==typeof console?function(){}:function(t){console.error(t)},y=["paddingLeft","paddingRight","paddingTop","paddingBottom","marginLeft","marginRight","marginTop","marginBottom","borderLeftWidth","borderRightWidth","borderTopWidth","borderBottomWidth"],b=y.length;function E(t){var i=getComputedStyle(t);return i||e("Style returned "+i+". Are you running this code in a hidden iframe on Firefox? See http://bit.ly/getsizebug1"),i}var _,x=!1;function P(t){if(function(){if(!x){x=!0;var t=document.createElement("div");t.style.width="200px",t.style.padding="1px 2px 3px 4px",t.style.borderStyle="solid",t.style.borderWidth="1px 2px 3px 4px",t.style.boxSizing="border-box";var i=document.body||document.documentElement;i.appendChild(t);var e=E(t);P.isBoxSizeOuter=_=200==m(e.width),i.removeChild(t)}}(),"string"==typeof t&&(t=document.querySelector(t)),t&&"object"==typeof t&&t.nodeType){var i=E(t);if("none"==i.display)return function(){for(var t={width:0,height:0,innerWidth:0,innerHeight:0,outerWidth:0,outerHeight:0},i=0; i<b; i++)t[y[i]]=0;return t}();var e={};e.width=t.offsetWidth,e.height=t.offsetHeight;for(var n=e.isBorderBox="border-box"==i.boxSizing,o=0; o<b; o++){var r=y[o],s=i[r],h=parseFloat(s);e[r]=isNaN(h)?0:h}var a=e.paddingLeft+e.paddingRight,d=e.paddingTop+e.paddingBottom,u=e.marginLeft+e.marginRight,c=e.marginTop+e.marginBottom,p=e.borderLeftWidth+e.borderRightWidth,f=e.borderTopWidth+e.borderBottomWidth,g=n&&_,l=m(i.width);!1!==l&&(e.width=l+(g?0:a+p));var v=m(i.height);return!1!==v&&(e.height=v+(g?0:d+f)),e.innerWidth=e.width-(a+p),e.innerHeight=e.height-(d+f),e.outerWidth=e.width+u,e.outerHeight=e.height+c,e}}return P}),function(t, i){"function"==typeof define&&define.amd?define("ev-emitter/ev-emitter",i):"object"==typeof module&&module.exports?module.exports=i():t.EvEmitter=i()}("undefined"!=typeof window?window:this,function(){function t(){}var i=t.prototype;return i.on=function(t, i){if(t&&i){var e=this._events=this._events||{},n=e[t]=e[t]||[];return-1==n.indexOf(i)&&n.push(i),this}},i.once=function(t, i){if(t&&i){this.on(t,i);var e=this._onceEvents=this._onceEvents||{};return(e[t]=e[t]||{})[i]=!0,this}},i.off=function(t, i){var e=this._events&&this._events[t];if(e&&e.length){var n=e.indexOf(i);return-1!=n&&e.splice(n,1),this}},i.emitEvent=function(t, i){var e=this._events&&this._events[t];if(e&&e.length){e=e.slice(0),i=i||[];for(var n=this._onceEvents&&this._onceEvents[t],o=0; o<e.length; o++){var r=e[o];n&&n[r]&&(this.off(t,r),delete n[r]),r.apply(this,i)}return this}},i.allOff=function(){delete this._events,delete this._onceEvents},t}),function(i, e){"function"==typeof define&&define.amd?define("unipointer/unipointer",["ev-emitter/ev-emitter"],function(t){return e(i,t)}):"object"==typeof module&&module.exports?module.exports=e(i,require("ev-emitter")):i.Unipointer=e(i,i.EvEmitter)}(window,function(o, t){function i(){}var e=i.prototype=Object.create(t.prototype);e.bindStartEvent=function(t){this._bindStartEvent(t,!0)},e.unbindStartEvent=function(t){this._bindStartEvent(t,!1)},e._bindStartEvent=function(t, i){var e=(i=void 0===i||i)?"addEventListener":"removeEventListener",n="mousedown";o.PointerEvent?n="pointerdown":"ontouchstart"in o&&(n="touchstart"),t[e](n,this)},e.handleEvent=function(t){var i="on"+t.type;this[i]&&this[i](t)},e.getTouch=function(t){for(var i=0; i<t.length; i++){var e=t[i];if(e.identifier==this.pointerIdentifier)return e}},e.onmousedown=function(t){var i=t.button;i&&0!==i&&1!==i||this._pointerDown(t,t)},e.ontouchstart=function(t){this._pointerDown(t,t.changedTouches[0])},e.onpointerdown=function(t){this._pointerDown(t,t)},e._pointerDown=function(t, i){t.button||this.isPointerDown||(this.isPointerDown=!0,this.pointerIdentifier=void 0!==i.pointerId?i.pointerId:i.identifier,this.pointerDown(t,i))},e.pointerDown=function(t, i){this._bindPostStartEvents(t),this.emitEvent("pointerDown",[t,i])};var n={mousedown:["mousemove","mouseup"],touchstart:["touchmove","touchend","touchcancel"],pointerdown:["pointermove","pointerup","pointercancel"]};return e._bindPostStartEvents=function(t){if(t){var i=n[t.type];i.forEach(function(t){o.addEventListener(t,this)},this),this._boundPointerEvents=i}},e._unbindPostStartEvents=function(){this._boundPointerEvents&&(this._boundPointerEvents.forEach(function(t){o.removeEventListener(t,this)},this),delete this._boundPointerEvents)},e.onmousemove=function(t){this._pointerMove(t,t)},e.onpointermove=function(t){t.pointerId==this.pointerIdentifier&&this._pointerMove(t,t)},e.ontouchmove=function(t){var i=this.getTouch(t.changedTouches);i&&this._pointerMove(t,i)},e._pointerMove=function(t, i){this.pointerMove(t,i)},e.pointerMove=function(t, i){this.emitEvent("pointerMove",[t,i])},e.onmouseup=function(t){this._pointerUp(t,t)},e.onpointerup=function(t){t.pointerId==this.pointerIdentifier&&this._pointerUp(t,t)},e.ontouchend=function(t){var i=this.getTouch(t.changedTouches);i&&this._pointerUp(t,i)},e._pointerUp=function(t, i){this._pointerDone(),this.pointerUp(t,i)},e.pointerUp=function(t, i){this.emitEvent("pointerUp",[t,i])},e._pointerDone=function(){this._pointerReset(),this._unbindPostStartEvents(),this.pointerDone()},e._pointerReset=function(){this.isPointerDown=!1,delete this.pointerIdentifier},e.pointerDone=function(){},e.onpointercancel=function(t){t.pointerId==this.pointerIdentifier&&this._pointerCancel(t,t)},e.ontouchcancel=function(t){var i=this.getTouch(t.changedTouches);i&&this._pointerCancel(t,i)},e._pointerCancel=function(t, i){this._pointerDone(),this.pointerCancel(t,i)},e.pointerCancel=function(t, i){this.emitEvent("pointerCancel",[t,i])},i.getPointerPoint=function(t){return{x:t.pageX,y:t.pageY}},i}),function(i, e){"function"==typeof define&&define.amd?define("unidragger/unidragger",["unipointer/unipointer"],function(t){return e(i,t)}):"object"==typeof module&&module.exports?module.exports=e(i,require("unipointer")):i.Unidragger=e(i,i.Unipointer)}(window,function(r, t){function i(){}var e=i.prototype=Object.create(t.prototype);e.bindHandles=function(){this._bindHandles(!0)},e.unbindHandles=function(){this._bindHandles(!1)},e._bindHandles=function(t){for(var i=(t=void 0===t||t)?"addEventListener":"removeEventListener",e=t?this._touchActionValue:"",n=0; n<this.handles.length; n++){var o=this.handles[n];this._bindStartEvent(o,t),o[i]("click",this),r.PointerEvent&&(o.style.touchAction=e)}},e._touchActionValue="none",e.pointerDown=function(t, i){this.okayPointerDown(t)&&(this.pointerDownPointer=i,t.preventDefault(),this.pointerDownBlur(),this._bindPostStartEvents(t),this.emitEvent("pointerDown",[t,i]))};var o={TEXTAREA:!0,INPUT:!0,SELECT:!0,OPTION:!0},s={radio:!0,checkbox:!0,button:!0,submit:!0,image:!0,file:!0};return e.okayPointerDown=function(t){var i=o[t.target.nodeName],e=s[t.target.type],n=!i||e;return n||this._pointerReset(),n},e.pointerDownBlur=function(){var t=document.activeElement;t&&t.blur&&t!=document.body&&t.blur()},e.pointerMove=function(t, i){var e=this._dragPointerMove(t,i);this.emitEvent("pointerMove",[t,i,e]),this._dragMove(t,i,e)},e._dragPointerMove=function(t, i){var e={x:i.pageX-this.pointerDownPointer.pageX,y:i.pageY-this.pointerDownPointer.pageY};return!this.isDragging&&this.hasDragStarted(e)&&this._dragStart(t,i),e},e.hasDragStarted=function(t){return 3<Math.abs(t.x)||3<Math.abs(t.y)},e.pointerUp=function(t, i){this.emitEvent("pointerUp",[t,i]),this._dragPointerUp(t,i)},e._dragPointerUp=function(t, i){this.isDragging?this._dragEnd(t,i):this._staticClick(t,i)},e._dragStart=function(t, i){this.isDragging=!0,this.isPreventingClicks=!0,this.dragStart(t,i)},e.dragStart=function(t, i){this.emitEvent("dragStart",[t,i])},e._dragMove=function(t, i, e){this.isDragging&&this.dragMove(t,i,e)},e.dragMove=function(t, i, e){t.preventDefault(),this.emitEvent("dragMove",[t,i,e])},e._dragEnd=function(t, i){this.isDragging=!1,setTimeout(function(){delete this.isPreventingClicks}.bind(this)),this.dragEnd(t,i)},e.dragEnd=function(t, i){this.emitEvent("dragEnd",[t,i])},e.onclick=function(t){this.isPreventingClicks&&t.preventDefault()},e._staticClick=function(t, i){this.isIgnoringMouseUp&&"mouseup"==t.type||(this.staticClick(t,i),"mouseup"!=t.type&&(this.isIgnoringMouseUp=!0,setTimeout(function(){delete this.isIgnoringMouseUp}.bind(this),400)))},e.staticClick=function(t, i){this.emitEvent("staticClick",[t,i])},i.getPointerPoint=t.getPointerPoint,i}),function(e, n){"function"==typeof define&&define.amd?define(["get-size/get-size","unidragger/unidragger"],function(t, i){return n(e,t,i)}):"object"==typeof module&&module.exports?module.exports=n(e,require("get-size"),require("unidragger")):e.Draggabilly=n(e,e.getSize,e.Unidragger)}(window,function(r, a, t){function e(t, i){for(var e in i)t[e]=i[e];return t}var n=r.jQuery;function i(t, i){this.element="string"==typeof t?document.querySelector(t):t,n&&(this.$element=n(this.element)),this.options=e({},this.constructor.defaults),this.option(i),this._create()}var o=i.prototype=Object.create(t.prototype);i.defaults={},o.option=function(t){e(this.options,t)};var s={relative:!0,absolute:!0,fixed:!0};function d(t, i, e){return e=e||"round",i?Math[e](t/i)*i:t}return o._create=function(){this.position={},this._getPosition(),this.startPoint={x:0,y:0},this.dragPoint={x:0,y:0},this.startPosition=e({},this.position);var t=getComputedStyle(this.element);s[t.position]||(this.element.style.position="relative"),this.on("pointerDown",this.onPointerDown),this.on("pointerMove",this.onPointerMove),this.on("pointerUp",this.onPointerUp),this.enable(),this.setHandles()},o.setHandles=function(){this.handles=this.options.handle?this.element.querySelectorAll(this.options.handle):[this.element],this.bindHandles()},o.dispatchEvent=function(t, i, e){var n=[i].concat(e);this.emitEvent(t,n),this.dispatchJQueryEvent(t,i,e)},o.dispatchJQueryEvent=function(t, i, e){var n=r.jQuery;if(n&&this.$element){var o=n.Event(i);o.type=t,this.$element.trigger(o,e)}},o._getPosition=function(){var t=getComputedStyle(this.element),i=this._getPositionCoord(t.left,"width"),e=this._getPositionCoord(t.top,"height");this.position.x=isNaN(i)?0:i,this.position.y=isNaN(e)?0:e,this._addTransformPosition(t)},o._getPositionCoord=function(t, i){if(-1!=t.indexOf("%")){var e=a(this.element.parentNode);return e?parseFloat(t)/100*e[i]:0}return parseInt(t,10)},o._addTransformPosition=function(t){var i=t.transform;if(0===i.indexOf("matrix")){var e=i.split(","),n=0===i.indexOf("matrix3d")?12:4,o=parseInt(e[n],10),r=parseInt(e[n+1],10);this.position.x+=o,this.position.y+=r}},o.onPointerDown=function(t, i){this.element.classList.add("is-pointer-down"),this.dispatchJQueryEvent("pointerDown",t,[i])},o.dragStart=function(t, i){this.isEnabled&&(this._getPosition(),this.measureContainment(),this.startPosition.x=this.position.x,this.startPosition.y=this.position.y,this.setLeftTop(),this.dragPoint.x=0,this.dragPoint.y=0,this.element.classList.add("is-dragging"),this.dispatchEvent("dragStart",t,[i]),this.animate())},o.measureContainment=function(){var t=this.getContainer();if(t){var i=a(this.element),e=a(t),n=this.element.getBoundingClientRect(),o=t.getBoundingClientRect(),r=e.borderLeftWidth+e.borderRightWidth,s=e.borderTopWidth+e.borderBottomWidth,h=this.relativeStartPosition={x:n.left-(o.left+e.borderLeftWidth),y:n.top-(o.top+e.borderTopWidth)};this.containSize={width:e.width-r-h.x-i.width,height:e.height-s-h.y-i.height}}},o.getContainer=function(){var t=this.options.containment;if(t)return t instanceof HTMLElement?t:"string"==typeof t?document.querySelector(t):this.element.parentNode},o.onPointerMove=function(t, i, e){this.dispatchJQueryEvent("pointerMove",t,[i,e])},o.dragMove=function(t, i, e){if(this.isEnabled){var n=e.x,o=e.y,r=this.options.grid,s=r&&r[0],h=r&&r[1];n=d(n,s),o=d(o,h),n=this.containDrag("x",n,s),o=this.containDrag("y",o,h),n="y"==this.options.axis?0:n,o="x"==this.options.axis?0:o,this.position.x=this.startPosition.x+n,this.position.y=this.startPosition.y+o,this.dragPoint.x=n,this.dragPoint.y=o,this.dispatchEvent("dragMove",t,[i,e])}},o.containDrag=function(t, i, e){if(!this.options.containment)return i;var n="x"==t?"width":"height",o=d(-this.relativeStartPosition[t],e,"ceil"),r=this.containSize[n];return r=d(r,e,"floor"),Math.max(o,Math.min(r,i))},o.onPointerUp=function(t, i){this.element.classList.remove("is-pointer-down"),this.dispatchJQueryEvent("pointerUp",t,[i])},o.dragEnd=function(t, i){this.isEnabled&&(this.element.style.transform="",this.setLeftTop(),this.element.classList.remove("is-dragging"),this.dispatchEvent("dragEnd",t,[i]))},o.animate=function(){if(this.isDragging){this.positionDrag();var t=this;requestAnimationFrame(function(){t.animate()})}},o.setLeftTop=function(){this.element.style.left=this.position.x+"px",this.element.style.top=this.position.y+"px"},o.positionDrag=function(){this.element.style.transform="translate3d( "+this.dragPoint.x+"px, "+this.dragPoint.y+"px, 0)"},o.staticClick=function(t, i){this.dispatchEvent("staticClick",t,[i])},o.setPosition=function(t, i){this.position.x=t,this.position.y=i,this.setLeftTop()},o.enable=function(){this.isEnabled=!0},o.disable=function(){this.isEnabled=!1,this.isDragging&&this.dragEnd()},o.destroy=function(){this.disable(),this.element.style.transform="",this.element.style.left="",this.element.style.top="",this.element.style.position="",this.unbindHandles(),this.$element&&this.$element.removeData("draggabilly")},o._init=function(){},n&&n.bridget&&n.bridget("draggabilly",i),i});
+!function(i, e){"function"==typeof define&&define.amd?define("jquery-bridget/jquery-bridget",["jquery"],function(t){return e(i,t)}):"object"==typeof module&&module.exports?module.exports=e(i,require("jquery")):i.jQueryBridget=e(i,i.jQuery)}(window,function(t, i){"use strict";var c=Array.prototype.slice,e=t.console,p=void 0===e?function(){}:function(t){e.error(t)};function n(d, o, u){(u=u||i||t.jQuery)&&(o.prototype.option||(o.prototype.option=function(t){u.isPlainObject(t)&&(this.options=u.extend(!0,this.options,t))}),u.fn[d]=function(t){if("string"==typeof t){var i=c.call(arguments,1);return s=i,a="$()."+d+'("'+(r=t)+'")',(e=this).each(function(t, i){var e=u.data(i,d);if(e){var n=e[r];if(n&&"_"!=r.charAt(0)){var o=n.apply(e,s);h=void 0===h?o:h}else p(a+" is not a valid method")}else p(d+" not initialized. Cannot call methods, i.e. "+a)}),void 0!==h?h:e}var e,r,s,h,a,n;return n=t,this.each(function(t, i){var e=u.data(i,d);e?(e.option(n),e._init()):(e=new o(i,n),u.data(i,d,e))}),this},r(u))}function r(t){!t||t&&t.bridget||(t.bridget=n)}return r(i||t.jQuery),n}),function(t, i){"use strict";"function"==typeof define&&define.amd?define("get-size/get-size",[],function(){return i()}):"object"==typeof module&&module.exports?module.exports=i():t.getSize=i()}(window,function(){"use strict";function m(t){var i=parseFloat(t);return-1==t.indexOf("%")&&!isNaN(i)&&i}var e="undefined"==typeof console?function(){}:function(t){console.error(t)},y=["paddingLeft","paddingRight","paddingTop","paddingBottom","marginLeft","marginRight","marginTop","marginBottom","borderLeftWidth","borderRightWidth","borderTopWidth","borderBottomWidth"],b=y.length;function E(t){var i=getComputedStyle(t);return i||e("Style returned "+i+". Are you running this code in a hidden iframe on Firefox? See http://bit.ly/getsizebug1"),i}var _,x=!1;function P(t){if(function(){if(!x){x=!0;var t=document.createElement("div");t.style.width="200px",t.style.padding="1px 2px 3px 4px",t.style.borderStyle="solid",t.style.borderWidth="1px 2px 3px 4px",t.style.boxSizing="border-box";var i=document.body||document.documentElement;i.appendChild(t);var e=E(t);P.isBoxSizeOuter=_=200==m(e.width),i.removeChild(t)}}(),"string"==typeof t&&(t=document.querySelector(t)),t&&"object"==typeof t&&t.nodeType){var i=E(t);if("none"==i.display)return function(){for(var t={width:0,height:0,innerWidth:0,innerHeight:0,outerWidth:0,outerHeight:0},i=0; i<b; i++)t[y[i]]=0;return t}();var e={};e.width=t.offsetWidth,e.height=t.offsetHeight;for(var n=e.isBorderBox="border-box"==i.boxSizing,o=0; o<b; o++){var r=y[o],s=i[r],h=parseFloat(s);e[r]=isNaN(h)?0:h}var a=e.paddingLeft+e.paddingRight,d=e.paddingTop+e.paddingBottom,u=e.marginLeft+e.marginRight,c=e.marginTop+e.marginBottom,p=e.borderLeftWidth+e.borderRightWidth,f=e.borderTopWidth+e.borderBottomWidth,g=n&&_,l=m(i.width);!1!==l&&(e.width=l+(g?0:a+p));var v=m(i.height);return!1!==v&&(e.height=v+(g?0:d+f)),e.innerWidth=e.width-(a+p),e.innerHeight=e.height-(d+f),e.outerWidth=e.width+u,e.outerHeight=e.height+c,e}}return P}),function(t, i){"function"==typeof define&&define.amd?define("ev-emitter/ev-emitter",i):"object"==typeof module&&module.exports?module.exports=i():t.EvEmitter=i()}("undefined"!=typeof window?window:this,function(){function t(){}var i=t.prototype;return i.on=function(t, i){if(t&&i){var e=this._events=this._events||{},n=e[t]=e[t]||[];return-1==n.indexOf(i)&&n.push(i),this}},i.once=function(t, i){if(t&&i){this.on(t,i);var e=this._onceEvents=this._onceEvents||{};return(e[t]=e[t]||{})[i]=!0,this}},i.off=function(t, i){var e=this._events&&this._events[t];if(e&&e.length){var n=e.indexOf(i);return-1!=n&&e.splice(n,1),this}},i.emitEvent=function(t, i){var e=this._events&&this._events[t];if(e&&e.length){e=e.slice(0),i=i||[];for(var n=this._onceEvents&&this._onceEvents[t],o=0; o<e.length; o++){var r=e[o];n&&n[r]&&(this.off(t,r),delete n[r]),r.apply(this,i)}return this}},i.allOff=function(){delete this._events,delete this._onceEvents},t}),function(i, e){"function"==typeof define&&define.amd?define("unipointer/unipointer",["ev-emitter/ev-emitter"],function(t){return e(i,t)}):"object"==typeof module&&module.exports?module.exports=e(i,require("ev-emitter")):i.Unipointer=e(i,i.EvEmitter)}(window,function(o, t){function i(){}var e=i.prototype=Object.create(t.prototype);e.bindStartEvent=function(t){this._bindStartEvent(t,!0)},e.unbindStartEvent=function(t){this._bindStartEvent(t,!1)},e._bindStartEvent=function(t, i){var e=(i=void 0===i||i)?"addEventListener":"removeEventListener",n="mousedown";o.PointerEvent?n="pointerdown":"ontouchstart"in o&&(n="touchstart"),t[e](n,this)},e.handleEvent=function(t){var i="on"+t.type;this[i]&&this[i](t)},e.getTouch=function(t){for(var i=0; i<t.length; i++){var e=t[i];if(e.identifier==this.pointerIdentifier)return e}},e.onmousedown=function(t){var i=t.button;i&&0!==i&&1!==i||this._pointerDown(t,t)},e.ontouchstart=function(t){this._pointerDown(t,t.changedTouches[0])},e.onpointerdown=function(t){this._pointerDown(t,t)},e._pointerDown=function(t, i){t.button||this.isPointerDown||(this.isPointerDown=!0,this.pointerIdentifier=void 0!==i.pointerId?i.pointerId:i.identifier,this.pointerDown(t,i))},e.pointerDown=function(t, i){this._bindPostStartEvents(t),this.emitEvent("pointerDown",[t,i])};var n={mousedown:["mousemove","mouseup"],touchstart:["touchmove","touchend","touchcancel"],pointerdown:["pointermove","pointerup","pointercancel"]};return e._bindPostStartEvents=function(t){if(t){var i=n[t.type];i.forEach(function(t){o.addEventEvent(t,this)},this),this._boundPointerEvents=i}},e._unbindPostStartEvents=function(){this._boundPointerEvents&&(this._boundPointerEvents.forEach(function(t){o.removeEventEvent(t,this)},this),delete this._boundPointerEvents)},e.onmousemove=function(t){this._pointerMove(t,t)},e.onpointermove=function(t){t.pointerId==this.pointerIdentifier&&this._pointerMove(t,t)},e.ontouchmove=function(t){var i=this.getTouch(t.changedTouches);i&&this._pointerMove(t,i)},e._pointerMove=function(t, i){this.pointerMove(t,i)},e.pointerMove=function(t, i){this.emitEvent("pointerMove",[t,i])},e.onmouseup=function(t){this._pointerUp(t,t)},e.onpointerup=function(t){t.pointerId==this.pointerIdentifier&&this._pointerUp(t,t)},e.ontouchend=function(t){var i=this.getTouch(t.changedTouches);i&&this._pointerUp(t,i)},e._pointerUp=function(t, i){this._pointerDone(),this.pointerUp(t,i)},e.pointerUp=function(t, i){this.emitEvent("pointerUp",[t,i])},e._pointerDone=function(){this._pointerReset(),this._unbindPostStartEvents(),this.pointerDone()},e._pointerReset=function(){this.isPointerDown=!1,delete this.pointerIdentifier},e.pointerDone=function(){},e.onpointercancel=function(t){t.pointerId==this.pointerIdentifier&&this._pointerCancel(t,t)},e.ontouchcancel=function(t){var i=this.getTouch(t.changedTouches);i&&this._pointerCancel(t,i)},e._pointerCancel=function(t, i){this._pointerDone(),this.pointerCancel(t,i)},e.pointerCancel=function(t, i){this.emitEvent("pointerCancel",[t,i])},i.getPointerPoint=function(t){return{x:t.pageX,y:t.pageY}},i}),function(i, e){"function"==typeof define&&define.amd?define("unidragger/unidragger",["unipointer/unipointer"],function(t){return e(i,t)}):"object"==typeof module&&module.exports?module.exports=e(i,require("unipointer")):i.Unidragger=e(i,i.Unipointer)}(window,function(r, t){function i(){}var e=i.prototype=Object.create(t.prototype);e.bindHandles=function(){this._bindHandles(!0)},e.unbindHandles=function(){this._bindHandles(!1)},e._bindHandles=function(t){for(var i=(t=void 0===t||t)?"addEventListener":"removeEventListener",e=t?this._touchActionValue:"",n=0; n<this.handles.length; n++){var o=this.handles[n];this._bindStartEvent(o,t),o[i]("click",this),r.PointerEvent&&(o.style.touchAction=e)}},e._touchActionValue="none",e.pointerDown=function(t, i){this.okayPointerDown(t)&&(this.pointerDownPointer=i,t.preventDefault(),this.pointerDownBlur(),this._bindPostStartEvents(t),this.emitEvent("pointerDown",[t,i]))};var o={TEXTAREA:!0,INPUT:!0,SELECT:!0,OPTION:!0},s={radio:!0,checkbox:!0,button:!0,submit:!0,image:!0,file:!0};return e.okayPointerDown=function(t){var i=o[t.target.nodeName],e=s[t.target.type],n=!i||e;return n||this._pointerReset(),n},e.pointerDownBlur=function(){var t=document.activeElement;t&&t.blur&&t!=document.body&&t.blur()},e.pointerMove=function(t, i){var e=this._dragPointerMove(t,i);this.emitEvent("pointerMove",[t,i,e]),this._dragMove(t,i,e)},e._dragPointerMove=function(t, i){var e={x:i.pageX-this.pointerDownPointer.pageX,y:i.pageY-this.pointerDownPointer.pageY};return!this.isDragging&&this.hasDragStarted(e)&&this._dragStart(t,i),e},e.hasDragStarted=function(t){return 3<Math.abs(t.x)||3<Math.abs(t.y)},e.pointerUp=function(t, i){this.emitEvent("pointerUp",[t,i]),this._dragPointerUp(t,i)},e._dragPointerUp=function(t, i){this.isDragging?this._dragEnd(t,i):this._staticClick(t,i)},e._dragStart=function(t, i){this.isDragging=!0,this.isPreventingClicks=!0,this.dragStart(t,i)},e.dragStart=function(t, i){this.emitEvent("dragStart",[t,i])},e._dragMove=function(t, i, e){this.isDragging&&this.dragMove(t,i,e)},e.dragMove=function(t, i, e){t.preventDefault(),this.emitEvent("dragMove",[t,i,e])},e._dragEnd=function(t, i){this.isDragging=!1,setTimeout(function(){delete this.isPreventingClicks}.bind(this)),this.dragEnd(t,i)},e.dragEnd=function(t, i){this.emitEvent("dragEnd",[t,i])},e.onclick=function(t){this.isPreventingClicks&&t.preventDefault()},e._staticClick=function(t, i){this.isIgnoringMouseUp&&"mouseup"==t.type||(this.staticClick(t,i),"mouseup"!=t.type&&(this.isIgnoringMouseUp=!0,setTimeout(function(){delete this.isIgnoringMouseUp}.bind(this),400)))},e.staticClick=function(t, i){this.emitEvent("staticClick",[t,i])},i.getPointerPoint=t.getPointerPoint,i}),function(e, n){"function"==typeof define&&define.amd?define(["get-size/get-size","unidragger/unidragger"],function(t, i){return n(e,t,i)}):"object"==typeof module&&module.exports?module.exports=n(e,require("get-size"),require("unidragger")):e.Draggabilly=n(e,e.getSize,e.Unidragger)}(window,function(r, a, t){function e(t, i){for(var e in i)t[e]=i[e];return t}var n=r.jQuery;function i(t, i){this.element="string"==typeof t?document.querySelector(t):t,n&&(this.$element=n(this.element)),this.options=e({},this.constructor.defaults),this.option(i),this._create()}var o=i.prototype=Object.create(t.prototype);i.defaults={},o.option=function(t){e(this.options,t)};var s={relative:!0,absolute:!0,fixed:!0};function d(t, i, e){return e=e||"round",i?Math[e](t/i)*i:t}return o._create=function(){this.position={},this._getPosition(),this.startPoint={x:0,y:0},this.dragPoint={x:0,y:0},this.startPosition=e({},this.position);var t=getComputedStyle(this.element);s[t.position]||(this.element.style.position="relative"),this.on("pointerDown",this.onPointerDown),this.on("pointerMove",this.onPointerMove),this.on("pointerUp",this.onPointerUp),this.enable(),this.setHandles()},o.setHandles=function(){this.handles=this.options.handle?this.element.querySelectorAll(this.options.handle):[this.element],this.bindHandles()},o.dispatchEvent=function(t, i, e){var n=[i].concat(e);this.emitEvent(t,n),this.dispatchJQueryEvent(t,i,e)},o.dispatchJQueryEvent=function(t, i, e){var n=r.jQuery;if(n&&this.$element){var o=n.Event(i);o.type=t,this.$element.trigger(o,e)}},o._getPosition=function(){var t=getComputedStyle(this.element),i=this._getPositionCoord(t.left,"width"),e=this._getPositionCoord(t.top,"height");this.position.x=isNaN(i)?0:i,this.position.y=isNaN(e)?0:e,this._addTransformPosition(t)},o._getPositionCoord=function(t, i){if(-1!=t.indexOf("%")){var e=a(this.element.parentNode);return e?parseFloat(t)/100*e[i]:0}return parseInt(t,10)},o._addTransformPosition=function(t){var i=t.transform;if(0===i.indexOf("matrix")){var e=i.split(","),n=0===i.indexOf("matrix3d")?12:4,o=parseInt(e[n],10),r=parseInt(e[n+1],10);this.position.x+=o,this.position.y+=r}},o.onPointerDown=function(t, i){this.element.classList.add("is-pointer-down"),this.dispatchJQueryEvent("pointerDown",t,[i])},o.dragStart=function(t, i){this.isEnabled&&(this._getPosition(),this.measureContainment(),this.startPosition.x=this.position.x,this.startPosition.y=this.position.y,this.setLeftTop(),this.dragPoint.x=0,this.dragPoint.y=0,this.element.classList.add("is-dragging"),this.dispatchEvent("dragStart",t,[i]),this.animate())},o.measureContainment=function(){var t=this.getContainer();if(t){var i=a(this.element),e=a(t),n=this.element.getBoundingClientRect(),o=t.getBoundingClientRect(),r=e.borderLeftWidth+e.borderRightWidth,s=e.borderTopWidth+e.borderBottomWidth,h=this.relativeStartPosition={x:n.left-(o.left+e.borderLeftWidth),y:n.top-(o.top+e.borderTopWidth)};this.containSize={width:e.width-r-h.x-i.width,height:e.height-s-h.y-i.height}}},o.getContainer=function(){var t=this.options.containment;if(t)return t instanceof HTMLElement?t:"string"==typeof t?document.querySelector(t):this.element.parentNode},o.onPointerMove=function(t, i, e){this.dispatchJQueryEvent("pointerMove",t,[i,e])},o.dragMove=function(t, i, e){if(this.isEnabled){var n=e.x,o=e.y,r=this.options.grid,s=r&&r[0],h=r&&r[1];n=d(n,s),o=d(o,h),n=this.containDrag("x",n,s),o=this.containDrag("y",o,h),n="y"==this.options.axis?0:n,o="x"==this.options.axis?0:o,this.position.x=this.startPosition.x+n,this.position.y=this.startPosition.y+o,this.dragPoint.x=n,this.dragPoint.y=o,this.dispatchEvent("dragMove",t,[i,e])}},o.containDrag=function(t, i, e){if(!this.options.containment)return i;var n="x"==t?"width":"height",o=d(-this.relativeStartPosition[t],e,"ceil"),r=this.containSize[n];return r=d(r,e,"floor"),Math.max(o,Math.min(r,i))},o.onPointerUp=function(t, i){this.element.classList.remove("is-pointer-down"),this.dispatchJQueryEvent("pointerUp",t,[i])},o.dragEnd=function(t, i){this.isEnabled&&(this.element.style.transform="",this.setLeftTop(),this.element.classList.remove("is-dragging"),this.dispatchEvent("dragEnd",t,[i]))},o.animate=function(){if(this.isDragging){this.positionDrag();var t=this;requestAnimationFrame(function(){t.animate()})}},o.setLeftTop=function(){this.element.style.left=this.position.x+"px",this.element.style.top=this.position.y+"px"},o.positionDrag=function(){this.element.style.transform="translate3d( "+this.dragPoint.x+"px, "+this.dragPoint.y+"px, 0)"},o.staticClick=function(t, i){this.dispatchEvent("staticClick",t,[i])},o.setPosition=function(t, i){this.position.x=t,this.position.y=i,this.setLeftTop()},o.enable=function(){this.isEnabled=!0},o.disable=function(){this.isEnabled=!1,this.isDragging&&this.dragEnd()},o.destroy=function(){this.disable(),this.element.style.transform="",this.element.style.left="",this.element.style.top="",this.element.style.position="",this.unbindHandles(),this.$element&&this.$element.removeData("draggabilly")},o._init=function(){},n&&n.bridget&&n.bridget("draggabilly",i),i});
const Draggabilly = window.Draggabilly;
@@ -287,10 +287,10 @@ export default class TabRowWidget extends BasicWidget {
}
else {
// for older firefox
- window.addEventListener('resize', resizeListener);
+ window.addEventEvent('resize', resizeListener);
}
- this.tabEls.forEach((tabEl) => this.setTabCloseEventListener(tabEl));
+ this.tabEls.forEach((tabEl) => this.setTabCloseEventEvent(tabEl));
}
setVisibility() {
@@ -386,14 +386,14 @@ export default class TabRowWidget extends BasicWidget {
this.$newTab.before($tab);
this.setVisibility();
- this.setTabCloseEventListener($tab);
+ this.setTabCloseEventEvent($tab);
this.updateTitle($tab, 'New tab');
this.cleanUpPreviouslyDraggedTabs();
this.layoutTabs();
this.setupDraggabilly();
}
- setTabCloseEventListener($tab) {
+ setTabCloseEventEvent($tab) {
$tab.find('.note-tab-close')
.on('click', _ => appContext.tabManager.removeTab($tab.attr('data-tab-id')));
@@ -410,7 +410,7 @@ export default class TabRowWidget extends BasicWidget {
return this.$widget.find('.note-tab[active]')[0];
}
- activeTabChangedListener() {
+ activeTabChangedEvent() {
const newActiveTabId = appContext.tabManager.activeTabId;
const tabEl = this.getTabById(newActiveTabId)[0];
@@ -420,7 +420,7 @@ export default class TabRowWidget extends BasicWidget {
if (tabEl) tabEl.setAttribute('active', '');
}
- newTabOpenedListener({tabId}) {
+ newTabOpenedEvent({tabId}) {
this.addTab(tabId);
}
@@ -446,7 +446,7 @@ export default class TabRowWidget extends BasicWidget {
return this.$widget.find(`[data-tab-id='${tabId}']`);
}
- tabRemovedListener({tabId}) {
+ tabRemovedEvent({tabId}) {
this.removeTab(tabId);
}
@@ -575,7 +575,7 @@ export default class TabRowWidget extends BasicWidget {
return closestIndex;
};
- tabNoteSwitchedListener({tabId}) {
+ tabNoteSwitchedEvent({tabId}) {
const $tab = this.getTabById(tabId);
const {note} = appContext.tabManager.getTabContextById(tabId);
@@ -601,7 +601,7 @@ export default class TabRowWidget extends BasicWidget {
$tab.addClass(utils.getMimeTypeClass(note.mime));
}
- async entitiesReloadedListener({loadResults}) {
+ async entitiesReloadedEvent({loadResults}) {
for (const tabContext of appContext.tabManager.tabContexts) {
if (loadResults.isNoteReloaded(tabContext.noteId)) {
const $tab = this.getTabById(tabContext.tabId);
@@ -611,7 +611,7 @@ export default class TabRowWidget extends BasicWidget {
}
}
- treeCacheReloadedListener() {
+ treeCacheReloadedEvent() {
for (const tabContext of appContext.tabManager.tabContexts) {
const $tab = this.getTabById(tabContext.tabId);
diff --git a/src/public/javascripts/widgets/type_widgets/text.js b/src/public/javascripts/widgets/type_widgets/text.js
index e39e454e8b..c5be273ec7 100644
--- a/src/public/javascripts/widgets/type_widgets/text.js
+++ b/src/public/javascripts/widgets/type_widgets/text.js
@@ -215,7 +215,7 @@ export default class TextTypeWidget extends TypeWidget {
});
}
- addTextToActiveEditorListener(text) {
+ addTextToActiveEditorEvent(text) {
if (!this.isActive()) {
return;
}
@@ -244,7 +244,7 @@ export default class TextTypeWidget extends TypeWidget {
return !selection.isCollapsed;
}
- async executeInActiveEditorListener({callback}) {
+ async executeInActiveEditorEvent({callback}) {
if (!this.isActive()) {
return;
}
diff --git a/src/public/javascripts/widgets/what_links_here.js b/src/public/javascripts/widgets/what_links_here.js
index d5fc2ea179..0ba7769bab 100644
--- a/src/public/javascripts/widgets/what_links_here.js
+++ b/src/public/javascripts/widgets/what_links_here.js
@@ -50,7 +50,7 @@ export default class WhatLinksHereWidget extends CollapsibleWidget {
this.$body.empty().append($list);
}
- entitiesReloadedListener({loadResults}) {
+ entitiesReloadedEvent({loadResults}) {
if (loadResults.getAttributes().find(attr => attr.type === 'relation' && attr.value === this.noteId)) {
this.refresh();
}