mirror of
https://github.com/TriliumNext/Notes.git
synced 2026-05-08 05:09:13 -05:00
help buttons and existing custom HTML attribute refactoring to data-*
This commit is contained in:
@@ -15,7 +15,7 @@ async function showDialog() {
|
||||
|
||||
await $dialog.dialog({
|
||||
modal: true,
|
||||
width: 500
|
||||
width: 600
|
||||
});
|
||||
|
||||
const currentNode = treeService.getCurrentNode();
|
||||
|
||||
@@ -63,10 +63,10 @@ $list.on('change', () => {
|
||||
}
|
||||
});
|
||||
|
||||
$(document).on('click', "a[action='note-revision']", event => {
|
||||
$(document).on('click', "a[data-action='note-revision']", event => {
|
||||
const linkEl = $(event.target);
|
||||
const noteId = linkEl.attr('note-path');
|
||||
const noteRevisionId = linkEl.attr('note-revision-id');
|
||||
const noteId = linkEl.attr('data-note-path');
|
||||
const noteRevisionId = linkEl.attr('data-note-revision-id');
|
||||
|
||||
showNoteRevisionsDialog(noteId, noteRevisionId);
|
||||
|
||||
|
||||
@@ -30,9 +30,9 @@ async function showDialog() {
|
||||
const revLink = $("<a>", {
|
||||
href: 'javascript:',
|
||||
text: 'rev'
|
||||
}).attr('action', 'note-revision')
|
||||
.attr('note-path', change.noteId)
|
||||
.attr('note-revision-id', change.noteRevisionId);
|
||||
}).attr('data-action', 'note-revision')
|
||||
.attr('data-note-path', change.noteId)
|
||||
.attr('data-note-revision-id', change.noteRevisionId);
|
||||
|
||||
let noteLink;
|
||||
|
||||
|
||||
@@ -71,6 +71,14 @@ window.onerror = function (msg, url, lineNo, columnNo, error) {
|
||||
return false;
|
||||
};
|
||||
|
||||
const wikiBaseUrl = "https://github.com/zadam/trilium/wiki/";
|
||||
|
||||
$(document).on("click", "button[data-help-page]", e => {
|
||||
const $button = $(e.target);
|
||||
|
||||
window.open(wikiBaseUrl + $button.attr("data-help-page"), '_blank');
|
||||
});
|
||||
|
||||
$("#logout-button").toggle(!utils.isElectron());
|
||||
|
||||
if (utils.isElectron()) {
|
||||
|
||||
@@ -33,8 +33,8 @@ async function createNoteLink(notePath, noteTitle = null) {
|
||||
const noteLink = $("<a>", {
|
||||
href: 'javascript:',
|
||||
text: noteTitle
|
||||
}).attr('action', 'note')
|
||||
.attr('note-path', notePath);
|
||||
}).attr('data-action', 'note')
|
||||
.attr('data-note-path', notePath);
|
||||
|
||||
return noteLink;
|
||||
}
|
||||
@@ -43,10 +43,10 @@ function goToLink(e) {
|
||||
e.preventDefault();
|
||||
|
||||
const $link = $(e.target);
|
||||
let notePath = $link.attr("note-path");
|
||||
let notePath = $link.attr("data-note-path");
|
||||
|
||||
if (!notePath) {
|
||||
const address = $link.attr("note-path") ? $link.attr("note-path") : $link.attr('href');
|
||||
const address = $link.attr("data-note-path") ? $link.attr("data-note-path") : $link.attr('href');
|
||||
|
||||
if (!address) {
|
||||
return;
|
||||
@@ -104,7 +104,7 @@ ko.bindingHandlers.noteLink = {
|
||||
|
||||
// when click on link popup, in case of internal link, just go the the referenced note instead of default behavior
|
||||
// of opening the link in new window/tab
|
||||
$(document).on('click', "a[action='note']", goToLink);
|
||||
$(document).on('click', "a[data-action='note']", goToLink);
|
||||
$(document).on('click', 'div.popover-content a, div.ui-tooltip-content a', goToLink);
|
||||
$(document).on('dblclick', '#note-detail-text a', goToLink);
|
||||
|
||||
|
||||
@@ -209,7 +209,7 @@ async function showChildrenOverview(hideChildrenOverview) {
|
||||
const link = $('<a>', {
|
||||
href: 'javascript:',
|
||||
text: await treeUtils.getNoteTitle(childBranch.noteId, childBranch.parentNoteId)
|
||||
}).attr('action', 'note').attr('note-path', notePath + '/' + childBranch.noteId);
|
||||
}).attr('data-action', 'note').attr('data-note-path', notePath + '/' + childBranch.noteId);
|
||||
|
||||
const childEl = $('<div class="child-overview">').html(link);
|
||||
$childrenOverview.append(childEl);
|
||||
|
||||
@@ -58,7 +58,7 @@ async function doSearch(searchText) {
|
||||
const link = $('<a>', {
|
||||
href: 'javascript:',
|
||||
text: result.title
|
||||
}).attr('action', 'note').attr('note-path', result.path);
|
||||
}).attr('data-action', 'note').attr('data-note-path', result.path);
|
||||
|
||||
const $result = $('<li>').append(link);
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ function setupTooltip() {
|
||||
let notePath = linkService.getNotePathFromLink($(this).attr("href"));
|
||||
|
||||
if (!notePath) {
|
||||
notePath = $(this).attr("note-path");
|
||||
notePath = $(this).attr("data-note-path");
|
||||
}
|
||||
|
||||
if (notePath) {
|
||||
|
||||
Reference in New Issue
Block a user