From 263bff903cb60c8cac49b3953b15be9493c0143b Mon Sep 17 00:00:00 2001 From: zadam Date: Sun, 28 Jul 2019 14:08:05 +0200 Subject: [PATCH] mobile frontend shows only the active tab --- src/public/javascripts/services/tree.js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/public/javascripts/services/tree.js b/src/public/javascripts/services/tree.js index 74317bf25..a92032137 100644 --- a/src/public/javascripts/services/tree.js +++ b/src/public/javascripts/services/tree.js @@ -196,7 +196,11 @@ async function resolveNotePath(notePath) { async function getRunPath(notePath) { utils.assertArguments(notePath); - notePath = notePath.split("-")[0]; + notePath = notePath.split("-")[0].trim(); + + if (notePath.length === 0) { + return; + } const path = notePath.split("/").reverse(); @@ -362,7 +366,7 @@ async function treeInitialized() { } } - const filteredTabs = []; + let filteredTabs = []; for (const openTab of openTabs) { const noteId = treeUtils.getNoteIdFromNotePath(openTab.notePath); @@ -373,6 +377,11 @@ async function treeInitialized() { } } + if (utils.isMobile()) { + // mobile frontend doesn't have tabs so show only the active tab + filteredTabs = filteredTabs.filter(tab => tab.active); + } + if (filteredTabs.length === 0) { filteredTabs.push({ notePath: 'root',