diff --git a/src/public/app/layouts/desktop_layout.js b/src/public/app/layouts/desktop_layout.js index dd62fa19c..02cba8895 100644 --- a/src/public/app/layouts/desktop_layout.js +++ b/src/public/app/layouts/desktop_layout.js @@ -42,6 +42,7 @@ import RightPaneContainer from "../widgets/containers/right_pane_container.js"; import EditButton from "../widgets/buttons/edit_button.js"; import CalendarMenuWidget from "../widgets/buttons/calendar_menu.js"; import EditedNotesWidget from "../widgets/ribbon_widgets/edited_notes.js"; +import OpenNoteButtonWidget from "../widgets/buttons/open_note_button_widget.js"; export default class DesktopLayout { constructor(customWidgets) { @@ -69,6 +70,10 @@ export default class DesktopLayout { .icon("bx-send") .title("Jump to note") .command("jumpToNote")) + .child(new OpenNoteButtonWidget() + .icon("bx-map-alt") + .title("Global link map") + .targetNote('globallinkmap')) .child(new ButtonWidget() .icon("bx-history") .title("Show recent changes") diff --git a/src/public/app/services/tab_manager.js b/src/public/app/services/tab_manager.js index 286b3955c..0e51864ec 100644 --- a/src/public/app/services/tab_manager.js +++ b/src/public/app/services/tab_manager.js @@ -227,7 +227,7 @@ export default class TabManager extends Component { /** * If the requested notePath is within current note hoisting scope then keep the note hoisting also for the new tab. */ - async openTabWithNoteWithHoisting(notePath) { + async openTabWithNoteWithHoisting(notePath, activate = false) { const noteContext = this.getActiveContext(); let hoistedNoteId = 'root'; @@ -239,7 +239,7 @@ export default class TabManager extends Component { } } - return this.openContextWithNote(notePath, false, null, hoistedNoteId); + return this.openContextWithNote(notePath, activate, null, hoistedNoteId); } async openContextWithNote(notePath, activate, ntxId, hoistedNoteId = 'root', mainNtxId = null) { diff --git a/src/public/app/widgets/buttons/open_note_button_widget.js b/src/public/app/widgets/buttons/open_note_button_widget.js new file mode 100644 index 000000000..05f3b8244 --- /dev/null +++ b/src/public/app/widgets/buttons/open_note_button_widget.js @@ -0,0 +1,10 @@ +import ButtonWidget from "./button_widget.js"; +import appContext from "../../services/app_context.js"; + +export default class OpenNoteButtonWidget extends ButtonWidget { + targetNote(noteId) { + this.onClick(() => appContext.tabManager.openTabWithNoteWithHoisting(noteId, true)); + + return this; + } +} diff --git a/src/public/app/widgets/note_detail.js b/src/public/app/widgets/note_detail.js index 8027393eb..7747e049f 100644 --- a/src/public/app/widgets/note_detail.js +++ b/src/public/app/widgets/note_detail.js @@ -20,6 +20,7 @@ import ReadOnlyTextTypeWidget from "./type_widgets/read_only_text.js"; import ReadOnlyCodeTypeWidget from "./type_widgets/read_only_code.js"; import NoneTypeWidget from "./type_widgets/none.js"; import attributeService from "../services/attributes.js"; +import GlobalLinkMapTypeWidget from "./type_widgets/global_link_map.js"; const TPL = `