mirror of
https://github.com/zadam/trilium.git
synced 2025-03-01 14:22:32 +01:00
stop click propagation in tree item actions
This commit is contained in:
parent
6548149107
commit
bea39f37ee
4
package-lock.json
generated
4
package-lock.json
generated
@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "trilium",
|
"name": "trilium",
|
||||||
"version": "0.60.1-beta",
|
"version": "0.60.2-beta",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "trilium",
|
"name": "trilium",
|
||||||
"version": "0.60.1-beta",
|
"version": "0.60.2-beta",
|
||||||
"hasInstallScript": true,
|
"hasInstallScript": true,
|
||||||
"license": "AGPL-3.0-only",
|
"license": "AGPL-3.0-only",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
@ -148,6 +148,9 @@ const TPL = `
|
|||||||
|
|
||||||
const MAX_SEARCH_RESULTS_IN_TREE = 100;
|
const MAX_SEARCH_RESULTS_IN_TREE = 100;
|
||||||
|
|
||||||
|
// this has to be hanged on the actual elements to effectively intercept and stop click event
|
||||||
|
const cancelClickPropagation = e => e.stopPropagation();
|
||||||
|
|
||||||
export default class NoteTreeWidget extends NoteContextAwareWidget {
|
export default class NoteTreeWidget extends NoteContextAwareWidget {
|
||||||
constructor() {
|
constructor() {
|
||||||
super();
|
super();
|
||||||
@ -559,7 +562,8 @@ export default class NoteTreeWidget extends NoteContextAwareWidget {
|
|||||||
const isHoistedNote = activeNoteContext && activeNoteContext.hoistedNoteId === note.noteId && note.noteId !== 'root';
|
const isHoistedNote = activeNoteContext && activeNoteContext.hoistedNoteId === note.noteId && note.noteId !== 'root';
|
||||||
|
|
||||||
if (isHoistedNote) {
|
if (isHoistedNote) {
|
||||||
const $unhoistButton = $('<span class="tree-item-button unhoist-button bx bx-door-open" title="Unhoist"></span>');
|
const $unhoistButton = $('<span class="tree-item-button unhoist-button bx bx-door-open" title="Unhoist"></span>')
|
||||||
|
.on("click", cancelClickPropagation);
|
||||||
|
|
||||||
// unhoist button is prepended since compared to other buttons this is not just convenience
|
// unhoist button is prepended since compared to other buttons this is not just convenience
|
||||||
// on the mobile interface - it's the only way to unhoist
|
// on the mobile interface - it's the only way to unhoist
|
||||||
@ -567,19 +571,22 @@ export default class NoteTreeWidget extends NoteContextAwareWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (note.hasLabel('workspace') && !isHoistedNote) {
|
if (note.hasLabel('workspace') && !isHoistedNote) {
|
||||||
const $enterWorkspaceButton = $('<span class="tree-item-button enter-workspace-button bx bx-door-open" title="Hoist this note (workspace)"></span>');
|
const $enterWorkspaceButton = $('<span class="tree-item-button enter-workspace-button bx bx-door-open" title="Hoist this note (workspace)"></span>')
|
||||||
|
.on("click", cancelClickPropagation);
|
||||||
|
|
||||||
$span.append($enterWorkspaceButton);
|
$span.append($enterWorkspaceButton);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (note.type === 'search') {
|
if (note.type === 'search') {
|
||||||
const $refreshSearchButton = $('<span class="tree-item-button refresh-search-button bx bx-refresh" title="Refresh saved search results"></span>');
|
const $refreshSearchButton = $('<span class="tree-item-button refresh-search-button bx bx-refresh" title="Refresh saved search results"></span>')
|
||||||
|
.on("click", cancelClickPropagation);
|
||||||
|
|
||||||
$span.append($refreshSearchButton);
|
$span.append($refreshSearchButton);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!['search', 'launcher'].includes(note.type) && !note.isOptions() && !note.isLaunchBarConfig()) {
|
if (!['search', 'launcher'].includes(note.type) && !note.isOptions() && !note.isLaunchBarConfig()) {
|
||||||
const $createChildNoteButton = $('<span class="tree-item-button add-note-button bx bx-plus" title="Create child note"></span>');
|
const $createChildNoteButton = $('<span class="tree-item-button add-note-button bx bx-plus" title="Create child note"></span>')
|
||||||
|
.on("click", cancelClickPropagation);
|
||||||
|
|
||||||
$span.append($createChildNoteButton);
|
$span.append($createChildNoteButton);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user