From fe7705524af0732ac98474447432d0c923f52ff6 Mon Sep 17 00:00:00 2001 From: zadam Date: Mon, 24 Feb 2020 22:37:45 +0100 Subject: [PATCH] fix include note in mobile frontend, closes #878 --- src/public/javascripts/mobile.js | 17 +++++++++++++++++ src/views/mobile.ejs | 2 ++ 2 files changed, 19 insertions(+) diff --git a/src/public/javascripts/mobile.js b/src/public/javascripts/mobile.js index 659f3dc51..ce6262f7d 100644 --- a/src/public/javascripts/mobile.js +++ b/src/public/javascripts/mobile.js @@ -7,9 +7,26 @@ import contextMenuWidget from "./services/context_menu.js"; import treeChangesService from "./services/branches.js"; import utils from "./services/utils.js"; import treeUtils from "./services/tree_utils.js"; +import linkService from "./services/link.js"; +import noteContentRenderer from "./services/note_content_renderer.js"; window.glob.isDesktop = utils.isDesktop; window.glob.isMobile = utils.isMobile; +window.glob.showAddLinkDialog = () => import('./dialogs/add_link.js').then(d => d.showDialog()); +window.glob.showIncludeNoteDialog = cb => import('./dialogs/include_note.js').then(d => d.showDialog(cb)); +window.glob.loadIncludedNote = async (noteId, el) => { + const note = await treeCache.getNote(noteId); + + if (note) { + $(el).empty().append($("

").append(await linkService.createNoteLink(note.noteId, { + showTooltip: false + }))); + + const {renderedContent} = await noteContentRenderer.getRenderedContent(note); + + $(el).append(renderedContent); + } +}; const $leftPane = $("#left-pane"); const $tree = $("#tree"); diff --git a/src/views/mobile.ejs b/src/views/mobile.ejs index 2591c7f45..fa43557da 100644 --- a/src/views/mobile.ejs +++ b/src/views/mobile.ejs @@ -73,6 +73,8 @@ <% include details/relation_map.ejs %> <% include details/protected_session_password.ejs %> + + <% include details/book.ejs %>