From 8f5094fe5c0df1a4db1b283e867298c31ecf595d Mon Sep 17 00:00:00 2001 From: Stephen Cameron Date: Thu, 2 Aug 2018 17:49:29 +0200 Subject: [PATCH] Allow SVGs to be used as normal images in menu and fix bug that stopped normal URLs being used for extra icons. Done #1762 @1.75 --- js/libs/fluidbook/fluidbook.nav.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/js/libs/fluidbook/fluidbook.nav.js b/js/libs/fluidbook/fluidbook.nav.js index cb8f79b7..38cf5b26 100644 --- a/js/libs/fluidbook/fluidbook.nav.js +++ b/js/libs/fluidbook/fluidbook.nav.js @@ -514,7 +514,7 @@ FluidbookNav.prototype = { if (extraIcon.indexOf('.') === -1) { linkIcon = getSpriteIcon(extraIcon); } else { - if (extraIcon.indexOf('.svg') >= 0) { + if ((extraIcon.indexOf('.svg') >= 0) && (extraType == 'icon')) { if (getSpriteIcon('extra-extra' + n) == '') { var url = 'data/images/' + extraIcon; extraNPerURL[url] = n; @@ -545,10 +545,12 @@ FluidbookNav.prototype = { } } - if (extraURL.indexOf(':') === -1) { + // Add "link:" prefix if it's an ID but not if it is a relative link + if (extraURL.indexOf(':') === -1 && extraURL.indexOf('/') === -1) { extraURL = 'link:' + extraURL; } + // Process link ID from editor if (extraURL.indexOf('link:') === 0) { var linkId = extraURL.split(':', 2)[1]; var foundLink; @@ -569,6 +571,9 @@ FluidbookNav.prototype = { } link = $(link).get(0).outerHTML; + } else { + // Normal link + link = '' + linkIcon + ''; } var nav = this.getNavFromType(navType); nav.find('ul').append('
  • ' + link + '
  • '); -- 2.39.5