Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix handle inter-page links
Signed-off-by: Ferdinand Thiessen <[email protected]>
  • Loading branch information
susnux committed May 30, 2022
commit 76f16055478c98e311583f11797464ae0b2c436b
6 changes: 6 additions & 0 deletions src/plugins/link.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@ const clickHandler = ({ editor }) => {
event.stopPropagation()

if (event.button === 0 && !event.ctrlKey && htmlHref.startsWith(window.location.origin)) {
if (window.location.href.split('#')[0] === htmlHref.split('#')[0]) {
// Inter-page link, so move to location
window.open(htmlHref, '_self')
return
}

const query = OC.parseQueryString(htmlHref)
const fragment = OC.parseQueryString(htmlHref.split('#').pop())
if (query.dir && fragment.relPath) {
Expand Down