diff --git a/editor/src/editor.js b/editor/src/editor.js index 63f452d..4e56ff1 100644 --- a/editor/src/editor.js +++ b/editor/src/editor.js @@ -121,6 +121,8 @@ function showSearchResultsExtended(element, template, searchTool, query, input, selectedPos = $lc.find('li').index(selected[0]) } + const isEditing = window.location.pathname.match(/^\/edit\//) + let $ul = el('ul', _.map(results, (hit, i) => { let div = el('div', []); @@ -133,7 +135,7 @@ function showSearchResultsExtended(element, template, searchTool, query, input, ]; if (hit.ref) { children = hit.ref ? [el('a', children)] : children; - children[0].setAttribute('href', '/edit/' + hit.ref) + children[0].setAttribute('href', (isEditing ? '/edit/' : '/') + hit.ref) } const li = el('li', children) if (selectedPos === i) li.classList.add('selected')