skeleton for global link map

This commit is contained in:
zadam 2021-09-16 23:09:48 +02:00
parent 5866004e23
commit ed26e32ccb
8 changed files with 42 additions and 10 deletions

View File

@ -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")

View File

@ -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) {

View File

@ -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;
}
}

View File

@ -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 = `
<div class="note-detail">
@ -45,7 +46,8 @@ const typeWidgetClasses = {
'render': RenderTypeWidget,
'relation-map': RelationMapTypeWidget,
'protected-session': ProtectedSessionTypeWidget,
'book': BookTypeWidget
'book': BookTypeWidget,
'globallinkmap': GlobalLinkMapTypeWidget
};
export default class NoteDetailWidget extends NoteContextAwareWidget {
@ -166,6 +168,10 @@ export default class NoteDetailWidget extends NoteContextAwareWidget {
type = 'editable-code';
}
if (type === 'special') {
type = note.noteId;
}
if (note.isProtected && !protectedSessionHolder.isProtectedSessionAvailable()) {
type = 'protected-session';
}

View File

@ -1,7 +1,5 @@
import openService from "../../services/open.js";
import TypeWidget from "./type_widget.js";
import fileWatcher from "../../services/file_watcher.js";
import server from "../../services/server.js";
const TPL = `
<div class="note-detail-file note-detail-printable">

View File

@ -0,0 +1,13 @@
import TypeWidget from "./type_widget.js";
const TPL = `<div class="note-detail-global-link-map note-detail-printable">WHATSUP</div>`;
export default class GlobalLinkMapTypeWidget extends TypeWidget {
static getType() { return "globallinkmap"; }
doRender() {
this.$widget = $(TPL);
super.doRender();
}
}

View File

@ -268,7 +268,7 @@ class ConsistencyChecks {
SELECT noteId, type
FROM notes
WHERE isDeleted = 0
AND type NOT IN ('text', 'code', 'render', 'file', 'image', 'search', 'relation-map', 'book')`,
AND type NOT IN ('text', 'code', 'render', 'file', 'image', 'search', 'relation-map', 'book', 'special')`,
({noteId, type}) => {
if (this.autoFix) {
const note = becca.getNote(noteId);

View File

@ -82,13 +82,13 @@ function getSinglesNoteRoot() {
}
function getGlobalLinkMapNote() {
let globalLinkMapNote = becca.getNote('global-link-map');
let globalLinkMapNote = becca.getNote('globallinkmap');
if (!globalLinkMapNote) {
globalLinkMapNote = noteService.createNewNote({
noteId: 'global-link-map',
title: 'global-link-map',
type: 'global-link-map',
noteId: 'globallinkmap',
title: 'Global Link Map',
type: 'special',
content: '',
parentNoteId: getSinglesNoteRoot().noteId
}).note;