diff --git a/src/public/app/dialogs/link_map.js b/src/public/app/dialogs/link_map.js deleted file mode 100644 index bf3832e11..000000000 --- a/src/public/app/dialogs/link_map.js +++ /dev/null @@ -1,36 +0,0 @@ -import utils from "../services/utils.js"; -import LinkMapService from "../services/link_map.js"; -import appContext from "../services/app_context.js"; - -const $linkMapContainer = $("#link-map-container"); - -const $dialog = $("#link-map-dialog"); -const $maxNotesInput = $("#link-map-max-notes"); - -let linkMapService; - -function getOptions() { - return { - maxNotes: $maxNotesInput.val() - }; -} - -export async function showDialog() { - // set default settings - $maxNotesInput.val(20); - - $linkMapContainer.css("height", $("body").height() - 150); - - $linkMapContainer.empty(); - - utils.openDialog($dialog); -} - -$dialog.on('shown.bs.modal', () => { - const note = appContext.tabManager.getActiveContextNote(); - - linkMapService = new LinkMapService(note, $linkMapContainer, getOptions()); - linkMapService.render(); -}); - -$maxNotesInput.on("input", () => linkMapService.loadNotesAndRelations(getOptions())); diff --git a/src/public/app/layouts/desktop_layout.js b/src/public/app/layouts/desktop_layout.js index d367c6d3c..3a0f884c0 100644 --- a/src/public/app/layouts/desktop_layout.js +++ b/src/public/app/layouts/desktop_layout.js @@ -35,7 +35,6 @@ import ClosePaneButton from "../widgets/buttons/close_pane_button.js"; import BasicPropertiesWidget from "../widgets/section_widgets/basic_properties.js"; import NoteInfoWidget from "../widgets/section_widgets/note_info_widget.js"; import BookPropertiesWidget from "../widgets/section_widgets/book_properties.js"; -import ShowNoteSourceButton from "../widgets/buttons/show_note_source.js"; import LinkMapWidget from "../widgets/section_widgets/link_map.js"; import NotePathsWidget from "../widgets/section_widgets/note_paths.js"; import SimilarNotesWidget from "../widgets/section_widgets/similar_notes.js"; diff --git a/src/public/app/services/library_loader.js b/src/public/app/services/library_loader.js index f8627acce..2f0f3e50c 100644 --- a/src/public/app/services/library_loader.js +++ b/src/public/app/services/library_loader.js @@ -33,17 +33,6 @@ const RELATION_MAP = { ] }; -const LINK_MAP = { - js: [ - "libraries/jsplumb.js", - "libraries/panzoom.js", - "libraries/springy.js" - ], - css: [ - "stylesheets/link_map.css" - ] -}; - const PRINT_THIS = {js: ["libraries/printThis.js"]}; const CALENDAR_WIDGET = {css: ["stylesheets/calendar.css"]}; @@ -106,7 +95,6 @@ export default { ESLINT, COMMONMARK, RELATION_MAP, - LINK_MAP, PRINT_THIS, CALENDAR_WIDGET, KATEX, diff --git a/src/public/app/services/root_command_executor.js b/src/public/app/services/root_command_executor.js index 4097adfb3..eaf937dff 100644 --- a/src/public/app/services/root_command_executor.js +++ b/src/public/app/services/root_command_executor.js @@ -22,10 +22,6 @@ export default class RootCommandExecutor extends Component { import("../dialogs/note_source.js").then(d => d.showDialog()); } - showLinkMapCommand() { - import("../dialogs/link_map.js").then(d => d.showDialog()); - } - pasteMarkdownIntoTextCommand() { import("../dialogs/markdown_import.js").then(d => d.importMarkdownInline()); } diff --git a/src/public/app/widgets/collapsible_widgets/link_map.js b/src/public/app/widgets/collapsible_widgets/link_map.js deleted file mode 100644 index c69d4e363..000000000 --- a/src/public/app/widgets/collapsible_widgets/link_map.js +++ /dev/null @@ -1,115 +0,0 @@ -import CollapsibleWidget from "../collapsible_widget.js"; -import froca from "../../services/froca.js"; - -let linkMapContainerIdCtr = 1; - -const TPL = ` - -`; - -export default class LinkMapWidget extends CollapsibleWidget { - isEnabled() { - return super.isEnabled() && !this.note.hasLabel('linkMapWidgetDisabled'); - } - - get widgetTitle() { return "Link map"; } - - get help() { - return { - title: "Link map shows incoming and outgoing links from/to the current note.", - url: "https://github.com/zadam/trilium/wiki/Link-map" - }; - } - - get headerActions() { - const $showFullButton = $("") - .addClass("bx bx-network-chart") - .addClass('widget-header-action') - .attr('title', 'Show full link map'); - - $showFullButton.on('click', async () => { - const linkMapDialog = await import("../../dialogs/link_map.js"); - linkMapDialog.showDialog(); - }); - - return [$showFullButton]; - } - - decorateWidget() { - this.$body.css("max-height", "400px"); - } - - async refreshWithNote(note) { - const noteId = this.noteId; - - let shown = false; - - // avoid executing this expensive operation multiple times when just going through notes (with keyboard especially) - // until the users settles on a note - setTimeout(() => { - if (this.noteId === noteId) { - // there's a problem with centering the rendered link map before it is actually shown on the screen - // that's why we make the whole process lazy and with the help of IntersectionObserver wait until the - // tab is really shown and only then render - const observer = new IntersectionObserver(entries => { - if (!shown && entries[0].isIntersecting) { - shown = true; - this.displayLinkMap(note); - } - }, { - rootMargin: '0px', - threshold: 0.1 - }); - - observer.observe(this.$body[0]); - } - }, 1000); - } - - async displayLinkMap(note) { - this.$body.css('opacity', 0); - this.$body.html(TPL); - - const $linkMapContainer = this.$body.find('.link-map-container'); - $linkMapContainer.attr("id", "link-map-container-" + linkMapContainerIdCtr++); - - const LinkMapServiceClass = (await import('../../services/link_map.js')).default; - - this.linkMapService = new LinkMapServiceClass(note, $linkMapContainer, { - maxDepth: 1, - zoom: 0.6 - }); - - await this.linkMapService.render(); - - this.$body.animate({opacity: 1}, 300); - } - - cleanup() { - if (this.linkMapService) { - this.linkMapService.cleanup(); - } - } - - entitiesReloadedEvent({loadResults}) { - if (loadResults.getAttributes().find(attr => attr.type === 'relation' && (attr.noteId === this.noteId || attr.value === this.noteId))) { - this.noteSwitched(); - } - - const changedNoteIds = loadResults.getNoteIds(); - - if (changedNoteIds.length > 0) { - const $linkMapContainer = this.$body.find('.link-map-container'); - - for (const noteId of changedNoteIds) { - const note = froca.notes[noteId]; - - if (note) { - $linkMapContainer.find(`a[data-note-path="${noteId}"]`).text(note.title); - } - } - } - } -} diff --git a/src/public/stylesheets/link_map.css b/src/public/stylesheets/link_map.css deleted file mode 100644 index 2b8d96dcf..000000000 --- a/src/public/stylesheets/link_map.css +++ /dev/null @@ -1,66 +0,0 @@ -.link-map-container { - position: relative; - outline: none; /* remove dotted outline on click */ -} - -.link-map-container .note-box { - padding: 0px 8px 8px 8px; - position: absolute !important; - background-color: var(--main-background-color); - color: var(--main-text-color); - z-index: 4; - border: 1px solid #666; - border-radius: 8px; - opacity: 0.8; - font-size: 11px; - width: auto; - min-width: 120px; - max-width: 250px; - overflow: hidden; - white-space: nowrap; - text-overflow: ellipsis; -} - -.link-map-container .note-box:hover { - background-color: var(--more-accented-background-color); -} - -.link-map-container .note-box .title { - font-size: larger; - font-weight: 600; -} - -.link-map-active-note { - background-color: var(--accented-background-color) !important; -} - -.link-map-container .jsplumb-connection-hover path { - stroke-width: 2 !important; - stroke: var(--main-text-color); -} - -.link-map-widget { - outline: none; - overflow: hidden; -} - -.link-map-widget .note-box .title { - font-size: 19px !important; - font-weight: 600 -} - -#link-map-dialog .note-box .bx { - font-size: 24px !important; - position: relative; - top: 6px; - display: inline-block; - margin-right: 5px; -} - -.link-map-widget .note-box .bx { - font-size: 30px !important; - position: relative; - top: 6px; - display: inline-block; - margin-right: 5px; -} diff --git a/src/views/desktop.ejs b/src/views/desktop.ejs index d3f43fe5e..f6d42523d 100644 --- a/src/views/desktop.ejs +++ b/src/views/desktop.ejs @@ -33,7 +33,6 @@ <%- include('dialogs/prompt.ejs') %> <%- include('dialogs/confirm.ejs') %> <%- include('dialogs/help.ejs') %> -<%- include('dialogs/link_map.ejs') %> <%- include('dialogs/clone_to.ejs') %> <%- include('dialogs/move_to.ejs') %> <%- include('dialogs/backend_log.ejs') %> diff --git a/src/views/dialogs/link_map.ejs b/src/views/dialogs/link_map.ejs deleted file mode 100644 index dedd5ffc0..000000000 --- a/src/views/dialogs/link_map.ejs +++ /dev/null @@ -1,32 +0,0 @@ -