From d1e9ce8038e2c18f0bb9a5cf211c8b00fbcd7973 Mon Sep 17 00:00:00 2001 From: Jovyn Tan Date: Wed, 16 Feb 2022 09:43:47 +0800 Subject: [PATCH 01/24] Implement src attribute --- packages/core/src/html/MdAttributeRenderer.js | 37 ++++++++- packages/core/src/html/NodeProcessor.js | 10 ++- .../core/src/html/includePanelProcessor.js | 79 +++++++++++++++++++ 3 files changed, 121 insertions(+), 5 deletions(-) diff --git a/packages/core/src/html/MdAttributeRenderer.js b/packages/core/src/html/MdAttributeRenderer.js index f572378ad2..2395a45491 100644 --- a/packages/core/src/html/MdAttributeRenderer.js +++ b/packages/core/src/html/MdAttributeRenderer.js @@ -44,9 +44,40 @@ class MdAttributeRenderer { delete node.attribs[attribute]; } - processPopover(node) { - this.processAttributeWithoutOverride(node, 'content', true); - this.processAttributeWithoutOverride(node, 'header', true); + /** + * Checks if the node has both the given slot and the given attribute, + * deleting the attribute and logging a warning if both the slot and attribute exist. + * @param node Element to process + * @param attribute Attribute name to process + * @param slotName Name attribute of the element to insert, which defaults to the attribute name + * @returns {boolean} whether the node has both the slot and attribute + */ + hasSlotOverridingAttribute(node, attribute, slotName = attribute) { + const hasNamedSlot = node.children + && node.children.some(child => getVslotShorthandName(child) === slotName); + if (!hasNamedSlot) { + return false; + } + + // If the slot is present, remove the attribute as the attribute has no effect. + const hasAttribute = _.has(node.attribs, attribute) + if (hasAttribute) { + logger.warn(`${node.name} has a ${slotName} slot, '${attribute}' attribute has no effect.`); + } + + delete node.attribs[attribute]; + + return hasAttribute; + } + + processPopoverAttributes(node) { + if (!this.hasSlotOverridingAttribute(node, 'header')) { + this.processAttributeWithoutOverride(node, 'header', true); + } + + if (!this.hasSlotOverridingAttribute(node, 'content')) { + this.processAttributeWithoutOverride(node, 'content', true); + } } processTooltip(node) { diff --git a/packages/core/src/html/NodeProcessor.js b/packages/core/src/html/NodeProcessor.js index 15409ccdce..08b43cb9d6 100644 --- a/packages/core/src/html/NodeProcessor.js +++ b/packages/core/src/html/NodeProcessor.js @@ -12,7 +12,7 @@ _.has = require('lodash/has'); _.find = require('lodash/find'); const { PageNavProcessor, renderSiteNav, addSitePageNavPortal } = require('./siteAndPageNavProcessor'); -const { processInclude, processPanelSrc } = require('./includePanelProcessor'); +const { processInclude, processPanelSrc, processPopoverSrc } = require('./includePanelProcessor'); const { Context } = require('./Context'); const linkProcessor = require('./linkProcessor'); const { highlightCodeBlock, setCodeLineNumbers } = require('./codeblockProcessor'); @@ -160,7 +160,13 @@ class NodeProcessor { this.mdAttributeRenderer.processQuiz(node); break; case 'popover': - this.mdAttributeRenderer.processPopover(node); + if (_.has(node.attribs, 'src')) { + const childContext = processPopoverSrc(node, context, this.pageSources, this.variableProcessor, + text => this.markdownProcessor.renderMd(text), this.config); + this.mdAttributeRenderer.processPopoverAttributes(node); + return childContext; + } + this.mdAttributeRenderer.processPopoverAttributes(node); break; case 'tooltip': this.mdAttributeRenderer.processTooltip(node); diff --git a/packages/core/src/html/includePanelProcessor.js b/packages/core/src/html/includePanelProcessor.js index 9e624b89c2..15b4f5fe91 100644 --- a/packages/core/src/html/includePanelProcessor.js +++ b/packages/core/src/html/includePanelProcessor.js @@ -255,7 +255,86 @@ function processInclude(node, context, pageSources, variableProcessor, renderMd, return childContext; } +/** + * PreProcesses popovers with the src attribute. + * Replaces it with an error node if the specified src is invalid, + * or an empty node if the src is invalid but optional. + * Else, sets the content attribute of the popover as parsed from the src. + */ +function processPopoverSrc(node, context, pageSources, variableProcessor, renderMd, config) { + if (_.isEmpty(node.attribs.src)) { + const error = new Error(`Empty src attribute in include in: ${context.cwf}`); + logger.error(error); + cheerio(node).replaceWith(createErrorNode(node, error)); + } + + if (_.has(node.attribs, 'content')) { + logger.warn(`${node.name} has a 'src' attribute, 'content' attribute has no effect.`); + } + + const { + isUrl, + hash, + filePath, + actualFilePath, + } = _getSrcFlagsAndFilePaths(node, config); + + const fileExistsNode = _getFileExistsNode(node, context, actualFilePath, pageSources); + if (fileExistsNode) { + return fileExistsNode; + } + + pageSources.staticIncludeSrc.push({ + from: context.cwf, + to: actualFilePath, + }); + + const { + nunjucksProcessed, + childContext, + } = variableProcessor.renderIncludeFile(actualFilePath, pageSources, node, context, filePath); + + let actualContent = nunjucksProcessed; + if (fsUtil.isMarkdownFileExt(path.extname(actualFilePath))) { + actualContent = renderMd(actualContent); + } + + // Process sources with or without hash, retrieving and appending + // the appropriate children to a wrapped include element + if (hash) { + const $ = cheerio.load(actualContent); + actualContent = $(hash).html(); + + if (actualContent === null) { + actualContent = ''; + + const error = new Error(`No such segment '${hash}' in file: ${actualFilePath}\n` + + `Missing reference in ${context.cwf}`); + logger.error(error); + + actualContent = cheerio.html(createErrorNode(node, error)); + } + } + + node.attribs.content = actualContent.trim(); + + if (node.children && node.children.length > 0) { + childContext.addCwfToCallstack(context.cwf); + + if (childContext.hasExceededMaxCallstackSize()) { + const error = new CyclicReferenceError(childContext.callStack); + logger.error(error); + cheerio(node).replaceWith(createErrorNode(node, error)); + } + } + + delete node.attribs.src; + + return childContext; +} + module.exports = { processInclude, + processPopoverSrc, processPanelSrc, }; From 5b98e15f2469aff06993291dfa47b7020542f5ee Mon Sep 17 00:00:00 2001 From: Jovyn Tan Date: Wed, 16 Feb 2022 10:40:20 +0800 Subject: [PATCH 02/24] Update tests --- .../test_site/expected/siteData.json | 10 + .../test_site/expected/testPopovers.html | 297 ++++++++++++++++++ .../expected/testPopovers.page-vue-render.js | 28 ++ .../cli/test/functional/test_site/site.json | 4 + .../test/functional/test_site/testPopovers.md | 67 ++++ .../expected/index.html | 2 +- .../expected/index.page-vue-render.js | 2 +- 7 files changed, 408 insertions(+), 2 deletions(-) create mode 100644 packages/cli/test/functional/test_site/expected/testPopovers.html create mode 100644 packages/cli/test/functional/test_site/expected/testPopovers.page-vue-render.js create mode 100644 packages/cli/test/functional/test_site/testPopovers.md diff --git a/packages/cli/test/functional/test_site/expected/siteData.json b/packages/cli/test/functional/test_site/expected/siteData.json index f17bff86f0..f7ec340585 100644 --- a/packages/cli/test/functional/test_site/expected/siteData.json +++ b/packages/cli/test/functional/test_site/expected/siteData.json @@ -214,6 +214,16 @@ "headings": {}, "headingKeywords": {} }, + { + "src": "testPopovers.md", + "title": "Test: Popovers", + "headings": { + "nested-panel": "Nested Panel", + "normal-panel-content-heading": "Normal panel content heading", + "some-heading": "Some heading" + }, + "headingKeywords": {} + }, { "src": "testPopoverTrigger.md", "title": "Popover initiated by trigger should honor trigger attribute", diff --git a/packages/cli/test/functional/test_site/expected/testPopovers.html b/packages/cli/test/functional/test_site/expected/testPopovers.html new file mode 100644 index 0000000000..af363a4461 --- /dev/null +++ b/packages/cli/test/functional/test_site/expected/testPopovers.html @@ -0,0 +1,297 @@ + + + + + + + + + + + + + Test: Popovers + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + +
  • Open Bugs
  • +
    +
    +
    + Test Jumbotron
    +
    +
    +
    +

    Relative Link Test This is a relative Intra-Site link in a layout (see link)

    +
    +
    + + + + +
    +

    Popover with attributes

    + + Hover popover + +
    + + Click popover + +
    +

    Popover with slots

    + + + Hover popover + +
    + + + + Click popover + +
    +

    Popover with slots overriding attributes

    + + + Hover popover + +
    + + + + Click popover + +
    +

    Popover with src attribute

    + + src from a .md file + +
    + + src with a fragment + +
    + + + src containing reactive content + + +
    + + + +
    +
    +
    +

    Heading in footer should not be indexed

    +
    + This is a dynamic height footer that supports markdown 😄! +
    +
    +
    +
    + + + + + + + + + + + \ No newline at end of file diff --git a/packages/cli/test/functional/test_site/expected/testPopovers.page-vue-render.js b/packages/cli/test/functional/test_site/expected/testPopovers.page-vue-render.js new file mode 100644 index 0000000000..81c011f5c2 --- /dev/null +++ b/packages/cli/test/functional/test_site/expected/testPopovers.page-vue-render.js @@ -0,0 +1,28 @@ + + var pageVueRenderFn = function anonymous( +) { +with(this){return _c('div',{attrs:{"id":"app"}},[_c('div',[_c('header',[_c('navbar',{attrs:{"type":"dark","default-highlight-on":"sibling-or-child"},scopedSlots:_u([{key:"brand",fn:function(){return [_c('a',{staticClass:"navbar-brand",attrs:{"href":"/","title":"Home"}},[_v("Markbind Test Site")])]},proxy:true}])},[_v(" "),_c('li',[_c('a',{staticClass:"nav-link",attrs:{"href":"/test_site/bugs/index.html"}},[_v("Open Bugs")])])]),_v(" "),_m(0)],1),_v(" "),_m(1)]),_v(" "),_c('div',{attrs:{"id":"flex-body"}},[_c('overlay-source',{staticClass:"fixed-header-padding",attrs:{"id":"site-nav","tag-name":"nav","to":"site-nav"}},[_c('div',{staticClass:"site-nav-top"},[_c('div',{staticClass:"font-weight-bold mb-2",staticStyle:{"font-size":"1.25rem"}},[_c('div',[_c('h2',{attrs:{"id":"default-layout"}},[_c('span',{staticClass:"anchor",attrs:{"id":"default-layout"}}),_v("Default Layout"),_c('a',{staticClass:"fa fa-anchor",attrs:{"href":"#default-layout","onclick":"event.stopPropagation()"}})])])])]),_v(" "),_c('div',{staticClass:"nav-component slim-scroll"},[_c('div',[_c('site-nav',[_c('overlay-source',{staticClass:"site-nav-list site-nav-list-root",attrs:{"tag-name":"ul","to":"mb-site-nav"}},[_c('li',[_c('div',{staticClass:"site-nav-default-list-item site-nav-list-item-0",attrs:{"onclick":"handleSiteNavClick(this)"}},[_c('a',{attrs:{"href":"/test_site/index.html"}},[_v("Home 🏠")])])]),_v(" "),_c('li',[_c('div',{staticClass:"site-nav-default-list-item site-nav-list-item-0",attrs:{"onclick":"handleSiteNavClick(this)"}},[_c('a',{attrs:{"href":"/test_site/bugs/index.html"}},[_v("Open Bugs 🐛")])])]),_v(" "),_c('li',{staticClass:"site-nav-custom-list-item site-nav-list-item-0"},[_c('h3',{attrs:{"id":"testing-site-nav"}},[_c('span',{staticClass:"anchor",attrs:{"id":"testing-site-nav"}}),_v("Testing Site-Nav"),_c('a',{staticClass:"fa fa-anchor",attrs:{"href":"#testing-site-nav","onclick":"event.stopPropagation()"}})])]),_v(" "),_c('li',[_c('div',{staticClass:"site-nav-default-list-item site-nav-list-item-0",attrs:{"onclick":"handleSiteNavClick(this)"}},[_c('strong',[_v("Dropdown ")]),_v(" "),_c('span',{staticClass:"glyphicon glyphicon-search",attrs:{"aria-hidden":"true"}}),_v(" title ✏️ "),_v(" "),_c('i',{staticClass:"site-nav-dropdown-btn-icon site-nav-rotate-icon",attrs:{"onclick":"handleSiteNavClick(this.parentNode, false); event.stopPropagation();"}},[_c('span',{staticClass:"glyphicon glyphicon-menu-down",attrs:{"aria-hidden":"true"}})])]),_c('ul',{staticClass:"site-nav-dropdown-container site-nav-dropdown-container-open site-nav-list"},[_c('li',[_c('div',{staticClass:"site-nav-default-list-item site-nav-list-item-1",attrs:{"onclick":"handleSiteNavClick(this)"}},[_c('a',{attrs:{"href":"https://www.google.com/"}},[_v("Dropdown link one")])])]),_v(" "),_c('li',[_c('div',{staticClass:"site-nav-default-list-item site-nav-list-item-1",attrs:{"onclick":"handleSiteNavClick(this)"}},[_c('a',{attrs:{"href":"https://www.google.com/"}},[_v("Html within site-nav "),_c('span',{staticStyle:{"color":"red"}},[_v("should")]),_v(" be displayed properly")])])]),_v(" "),_c('li',[_c('div',{staticClass:"site-nav-default-list-item site-nav-list-item-1",attrs:{"onclick":"handleSiteNavClick(this)"}},[_v("Nested Dropdown title 📐\n\n"),_c('i',{staticClass:"site-nav-dropdown-btn-icon",attrs:{"onclick":"handleSiteNavClick(this.parentNode, false); event.stopPropagation();"}},[_c('span',{staticClass:"glyphicon glyphicon-menu-down",attrs:{"aria-hidden":"true"}})])]),_c('ul',{staticClass:"site-nav-dropdown-container site-nav-list"},[_c('li',[_c('div',{staticClass:"site-nav-default-list-item site-nav-list-item-2",attrs:{"onclick":"handleSiteNavClick(this)"}},[_c('a',{attrs:{"href":"https://www.google.com/"}},[_c('strong',[_v("Nested")]),_v(" Dropdown link one")])])]),_v(" "),_c('li',[_c('div',{staticClass:"site-nav-default-list-item site-nav-list-item-2",attrs:{"onclick":"handleSiteNavClick(this)"}},[_c('a',{attrs:{"href":"https://www.google.com/"}},[_c('strong',[_v("Nested")]),_v(" Dropdown link two")])])])])]),_v(" "),_c('li',[_c('div',{staticClass:"site-nav-default-list-item site-nav-list-item-1",attrs:{"onclick":"handleSiteNavClick(this)"}},[_c('a',{attrs:{"href":"https://www.google.com/"}},[_v("Dropdown link two")])])])])]),_v(" "),_c('li',[_c('div',{staticClass:"site-nav-default-list-item site-nav-list-item-0",attrs:{"onclick":"handleSiteNavClick(this)"}},[_c('a',{attrs:{"href":"https://www.google.com/"}},[_c('mark',[_v("Third Link")]),_v(" 📋")])])]),_v(" "),_c('li',[_c('div',{staticClass:"site-nav-default-list-item site-nav-list-item-0",attrs:{"onclick":"handleSiteNavClick(this)"}},[_v("Filler text "),_c('a',{attrs:{"href":"https://www.youtube.com/"}},[_c('span',{staticClass:"glyphicon glyphicon-facetime-video",attrs:{"aria-hidden":"true"}}),_v(" Youtube 📺")]),_v(" filler text"),_v(" "),_c('i',{staticClass:"site-nav-dropdown-btn-icon",attrs:{"onclick":"handleSiteNavClick(this.parentNode, false); event.stopPropagation();"}},[_c('span',{staticClass:"glyphicon glyphicon-menu-down",attrs:{"aria-hidden":"true"}})])]),_c('ul',{staticClass:"site-nav-dropdown-container site-nav-list"},[_c('li',[_c('div',{staticClass:"site-nav-default-list-item site-nav-list-item-1",attrs:{"onclick":"handleSiteNavClick(this)"}},[_c('a',{attrs:{"href":"https://www.youtube.com/watch?v=dQw4w9WgXcQ"}},[_v("The answer to everything in the universe")])])]),_v(" "),_c('li',[_c('div',{staticClass:"site-nav-default-list-item site-nav-list-item-1",attrs:{"onclick":"handleSiteNavClick(this)"}},[_c('mark',[_v("Dropdown title")]),_v(" "),_c('span',{staticClass:"glyphicon glyphicon-comment",attrs:{"aria-hidden":"true"}}),_v(" ✏️ "),_v(" "),_c('i',{staticClass:"site-nav-dropdown-btn-icon site-nav-rotate-icon",attrs:{"onclick":"handleSiteNavClick(this.parentNode, false); event.stopPropagation();"}},[_c('span',{staticClass:"glyphicon glyphicon-menu-down",attrs:{"aria-hidden":"true"}})])]),_c('ul',{staticClass:"site-nav-dropdown-container site-nav-dropdown-container-open site-nav-list"},[_c('li',[_c('div',{staticClass:"site-nav-default-list-item site-nav-list-item-2",attrs:{"onclick":"handleSiteNavClick(this)"}},[_c('a',{attrs:{"href":"https://www.google.com/"}},[_c('strong',[_v("Nested")]),_v(" Dropdown link one")])])])])])])]),_v(" "),_c('li',[_c('div',{staticClass:"site-nav-default-list-item site-nav-list-item-0",attrs:{"onclick":"handleSiteNavClick(this)"}},[_v("Really Long Dropdown Title Really Long Dropdown Title Really Long Dropdown Title Really Long Dropdown\n\n"),_c('i',{staticClass:"site-nav-dropdown-btn-icon",attrs:{"onclick":"handleSiteNavClick(this.parentNode, false); event.stopPropagation();"}},[_c('span',{staticClass:"glyphicon glyphicon-menu-down",attrs:{"aria-hidden":"true"}})])]),_c('ul',{staticClass:"site-nav-dropdown-container site-nav-list"},[_c('li',{staticClass:"site-nav-custom-list-item site-nav-list-item-1"},[_v("Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text")]),_v(" "),_c('li',[_c('div',{staticClass:"site-nav-default-list-item site-nav-list-item-1",attrs:{"onclick":"handleSiteNavClick(this)"}},[_v("Nested Dropdown Title\n\n"),_c('i',{staticClass:"site-nav-dropdown-btn-icon",attrs:{"onclick":"handleSiteNavClick(this.parentNode, false); event.stopPropagation();"}},[_c('span',{staticClass:"glyphicon glyphicon-menu-down",attrs:{"aria-hidden":"true"}})])]),_c('ul',{staticClass:"site-nav-dropdown-container site-nav-list"},[_c('li',{staticClass:"site-nav-custom-list-item site-nav-list-item-2"},[_v("Hello Doge Hello Doge 🐶")]),_v(" "),_c('li',[_c('div',{staticClass:"site-nav-default-list-item site-nav-list-item-2",attrs:{"onclick":"handleSiteNavClick(this)"}},[_c('a',{attrs:{"href":"/test_site/index.html"}},[_c('strong',[_v("NESTED LINK")]),_v(" Home 🏠")])])]),_v(" "),_c('li',{staticClass:"site-nav-custom-list-item site-nav-list-item-2"},[_v("Text cut off from height limit Text cut off from height limit Text cut off from height limit Text cut off from height limit Text cut off from height limit Text cut off from height limit Text cut off from height limit Text cut off from height limit Text cut off from height limit Text cut off from height limit Text cut off from height limit Text cut off from height limit Text cut off from height limit Text cut off from height limit Text cut off from height limit Text cut off from height limit Text cut off from height limit Text cut off from height limit Text cut off from height limit Text cut off from height limit Text cut off from height limit")])])])])]),_v(" "),_c('li',[_c('div',{staticClass:"site-nav-default-list-item site-nav-list-item-0",attrs:{"onclick":"handleSiteNavClick(this)"}},[_v("Test line break in navigation layout\n\n"),_c('i',{staticClass:"site-nav-dropdown-btn-icon",attrs:{"onclick":"handleSiteNavClick(this.parentNode, false); event.stopPropagation();"}},[_c('span',{staticClass:"glyphicon glyphicon-menu-down",attrs:{"aria-hidden":"true"}})])]),_c('ul',{staticClass:"site-nav-dropdown-container site-nav-list"},[_c('li',{staticClass:"site-nav-custom-list-item site-nav-list-item-1"},[_v("Nested line break text ✂️")]),_v(" "),_c('li',[_c('div',{staticClass:"site-nav-default-list-item site-nav-list-item-1",attrs:{"onclick":"handleSiteNavClick(this)"}},[_c('a',{attrs:{"href":"/test_site/index.html"}},[_v("Nested line break href")]),_v(" "),_c('i',{staticClass:"site-nav-dropdown-btn-icon",attrs:{"onclick":"handleSiteNavClick(this.parentNode, false); event.stopPropagation();"}},[_c('span',{staticClass:"glyphicon glyphicon-menu-down",attrs:{"aria-hidden":"true"}})])]),_c('ul',{staticClass:"site-nav-dropdown-container site-nav-list"},[_c('li',{staticClass:"site-nav-custom-list-item site-nav-list-item-2"},[_v("Nested Nested line break text ✂️")])])]),_v(" "),_c('li',[_c('div',{staticClass:"site-nav-default-list-item site-nav-list-item-1",attrs:{"onclick":"handleSiteNavClick(this)"}},[_v("Nested line break dropdown menu\n\n"),_c('i',{staticClass:"site-nav-dropdown-btn-icon",attrs:{"onclick":"handleSiteNavClick(this.parentNode, false); event.stopPropagation();"}},[_c('span',{staticClass:"glyphicon glyphicon-menu-down",attrs:{"aria-hidden":"true"}})])]),_c('ul',{staticClass:"site-nav-dropdown-container site-nav-list"},[_c('li',{staticClass:"site-nav-custom-list-item site-nav-list-item-2"},[_v("Line break item 2 📘")])])])])])])],1)],1)])]),_v(" "),_c('div',{staticClass:"fixed-header-padding",attrs:{"id":"content-wrapper"}},[_m(2),_v(" "),_c('popover',{scopedSlots:_u([{key:"content",fn:function(){return [_v("Correct content")]},proxy:true},{key:"header",fn:function(){return [_v("Correct header")]},proxy:true}])},[_v("\n Hover popover\n")]),_v(" "),_c('br'),_v(" "),_c('popover',{attrs:{"trigger":"click"},scopedSlots:_u([{key:"content",fn:function(){return [_v("Correct content")]},proxy:true},{key:"header",fn:function(){return [_v("Correct header")]},proxy:true}])},[_v("\n Click popover\n")]),_v(" "),_c('br'),_v(" "),_m(3),_v(" "),_c('popover',{scopedSlots:_u([{key:"content",fn:function(){return [_c('span',[_v("Correct content")])]},proxy:true}])},[_v("\n Hover popover\n")]),_v(" "),_c('br'),_v(" "),_c('popover',{attrs:{"trigger":"click"},scopedSlots:_u([{key:"header",fn:function(){return [_c('span',[_v("Correct header")])]},proxy:true},{key:"content",fn:function(){return [_c('span',[_v("Correct content")])]},proxy:true}])},[_v(" "),_v("\n Click popover\n")]),_v(" "),_c('br'),_v(" "),_m(4),_v(" "),_c('popover',{scopedSlots:_u([{key:"header",fn:function(){return [_v("Correct header")]},proxy:true},{key:"content",fn:function(){return [_c('span',[_v("Correct content")])]},proxy:true}])},[_v(" "),_v("\n Hover popover\n")]),_v(" "),_c('br'),_v(" "),_c('popover',{attrs:{"trigger":"click"},scopedSlots:_u([{key:"header",fn:function(){return [_c('span',[_v("Correct header")])]},proxy:true},{key:"content",fn:function(){return [_c('span',[_v("Correct content")])]},proxy:true}])},[_v(" "),_v("\n Click popover\n")]),_v(" "),_c('br'),_v(" "),_m(5),_v(" "),_c('popover',{scopedSlots:_u([{key:"content",fn:function(){return [_c('h1',{attrs:{"id":"some-heading"}},[_c('span',{staticClass:"anchor",attrs:{"id":"some-heading"}}),_v("Some heading"),_c('a',{staticClass:"fa fa-anchor",attrs:{"href":"#some-heading","onclick":"event.stopPropagation()"}})]),_v(" "),_c('p',[_v("The "),_c('strong',[_v("quick")]),_v(" brown fox jumps "),_c('em',[_v("over")]),_v(" the lazy dog.")])]},proxy:true},{key:"header",fn:function(){return [_v("Correct header")]},proxy:true}])},[_v("\n src from a .md file\n")]),_v(" "),_c('br'),_v(" "),_c('popover',{scopedSlots:_u([{key:"content",fn:function(){return [_v("content fragment")]},proxy:true}])},[_v("\n src with a fragment\n")]),_v(" "),_c('br'),_v(" "),_c('popover',{scopedSlots:_u([{key:"content",fn:function(){return [_c('panel',{attrs:{"src":"/test_site/testPanels/NormalPanelContent._include_.html","expanded":"","panelId":"nested-panel"},scopedSlots:_u([{key:"header",fn:function(){return [_c('h2',{attrs:{"id":"nested-panel"}},[_c('span',{staticClass:"anchor",attrs:{"id":"nested-panel"}}),_v("Nested Panel"),_c('a',{staticClass:"fa fa-anchor",attrs:{"href":"#nested-panel","onclick":"event.stopPropagation()"}})])]},proxy:true}])})]},proxy:true},{key:"header",fn:function(){return [_c('span',[_v("Reactive content")])]},proxy:true}])},[_v(" "),_v("\n src containing reactive content\n")]),_v(" "),_c('i',{staticClass:"fa fa-arrow-circle-up fa-lg d-print-none",attrs:{"id":"scroll-top-button","onclick":"handleScrollTop()","aria-hidden":"true"}})],1),_v(" "),_c('overlay-source',{staticClass:"fixed-header-padding",attrs:{"id":"page-nav","tag-name":"nav","to":"page-nav"}},[_c('div',{staticClass:"nav-component slim-scroll"})])],1),_v(" "),_m(6)])} +}; + var pageVueStaticRenderFns = [function anonymous( +) { +with(this){return _c('div',{staticClass:"bg-info display-4 text-center text-white"},[_c('br'),_v("\n Test Jumbotron"),_c('br'),_v(" "),_c('br')])} +},function anonymous( +) { +with(this){return _c('p',[_c('strong',[_v("Relative Link Test")]),_v(" This is a relative Intra-Site link in a layout (see "),_c('a',{attrs:{"href":"/test_site/index.html#heading-with-hidden-keyword"}},[_v("link")]),_v(")")])} +},function anonymous( +) { +with(this){return _c('p',[_c('strong',[_v("Popover with attributes")])])} +},function anonymous( +) { +with(this){return _c('p',[_c('strong',[_v("Popover with slots")])])} +},function anonymous( +) { +with(this){return _c('p',[_c('strong',[_v("Popover with slots overriding attributes")])])} +},function anonymous( +) { +with(this){return _c('p',[_c('strong',[_v("Popover with src attribute")])])} +},function anonymous( +) { +with(this){return _c('div',[_c('footer',[_c('h1',{attrs:{"id":"heading-in-footer-should-not-be-indexed"}},[_c('span',{staticClass:"anchor",attrs:{"id":"heading-in-footer-should-not-be-indexed"}}),_v("Heading in footer should not be indexed"),_c('a',{staticClass:"fa fa-anchor",attrs:{"href":"#heading-in-footer-should-not-be-indexed","onclick":"event.stopPropagation()"}})]),_v(" "),_c('div',{staticClass:"text-center"},[_v("\n This is a dynamic height footer that supports markdown "),_c('span',[_v("😄")]),_v("!\n ")])])])} +}]; + \ No newline at end of file diff --git a/packages/cli/test/functional/test_site/site.json b/packages/cli/test/functional/test_site/site.json index 8c456f0eb8..3270b725f3 100644 --- a/packages/cli/test/functional/test_site/site.json +++ b/packages/cli/test/functional/test_site/site.json @@ -74,6 +74,10 @@ "src": "testIncludeMultipleModals.md", "title": "Multiple inclusions of a modal should be supported" }, + { + "src": "testPopovers.md", + "title": "Test: Popovers" + }, { "src": "testPopoverTrigger.md", "title": "Popover initiated by trigger should honor trigger attribute" diff --git a/packages/cli/test/functional/test_site/testPopovers.md b/packages/cli/test/functional/test_site/testPopovers.md new file mode 100644 index 0000000000..68fb3219a5 --- /dev/null +++ b/packages/cli/test/functional/test_site/testPopovers.md @@ -0,0 +1,67 @@ +**Popover with attributes** + + + Hover popover + + +
    + + + Click popover + + +
    + +**Popover with slots** + + + Correct content + Hover popover + + +
    + + + Correct header + Correct content + Click popover + + +
    + +**Popover with slots overriding attributes** + + + Correct content + Hover popover + + +
    + + + Correct header + Correct content + Click popover + + +
    + +**Popover with src attribute** + + + src from a .md file + + +
    + + + src with a fragment + + +
    + + + Reactive content + src containing reactive content + + diff --git a/packages/cli/test/functional/test_site_algolia_plugin/expected/index.html b/packages/cli/test/functional/test_site_algolia_plugin/expected/index.html index bd7a275eee..dc2cd7d268 100644 --- a/packages/cli/test/functional/test_site_algolia_plugin/expected/index.html +++ b/packages/cli/test/functional/test_site_algolia_plugin/expected/index.html @@ -59,7 +59,7 @@ - +

    Tooltip content should have algolia-no-index class

    diff --git a/packages/cli/test/functional/test_site_algolia_plugin/expected/index.page-vue-render.js b/packages/cli/test/functional/test_site_algolia_plugin/expected/index.page-vue-render.js index de509b2175..a0058e74cd 100644 --- a/packages/cli/test/functional/test_site_algolia_plugin/expected/index.page-vue-render.js +++ b/packages/cli/test/functional/test_site_algolia_plugin/expected/index.page-vue-render.js @@ -1,7 +1,7 @@ var pageVueRenderFn = function anonymous( ) { -with(this){return _c('div',{attrs:{"id":"app"}},[_c('p'),_m(0),_v(" "),_m(1),_v(" "),_c('dropdown',{staticClass:"algolia-no-index",scopedSlots:_u([{key:"header",fn:function(){return [_v("Dropdown")]},proxy:true}])},[_v(" "),_c('li',[_c('a',{staticClass:"dropdown-item",attrs:{"href":"/"}},[_v("One")])]),_v(" "),_c('li',[_c('a',{staticClass:"dropdown-item",attrs:{"href":"/"}},[_v("Two")])])]),_v(" "),_m(2),_v(" "),_c('b-modal',{ref:"modal:trigger_id",staticClass:"algolia-no-index",attrs:{"id":"modal:trigger_id","hide-footer":"","size":"","modal-class":"mb-zoom"},scopedSlots:_u([{key:"modal-title",fn:function(){return [_v("Modal")]},proxy:true}])},[_v("\n Content should have `algolia-no-index` class\n")]),_v(" "),_c('trigger',{attrs:{"for":"modal:trigger_id"}},[_v("Trigger should not have `algolia-no-index` class")]),_v(" "),_m(3),_v(" "),_c('panel',{staticClass:"algolia-no-index",scopedSlots:_u([{key:"header",fn:function(){return [_c('p',[_v("Panel")])]},proxy:true}])},[_v("\n Content\n")]),_v(" "),_c('panel',{attrs:{"expanded":""},scopedSlots:_u([{key:"header",fn:function(){return [_c('p',[_v("Panel")])]},proxy:true}])},[_v("\n Content\n")]),_v(" "),_m(4),_v(" "),_c('popover',{attrs:{"effect":"fade","placement":"top"},scopedSlots:_u([{key:"header",fn:function(){return [_v("Title")]},proxy:true},{key:"content",fn:function(){return [_c('div',[_v("Content should have `algolia-no-index` class")])]},proxy:true}])},[_v(" "),_v(" "),_c('button',{staticClass:"btn btn-secondary"},[_v("Trigger should not have `algolia-no-index` class")])]),_v(" "),_c('popover',{attrs:{"effect":"fade","placement":"top"},scopedSlots:_u([{key:"header",fn:function(){return [_v("Title")]},proxy:true},{key:"content",fn:function(){return [_v("Content should have "),_c('code',{pre:true,attrs:{"class":"hljs inline no-lang"}},[_v("algolia-no-index")]),_v(" class")]},proxy:true}])},[_v(" "),_c('button',{staticClass:"btn btn-secondary"},[_v("Trigger should not have `algolia-no-index` class")])]),_v(" "),_m(5),_v(" "),_c('tooltip',{attrs:{"placement":"top"},scopedSlots:_u([{key:"content",fn:function(){return [_v("Content should have "),_c('code',{pre:true,attrs:{"class":"hljs inline no-lang"}},[_v("algolia-no-index")]),_v(" class")]},proxy:true}])},[_v(" "),_c('button',{staticClass:"btn btn-secondary"},[_v("Trigger should not have `algolia-no-index` class")])]),_v(" "),_m(6),_v(" "),_c('question',{scopedSlots:_u([{key:"hint",fn:function(){return [_c('div',{staticClass:"algolia-no-index"},[_v("Hint should have `algolia-no-index` class")])]},proxy:true},{key:"answer",fn:function(){return [_c('div',{staticClass:"algolia-no-index"},[_v("Answer should have `algolia-no-index` class")])]},proxy:true}])},[_v("\n Question should not have `algolia-no-index` class\n ")]),_v(" "),_m(7),_v(" "),_c('tabs',[_c('tab',{scopedSlots:_u([{key:"header",fn:function(){return [_v("First Tab")]},proxy:true}])},[_v("\n Content"),_c('br'),_v("Content"),_c('br'),_v("Content"),_c('br'),_v("Content\n ")]),_v(" "),_c('tab',{staticClass:"algolia-no-index",scopedSlots:_u([{key:"header",fn:function(){return [_v("Second Tab")]},proxy:true}])},[_v("\n Content"),_c('br'),_v("Content"),_c('br'),_v("Content"),_c('br'),_v("Content\n ")])],1),_v(" "),_c('tabs',[_c('tab-group',{scopedSlots:_u([{key:"header",fn:function(){return [_v("First Group")]},proxy:true}])},[_v(" "),_c('tab',{scopedSlots:_u([{key:"header",fn:function(){return [_v("First Tab")]},proxy:true}])},[_v("\n Content"),_c('br'),_v("Content"),_c('br'),_v("Content"),_c('br'),_v("Content\n ")]),_v(" "),_c('tab',{staticClass:"algolia-no-index",scopedSlots:_u([{key:"header",fn:function(){return [_v("Second Tab")]},proxy:true}])},[_v("\n Content"),_c('br'),_v("Content"),_c('br'),_v("Content"),_c('br'),_v("Content\n ")])],1),_v(" "),_c('tab-group',{staticClass:"algolia-no-index",scopedSlots:_u([{key:"header",fn:function(){return [_v("Second Group")]},proxy:true}])},[_v(" "),_c('tab',{scopedSlots:_u([{key:"header",fn:function(){return [_v("First Tab")]},proxy:true}])},[_v("\n Content"),_c('br'),_v("Content"),_c('br'),_v("Content"),_c('br'),_v("Content\n ")]),_v(" "),_c('tab',{staticClass:"algolia-no-index",scopedSlots:_u([{key:"header",fn:function(){return [_v("Second Tab")]},proxy:true}])},[_v("\n Content"),_c('br'),_v("Content"),_c('br'),_v("Content"),_c('br'),_v("Content\n ")])],1)],1),_v(" "),_c('tabs',[_c('tab-group',{scopedSlots:_u([{key:"header",fn:function(){return [_v("Outer One")]},proxy:true}])},[_v(" "),_c('tab',{scopedSlots:_u([{key:"header",fn:function(){return [_v("First Tab")]},proxy:true}])},[_v("\n Content"),_c('br'),_v("Content"),_c('br'),_v("Content"),_c('br'),_v("Content\n ")]),_v(" "),_c('tab',{staticClass:"algolia-no-index",scopedSlots:_u([{key:"header",fn:function(){return [_v("Second Tab")]},proxy:true}])},[_v("\n Content"),_c('br'),_v("Content"),_c('br'),_v("Content"),_c('br'),_v("Content\n ")])],1),_v(" "),_c('tab',{scopedSlots:_u([{key:"header",fn:function(){return [_v("Outer Two")]},proxy:true}])},[_v("\n Content"),_c('br'),_v("Content"),_c('br'),_v("Content"),_c('br'),_v("Content\n ")])],1),_v(" "),_c('i',{staticClass:"fa fa-arrow-circle-up fa-lg d-print-none",attrs:{"id":"scroll-top-button","onclick":"handleScrollTop()","aria-hidden":"true"}}),_c('p')],1)} +with(this){return _c('div',{attrs:{"id":"app"}},[_c('p'),_m(0),_v(" "),_m(1),_v(" "),_c('dropdown',{staticClass:"algolia-no-index",scopedSlots:_u([{key:"header",fn:function(){return [_v("Dropdown")]},proxy:true}])},[_v(" "),_c('li',[_c('a',{staticClass:"dropdown-item",attrs:{"href":"/"}},[_v("One")])]),_v(" "),_c('li',[_c('a',{staticClass:"dropdown-item",attrs:{"href":"/"}},[_v("Two")])])]),_v(" "),_m(2),_v(" "),_c('b-modal',{ref:"modal:trigger_id",staticClass:"algolia-no-index",attrs:{"id":"modal:trigger_id","hide-footer":"","size":"","modal-class":"mb-zoom"},scopedSlots:_u([{key:"modal-title",fn:function(){return [_v("Modal")]},proxy:true}])},[_v("\n Content should have `algolia-no-index` class\n")]),_v(" "),_c('trigger',{attrs:{"for":"modal:trigger_id"}},[_v("Trigger should not have `algolia-no-index` class")]),_v(" "),_m(3),_v(" "),_c('panel',{staticClass:"algolia-no-index",scopedSlots:_u([{key:"header",fn:function(){return [_c('p',[_v("Panel")])]},proxy:true}])},[_v("\n Content\n")]),_v(" "),_c('panel',{attrs:{"expanded":""},scopedSlots:_u([{key:"header",fn:function(){return [_c('p',[_v("Panel")])]},proxy:true}])},[_v("\n Content\n")]),_v(" "),_m(4),_v(" "),_c('popover',{attrs:{"effect":"fade","placement":"top"},scopedSlots:_u([{key:"header",fn:function(){return [_v("Title")]},proxy:true},{key:"content",fn:function(){return [_c('div',[_v("Content should have `algolia-no-index` class")])]},proxy:true}])},[_v(" "),_v(" "),_c('button',{staticClass:"btn btn-secondary"},[_v("Trigger should not have `algolia-no-index` class")])]),_v(" "),_c('popover',{attrs:{"effect":"fade","placement":"top"},scopedSlots:_u([{key:"content",fn:function(){return [_v("Content should have "),_c('code',{pre:true,attrs:{"class":"hljs inline no-lang"}},[_v("algolia-no-index")]),_v(" class")]},proxy:true},{key:"header",fn:function(){return [_v("Title")]},proxy:true}])},[_v(" "),_c('button',{staticClass:"btn btn-secondary"},[_v("Trigger should not have `algolia-no-index` class")])]),_v(" "),_m(5),_v(" "),_c('tooltip',{attrs:{"placement":"top"},scopedSlots:_u([{key:"content",fn:function(){return [_v("Content should have "),_c('code',{pre:true,attrs:{"class":"hljs inline no-lang"}},[_v("algolia-no-index")]),_v(" class")]},proxy:true}])},[_v(" "),_c('button',{staticClass:"btn btn-secondary"},[_v("Trigger should not have `algolia-no-index` class")])]),_v(" "),_m(6),_v(" "),_c('question',{scopedSlots:_u([{key:"hint",fn:function(){return [_c('div',{staticClass:"algolia-no-index"},[_v("Hint should have `algolia-no-index` class")])]},proxy:true},{key:"answer",fn:function(){return [_c('div',{staticClass:"algolia-no-index"},[_v("Answer should have `algolia-no-index` class")])]},proxy:true}])},[_v("\n Question should not have `algolia-no-index` class\n ")]),_v(" "),_m(7),_v(" "),_c('tabs',[_c('tab',{scopedSlots:_u([{key:"header",fn:function(){return [_v("First Tab")]},proxy:true}])},[_v("\n Content"),_c('br'),_v("Content"),_c('br'),_v("Content"),_c('br'),_v("Content\n ")]),_v(" "),_c('tab',{staticClass:"algolia-no-index",scopedSlots:_u([{key:"header",fn:function(){return [_v("Second Tab")]},proxy:true}])},[_v("\n Content"),_c('br'),_v("Content"),_c('br'),_v("Content"),_c('br'),_v("Content\n ")])],1),_v(" "),_c('tabs',[_c('tab-group',{scopedSlots:_u([{key:"header",fn:function(){return [_v("First Group")]},proxy:true}])},[_v(" "),_c('tab',{scopedSlots:_u([{key:"header",fn:function(){return [_v("First Tab")]},proxy:true}])},[_v("\n Content"),_c('br'),_v("Content"),_c('br'),_v("Content"),_c('br'),_v("Content\n ")]),_v(" "),_c('tab',{staticClass:"algolia-no-index",scopedSlots:_u([{key:"header",fn:function(){return [_v("Second Tab")]},proxy:true}])},[_v("\n Content"),_c('br'),_v("Content"),_c('br'),_v("Content"),_c('br'),_v("Content\n ")])],1),_v(" "),_c('tab-group',{staticClass:"algolia-no-index",scopedSlots:_u([{key:"header",fn:function(){return [_v("Second Group")]},proxy:true}])},[_v(" "),_c('tab',{scopedSlots:_u([{key:"header",fn:function(){return [_v("First Tab")]},proxy:true}])},[_v("\n Content"),_c('br'),_v("Content"),_c('br'),_v("Content"),_c('br'),_v("Content\n ")]),_v(" "),_c('tab',{staticClass:"algolia-no-index",scopedSlots:_u([{key:"header",fn:function(){return [_v("Second Tab")]},proxy:true}])},[_v("\n Content"),_c('br'),_v("Content"),_c('br'),_v("Content"),_c('br'),_v("Content\n ")])],1)],1),_v(" "),_c('tabs',[_c('tab-group',{scopedSlots:_u([{key:"header",fn:function(){return [_v("Outer One")]},proxy:true}])},[_v(" "),_c('tab',{scopedSlots:_u([{key:"header",fn:function(){return [_v("First Tab")]},proxy:true}])},[_v("\n Content"),_c('br'),_v("Content"),_c('br'),_v("Content"),_c('br'),_v("Content\n ")]),_v(" "),_c('tab',{staticClass:"algolia-no-index",scopedSlots:_u([{key:"header",fn:function(){return [_v("Second Tab")]},proxy:true}])},[_v("\n Content"),_c('br'),_v("Content"),_c('br'),_v("Content"),_c('br'),_v("Content\n ")])],1),_v(" "),_c('tab',{scopedSlots:_u([{key:"header",fn:function(){return [_v("Outer Two")]},proxy:true}])},[_v("\n Content"),_c('br'),_v("Content"),_c('br'),_v("Content"),_c('br'),_v("Content\n ")])],1),_v(" "),_c('i',{staticClass:"fa fa-arrow-circle-up fa-lg d-print-none",attrs:{"id":"scroll-top-button","onclick":"handleScrollTop()","aria-hidden":"true"}}),_c('p')],1)} }; var pageVueStaticRenderFns = [function anonymous( ) { From 62123b65ce4c1cc474c10e0ade7979403a32eac1 Mon Sep 17 00:00:00 2001 From: Jovyn Tan Date: Wed, 16 Feb 2022 12:01:24 +0800 Subject: [PATCH 03/24] Update docs --- docs/userGuide/syntax/popovers.mbdf | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/docs/userGuide/syntax/popovers.mbdf b/docs/userGuide/syntax/popovers.mbdf index 3d4abfa26b..a292a985dc 100644 --- a/docs/userGuide/syntax/popovers.mbdf +++ b/docs/userGuide/syntax/popovers.mbdf @@ -45,14 +45,20 @@

    Content using slot

    - -
    - This is a long content... -
    - -
    -
    -
    +

    + +

    + This is a long content... +
    + + +

    +

    Content using src

    +

    + + + +

    Wrap Text

    What do you say @@ -81,6 +87,7 @@ Name | Type | Default | Description trigger | `String` | `hover` | How the Popover is triggered.
    Supports: `click`, `focus`, `hover`. header{{slot_info_trigger}} | `String` | `''` | Popover header, supports MarkDown text. content{{slot_info_trigger}} | `String` | `''` | Popover content, supports MarkDown text. +src | `String` | | The url to the remote page to be loaded as the content of the panel. placement | `String` | `top` | How to position the Popover.
    Supports: `top`, `left`, `right`, `bottom`. From d9e490adeeeca3153798f5aebf77a1b006d95e62 Mon Sep 17 00:00:00 2001 From: Jovyn Tan Date: Wed, 16 Feb 2022 15:41:14 +0800 Subject: [PATCH 04/24] Lint --- packages/core/src/html/MdAttributeRenderer.js | 3 ++- packages/core/src/html/includePanelProcessor.js | 6 ++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/packages/core/src/html/MdAttributeRenderer.js b/packages/core/src/html/MdAttributeRenderer.js index 2395a45491..56d79ff506 100644 --- a/packages/core/src/html/MdAttributeRenderer.js +++ b/packages/core/src/html/MdAttributeRenderer.js @@ -52,6 +52,7 @@ class MdAttributeRenderer { * @param slotName Name attribute of the element to insert, which defaults to the attribute name * @returns {boolean} whether the node has both the slot and attribute */ + // eslint-disable-next-line class-methods-use-this hasSlotOverridingAttribute(node, attribute, slotName = attribute) { const hasNamedSlot = node.children && node.children.some(child => getVslotShorthandName(child) === slotName); @@ -60,7 +61,7 @@ class MdAttributeRenderer { } // If the slot is present, remove the attribute as the attribute has no effect. - const hasAttribute = _.has(node.attribs, attribute) + const hasAttribute = _.has(node.attribs, attribute); if (hasAttribute) { logger.warn(`${node.name} has a ${slotName} slot, '${attribute}' attribute has no effect.`); } diff --git a/packages/core/src/html/includePanelProcessor.js b/packages/core/src/html/includePanelProcessor.js index 15b4f5fe91..a16ad19e11 100644 --- a/packages/core/src/html/includePanelProcessor.js +++ b/packages/core/src/html/includePanelProcessor.js @@ -284,6 +284,12 @@ function processPopoverSrc(node, context, pageSources, variableProcessor, render return fileExistsNode; } + // No need to process url contents + if (isUrl) { + _deleteIncludeAttributes(node); + return node; + } + pageSources.staticIncludeSrc.push({ from: context.cwf, to: actualFilePath, From 315b67fe2d6fec6c1c8be795c710bf3b8007d22d Mon Sep 17 00:00:00 2001 From: Jovyn Tan Date: Wed, 16 Feb 2022 16:14:44 +0800 Subject: [PATCH 05/24] Fix tests --- packages/core/test/unit/html/NodeProcessor.data.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/core/test/unit/html/NodeProcessor.data.js b/packages/core/test/unit/html/NodeProcessor.data.js index 32878fb688..85c4861022 100644 --- a/packages/core/test/unit/html/NodeProcessor.data.js +++ b/packages/core/test/unit/html/NodeProcessor.data.js @@ -146,7 +146,7 @@ module.exports.PROCESS_POPOVER_ATTRIBUTES = ` `; module.exports.PROCESS_POPOVER_ATTRIBUTES_EXPECTED = ` - + Content and header attributes should be processed and inserted under panel as slots and deleted. `; From 8cd21f85146a28050c59a3e5ba92105b48ec741b Mon Sep 17 00:00:00 2001 From: Jovyn Tan Date: Wed, 16 Feb 2022 23:55:22 +0800 Subject: [PATCH 06/24] possibly cleaner? --- packages/core/src/html/MdAttributeRenderer.js | 12 +++++++++++- packages/core/src/html/NodeProcessor.js | 8 ++------ packages/core/src/html/includePanelProcessor.js | 8 +++++--- 3 files changed, 18 insertions(+), 10 deletions(-) diff --git a/packages/core/src/html/MdAttributeRenderer.js b/packages/core/src/html/MdAttributeRenderer.js index 56d79ff506..b9fba0b439 100644 --- a/packages/core/src/html/MdAttributeRenderer.js +++ b/packages/core/src/html/MdAttributeRenderer.js @@ -76,7 +76,17 @@ class MdAttributeRenderer { this.processAttributeWithoutOverride(node, 'header', true); } - if (!this.hasSlotOverridingAttribute(node, 'content')) { + // Warn if there is a slot overriding an attribute + const hasSlotAndContentAttribute = this.hasSlotOverridingAttribute(node, 'content', 'content'); + const hasSlotAndSrcAttribute = this.hasSlotOverridingAttribute(node, 'src', 'content'); + + if (hasSlotAndContentAttribute || hasSlotAndSrcAttribute) { + return; + } + + if (_.has(node.attribs, 'src')) { + this.processAttributeWithoutOverride(node, 'src', true, 'content'); + } else { this.processAttributeWithoutOverride(node, 'content', true); } } diff --git a/packages/core/src/html/NodeProcessor.js b/packages/core/src/html/NodeProcessor.js index 08b43cb9d6..4cfe5fa607 100644 --- a/packages/core/src/html/NodeProcessor.js +++ b/packages/core/src/html/NodeProcessor.js @@ -160,12 +160,8 @@ class NodeProcessor { this.mdAttributeRenderer.processQuiz(node); break; case 'popover': - if (_.has(node.attribs, 'src')) { - const childContext = processPopoverSrc(node, context, this.pageSources, this.variableProcessor, - text => this.markdownProcessor.renderMd(text), this.config); - this.mdAttributeRenderer.processPopoverAttributes(node); - return childContext; - } + processPopoverSrc(node, context, this.pageSources, this.variableProcessor, + text => this.markdownProcessor.renderMd(text), this.config); this.mdAttributeRenderer.processPopoverAttributes(node); break; case 'tooltip': diff --git a/packages/core/src/html/includePanelProcessor.js b/packages/core/src/html/includePanelProcessor.js index a16ad19e11..a59b9d05e1 100644 --- a/packages/core/src/html/includePanelProcessor.js +++ b/packages/core/src/html/includePanelProcessor.js @@ -262,6 +262,10 @@ function processInclude(node, context, pageSources, variableProcessor, renderMd, * Else, sets the content attribute of the popover as parsed from the src. */ function processPopoverSrc(node, context, pageSources, variableProcessor, renderMd, config) { + if (!_.has(node.attribs, 'src')) { + return context; + } + if (_.isEmpty(node.attribs.src)) { const error = new Error(`Empty src attribute in include in: ${context.cwf}`); logger.error(error); @@ -322,7 +326,7 @@ function processPopoverSrc(node, context, pageSources, variableProcessor, render } } - node.attribs.content = actualContent.trim(); + node.attribs.src = actualContent.trim(); if (node.children && node.children.length > 0) { childContext.addCwfToCallstack(context.cwf); @@ -334,8 +338,6 @@ function processPopoverSrc(node, context, pageSources, variableProcessor, render } } - delete node.attribs.src; - return childContext; } From 4ba70d10cf4b4c9f33765990f0be497cff00354a Mon Sep 17 00:00:00 2001 From: Jovyn Tan Date: Thu, 17 Feb 2022 00:13:47 +0800 Subject: [PATCH 07/24] Refactor --- packages/core/src/html/MdAttributeRenderer.js | 7 ++----- packages/core/src/html/NodeProcessor.js | 5 ++--- packages/core/src/html/includePanelProcessor.js | 7 ++++++- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/packages/core/src/html/MdAttributeRenderer.js b/packages/core/src/html/MdAttributeRenderer.js index b9fba0b439..98e1160033 100644 --- a/packages/core/src/html/MdAttributeRenderer.js +++ b/packages/core/src/html/MdAttributeRenderer.js @@ -76,17 +76,14 @@ class MdAttributeRenderer { this.processAttributeWithoutOverride(node, 'header', true); } - // Warn if there is a slot overriding an attribute + // Warn if there is a content slot overriding the attributes 'content' or 'src' const hasSlotAndContentAttribute = this.hasSlotOverridingAttribute(node, 'content', 'content'); const hasSlotAndSrcAttribute = this.hasSlotOverridingAttribute(node, 'src', 'content'); - if (hasSlotAndContentAttribute || hasSlotAndSrcAttribute) { return; } - if (_.has(node.attribs, 'src')) { - this.processAttributeWithoutOverride(node, 'src', true, 'content'); - } else { + if (!_.has(node.attribs, 'src')) { this.processAttributeWithoutOverride(node, 'content', true); } } diff --git a/packages/core/src/html/NodeProcessor.js b/packages/core/src/html/NodeProcessor.js index 4cfe5fa607..0fc338725e 100644 --- a/packages/core/src/html/NodeProcessor.js +++ b/packages/core/src/html/NodeProcessor.js @@ -160,10 +160,9 @@ class NodeProcessor { this.mdAttributeRenderer.processQuiz(node); break; case 'popover': - processPopoverSrc(node, context, this.pageSources, this.variableProcessor, - text => this.markdownProcessor.renderMd(text), this.config); this.mdAttributeRenderer.processPopoverAttributes(node); - break; + return processPopoverSrc(node, context, this.pageSources, this.variableProcessor, + text => this.markdownProcessor.renderMd(text), this.config); case 'tooltip': this.mdAttributeRenderer.processTooltip(node); break; diff --git a/packages/core/src/html/includePanelProcessor.js b/packages/core/src/html/includePanelProcessor.js index a59b9d05e1..f18d0a7fa7 100644 --- a/packages/core/src/html/includePanelProcessor.js +++ b/packages/core/src/html/includePanelProcessor.js @@ -326,7 +326,7 @@ function processPopoverSrc(node, context, pageSources, variableProcessor, render } } - node.attribs.src = actualContent.trim(); + actualContent = actualContent.trim(); if (node.children && node.children.length > 0) { childContext.addCwfToCallstack(context.cwf); @@ -338,6 +338,11 @@ function processPopoverSrc(node, context, pageSources, variableProcessor, render } } + const attributeSlotElement = cheerio.parseHTML(``, true); + node.children = node.children ? attributeSlotElement.concat(node.children) : attributeSlotElement; + + delete node.attribs.src; + return childContext; } From 5e45e5e877ed6bcd9424957da17c7b60031ced3b Mon Sep 17 00:00:00 2001 From: Jovyn Tan Date: Thu, 17 Feb 2022 00:29:39 +0800 Subject: [PATCH 08/24] Fix typo --- docs/userGuide/syntax/popovers.mbdf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/userGuide/syntax/popovers.mbdf b/docs/userGuide/syntax/popovers.mbdf index a292a985dc..2e314cc154 100644 --- a/docs/userGuide/syntax/popovers.mbdf +++ b/docs/userGuide/syntax/popovers.mbdf @@ -87,7 +87,7 @@ Name | Type | Default | Description trigger | `String` | `hover` | How the Popover is triggered.
    Supports: `click`, `focus`, `hover`. header{{slot_info_trigger}} | `String` | `''` | Popover header, supports MarkDown text. content{{slot_info_trigger}} | `String` | `''` | Popover content, supports MarkDown text. -src | `String` | | The url to the remote page to be loaded as the content of the panel. +src | `String` | | The url to the remote page to be loaded as the content of the popover. placement | `String` | `top` | How to position the Popover.
    Supports: `top`, `left`, `right`, `bottom`. From fd2dc1a3f64ddef1f5012a50a0a2cce00b434206 Mon Sep 17 00:00:00 2001 From: Jovyn Tan Date: Sun, 20 Feb 2022 16:54:50 +0800 Subject: [PATCH 09/24] Add HTML example to docs --- docs/userGuide/syntax/popovers.md | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/docs/userGuide/syntax/popovers.md b/docs/userGuide/syntax/popovers.md index 45be3d12d1..ba83c8bf01 100644 --- a/docs/userGuide/syntax/popovers.md +++ b/docs/userGuide/syntax/popovers.md @@ -55,8 +55,13 @@

    Content using src

    - - + + This is loaded from a .html file + +

    +

    + + This is loaded from a .md file

    Wrap Text

    @@ -87,7 +92,7 @@ Name | Type | Default | Description trigger | `String` | `hover` | How the Popover is triggered.
    Supports: `click`, `focus`, `hover`. header{{slot_info_trigger}} | `String` | `''` | Popover header, supports MarkDown text. content{{slot_info_trigger}} | `String` | `''` | Popover content, supports MarkDown text. -src | `String` | | The url to the remote page to be loaded as the content of the popover. +src | `String` | | The url to the remote page to be loaded as the content of the popover. Both .md and .html are accepted. placement | `String` | `top` | How to position the Popover.
    Supports: `top`, `left`, `right`, `bottom`. From de9255fd745ba21408e12c5d4452886841674594 Mon Sep 17 00:00:00 2001 From: Jovyn Tan Date: Mon, 28 Feb 2022 11:16:23 +0800 Subject: [PATCH 10/24] Refactoring --- packages/core/src/html/MdAttributeRenderer.js | 3 +-- packages/core/src/html/elements.js | 4 ++++ .../core/src/html/includePanelProcessor.js | 24 ++++++++++++------- .../core/src/html/vueSlotSyntaxProcessor.js | 8 +++++++ 4 files changed, 28 insertions(+), 11 deletions(-) diff --git a/packages/core/src/html/MdAttributeRenderer.js b/packages/core/src/html/MdAttributeRenderer.js index 98e1160033..d61b3339dc 100644 --- a/packages/core/src/html/MdAttributeRenderer.js +++ b/packages/core/src/html/MdAttributeRenderer.js @@ -64,10 +64,9 @@ class MdAttributeRenderer { const hasAttribute = _.has(node.attribs, attribute); if (hasAttribute) { logger.warn(`${node.name} has a ${slotName} slot, '${attribute}' attribute has no effect.`); + delete node.attribs[attribute]; } - delete node.attribs[attribute]; - return hasAttribute; } diff --git a/packages/core/src/html/elements.js b/packages/core/src/html/elements.js index acbea46839..5c38b388fa 100644 --- a/packages/core/src/html/elements.js +++ b/packages/core/src/html/elements.js @@ -13,4 +13,8 @@ module.exports = { createEmptyNode() { return cheerio.parseHTML('
    ', true)[0]; }, + + createSlotTemplateNode(content) { + return cheerio.parseHTML(``, true); + }, }; diff --git a/packages/core/src/html/includePanelProcessor.js b/packages/core/src/html/includePanelProcessor.js index ae7164f8b2..48cb27868b 100644 --- a/packages/core/src/html/includePanelProcessor.js +++ b/packages/core/src/html/includePanelProcessor.js @@ -4,6 +4,7 @@ const url = require('url'); const { createErrorNode, createEmptyNode } = require('./elements'); const { CyclicReferenceError } = require('../errors'); +const { appendSlotNode } = require('./vueSlotSyntaxProcessor'); const fsUtil = require('../utils/fsUtil'); const logger = require('../utils/logger'); @@ -270,6 +271,7 @@ function processPopoverSrc(node, context, pageSources, variableProcessor, render const error = new Error(`Empty src attribute in include in: ${context.cwf}`); logger.error(error); cheerio(node).replaceWith(createErrorNode(node, error)); + return context; } if (_.has(node.attribs, 'content')) { @@ -283,17 +285,19 @@ function processPopoverSrc(node, context, pageSources, variableProcessor, render actualFilePath, } = _getSrcFlagsAndFilePaths(node, config); + // No need to process url contents + if (isUrl) { + const error = new Error(`URLs are not allowed in the 'src' attribute`); + logger.error(error); + cheerio(node).replaceWith(createErrorNode(node, error)); + return context; + } + const fileExistsNode = _getFileExistsNode(node, context, actualFilePath, pageSources); if (fileExistsNode) { return fileExistsNode; } - // No need to process url contents - if (isUrl) { - delete node.attribs.src; - return node; - } - pageSources.staticIncludeSrc.push({ from: context.cwf, to: actualFilePath, @@ -322,7 +326,9 @@ function processPopoverSrc(node, context, pageSources, variableProcessor, render + `Missing reference in ${context.cwf}`); logger.error(error); - actualContent = cheerio.html(createErrorNode(node, error)); + cheerio(node).replaceWith(createErrorNode(node, error)); + + return context; } } @@ -335,11 +341,11 @@ function processPopoverSrc(node, context, pageSources, variableProcessor, render const error = new CyclicReferenceError(childContext.callStack); logger.error(error); cheerio(node).replaceWith(createErrorNode(node, error)); + return context; } } - const attributeSlotElement = cheerio.parseHTML(``, true); - node.children = node.children ? attributeSlotElement.concat(node.children) : attributeSlotElement; + appendSlotNode(node, actualContent); delete node.attribs.src; diff --git a/packages/core/src/html/vueSlotSyntaxProcessor.js b/packages/core/src/html/vueSlotSyntaxProcessor.js index 33823036eb..33c952fb36 100644 --- a/packages/core/src/html/vueSlotSyntaxProcessor.js +++ b/packages/core/src/html/vueSlotSyntaxProcessor.js @@ -4,6 +4,13 @@ const _ = {}; _.has = require('lodash/has'); _.find = require('lodash/find'); +const { createSlotTemplateNode } = require('./elements'); + +function appendSlotNode(node, content) { + const attributeSlotElement = createSlotTemplateNode(content); + node.children = node.children ? attributeSlotElement.concat(node.children) : attributeSlotElement; +} + function getVslotShorthandName(node) { if (!node.attribs) { return ''; @@ -68,6 +75,7 @@ function transformOldSlotSyntax(node) { } module.exports = { + appendSlotNode, getVslotShorthandName, shiftSlotNodeDeeper, transformOldSlotSyntax, From 05d0d659088c7aabdd15e1138f90f0cc43a203e5 Mon Sep 17 00:00:00 2001 From: Jovyn Tan Date: Mon, 28 Feb 2022 11:24:21 +0800 Subject: [PATCH 11/24] Fix priority of src and content attribs --- packages/core/src/html/MdAttributeRenderer.js | 7 +++++-- packages/core/src/html/includePanelProcessor.js | 4 ---- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/packages/core/src/html/MdAttributeRenderer.js b/packages/core/src/html/MdAttributeRenderer.js index d61b3339dc..b792b7417e 100644 --- a/packages/core/src/html/MdAttributeRenderer.js +++ b/packages/core/src/html/MdAttributeRenderer.js @@ -82,9 +82,12 @@ class MdAttributeRenderer { return; } - if (!_.has(node.attribs, 'src')) { - this.processAttributeWithoutOverride(node, 'content', true); + if (_.has(node.attribs, 'content') && _.has(node.attribs, 'src')) { + logger.warn(`${node.name} has a 'content' attribute, 'src' attribute has no effect.`); + delete node.attribs.src; } + + this.processAttributeWithoutOverride(node, 'content', true); } processTooltip(node) { diff --git a/packages/core/src/html/includePanelProcessor.js b/packages/core/src/html/includePanelProcessor.js index 48cb27868b..525457b3bb 100644 --- a/packages/core/src/html/includePanelProcessor.js +++ b/packages/core/src/html/includePanelProcessor.js @@ -274,10 +274,6 @@ function processPopoverSrc(node, context, pageSources, variableProcessor, render return context; } - if (_.has(node.attribs, 'content')) { - logger.warn(`${node.name} has a 'src' attribute, 'content' attribute has no effect.`); - } - const { isUrl, hash, From 0469ec085644b2f45c91a55ea80ffea619f2dc6e Mon Sep 17 00:00:00 2001 From: Jovyn Tan Date: Mon, 28 Feb 2022 11:31:05 +0800 Subject: [PATCH 12/24] Linting --- packages/core/src/html/includePanelProcessor.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/core/src/html/includePanelProcessor.js b/packages/core/src/html/includePanelProcessor.js index 525457b3bb..2d86b167b2 100644 --- a/packages/core/src/html/includePanelProcessor.js +++ b/packages/core/src/html/includePanelProcessor.js @@ -283,7 +283,7 @@ function processPopoverSrc(node, context, pageSources, variableProcessor, render // No need to process url contents if (isUrl) { - const error = new Error(`URLs are not allowed in the 'src' attribute`); + const error = new Error('URLs are not allowed in the \'src\' attribute'); logger.error(error); cheerio(node).replaceWith(createErrorNode(node, error)); return context; From 5605e36d482b1907297b4245ff45c84a4b3a1d66 Mon Sep 17 00:00:00 2001 From: Jovyn Tan Date: Mon, 28 Feb 2022 11:37:35 +0800 Subject: [PATCH 13/24] Update tests after merge --- .../functional/test_site_algolia_plugin/expected/index.html | 2 +- .../test_site_algolia_plugin/expected/index.page-vue-render.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/cli/test/functional/test_site_algolia_plugin/expected/index.html b/packages/cli/test/functional/test_site_algolia_plugin/expected/index.html index 8887cdb1b2..aef10816f6 100644 --- a/packages/cli/test/functional/test_site_algolia_plugin/expected/index.html +++ b/packages/cli/test/functional/test_site_algolia_plugin/expected/index.html @@ -59,7 +59,7 @@
    - +

    Tooltip content should have algolia-no-index class

    diff --git a/packages/cli/test/functional/test_site_algolia_plugin/expected/index.page-vue-render.js b/packages/cli/test/functional/test_site_algolia_plugin/expected/index.page-vue-render.js index a3d16f29f7..7da6194163 100644 --- a/packages/cli/test/functional/test_site_algolia_plugin/expected/index.page-vue-render.js +++ b/packages/cli/test/functional/test_site_algolia_plugin/expected/index.page-vue-render.js @@ -1,7 +1,7 @@ var pageVueRenderFn = function anonymous( ) { -with(this){return _c('div',{attrs:{"id":"app"}},[_c('p'),_m(0),_v(" "),_m(1),_v(" "),_c('dropdown',{staticClass:"algolia-no-index",scopedSlots:_u([{key:"header",fn:function(){return [_v("Dropdown")]},proxy:true}])},[_v(" "),_c('li',[_c('a',{staticClass:"dropdown-item",attrs:{"href":"/"}},[_v("One")])]),_v(" "),_c('li',[_c('a',{staticClass:"dropdown-item",attrs:{"href":"/"}},[_v("Two")])])]),_v(" "),_m(2),_v(" "),_c('b-modal',{ref:"modal:trigger_id",staticClass:"algolia-no-index",attrs:{"id":"modal:trigger_id","hide-footer":"","size":"","modal-class":"mb-zoom"},scopedSlots:_u([{key:"modal-title",fn:function(){return [_v("Modal")]},proxy:true}])},[_v("\n Content should have `algolia-no-index` class\n")]),_v(" "),_c('trigger',{attrs:{"for":"modal:trigger_id"}},[_v("Trigger should not have `algolia-no-index` class")]),_v(" "),_m(3),_v(" "),_c('panel',{staticClass:"algolia-no-index",scopedSlots:_u([{key:"header",fn:function(){return [_c('p',[_v("Panel")])]},proxy:true}])},[_v("\n Content\n")]),_v(" "),_c('panel',{attrs:{"expanded":""},scopedSlots:_u([{key:"header",fn:function(){return [_c('p',[_v("Panel")])]},proxy:true}])},[_v("\n Content\n")]),_v(" "),_m(4),_v(" "),_c('popover',{attrs:{"placement":"top"},scopedSlots:_u([{key:"header",fn:function(){return [_v("Title")]},proxy:true},{key:"content",fn:function(){return [_c('div',[_v("Content should have `algolia-no-index` class")])]},proxy:true}])},[_v(" "),_v(" "),_c('button',{staticClass:"btn btn-secondary"},[_v("Trigger should not have `algolia-no-index` class")])]),_v(" "),_c('popover',{attrs:{"placement":"top"},scopedSlots:_u([{key:"header",fn:function(){return [_v("Title")]},proxy:true},{key:"content",fn:function(){return [_v("Content should have "),_c('code',{pre:true,attrs:{"class":"hljs inline no-lang"}},[_v("algolia-no-index")]),_v(" class")]},proxy:true}])},[_v(" "),_c('button',{staticClass:"btn btn-secondary"},[_v("Trigger should not have `algolia-no-index` class")])]),_v(" "),_m(5),_v(" "),_c('tooltip',{attrs:{"placement":"top"},scopedSlots:_u([{key:"content",fn:function(){return [_v("Content should have "),_c('code',{pre:true,attrs:{"class":"hljs inline no-lang"}},[_v("algolia-no-index")]),_v(" class")]},proxy:true}])},[_v(" "),_c('button',{staticClass:"btn btn-secondary"},[_v("Trigger should not have `algolia-no-index` class")])]),_v(" "),_m(6),_v(" "),_c('question',{scopedSlots:_u([{key:"hint",fn:function(){return [_c('div',{staticClass:"algolia-no-index"},[_v("Hint should have `algolia-no-index` class")])]},proxy:true},{key:"answer",fn:function(){return [_c('div',{staticClass:"algolia-no-index"},[_v("Answer should have `algolia-no-index` class")])]},proxy:true}])},[_v("\n Question should not have `algolia-no-index` class\n ")]),_v(" "),_m(7),_v(" "),_c('tabs',[_c('tab',{scopedSlots:_u([{key:"header",fn:function(){return [_v("First Tab")]},proxy:true}])},[_v("\n Content"),_c('br'),_v("Content"),_c('br'),_v("Content"),_c('br'),_v("Content\n ")]),_v(" "),_c('tab',{staticClass:"algolia-no-index",scopedSlots:_u([{key:"header",fn:function(){return [_v("Second Tab")]},proxy:true}])},[_v("\n Content"),_c('br'),_v("Content"),_c('br'),_v("Content"),_c('br'),_v("Content\n ")])],1),_v(" "),_c('tabs',[_c('tab-group',{scopedSlots:_u([{key:"header",fn:function(){return [_v("First Group")]},proxy:true}])},[_v(" "),_c('tab',{scopedSlots:_u([{key:"header",fn:function(){return [_v("First Tab")]},proxy:true}])},[_v("\n Content"),_c('br'),_v("Content"),_c('br'),_v("Content"),_c('br'),_v("Content\n ")]),_v(" "),_c('tab',{staticClass:"algolia-no-index",scopedSlots:_u([{key:"header",fn:function(){return [_v("Second Tab")]},proxy:true}])},[_v("\n Content"),_c('br'),_v("Content"),_c('br'),_v("Content"),_c('br'),_v("Content\n ")])],1),_v(" "),_c('tab-group',{staticClass:"algolia-no-index",scopedSlots:_u([{key:"header",fn:function(){return [_v("Second Group")]},proxy:true}])},[_v(" "),_c('tab',{scopedSlots:_u([{key:"header",fn:function(){return [_v("First Tab")]},proxy:true}])},[_v("\n Content"),_c('br'),_v("Content"),_c('br'),_v("Content"),_c('br'),_v("Content\n ")]),_v(" "),_c('tab',{staticClass:"algolia-no-index",scopedSlots:_u([{key:"header",fn:function(){return [_v("Second Tab")]},proxy:true}])},[_v("\n Content"),_c('br'),_v("Content"),_c('br'),_v("Content"),_c('br'),_v("Content\n ")])],1)],1),_v(" "),_c('tabs',[_c('tab-group',{scopedSlots:_u([{key:"header",fn:function(){return [_v("Outer One")]},proxy:true}])},[_v(" "),_c('tab',{scopedSlots:_u([{key:"header",fn:function(){return [_v("First Tab")]},proxy:true}])},[_v("\n Content"),_c('br'),_v("Content"),_c('br'),_v("Content"),_c('br'),_v("Content\n ")]),_v(" "),_c('tab',{staticClass:"algolia-no-index",scopedSlots:_u([{key:"header",fn:function(){return [_v("Second Tab")]},proxy:true}])},[_v("\n Content"),_c('br'),_v("Content"),_c('br'),_v("Content"),_c('br'),_v("Content\n ")])],1),_v(" "),_c('tab',{scopedSlots:_u([{key:"header",fn:function(){return [_v("Outer Two")]},proxy:true}])},[_v("\n Content"),_c('br'),_v("Content"),_c('br'),_v("Content"),_c('br'),_v("Content\n ")])],1),_v(" "),_c('i',{staticClass:"fa fa-arrow-circle-up fa-lg d-print-none",attrs:{"id":"scroll-top-button","onclick":"handleScrollTop()","aria-hidden":"true"}}),_c('p')],1)} +with(this){return _c('div',{attrs:{"id":"app"}},[_c('p'),_m(0),_v(" "),_m(1),_v(" "),_c('dropdown',{staticClass:"algolia-no-index",scopedSlots:_u([{key:"header",fn:function(){return [_v("Dropdown")]},proxy:true}])},[_v(" "),_c('li',[_c('a',{staticClass:"dropdown-item",attrs:{"href":"/"}},[_v("One")])]),_v(" "),_c('li',[_c('a',{staticClass:"dropdown-item",attrs:{"href":"/"}},[_v("Two")])])]),_v(" "),_m(2),_v(" "),_c('b-modal',{ref:"modal:trigger_id",staticClass:"algolia-no-index",attrs:{"id":"modal:trigger_id","hide-footer":"","size":"","modal-class":"mb-zoom"},scopedSlots:_u([{key:"modal-title",fn:function(){return [_v("Modal")]},proxy:true}])},[_v("\n Content should have `algolia-no-index` class\n")]),_v(" "),_c('trigger',{attrs:{"for":"modal:trigger_id"}},[_v("Trigger should not have `algolia-no-index` class")]),_v(" "),_m(3),_v(" "),_c('panel',{staticClass:"algolia-no-index",scopedSlots:_u([{key:"header",fn:function(){return [_c('p',[_v("Panel")])]},proxy:true}])},[_v("\n Content\n")]),_v(" "),_c('panel',{attrs:{"expanded":""},scopedSlots:_u([{key:"header",fn:function(){return [_c('p',[_v("Panel")])]},proxy:true}])},[_v("\n Content\n")]),_v(" "),_m(4),_v(" "),_c('popover',{attrs:{"placement":"top"},scopedSlots:_u([{key:"header",fn:function(){return [_v("Title")]},proxy:true},{key:"content",fn:function(){return [_c('div',[_v("Content should have `algolia-no-index` class")])]},proxy:true}])},[_v(" "),_v(" "),_c('button',{staticClass:"btn btn-secondary"},[_v("Trigger should not have `algolia-no-index` class")])]),_v(" "),_c('popover',{attrs:{"placement":"top"},scopedSlots:_u([{key:"content",fn:function(){return [_v("Content should have "),_c('code',{pre:true,attrs:{"class":"hljs inline no-lang"}},[_v("algolia-no-index")]),_v(" class")]},proxy:true},{key:"header",fn:function(){return [_v("Title")]},proxy:true}])},[_v(" "),_c('button',{staticClass:"btn btn-secondary"},[_v("Trigger should not have `algolia-no-index` class")])]),_v(" "),_m(5),_v(" "),_c('tooltip',{attrs:{"placement":"top"},scopedSlots:_u([{key:"content",fn:function(){return [_v("Content should have "),_c('code',{pre:true,attrs:{"class":"hljs inline no-lang"}},[_v("algolia-no-index")]),_v(" class")]},proxy:true}])},[_v(" "),_c('button',{staticClass:"btn btn-secondary"},[_v("Trigger should not have `algolia-no-index` class")])]),_v(" "),_m(6),_v(" "),_c('question',{scopedSlots:_u([{key:"hint",fn:function(){return [_c('div',{staticClass:"algolia-no-index"},[_v("Hint should have `algolia-no-index` class")])]},proxy:true},{key:"answer",fn:function(){return [_c('div',{staticClass:"algolia-no-index"},[_v("Answer should have `algolia-no-index` class")])]},proxy:true}])},[_v("\n Question should not have `algolia-no-index` class\n ")]),_v(" "),_m(7),_v(" "),_c('tabs',[_c('tab',{scopedSlots:_u([{key:"header",fn:function(){return [_v("First Tab")]},proxy:true}])},[_v("\n Content"),_c('br'),_v("Content"),_c('br'),_v("Content"),_c('br'),_v("Content\n ")]),_v(" "),_c('tab',{staticClass:"algolia-no-index",scopedSlots:_u([{key:"header",fn:function(){return [_v("Second Tab")]},proxy:true}])},[_v("\n Content"),_c('br'),_v("Content"),_c('br'),_v("Content"),_c('br'),_v("Content\n ")])],1),_v(" "),_c('tabs',[_c('tab-group',{scopedSlots:_u([{key:"header",fn:function(){return [_v("First Group")]},proxy:true}])},[_v(" "),_c('tab',{scopedSlots:_u([{key:"header",fn:function(){return [_v("First Tab")]},proxy:true}])},[_v("\n Content"),_c('br'),_v("Content"),_c('br'),_v("Content"),_c('br'),_v("Content\n ")]),_v(" "),_c('tab',{staticClass:"algolia-no-index",scopedSlots:_u([{key:"header",fn:function(){return [_v("Second Tab")]},proxy:true}])},[_v("\n Content"),_c('br'),_v("Content"),_c('br'),_v("Content"),_c('br'),_v("Content\n ")])],1),_v(" "),_c('tab-group',{staticClass:"algolia-no-index",scopedSlots:_u([{key:"header",fn:function(){return [_v("Second Group")]},proxy:true}])},[_v(" "),_c('tab',{scopedSlots:_u([{key:"header",fn:function(){return [_v("First Tab")]},proxy:true}])},[_v("\n Content"),_c('br'),_v("Content"),_c('br'),_v("Content"),_c('br'),_v("Content\n ")]),_v(" "),_c('tab',{staticClass:"algolia-no-index",scopedSlots:_u([{key:"header",fn:function(){return [_v("Second Tab")]},proxy:true}])},[_v("\n Content"),_c('br'),_v("Content"),_c('br'),_v("Content"),_c('br'),_v("Content\n ")])],1)],1),_v(" "),_c('tabs',[_c('tab-group',{scopedSlots:_u([{key:"header",fn:function(){return [_v("Outer One")]},proxy:true}])},[_v(" "),_c('tab',{scopedSlots:_u([{key:"header",fn:function(){return [_v("First Tab")]},proxy:true}])},[_v("\n Content"),_c('br'),_v("Content"),_c('br'),_v("Content"),_c('br'),_v("Content\n ")]),_v(" "),_c('tab',{staticClass:"algolia-no-index",scopedSlots:_u([{key:"header",fn:function(){return [_v("Second Tab")]},proxy:true}])},[_v("\n Content"),_c('br'),_v("Content"),_c('br'),_v("Content"),_c('br'),_v("Content\n ")])],1),_v(" "),_c('tab',{scopedSlots:_u([{key:"header",fn:function(){return [_v("Outer Two")]},proxy:true}])},[_v("\n Content"),_c('br'),_v("Content"),_c('br'),_v("Content"),_c('br'),_v("Content\n ")])],1),_v(" "),_c('i',{staticClass:"fa fa-arrow-circle-up fa-lg d-print-none",attrs:{"id":"scroll-top-button","onclick":"handleScrollTop()","aria-hidden":"true"}}),_c('p')],1)} }; var pageVueStaticRenderFns = [function anonymous( ) { From 8d9a4c5dc4aed1bded4745841cb848a56ecabf23 Mon Sep 17 00:00:00 2001 From: Jovyn Tan Date: Fri, 4 Mar 2022 11:09:23 +0800 Subject: [PATCH 14/24] Fix slot template functions --- packages/core/src/html/elements.js | 4 ++-- packages/core/src/html/includePanelProcessor.js | 6 +++--- packages/core/src/html/vueSlotSyntaxProcessor.js | 6 ------ 3 files changed, 5 insertions(+), 11 deletions(-) diff --git a/packages/core/src/html/elements.js b/packages/core/src/html/elements.js index 5c38b388fa..38d9e1751f 100644 --- a/packages/core/src/html/elements.js +++ b/packages/core/src/html/elements.js @@ -14,7 +14,7 @@ module.exports = { return cheerio.parseHTML('
    ', true)[0]; }, - createSlotTemplateNode(content) { - return cheerio.parseHTML(``, true); + createSlotTemplateNode(slotName, content) { + return cheerio.parseHTML(``, true); }, }; diff --git a/packages/core/src/html/includePanelProcessor.js b/packages/core/src/html/includePanelProcessor.js index 2d86b167b2..97f24102c4 100644 --- a/packages/core/src/html/includePanelProcessor.js +++ b/packages/core/src/html/includePanelProcessor.js @@ -2,9 +2,8 @@ const cheerio = require('cheerio'); require('../patches/htmlparser2'); const path = require('path'); const url = require('url'); -const { createErrorNode, createEmptyNode } = require('./elements'); +const { createErrorNode, createEmptyNode, createSlotTemplateNode } = require('./elements'); const { CyclicReferenceError } = require('../errors'); -const { appendSlotNode } = require('./vueSlotSyntaxProcessor'); const fsUtil = require('../utils/fsUtil'); const logger = require('../utils/logger'); @@ -341,7 +340,8 @@ function processPopoverSrc(node, context, pageSources, variableProcessor, render } } - appendSlotNode(node, actualContent); + const attributeSlotElement = createSlotTemplateNode('content', actualContent); + node.children = node.children ? attributeSlotElement.concat(node.children) : attributeSlotElement; delete node.attribs.src; diff --git a/packages/core/src/html/vueSlotSyntaxProcessor.js b/packages/core/src/html/vueSlotSyntaxProcessor.js index 33c952fb36..8ce802d32e 100644 --- a/packages/core/src/html/vueSlotSyntaxProcessor.js +++ b/packages/core/src/html/vueSlotSyntaxProcessor.js @@ -6,11 +6,6 @@ _.find = require('lodash/find'); const { createSlotTemplateNode } = require('./elements'); -function appendSlotNode(node, content) { - const attributeSlotElement = createSlotTemplateNode(content); - node.children = node.children ? attributeSlotElement.concat(node.children) : attributeSlotElement; -} - function getVslotShorthandName(node) { if (!node.attribs) { return ''; @@ -75,7 +70,6 @@ function transformOldSlotSyntax(node) { } module.exports = { - appendSlotNode, getVslotShorthandName, shiftSlotNodeDeeper, transformOldSlotSyntax, From 12f5e95ae649b79f3f1e5cb1a3bfa891c812c8a8 Mon Sep 17 00:00:00 2001 From: Jovyn Tan Date: Fri, 4 Mar 2022 11:16:04 +0800 Subject: [PATCH 15/24] Linting --- packages/core/src/html/elements.js | 2 +- packages/core/src/html/vueSlotSyntaxProcessor.js | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/packages/core/src/html/elements.js b/packages/core/src/html/elements.js index 38d9e1751f..03e644ef5c 100644 --- a/packages/core/src/html/elements.js +++ b/packages/core/src/html/elements.js @@ -15,6 +15,6 @@ module.exports = { }, createSlotTemplateNode(slotName, content) { - return cheerio.parseHTML(``, true); + return cheerio.parseHTML(``, true); }, }; diff --git a/packages/core/src/html/vueSlotSyntaxProcessor.js b/packages/core/src/html/vueSlotSyntaxProcessor.js index 8ce802d32e..33823036eb 100644 --- a/packages/core/src/html/vueSlotSyntaxProcessor.js +++ b/packages/core/src/html/vueSlotSyntaxProcessor.js @@ -4,8 +4,6 @@ const _ = {}; _.has = require('lodash/has'); _.find = require('lodash/find'); -const { createSlotTemplateNode } = require('./elements'); - function getVslotShorthandName(node) { if (!node.attribs) { return ''; From aba09ecd9db3637854fa1f1c01e783beb9840749 Mon Sep 17 00:00:00 2001 From: Jovyn Tan Date: Fri, 4 Mar 2022 11:18:31 +0800 Subject: [PATCH 16/24] Fix typo --- packages/core/src/html/elements.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/core/src/html/elements.js b/packages/core/src/html/elements.js index 03e644ef5c..3891422ffc 100644 --- a/packages/core/src/html/elements.js +++ b/packages/core/src/html/elements.js @@ -15,6 +15,6 @@ module.exports = { }, createSlotTemplateNode(slotName, content) { - return cheerio.parseHTML(``, true); + return cheerio.parseHTML(``, true); }, }; From 0ffe8dc26b93105ce77386c7544acfc061df0354 Mon Sep 17 00:00:00 2001 From: Jovyn Tan Date: Sun, 6 Mar 2022 20:58:51 +0800 Subject: [PATCH 17/24] update README.md for vue-components --- packages/vue-components/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/vue-components/README.md b/packages/vue-components/README.md index 3bfd4b1aa5..a0163d8d6e 100644 --- a/packages/vue-components/README.md +++ b/packages/vue-components/README.md @@ -20,6 +20,8 @@ Some custom components and directives are also added for MarkBind's use. - Question.vue - QOption.vue - Quiz.vue +- Popover.vue +- Tooltip.vue - Trigger.vue (built on bootstrap-vue's popovers, modals, tooltips) ### MarkBind components ported from [Markbind/vue-strap](https://github.com/MarkBind/vue-strap): @@ -50,8 +52,6 @@ Some custom components and directives are also added for MarkBind's use. ### BootstrapVue components included in the bundle - Modals -- Popovers -- Tooltips ## Installation From a561d53b4d112d7b508cbe068282b21ac65b0629 Mon Sep 17 00:00:00 2001 From: Jovyn Tan Date: Sun, 6 Mar 2022 21:00:39 +0800 Subject: [PATCH 18/24] Fix docs --- docs/userGuide/syntax/popovers.md | 50 +++++++++++-------- .../core/src/html/includePanelProcessor.js | 2 - 2 files changed, 29 insertions(+), 23 deletions(-) diff --git a/docs/userGuide/syntax/popovers.md b/docs/userGuide/syntax/popovers.md index 6f880575d1..46b76968ee 100644 --- a/docs/userGuide/syntax/popovers.md +++ b/docs/userGuide/syntax/popovers.md @@ -45,14 +45,12 @@

    Content using slot

    -

    - -

    - This is a long content... -
    - - -

    + +
    + This is a long content... +
    + +

    Content using src

    @@ -85,26 +83,36 @@ This is the same trigger as last one.

    -\***\*Options\*\*** +****Options**** + +| Name | Type | Default | Description | +| ---------------------------- | -------- | ------- | ---------------------------------------------------------------------------------------------------------------| +| trigger | `String` | `hover` | How the Popover is triggered.
    Supports: `click`, `focus`, `hover`. | +| header{{slot_info_trigger}} | `String` | `''` | Popover header, supports MarkDown text. | +| content{{slot_info_trigger}} | `String` | `''` | Popover content, supports MarkDown text. | +| src | `String` | | The url to the remote page to be loaded as the content of the popover.
    Both `.md` and `.html` are accepted. | +| placement | `String` | `top` | How to position the Popover.
    Supports: `top`, `left`, `right`, `bottom`. | -| Name | Type | Default | Description | -| ---------------------------- | -------- | ------- | ------------------------------------------------------------------------------------------------------- | -| trigger | `String` | `hover` | How the Popover is triggered.
    Supports: `click`, `focus`, `hover`. | -| header{{slot_info_trigger}} | `String` | `''` | Popover header, supports MarkDown text. | -| content{{slot_info_trigger}} | `String` | `''` | Popover content, supports MarkDown text. | -| src | `String` | | The url to the remote page to be loaded as the content of the popover. Both .md and .html are accepted. | -| placement | `String` | `top` | How to position the Popover.
    Supports: `top`, `left`, `right`, `bottom`. | + + +MarkBind supports the `src` attribute, `content` attribute and `content` slot for popovers. +Usually, only one of these would be used at a time. + +If multiple of these are used, MarkBind will prioritise in the following order: + 1. `content` slot + 1. `content` attribute + 1. `src` attribute + ```html -Hover over the keyword to see the -popover. +Hover over the keyword to see the popover. -

    - description :+1: -
    +
    +description :+1: +
    ``` diff --git a/packages/core/src/html/includePanelProcessor.js b/packages/core/src/html/includePanelProcessor.js index 2d86b167b2..b324a06403 100644 --- a/packages/core/src/html/includePanelProcessor.js +++ b/packages/core/src/html/includePanelProcessor.js @@ -316,8 +316,6 @@ function processPopoverSrc(node, context, pageSources, variableProcessor, render actualContent = $(hash).html(); if (actualContent === null) { - actualContent = ''; - const error = new Error(`No such segment '${hash}' in file: ${actualFilePath}\n` + `Missing reference in ${context.cwf}`); logger.error(error); From beb449ab5eb3a93c5e9e9f0edfcca5618682c8a7 Mon Sep 17 00:00:00 2001 From: Jovyn Tan Date: Sun, 6 Mar 2022 21:27:52 +0800 Subject: [PATCH 19/24] Update tests --- .../test_site/expected/testPopovers.html | 24 +++++++++++++++ .../expected/testPopovers.page-vue-render.js | 5 +++- .../test/functional/test_site/testPopovers.md | 30 +++++++++++++++++++ .../core/src/html/includePanelProcessor.js | 3 +- 4 files changed, 59 insertions(+), 3 deletions(-) diff --git a/packages/cli/test/functional/test_site/expected/testPopovers.html b/packages/cli/test/functional/test_site/expected/testPopovers.html index af363a4461..88948eee62 100644 --- a/packages/cli/test/functional/test_site/expected/testPopovers.html +++ b/packages/cli/test/functional/test_site/expected/testPopovers.html @@ -248,6 +248,14 @@

    Some heading src from a .md file
    + + src from a .html file + +
    src with a fragment @@ -260,6 +268,22 @@

    Nested Panel src containing reactive content +
    +

    Popover contents should use the priority of content slot > content attribute > src attribute

    + + Content attribute overrides src attribute + +
    + + + Content slot overrides content attribute overrides src attribute + +
    + + + Content slot overrides content attribute overrides src attribute + +
    diff --git a/packages/cli/test/functional/test_site/expected/testPopovers.page-vue-render.js b/packages/cli/test/functional/test_site/expected/testPopovers.page-vue-render.js index 81c011f5c2..5fec3ecba1 100644 --- a/packages/cli/test/functional/test_site/expected/testPopovers.page-vue-render.js +++ b/packages/cli/test/functional/test_site/expected/testPopovers.page-vue-render.js @@ -1,7 +1,7 @@ var pageVueRenderFn = function anonymous( ) { -with(this){return _c('div',{attrs:{"id":"app"}},[_c('div',[_c('header',[_c('navbar',{attrs:{"type":"dark","default-highlight-on":"sibling-or-child"},scopedSlots:_u([{key:"brand",fn:function(){return [_c('a',{staticClass:"navbar-brand",attrs:{"href":"/","title":"Home"}},[_v("Markbind Test Site")])]},proxy:true}])},[_v(" "),_c('li',[_c('a',{staticClass:"nav-link",attrs:{"href":"/test_site/bugs/index.html"}},[_v("Open Bugs")])])]),_v(" "),_m(0)],1),_v(" "),_m(1)]),_v(" "),_c('div',{attrs:{"id":"flex-body"}},[_c('overlay-source',{staticClass:"fixed-header-padding",attrs:{"id":"site-nav","tag-name":"nav","to":"site-nav"}},[_c('div',{staticClass:"site-nav-top"},[_c('div',{staticClass:"font-weight-bold mb-2",staticStyle:{"font-size":"1.25rem"}},[_c('div',[_c('h2',{attrs:{"id":"default-layout"}},[_c('span',{staticClass:"anchor",attrs:{"id":"default-layout"}}),_v("Default Layout"),_c('a',{staticClass:"fa fa-anchor",attrs:{"href":"#default-layout","onclick":"event.stopPropagation()"}})])])])]),_v(" "),_c('div',{staticClass:"nav-component slim-scroll"},[_c('div',[_c('site-nav',[_c('overlay-source',{staticClass:"site-nav-list site-nav-list-root",attrs:{"tag-name":"ul","to":"mb-site-nav"}},[_c('li',[_c('div',{staticClass:"site-nav-default-list-item site-nav-list-item-0",attrs:{"onclick":"handleSiteNavClick(this)"}},[_c('a',{attrs:{"href":"/test_site/index.html"}},[_v("Home 🏠")])])]),_v(" "),_c('li',[_c('div',{staticClass:"site-nav-default-list-item site-nav-list-item-0",attrs:{"onclick":"handleSiteNavClick(this)"}},[_c('a',{attrs:{"href":"/test_site/bugs/index.html"}},[_v("Open Bugs 🐛")])])]),_v(" "),_c('li',{staticClass:"site-nav-custom-list-item site-nav-list-item-0"},[_c('h3',{attrs:{"id":"testing-site-nav"}},[_c('span',{staticClass:"anchor",attrs:{"id":"testing-site-nav"}}),_v("Testing Site-Nav"),_c('a',{staticClass:"fa fa-anchor",attrs:{"href":"#testing-site-nav","onclick":"event.stopPropagation()"}})])]),_v(" "),_c('li',[_c('div',{staticClass:"site-nav-default-list-item site-nav-list-item-0",attrs:{"onclick":"handleSiteNavClick(this)"}},[_c('strong',[_v("Dropdown ")]),_v(" "),_c('span',{staticClass:"glyphicon glyphicon-search",attrs:{"aria-hidden":"true"}}),_v(" title ✏️ "),_v(" "),_c('i',{staticClass:"site-nav-dropdown-btn-icon site-nav-rotate-icon",attrs:{"onclick":"handleSiteNavClick(this.parentNode, false); event.stopPropagation();"}},[_c('span',{staticClass:"glyphicon glyphicon-menu-down",attrs:{"aria-hidden":"true"}})])]),_c('ul',{staticClass:"site-nav-dropdown-container site-nav-dropdown-container-open site-nav-list"},[_c('li',[_c('div',{staticClass:"site-nav-default-list-item site-nav-list-item-1",attrs:{"onclick":"handleSiteNavClick(this)"}},[_c('a',{attrs:{"href":"https://www.google.com/"}},[_v("Dropdown link one")])])]),_v(" "),_c('li',[_c('div',{staticClass:"site-nav-default-list-item site-nav-list-item-1",attrs:{"onclick":"handleSiteNavClick(this)"}},[_c('a',{attrs:{"href":"https://www.google.com/"}},[_v("Html within site-nav "),_c('span',{staticStyle:{"color":"red"}},[_v("should")]),_v(" be displayed properly")])])]),_v(" "),_c('li',[_c('div',{staticClass:"site-nav-default-list-item site-nav-list-item-1",attrs:{"onclick":"handleSiteNavClick(this)"}},[_v("Nested Dropdown title 📐\n\n"),_c('i',{staticClass:"site-nav-dropdown-btn-icon",attrs:{"onclick":"handleSiteNavClick(this.parentNode, false); event.stopPropagation();"}},[_c('span',{staticClass:"glyphicon glyphicon-menu-down",attrs:{"aria-hidden":"true"}})])]),_c('ul',{staticClass:"site-nav-dropdown-container site-nav-list"},[_c('li',[_c('div',{staticClass:"site-nav-default-list-item site-nav-list-item-2",attrs:{"onclick":"handleSiteNavClick(this)"}},[_c('a',{attrs:{"href":"https://www.google.com/"}},[_c('strong',[_v("Nested")]),_v(" Dropdown link one")])])]),_v(" "),_c('li',[_c('div',{staticClass:"site-nav-default-list-item site-nav-list-item-2",attrs:{"onclick":"handleSiteNavClick(this)"}},[_c('a',{attrs:{"href":"https://www.google.com/"}},[_c('strong',[_v("Nested")]),_v(" Dropdown link two")])])])])]),_v(" "),_c('li',[_c('div',{staticClass:"site-nav-default-list-item site-nav-list-item-1",attrs:{"onclick":"handleSiteNavClick(this)"}},[_c('a',{attrs:{"href":"https://www.google.com/"}},[_v("Dropdown link two")])])])])]),_v(" "),_c('li',[_c('div',{staticClass:"site-nav-default-list-item site-nav-list-item-0",attrs:{"onclick":"handleSiteNavClick(this)"}},[_c('a',{attrs:{"href":"https://www.google.com/"}},[_c('mark',[_v("Third Link")]),_v(" 📋")])])]),_v(" "),_c('li',[_c('div',{staticClass:"site-nav-default-list-item site-nav-list-item-0",attrs:{"onclick":"handleSiteNavClick(this)"}},[_v("Filler text "),_c('a',{attrs:{"href":"https://www.youtube.com/"}},[_c('span',{staticClass:"glyphicon glyphicon-facetime-video",attrs:{"aria-hidden":"true"}}),_v(" Youtube 📺")]),_v(" filler text"),_v(" "),_c('i',{staticClass:"site-nav-dropdown-btn-icon",attrs:{"onclick":"handleSiteNavClick(this.parentNode, false); event.stopPropagation();"}},[_c('span',{staticClass:"glyphicon glyphicon-menu-down",attrs:{"aria-hidden":"true"}})])]),_c('ul',{staticClass:"site-nav-dropdown-container site-nav-list"},[_c('li',[_c('div',{staticClass:"site-nav-default-list-item site-nav-list-item-1",attrs:{"onclick":"handleSiteNavClick(this)"}},[_c('a',{attrs:{"href":"https://www.youtube.com/watch?v=dQw4w9WgXcQ"}},[_v("The answer to everything in the universe")])])]),_v(" "),_c('li',[_c('div',{staticClass:"site-nav-default-list-item site-nav-list-item-1",attrs:{"onclick":"handleSiteNavClick(this)"}},[_c('mark',[_v("Dropdown title")]),_v(" "),_c('span',{staticClass:"glyphicon glyphicon-comment",attrs:{"aria-hidden":"true"}}),_v(" ✏️ "),_v(" "),_c('i',{staticClass:"site-nav-dropdown-btn-icon site-nav-rotate-icon",attrs:{"onclick":"handleSiteNavClick(this.parentNode, false); event.stopPropagation();"}},[_c('span',{staticClass:"glyphicon glyphicon-menu-down",attrs:{"aria-hidden":"true"}})])]),_c('ul',{staticClass:"site-nav-dropdown-container site-nav-dropdown-container-open site-nav-list"},[_c('li',[_c('div',{staticClass:"site-nav-default-list-item site-nav-list-item-2",attrs:{"onclick":"handleSiteNavClick(this)"}},[_c('a',{attrs:{"href":"https://www.google.com/"}},[_c('strong',[_v("Nested")]),_v(" Dropdown link one")])])])])])])]),_v(" "),_c('li',[_c('div',{staticClass:"site-nav-default-list-item site-nav-list-item-0",attrs:{"onclick":"handleSiteNavClick(this)"}},[_v("Really Long Dropdown Title Really Long Dropdown Title Really Long Dropdown Title Really Long Dropdown\n\n"),_c('i',{staticClass:"site-nav-dropdown-btn-icon",attrs:{"onclick":"handleSiteNavClick(this.parentNode, false); event.stopPropagation();"}},[_c('span',{staticClass:"glyphicon glyphicon-menu-down",attrs:{"aria-hidden":"true"}})])]),_c('ul',{staticClass:"site-nav-dropdown-container site-nav-list"},[_c('li',{staticClass:"site-nav-custom-list-item site-nav-list-item-1"},[_v("Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text")]),_v(" "),_c('li',[_c('div',{staticClass:"site-nav-default-list-item site-nav-list-item-1",attrs:{"onclick":"handleSiteNavClick(this)"}},[_v("Nested Dropdown Title\n\n"),_c('i',{staticClass:"site-nav-dropdown-btn-icon",attrs:{"onclick":"handleSiteNavClick(this.parentNode, false); event.stopPropagation();"}},[_c('span',{staticClass:"glyphicon glyphicon-menu-down",attrs:{"aria-hidden":"true"}})])]),_c('ul',{staticClass:"site-nav-dropdown-container site-nav-list"},[_c('li',{staticClass:"site-nav-custom-list-item site-nav-list-item-2"},[_v("Hello Doge Hello Doge 🐶")]),_v(" "),_c('li',[_c('div',{staticClass:"site-nav-default-list-item site-nav-list-item-2",attrs:{"onclick":"handleSiteNavClick(this)"}},[_c('a',{attrs:{"href":"/test_site/index.html"}},[_c('strong',[_v("NESTED LINK")]),_v(" Home 🏠")])])]),_v(" "),_c('li',{staticClass:"site-nav-custom-list-item site-nav-list-item-2"},[_v("Text cut off from height limit Text cut off from height limit Text cut off from height limit Text cut off from height limit Text cut off from height limit Text cut off from height limit Text cut off from height limit Text cut off from height limit Text cut off from height limit Text cut off from height limit Text cut off from height limit Text cut off from height limit Text cut off from height limit Text cut off from height limit Text cut off from height limit Text cut off from height limit Text cut off from height limit Text cut off from height limit Text cut off from height limit Text cut off from height limit Text cut off from height limit")])])])])]),_v(" "),_c('li',[_c('div',{staticClass:"site-nav-default-list-item site-nav-list-item-0",attrs:{"onclick":"handleSiteNavClick(this)"}},[_v("Test line break in navigation layout\n\n"),_c('i',{staticClass:"site-nav-dropdown-btn-icon",attrs:{"onclick":"handleSiteNavClick(this.parentNode, false); event.stopPropagation();"}},[_c('span',{staticClass:"glyphicon glyphicon-menu-down",attrs:{"aria-hidden":"true"}})])]),_c('ul',{staticClass:"site-nav-dropdown-container site-nav-list"},[_c('li',{staticClass:"site-nav-custom-list-item site-nav-list-item-1"},[_v("Nested line break text ✂️")]),_v(" "),_c('li',[_c('div',{staticClass:"site-nav-default-list-item site-nav-list-item-1",attrs:{"onclick":"handleSiteNavClick(this)"}},[_c('a',{attrs:{"href":"/test_site/index.html"}},[_v("Nested line break href")]),_v(" "),_c('i',{staticClass:"site-nav-dropdown-btn-icon",attrs:{"onclick":"handleSiteNavClick(this.parentNode, false); event.stopPropagation();"}},[_c('span',{staticClass:"glyphicon glyphicon-menu-down",attrs:{"aria-hidden":"true"}})])]),_c('ul',{staticClass:"site-nav-dropdown-container site-nav-list"},[_c('li',{staticClass:"site-nav-custom-list-item site-nav-list-item-2"},[_v("Nested Nested line break text ✂️")])])]),_v(" "),_c('li',[_c('div',{staticClass:"site-nav-default-list-item site-nav-list-item-1",attrs:{"onclick":"handleSiteNavClick(this)"}},[_v("Nested line break dropdown menu\n\n"),_c('i',{staticClass:"site-nav-dropdown-btn-icon",attrs:{"onclick":"handleSiteNavClick(this.parentNode, false); event.stopPropagation();"}},[_c('span',{staticClass:"glyphicon glyphicon-menu-down",attrs:{"aria-hidden":"true"}})])]),_c('ul',{staticClass:"site-nav-dropdown-container site-nav-list"},[_c('li',{staticClass:"site-nav-custom-list-item site-nav-list-item-2"},[_v("Line break item 2 📘")])])])])])])],1)],1)])]),_v(" "),_c('div',{staticClass:"fixed-header-padding",attrs:{"id":"content-wrapper"}},[_m(2),_v(" "),_c('popover',{scopedSlots:_u([{key:"content",fn:function(){return [_v("Correct content")]},proxy:true},{key:"header",fn:function(){return [_v("Correct header")]},proxy:true}])},[_v("\n Hover popover\n")]),_v(" "),_c('br'),_v(" "),_c('popover',{attrs:{"trigger":"click"},scopedSlots:_u([{key:"content",fn:function(){return [_v("Correct content")]},proxy:true},{key:"header",fn:function(){return [_v("Correct header")]},proxy:true}])},[_v("\n Click popover\n")]),_v(" "),_c('br'),_v(" "),_m(3),_v(" "),_c('popover',{scopedSlots:_u([{key:"content",fn:function(){return [_c('span',[_v("Correct content")])]},proxy:true}])},[_v("\n Hover popover\n")]),_v(" "),_c('br'),_v(" "),_c('popover',{attrs:{"trigger":"click"},scopedSlots:_u([{key:"header",fn:function(){return [_c('span',[_v("Correct header")])]},proxy:true},{key:"content",fn:function(){return [_c('span',[_v("Correct content")])]},proxy:true}])},[_v(" "),_v("\n Click popover\n")]),_v(" "),_c('br'),_v(" "),_m(4),_v(" "),_c('popover',{scopedSlots:_u([{key:"header",fn:function(){return [_v("Correct header")]},proxy:true},{key:"content",fn:function(){return [_c('span',[_v("Correct content")])]},proxy:true}])},[_v(" "),_v("\n Hover popover\n")]),_v(" "),_c('br'),_v(" "),_c('popover',{attrs:{"trigger":"click"},scopedSlots:_u([{key:"header",fn:function(){return [_c('span',[_v("Correct header")])]},proxy:true},{key:"content",fn:function(){return [_c('span',[_v("Correct content")])]},proxy:true}])},[_v(" "),_v("\n Click popover\n")]),_v(" "),_c('br'),_v(" "),_m(5),_v(" "),_c('popover',{scopedSlots:_u([{key:"content",fn:function(){return [_c('h1',{attrs:{"id":"some-heading"}},[_c('span',{staticClass:"anchor",attrs:{"id":"some-heading"}}),_v("Some heading"),_c('a',{staticClass:"fa fa-anchor",attrs:{"href":"#some-heading","onclick":"event.stopPropagation()"}})]),_v(" "),_c('p',[_v("The "),_c('strong',[_v("quick")]),_v(" brown fox jumps "),_c('em',[_v("over")]),_v(" the lazy dog.")])]},proxy:true},{key:"header",fn:function(){return [_v("Correct header")]},proxy:true}])},[_v("\n src from a .md file\n")]),_v(" "),_c('br'),_v(" "),_c('popover',{scopedSlots:_u([{key:"content",fn:function(){return [_v("content fragment")]},proxy:true}])},[_v("\n src with a fragment\n")]),_v(" "),_c('br'),_v(" "),_c('popover',{scopedSlots:_u([{key:"content",fn:function(){return [_c('panel',{attrs:{"src":"/test_site/testPanels/NormalPanelContent._include_.html","expanded":"","panelId":"nested-panel"},scopedSlots:_u([{key:"header",fn:function(){return [_c('h2',{attrs:{"id":"nested-panel"}},[_c('span',{staticClass:"anchor",attrs:{"id":"nested-panel"}}),_v("Nested Panel"),_c('a',{staticClass:"fa fa-anchor",attrs:{"href":"#nested-panel","onclick":"event.stopPropagation()"}})])]},proxy:true}])})]},proxy:true},{key:"header",fn:function(){return [_c('span',[_v("Reactive content")])]},proxy:true}])},[_v(" "),_v("\n src containing reactive content\n")]),_v(" "),_c('i',{staticClass:"fa fa-arrow-circle-up fa-lg d-print-none",attrs:{"id":"scroll-top-button","onclick":"handleScrollTop()","aria-hidden":"true"}})],1),_v(" "),_c('overlay-source',{staticClass:"fixed-header-padding",attrs:{"id":"page-nav","tag-name":"nav","to":"page-nav"}},[_c('div',{staticClass:"nav-component slim-scroll"})])],1),_v(" "),_m(6)])} +with(this){return _c('div',{attrs:{"id":"app"}},[_c('div',[_c('header',[_c('navbar',{attrs:{"type":"dark","default-highlight-on":"sibling-or-child"},scopedSlots:_u([{key:"brand",fn:function(){return [_c('a',{staticClass:"navbar-brand",attrs:{"href":"/","title":"Home"}},[_v("Markbind Test Site")])]},proxy:true}])},[_v(" "),_c('li',[_c('a',{staticClass:"nav-link",attrs:{"href":"/test_site/bugs/index.html"}},[_v("Open Bugs")])])]),_v(" "),_m(0)],1),_v(" "),_m(1)]),_v(" "),_c('div',{attrs:{"id":"flex-body"}},[_c('overlay-source',{staticClass:"fixed-header-padding",attrs:{"id":"site-nav","tag-name":"nav","to":"site-nav"}},[_c('div',{staticClass:"site-nav-top"},[_c('div',{staticClass:"font-weight-bold mb-2",staticStyle:{"font-size":"1.25rem"}},[_c('div',[_c('h2',{attrs:{"id":"default-layout"}},[_c('span',{staticClass:"anchor",attrs:{"id":"default-layout"}}),_v("Default Layout"),_c('a',{staticClass:"fa fa-anchor",attrs:{"href":"#default-layout","onclick":"event.stopPropagation()"}})])])])]),_v(" "),_c('div',{staticClass:"nav-component slim-scroll"},[_c('div',[_c('site-nav',[_c('overlay-source',{staticClass:"site-nav-list site-nav-list-root",attrs:{"tag-name":"ul","to":"mb-site-nav"}},[_c('li',[_c('div',{staticClass:"site-nav-default-list-item site-nav-list-item-0",attrs:{"onclick":"handleSiteNavClick(this)"}},[_c('a',{attrs:{"href":"/test_site/index.html"}},[_v("Home 🏠")])])]),_v(" "),_c('li',[_c('div',{staticClass:"site-nav-default-list-item site-nav-list-item-0",attrs:{"onclick":"handleSiteNavClick(this)"}},[_c('a',{attrs:{"href":"/test_site/bugs/index.html"}},[_v("Open Bugs 🐛")])])]),_v(" "),_c('li',{staticClass:"site-nav-custom-list-item site-nav-list-item-0"},[_c('h3',{attrs:{"id":"testing-site-nav"}},[_c('span',{staticClass:"anchor",attrs:{"id":"testing-site-nav"}}),_v("Testing Site-Nav"),_c('a',{staticClass:"fa fa-anchor",attrs:{"href":"#testing-site-nav","onclick":"event.stopPropagation()"}})])]),_v(" "),_c('li',[_c('div',{staticClass:"site-nav-default-list-item site-nav-list-item-0",attrs:{"onclick":"handleSiteNavClick(this)"}},[_c('strong',[_v("Dropdown ")]),_v(" "),_c('span',{staticClass:"glyphicon glyphicon-search",attrs:{"aria-hidden":"true"}}),_v(" title ✏️ "),_v(" "),_c('i',{staticClass:"site-nav-dropdown-btn-icon site-nav-rotate-icon",attrs:{"onclick":"handleSiteNavClick(this.parentNode, false); event.stopPropagation();"}},[_c('span',{staticClass:"glyphicon glyphicon-menu-down",attrs:{"aria-hidden":"true"}})])]),_c('ul',{staticClass:"site-nav-dropdown-container site-nav-dropdown-container-open site-nav-list"},[_c('li',[_c('div',{staticClass:"site-nav-default-list-item site-nav-list-item-1",attrs:{"onclick":"handleSiteNavClick(this)"}},[_c('a',{attrs:{"href":"https://www.google.com/"}},[_v("Dropdown link one")])])]),_v(" "),_c('li',[_c('div',{staticClass:"site-nav-default-list-item site-nav-list-item-1",attrs:{"onclick":"handleSiteNavClick(this)"}},[_c('a',{attrs:{"href":"https://www.google.com/"}},[_v("Html within site-nav "),_c('span',{staticStyle:{"color":"red"}},[_v("should")]),_v(" be displayed properly")])])]),_v(" "),_c('li',[_c('div',{staticClass:"site-nav-default-list-item site-nav-list-item-1",attrs:{"onclick":"handleSiteNavClick(this)"}},[_v("Nested Dropdown title 📐\n\n"),_c('i',{staticClass:"site-nav-dropdown-btn-icon",attrs:{"onclick":"handleSiteNavClick(this.parentNode, false); event.stopPropagation();"}},[_c('span',{staticClass:"glyphicon glyphicon-menu-down",attrs:{"aria-hidden":"true"}})])]),_c('ul',{staticClass:"site-nav-dropdown-container site-nav-list"},[_c('li',[_c('div',{staticClass:"site-nav-default-list-item site-nav-list-item-2",attrs:{"onclick":"handleSiteNavClick(this)"}},[_c('a',{attrs:{"href":"https://www.google.com/"}},[_c('strong',[_v("Nested")]),_v(" Dropdown link one")])])]),_v(" "),_c('li',[_c('div',{staticClass:"site-nav-default-list-item site-nav-list-item-2",attrs:{"onclick":"handleSiteNavClick(this)"}},[_c('a',{attrs:{"href":"https://www.google.com/"}},[_c('strong',[_v("Nested")]),_v(" Dropdown link two")])])])])]),_v(" "),_c('li',[_c('div',{staticClass:"site-nav-default-list-item site-nav-list-item-1",attrs:{"onclick":"handleSiteNavClick(this)"}},[_c('a',{attrs:{"href":"https://www.google.com/"}},[_v("Dropdown link two")])])])])]),_v(" "),_c('li',[_c('div',{staticClass:"site-nav-default-list-item site-nav-list-item-0",attrs:{"onclick":"handleSiteNavClick(this)"}},[_c('a',{attrs:{"href":"https://www.google.com/"}},[_c('mark',[_v("Third Link")]),_v(" 📋")])])]),_v(" "),_c('li',[_c('div',{staticClass:"site-nav-default-list-item site-nav-list-item-0",attrs:{"onclick":"handleSiteNavClick(this)"}},[_v("Filler text "),_c('a',{attrs:{"href":"https://www.youtube.com/"}},[_c('span',{staticClass:"glyphicon glyphicon-facetime-video",attrs:{"aria-hidden":"true"}}),_v(" Youtube 📺")]),_v(" filler text"),_v(" "),_c('i',{staticClass:"site-nav-dropdown-btn-icon",attrs:{"onclick":"handleSiteNavClick(this.parentNode, false); event.stopPropagation();"}},[_c('span',{staticClass:"glyphicon glyphicon-menu-down",attrs:{"aria-hidden":"true"}})])]),_c('ul',{staticClass:"site-nav-dropdown-container site-nav-list"},[_c('li',[_c('div',{staticClass:"site-nav-default-list-item site-nav-list-item-1",attrs:{"onclick":"handleSiteNavClick(this)"}},[_c('a',{attrs:{"href":"https://www.youtube.com/watch?v=dQw4w9WgXcQ"}},[_v("The answer to everything in the universe")])])]),_v(" "),_c('li',[_c('div',{staticClass:"site-nav-default-list-item site-nav-list-item-1",attrs:{"onclick":"handleSiteNavClick(this)"}},[_c('mark',[_v("Dropdown title")]),_v(" "),_c('span',{staticClass:"glyphicon glyphicon-comment",attrs:{"aria-hidden":"true"}}),_v(" ✏️ "),_v(" "),_c('i',{staticClass:"site-nav-dropdown-btn-icon site-nav-rotate-icon",attrs:{"onclick":"handleSiteNavClick(this.parentNode, false); event.stopPropagation();"}},[_c('span',{staticClass:"glyphicon glyphicon-menu-down",attrs:{"aria-hidden":"true"}})])]),_c('ul',{staticClass:"site-nav-dropdown-container site-nav-dropdown-container-open site-nav-list"},[_c('li',[_c('div',{staticClass:"site-nav-default-list-item site-nav-list-item-2",attrs:{"onclick":"handleSiteNavClick(this)"}},[_c('a',{attrs:{"href":"https://www.google.com/"}},[_c('strong',[_v("Nested")]),_v(" Dropdown link one")])])])])])])]),_v(" "),_c('li',[_c('div',{staticClass:"site-nav-default-list-item site-nav-list-item-0",attrs:{"onclick":"handleSiteNavClick(this)"}},[_v("Really Long Dropdown Title Really Long Dropdown Title Really Long Dropdown Title Really Long Dropdown\n\n"),_c('i',{staticClass:"site-nav-dropdown-btn-icon",attrs:{"onclick":"handleSiteNavClick(this.parentNode, false); event.stopPropagation();"}},[_c('span',{staticClass:"glyphicon glyphicon-menu-down",attrs:{"aria-hidden":"true"}})])]),_c('ul',{staticClass:"site-nav-dropdown-container site-nav-list"},[_c('li',{staticClass:"site-nav-custom-list-item site-nav-list-item-1"},[_v("Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text")]),_v(" "),_c('li',[_c('div',{staticClass:"site-nav-default-list-item site-nav-list-item-1",attrs:{"onclick":"handleSiteNavClick(this)"}},[_v("Nested Dropdown Title\n\n"),_c('i',{staticClass:"site-nav-dropdown-btn-icon",attrs:{"onclick":"handleSiteNavClick(this.parentNode, false); event.stopPropagation();"}},[_c('span',{staticClass:"glyphicon glyphicon-menu-down",attrs:{"aria-hidden":"true"}})])]),_c('ul',{staticClass:"site-nav-dropdown-container site-nav-list"},[_c('li',{staticClass:"site-nav-custom-list-item site-nav-list-item-2"},[_v("Hello Doge Hello Doge 🐶")]),_v(" "),_c('li',[_c('div',{staticClass:"site-nav-default-list-item site-nav-list-item-2",attrs:{"onclick":"handleSiteNavClick(this)"}},[_c('a',{attrs:{"href":"/test_site/index.html"}},[_c('strong',[_v("NESTED LINK")]),_v(" Home 🏠")])])]),_v(" "),_c('li',{staticClass:"site-nav-custom-list-item site-nav-list-item-2"},[_v("Text cut off from height limit Text cut off from height limit Text cut off from height limit Text cut off from height limit Text cut off from height limit Text cut off from height limit Text cut off from height limit Text cut off from height limit Text cut off from height limit Text cut off from height limit Text cut off from height limit Text cut off from height limit Text cut off from height limit Text cut off from height limit Text cut off from height limit Text cut off from height limit Text cut off from height limit Text cut off from height limit Text cut off from height limit Text cut off from height limit Text cut off from height limit")])])])])]),_v(" "),_c('li',[_c('div',{staticClass:"site-nav-default-list-item site-nav-list-item-0",attrs:{"onclick":"handleSiteNavClick(this)"}},[_v("Test line break in navigation layout\n\n"),_c('i',{staticClass:"site-nav-dropdown-btn-icon",attrs:{"onclick":"handleSiteNavClick(this.parentNode, false); event.stopPropagation();"}},[_c('span',{staticClass:"glyphicon glyphicon-menu-down",attrs:{"aria-hidden":"true"}})])]),_c('ul',{staticClass:"site-nav-dropdown-container site-nav-list"},[_c('li',{staticClass:"site-nav-custom-list-item site-nav-list-item-1"},[_v("Nested line break text ✂️")]),_v(" "),_c('li',[_c('div',{staticClass:"site-nav-default-list-item site-nav-list-item-1",attrs:{"onclick":"handleSiteNavClick(this)"}},[_c('a',{attrs:{"href":"/test_site/index.html"}},[_v("Nested line break href")]),_v(" "),_c('i',{staticClass:"site-nav-dropdown-btn-icon",attrs:{"onclick":"handleSiteNavClick(this.parentNode, false); event.stopPropagation();"}},[_c('span',{staticClass:"glyphicon glyphicon-menu-down",attrs:{"aria-hidden":"true"}})])]),_c('ul',{staticClass:"site-nav-dropdown-container site-nav-list"},[_c('li',{staticClass:"site-nav-custom-list-item site-nav-list-item-2"},[_v("Nested Nested line break text ✂️")])])]),_v(" "),_c('li',[_c('div',{staticClass:"site-nav-default-list-item site-nav-list-item-1",attrs:{"onclick":"handleSiteNavClick(this)"}},[_v("Nested line break dropdown menu\n\n"),_c('i',{staticClass:"site-nav-dropdown-btn-icon",attrs:{"onclick":"handleSiteNavClick(this.parentNode, false); event.stopPropagation();"}},[_c('span',{staticClass:"glyphicon glyphicon-menu-down",attrs:{"aria-hidden":"true"}})])]),_c('ul',{staticClass:"site-nav-dropdown-container site-nav-list"},[_c('li',{staticClass:"site-nav-custom-list-item site-nav-list-item-2"},[_v("Line break item 2 📘")])])])])])])],1)],1)])]),_v(" "),_c('div',{staticClass:"fixed-header-padding",attrs:{"id":"content-wrapper"}},[_m(2),_v(" "),_c('popover',{scopedSlots:_u([{key:"content",fn:function(){return [_v("Correct content")]},proxy:true},{key:"header",fn:function(){return [_v("Correct header")]},proxy:true}])},[_v("\n Hover popover\n")]),_v(" "),_c('br'),_v(" "),_c('popover',{attrs:{"trigger":"click"},scopedSlots:_u([{key:"content",fn:function(){return [_v("Correct content")]},proxy:true},{key:"header",fn:function(){return [_v("Correct header")]},proxy:true}])},[_v("\n Click popover\n")]),_v(" "),_c('br'),_v(" "),_m(3),_v(" "),_c('popover',{scopedSlots:_u([{key:"content",fn:function(){return [_c('span',[_v("Correct content")])]},proxy:true}])},[_v("\n Hover popover\n")]),_v(" "),_c('br'),_v(" "),_c('popover',{attrs:{"trigger":"click"},scopedSlots:_u([{key:"header",fn:function(){return [_c('span',[_v("Correct header")])]},proxy:true},{key:"content",fn:function(){return [_c('span',[_v("Correct content")])]},proxy:true}])},[_v(" "),_v("\n Click popover\n")]),_v(" "),_c('br'),_v(" "),_m(4),_v(" "),_c('popover',{scopedSlots:_u([{key:"header",fn:function(){return [_v("Correct header")]},proxy:true},{key:"content",fn:function(){return [_c('span',[_v("Correct content")])]},proxy:true}])},[_v(" "),_v("\n Hover popover\n")]),_v(" "),_c('br'),_v(" "),_c('popover',{attrs:{"trigger":"click"},scopedSlots:_u([{key:"header",fn:function(){return [_c('span',[_v("Correct header")])]},proxy:true},{key:"content",fn:function(){return [_c('span',[_v("Correct content")])]},proxy:true}])},[_v(" "),_v("\n Click popover\n")]),_v(" "),_c('br'),_v(" "),_m(5),_v(" "),_c('popover',{scopedSlots:_u([{key:"content",fn:function(){return [_c('h1',{attrs:{"id":"some-heading"}},[_c('span',{staticClass:"anchor",attrs:{"id":"some-heading"}}),_v("Some heading"),_c('a',{staticClass:"fa fa-anchor",attrs:{"href":"#some-heading","onclick":"event.stopPropagation()"}})]),_v(" "),_c('p',[_v("The "),_c('strong',[_v("quick")]),_v(" brown fox jumps "),_c('em',[_v("over")]),_v(" the lazy dog.")])]},proxy:true},{key:"header",fn:function(){return [_v("Correct header")]},proxy:true}])},[_v("\n src from a .md file\n")]),_v(" "),_c('br'),_v(" "),_c('popover',{scopedSlots:_u([{key:"content",fn:function(){return [_c('p',[_v("This is a HTML document")]),_v(" "),_c('span',[_v("It is "),_c('strong',[_v("possible")]),_v(" to use Markdown in HTML")])]},proxy:true},{key:"header",fn:function(){return [_v("Correct header")]},proxy:true}])},[_v("\n src from a .html file\n")]),_v(" "),_c('br'),_v(" "),_c('popover',{scopedSlots:_u([{key:"content",fn:function(){return [_v("content fragment")]},proxy:true}])},[_v("\n src with a fragment\n")]),_v(" "),_c('br'),_v(" "),_c('popover',{scopedSlots:_u([{key:"content",fn:function(){return [_c('panel',{attrs:{"src":"/test_site/testPanels/NormalPanelContent._include_.html","expanded":"","panelId":"nested-panel"},scopedSlots:_u([{key:"header",fn:function(){return [_c('h2',{attrs:{"id":"nested-panel"}},[_c('span',{staticClass:"anchor",attrs:{"id":"nested-panel"}}),_v("Nested Panel"),_c('a',{staticClass:"fa fa-anchor",attrs:{"href":"#nested-panel","onclick":"event.stopPropagation()"}})])]},proxy:true}])})]},proxy:true},{key:"header",fn:function(){return [_c('span',[_v("Reactive content")])]},proxy:true}])},[_v(" "),_v("\n src containing reactive content\n")]),_v(" "),_c('br'),_v(" "),_m(6),_v(" "),_c('popover',{scopedSlots:_u([{key:"content",fn:function(){return [_v("Correct content")]},proxy:true},{key:"header",fn:function(){return [_v("Content slot > content attrib > src attrib")]},proxy:true}])},[_v("\n Content attribute overrides src attribute\n")]),_v(" "),_c('br'),_v(" "),_c('popover',{scopedSlots:_u([{key:"header",fn:function(){return [_v("Content slot > content attrib > src attrib")]},proxy:true},{key:"content",fn:function(){return [_c('span',[_v("Correct content")])]},proxy:true}])},[_v(" "),_v("\n Content slot overrides content attribute overrides src attribute\n")]),_v(" "),_c('br'),_v(" "),_c('popover',{scopedSlots:_u([{key:"header",fn:function(){return [_v("Content slot > content attrib > src attrib")]},proxy:true},{key:"content",fn:function(){return [_c('span',[_v("Correct content")])]},proxy:true}])},[_v(" "),_v("\n Content slot overrides content attribute overrides src attribute\n")]),_v(" "),_c('br'),_v(" "),_c('i',{staticClass:"fa fa-arrow-circle-up fa-lg d-print-none",attrs:{"id":"scroll-top-button","onclick":"handleScrollTop()","aria-hidden":"true"}})],1),_v(" "),_c('overlay-source',{staticClass:"fixed-header-padding",attrs:{"id":"page-nav","tag-name":"nav","to":"page-nav"}},[_c('div',{staticClass:"nav-component slim-scroll"})])],1),_v(" "),_m(7)])} }; var pageVueStaticRenderFns = [function anonymous( ) { @@ -23,6 +23,9 @@ with(this){return _c('p',[_c('strong',[_v("Popover with slots overriding attribu with(this){return _c('p',[_c('strong',[_v("Popover with src attribute")])])} },function anonymous( ) { +with(this){return _c('p',[_c('strong',[_v("Popover contents should use the priority of content slot > content attribute > src attribute")])])} +},function anonymous( +) { with(this){return _c('div',[_c('footer',[_c('h1',{attrs:{"id":"heading-in-footer-should-not-be-indexed"}},[_c('span',{staticClass:"anchor",attrs:{"id":"heading-in-footer-should-not-be-indexed"}}),_v("Heading in footer should not be indexed"),_c('a',{staticClass:"fa fa-anchor",attrs:{"href":"#heading-in-footer-should-not-be-indexed","onclick":"event.stopPropagation()"}})]),_v(" "),_c('div',{staticClass:"text-center"},[_v("\n This is a dynamic height footer that supports markdown "),_c('span',[_v("😄")]),_v("!\n ")])])])} }]; \ No newline at end of file diff --git a/packages/cli/test/functional/test_site/testPopovers.md b/packages/cli/test/functional/test_site/testPopovers.md index 68fb3219a5..98141181bb 100644 --- a/packages/cli/test/functional/test_site/testPopovers.md +++ b/packages/cli/test/functional/test_site/testPopovers.md @@ -54,6 +54,12 @@
    + + src from a .html file + + +
    + src with a fragment @@ -65,3 +71,27 @@ src containing reactive content +
    + +**Popover contents should use the priority of content slot > content attribute > src attribute** + + + Content attribute overrides src attribute + + +
    + + + Correct content + Content slot overrides content attribute overrides src attribute + + +
    + + + Correct content + Content slot overrides content attribute overrides src attribute + + +
    + diff --git a/packages/core/src/html/includePanelProcessor.js b/packages/core/src/html/includePanelProcessor.js index f85d0a0eeb..7db2e585c4 100644 --- a/packages/core/src/html/includePanelProcessor.js +++ b/packages/core/src/html/includePanelProcessor.js @@ -257,8 +257,7 @@ function processInclude(node, context, pageSources, variableProcessor, renderMd, /** * PreProcesses popovers with the src attribute. - * Replaces it with an error node if the specified src is invalid, - * or an empty node if the src is invalid but optional. + * Replaces it with an error node if the specified src is invalid. * Else, sets the content attribute of the popover as parsed from the src. */ function processPopoverSrc(node, context, pageSources, variableProcessor, renderMd, config) { From 8836d0d7030184c3f55072ad930493b59bc105e7 Mon Sep 17 00:00:00 2001 From: Jovyn Tan Date: Mon, 7 Mar 2022 00:04:21 +0800 Subject: [PATCH 20/24] Add test cases --- .../test/functional/test_site/expected/testPopovers.html | 2 ++ .../test_site/expected/testPopovers.page-vue-render.js | 5 ++++- packages/cli/test/functional/test_site/testPopovers.md | 6 ++++++ packages/core/src/html/includePanelProcessor.js | 2 +- 4 files changed, 13 insertions(+), 2 deletions(-) diff --git a/packages/cli/test/functional/test_site/expected/testPopovers.html b/packages/cli/test/functional/test_site/expected/testPopovers.html index 88948eee62..4698c81407 100644 --- a/packages/cli/test/functional/test_site/expected/testPopovers.html +++ b/packages/cli/test/functional/test_site/expected/testPopovers.html @@ -284,6 +284,8 @@

    Nested Panel Content slot overrides content attribute overrides src attribute
    +

    URLs are not valid src

    +
    URLs are not allowed in the 'src' attribute
    diff --git a/packages/cli/test/functional/test_site/expected/testPopovers.page-vue-render.js b/packages/cli/test/functional/test_site/expected/testPopovers.page-vue-render.js index 5fec3ecba1..97102f69a8 100644 --- a/packages/cli/test/functional/test_site/expected/testPopovers.page-vue-render.js +++ b/packages/cli/test/functional/test_site/expected/testPopovers.page-vue-render.js @@ -1,7 +1,7 @@ var pageVueRenderFn = function anonymous( ) { -with(this){return _c('div',{attrs:{"id":"app"}},[_c('div',[_c('header',[_c('navbar',{attrs:{"type":"dark","default-highlight-on":"sibling-or-child"},scopedSlots:_u([{key:"brand",fn:function(){return [_c('a',{staticClass:"navbar-brand",attrs:{"href":"/","title":"Home"}},[_v("Markbind Test Site")])]},proxy:true}])},[_v(" "),_c('li',[_c('a',{staticClass:"nav-link",attrs:{"href":"/test_site/bugs/index.html"}},[_v("Open Bugs")])])]),_v(" "),_m(0)],1),_v(" "),_m(1)]),_v(" "),_c('div',{attrs:{"id":"flex-body"}},[_c('overlay-source',{staticClass:"fixed-header-padding",attrs:{"id":"site-nav","tag-name":"nav","to":"site-nav"}},[_c('div',{staticClass:"site-nav-top"},[_c('div',{staticClass:"font-weight-bold mb-2",staticStyle:{"font-size":"1.25rem"}},[_c('div',[_c('h2',{attrs:{"id":"default-layout"}},[_c('span',{staticClass:"anchor",attrs:{"id":"default-layout"}}),_v("Default Layout"),_c('a',{staticClass:"fa fa-anchor",attrs:{"href":"#default-layout","onclick":"event.stopPropagation()"}})])])])]),_v(" "),_c('div',{staticClass:"nav-component slim-scroll"},[_c('div',[_c('site-nav',[_c('overlay-source',{staticClass:"site-nav-list site-nav-list-root",attrs:{"tag-name":"ul","to":"mb-site-nav"}},[_c('li',[_c('div',{staticClass:"site-nav-default-list-item site-nav-list-item-0",attrs:{"onclick":"handleSiteNavClick(this)"}},[_c('a',{attrs:{"href":"/test_site/index.html"}},[_v("Home 🏠")])])]),_v(" "),_c('li',[_c('div',{staticClass:"site-nav-default-list-item site-nav-list-item-0",attrs:{"onclick":"handleSiteNavClick(this)"}},[_c('a',{attrs:{"href":"/test_site/bugs/index.html"}},[_v("Open Bugs 🐛")])])]),_v(" "),_c('li',{staticClass:"site-nav-custom-list-item site-nav-list-item-0"},[_c('h3',{attrs:{"id":"testing-site-nav"}},[_c('span',{staticClass:"anchor",attrs:{"id":"testing-site-nav"}}),_v("Testing Site-Nav"),_c('a',{staticClass:"fa fa-anchor",attrs:{"href":"#testing-site-nav","onclick":"event.stopPropagation()"}})])]),_v(" "),_c('li',[_c('div',{staticClass:"site-nav-default-list-item site-nav-list-item-0",attrs:{"onclick":"handleSiteNavClick(this)"}},[_c('strong',[_v("Dropdown ")]),_v(" "),_c('span',{staticClass:"glyphicon glyphicon-search",attrs:{"aria-hidden":"true"}}),_v(" title ✏️ "),_v(" "),_c('i',{staticClass:"site-nav-dropdown-btn-icon site-nav-rotate-icon",attrs:{"onclick":"handleSiteNavClick(this.parentNode, false); event.stopPropagation();"}},[_c('span',{staticClass:"glyphicon glyphicon-menu-down",attrs:{"aria-hidden":"true"}})])]),_c('ul',{staticClass:"site-nav-dropdown-container site-nav-dropdown-container-open site-nav-list"},[_c('li',[_c('div',{staticClass:"site-nav-default-list-item site-nav-list-item-1",attrs:{"onclick":"handleSiteNavClick(this)"}},[_c('a',{attrs:{"href":"https://www.google.com/"}},[_v("Dropdown link one")])])]),_v(" "),_c('li',[_c('div',{staticClass:"site-nav-default-list-item site-nav-list-item-1",attrs:{"onclick":"handleSiteNavClick(this)"}},[_c('a',{attrs:{"href":"https://www.google.com/"}},[_v("Html within site-nav "),_c('span',{staticStyle:{"color":"red"}},[_v("should")]),_v(" be displayed properly")])])]),_v(" "),_c('li',[_c('div',{staticClass:"site-nav-default-list-item site-nav-list-item-1",attrs:{"onclick":"handleSiteNavClick(this)"}},[_v("Nested Dropdown title 📐\n\n"),_c('i',{staticClass:"site-nav-dropdown-btn-icon",attrs:{"onclick":"handleSiteNavClick(this.parentNode, false); event.stopPropagation();"}},[_c('span',{staticClass:"glyphicon glyphicon-menu-down",attrs:{"aria-hidden":"true"}})])]),_c('ul',{staticClass:"site-nav-dropdown-container site-nav-list"},[_c('li',[_c('div',{staticClass:"site-nav-default-list-item site-nav-list-item-2",attrs:{"onclick":"handleSiteNavClick(this)"}},[_c('a',{attrs:{"href":"https://www.google.com/"}},[_c('strong',[_v("Nested")]),_v(" Dropdown link one")])])]),_v(" "),_c('li',[_c('div',{staticClass:"site-nav-default-list-item site-nav-list-item-2",attrs:{"onclick":"handleSiteNavClick(this)"}},[_c('a',{attrs:{"href":"https://www.google.com/"}},[_c('strong',[_v("Nested")]),_v(" Dropdown link two")])])])])]),_v(" "),_c('li',[_c('div',{staticClass:"site-nav-default-list-item site-nav-list-item-1",attrs:{"onclick":"handleSiteNavClick(this)"}},[_c('a',{attrs:{"href":"https://www.google.com/"}},[_v("Dropdown link two")])])])])]),_v(" "),_c('li',[_c('div',{staticClass:"site-nav-default-list-item site-nav-list-item-0",attrs:{"onclick":"handleSiteNavClick(this)"}},[_c('a',{attrs:{"href":"https://www.google.com/"}},[_c('mark',[_v("Third Link")]),_v(" 📋")])])]),_v(" "),_c('li',[_c('div',{staticClass:"site-nav-default-list-item site-nav-list-item-0",attrs:{"onclick":"handleSiteNavClick(this)"}},[_v("Filler text "),_c('a',{attrs:{"href":"https://www.youtube.com/"}},[_c('span',{staticClass:"glyphicon glyphicon-facetime-video",attrs:{"aria-hidden":"true"}}),_v(" Youtube 📺")]),_v(" filler text"),_v(" "),_c('i',{staticClass:"site-nav-dropdown-btn-icon",attrs:{"onclick":"handleSiteNavClick(this.parentNode, false); event.stopPropagation();"}},[_c('span',{staticClass:"glyphicon glyphicon-menu-down",attrs:{"aria-hidden":"true"}})])]),_c('ul',{staticClass:"site-nav-dropdown-container site-nav-list"},[_c('li',[_c('div',{staticClass:"site-nav-default-list-item site-nav-list-item-1",attrs:{"onclick":"handleSiteNavClick(this)"}},[_c('a',{attrs:{"href":"https://www.youtube.com/watch?v=dQw4w9WgXcQ"}},[_v("The answer to everything in the universe")])])]),_v(" "),_c('li',[_c('div',{staticClass:"site-nav-default-list-item site-nav-list-item-1",attrs:{"onclick":"handleSiteNavClick(this)"}},[_c('mark',[_v("Dropdown title")]),_v(" "),_c('span',{staticClass:"glyphicon glyphicon-comment",attrs:{"aria-hidden":"true"}}),_v(" ✏️ "),_v(" "),_c('i',{staticClass:"site-nav-dropdown-btn-icon site-nav-rotate-icon",attrs:{"onclick":"handleSiteNavClick(this.parentNode, false); event.stopPropagation();"}},[_c('span',{staticClass:"glyphicon glyphicon-menu-down",attrs:{"aria-hidden":"true"}})])]),_c('ul',{staticClass:"site-nav-dropdown-container site-nav-dropdown-container-open site-nav-list"},[_c('li',[_c('div',{staticClass:"site-nav-default-list-item site-nav-list-item-2",attrs:{"onclick":"handleSiteNavClick(this)"}},[_c('a',{attrs:{"href":"https://www.google.com/"}},[_c('strong',[_v("Nested")]),_v(" Dropdown link one")])])])])])])]),_v(" "),_c('li',[_c('div',{staticClass:"site-nav-default-list-item site-nav-list-item-0",attrs:{"onclick":"handleSiteNavClick(this)"}},[_v("Really Long Dropdown Title Really Long Dropdown Title Really Long Dropdown Title Really Long Dropdown\n\n"),_c('i',{staticClass:"site-nav-dropdown-btn-icon",attrs:{"onclick":"handleSiteNavClick(this.parentNode, false); event.stopPropagation();"}},[_c('span',{staticClass:"glyphicon glyphicon-menu-down",attrs:{"aria-hidden":"true"}})])]),_c('ul',{staticClass:"site-nav-dropdown-container site-nav-list"},[_c('li',{staticClass:"site-nav-custom-list-item site-nav-list-item-1"},[_v("Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text")]),_v(" "),_c('li',[_c('div',{staticClass:"site-nav-default-list-item site-nav-list-item-1",attrs:{"onclick":"handleSiteNavClick(this)"}},[_v("Nested Dropdown Title\n\n"),_c('i',{staticClass:"site-nav-dropdown-btn-icon",attrs:{"onclick":"handleSiteNavClick(this.parentNode, false); event.stopPropagation();"}},[_c('span',{staticClass:"glyphicon glyphicon-menu-down",attrs:{"aria-hidden":"true"}})])]),_c('ul',{staticClass:"site-nav-dropdown-container site-nav-list"},[_c('li',{staticClass:"site-nav-custom-list-item site-nav-list-item-2"},[_v("Hello Doge Hello Doge 🐶")]),_v(" "),_c('li',[_c('div',{staticClass:"site-nav-default-list-item site-nav-list-item-2",attrs:{"onclick":"handleSiteNavClick(this)"}},[_c('a',{attrs:{"href":"/test_site/index.html"}},[_c('strong',[_v("NESTED LINK")]),_v(" Home 🏠")])])]),_v(" "),_c('li',{staticClass:"site-nav-custom-list-item site-nav-list-item-2"},[_v("Text cut off from height limit Text cut off from height limit Text cut off from height limit Text cut off from height limit Text cut off from height limit Text cut off from height limit Text cut off from height limit Text cut off from height limit Text cut off from height limit Text cut off from height limit Text cut off from height limit Text cut off from height limit Text cut off from height limit Text cut off from height limit Text cut off from height limit Text cut off from height limit Text cut off from height limit Text cut off from height limit Text cut off from height limit Text cut off from height limit Text cut off from height limit")])])])])]),_v(" "),_c('li',[_c('div',{staticClass:"site-nav-default-list-item site-nav-list-item-0",attrs:{"onclick":"handleSiteNavClick(this)"}},[_v("Test line break in navigation layout\n\n"),_c('i',{staticClass:"site-nav-dropdown-btn-icon",attrs:{"onclick":"handleSiteNavClick(this.parentNode, false); event.stopPropagation();"}},[_c('span',{staticClass:"glyphicon glyphicon-menu-down",attrs:{"aria-hidden":"true"}})])]),_c('ul',{staticClass:"site-nav-dropdown-container site-nav-list"},[_c('li',{staticClass:"site-nav-custom-list-item site-nav-list-item-1"},[_v("Nested line break text ✂️")]),_v(" "),_c('li',[_c('div',{staticClass:"site-nav-default-list-item site-nav-list-item-1",attrs:{"onclick":"handleSiteNavClick(this)"}},[_c('a',{attrs:{"href":"/test_site/index.html"}},[_v("Nested line break href")]),_v(" "),_c('i',{staticClass:"site-nav-dropdown-btn-icon",attrs:{"onclick":"handleSiteNavClick(this.parentNode, false); event.stopPropagation();"}},[_c('span',{staticClass:"glyphicon glyphicon-menu-down",attrs:{"aria-hidden":"true"}})])]),_c('ul',{staticClass:"site-nav-dropdown-container site-nav-list"},[_c('li',{staticClass:"site-nav-custom-list-item site-nav-list-item-2"},[_v("Nested Nested line break text ✂️")])])]),_v(" "),_c('li',[_c('div',{staticClass:"site-nav-default-list-item site-nav-list-item-1",attrs:{"onclick":"handleSiteNavClick(this)"}},[_v("Nested line break dropdown menu\n\n"),_c('i',{staticClass:"site-nav-dropdown-btn-icon",attrs:{"onclick":"handleSiteNavClick(this.parentNode, false); event.stopPropagation();"}},[_c('span',{staticClass:"glyphicon glyphicon-menu-down",attrs:{"aria-hidden":"true"}})])]),_c('ul',{staticClass:"site-nav-dropdown-container site-nav-list"},[_c('li',{staticClass:"site-nav-custom-list-item site-nav-list-item-2"},[_v("Line break item 2 📘")])])])])])])],1)],1)])]),_v(" "),_c('div',{staticClass:"fixed-header-padding",attrs:{"id":"content-wrapper"}},[_m(2),_v(" "),_c('popover',{scopedSlots:_u([{key:"content",fn:function(){return [_v("Correct content")]},proxy:true},{key:"header",fn:function(){return [_v("Correct header")]},proxy:true}])},[_v("\n Hover popover\n")]),_v(" "),_c('br'),_v(" "),_c('popover',{attrs:{"trigger":"click"},scopedSlots:_u([{key:"content",fn:function(){return [_v("Correct content")]},proxy:true},{key:"header",fn:function(){return [_v("Correct header")]},proxy:true}])},[_v("\n Click popover\n")]),_v(" "),_c('br'),_v(" "),_m(3),_v(" "),_c('popover',{scopedSlots:_u([{key:"content",fn:function(){return [_c('span',[_v("Correct content")])]},proxy:true}])},[_v("\n Hover popover\n")]),_v(" "),_c('br'),_v(" "),_c('popover',{attrs:{"trigger":"click"},scopedSlots:_u([{key:"header",fn:function(){return [_c('span',[_v("Correct header")])]},proxy:true},{key:"content",fn:function(){return [_c('span',[_v("Correct content")])]},proxy:true}])},[_v(" "),_v("\n Click popover\n")]),_v(" "),_c('br'),_v(" "),_m(4),_v(" "),_c('popover',{scopedSlots:_u([{key:"header",fn:function(){return [_v("Correct header")]},proxy:true},{key:"content",fn:function(){return [_c('span',[_v("Correct content")])]},proxy:true}])},[_v(" "),_v("\n Hover popover\n")]),_v(" "),_c('br'),_v(" "),_c('popover',{attrs:{"trigger":"click"},scopedSlots:_u([{key:"header",fn:function(){return [_c('span',[_v("Correct header")])]},proxy:true},{key:"content",fn:function(){return [_c('span',[_v("Correct content")])]},proxy:true}])},[_v(" "),_v("\n Click popover\n")]),_v(" "),_c('br'),_v(" "),_m(5),_v(" "),_c('popover',{scopedSlots:_u([{key:"content",fn:function(){return [_c('h1',{attrs:{"id":"some-heading"}},[_c('span',{staticClass:"anchor",attrs:{"id":"some-heading"}}),_v("Some heading"),_c('a',{staticClass:"fa fa-anchor",attrs:{"href":"#some-heading","onclick":"event.stopPropagation()"}})]),_v(" "),_c('p',[_v("The "),_c('strong',[_v("quick")]),_v(" brown fox jumps "),_c('em',[_v("over")]),_v(" the lazy dog.")])]},proxy:true},{key:"header",fn:function(){return [_v("Correct header")]},proxy:true}])},[_v("\n src from a .md file\n")]),_v(" "),_c('br'),_v(" "),_c('popover',{scopedSlots:_u([{key:"content",fn:function(){return [_c('p',[_v("This is a HTML document")]),_v(" "),_c('span',[_v("It is "),_c('strong',[_v("possible")]),_v(" to use Markdown in HTML")])]},proxy:true},{key:"header",fn:function(){return [_v("Correct header")]},proxy:true}])},[_v("\n src from a .html file\n")]),_v(" "),_c('br'),_v(" "),_c('popover',{scopedSlots:_u([{key:"content",fn:function(){return [_v("content fragment")]},proxy:true}])},[_v("\n src with a fragment\n")]),_v(" "),_c('br'),_v(" "),_c('popover',{scopedSlots:_u([{key:"content",fn:function(){return [_c('panel',{attrs:{"src":"/test_site/testPanels/NormalPanelContent._include_.html","expanded":"","panelId":"nested-panel"},scopedSlots:_u([{key:"header",fn:function(){return [_c('h2',{attrs:{"id":"nested-panel"}},[_c('span',{staticClass:"anchor",attrs:{"id":"nested-panel"}}),_v("Nested Panel"),_c('a',{staticClass:"fa fa-anchor",attrs:{"href":"#nested-panel","onclick":"event.stopPropagation()"}})])]},proxy:true}])})]},proxy:true},{key:"header",fn:function(){return [_c('span',[_v("Reactive content")])]},proxy:true}])},[_v(" "),_v("\n src containing reactive content\n")]),_v(" "),_c('br'),_v(" "),_m(6),_v(" "),_c('popover',{scopedSlots:_u([{key:"content",fn:function(){return [_v("Correct content")]},proxy:true},{key:"header",fn:function(){return [_v("Content slot > content attrib > src attrib")]},proxy:true}])},[_v("\n Content attribute overrides src attribute\n")]),_v(" "),_c('br'),_v(" "),_c('popover',{scopedSlots:_u([{key:"header",fn:function(){return [_v("Content slot > content attrib > src attrib")]},proxy:true},{key:"content",fn:function(){return [_c('span',[_v("Correct content")])]},proxy:true}])},[_v(" "),_v("\n Content slot overrides content attribute overrides src attribute\n")]),_v(" "),_c('br'),_v(" "),_c('popover',{scopedSlots:_u([{key:"header",fn:function(){return [_v("Content slot > content attrib > src attrib")]},proxy:true},{key:"content",fn:function(){return [_c('span',[_v("Correct content")])]},proxy:true}])},[_v(" "),_v("\n Content slot overrides content attribute overrides src attribute\n")]),_v(" "),_c('br'),_v(" "),_c('i',{staticClass:"fa fa-arrow-circle-up fa-lg d-print-none",attrs:{"id":"scroll-top-button","onclick":"handleScrollTop()","aria-hidden":"true"}})],1),_v(" "),_c('overlay-source',{staticClass:"fixed-header-padding",attrs:{"id":"page-nav","tag-name":"nav","to":"page-nav"}},[_c('div',{staticClass:"nav-component slim-scroll"})])],1),_v(" "),_m(7)])} +with(this){return _c('div',{attrs:{"id":"app"}},[_c('div',[_c('header',[_c('navbar',{attrs:{"type":"dark","default-highlight-on":"sibling-or-child"},scopedSlots:_u([{key:"brand",fn:function(){return [_c('a',{staticClass:"navbar-brand",attrs:{"href":"/","title":"Home"}},[_v("Markbind Test Site")])]},proxy:true}])},[_v(" "),_c('li',[_c('a',{staticClass:"nav-link",attrs:{"href":"/test_site/bugs/index.html"}},[_v("Open Bugs")])])]),_v(" "),_m(0)],1),_v(" "),_m(1)]),_v(" "),_c('div',{attrs:{"id":"flex-body"}},[_c('overlay-source',{staticClass:"fixed-header-padding",attrs:{"id":"site-nav","tag-name":"nav","to":"site-nav"}},[_c('div',{staticClass:"site-nav-top"},[_c('div',{staticClass:"font-weight-bold mb-2",staticStyle:{"font-size":"1.25rem"}},[_c('div',[_c('h2',{attrs:{"id":"default-layout"}},[_c('span',{staticClass:"anchor",attrs:{"id":"default-layout"}}),_v("Default Layout"),_c('a',{staticClass:"fa fa-anchor",attrs:{"href":"#default-layout","onclick":"event.stopPropagation()"}})])])])]),_v(" "),_c('div',{staticClass:"nav-component slim-scroll"},[_c('div',[_c('site-nav',[_c('overlay-source',{staticClass:"site-nav-list site-nav-list-root",attrs:{"tag-name":"ul","to":"mb-site-nav"}},[_c('li',[_c('div',{staticClass:"site-nav-default-list-item site-nav-list-item-0",attrs:{"onclick":"handleSiteNavClick(this)"}},[_c('a',{attrs:{"href":"/test_site/index.html"}},[_v("Home 🏠")])])]),_v(" "),_c('li',[_c('div',{staticClass:"site-nav-default-list-item site-nav-list-item-0",attrs:{"onclick":"handleSiteNavClick(this)"}},[_c('a',{attrs:{"href":"/test_site/bugs/index.html"}},[_v("Open Bugs 🐛")])])]),_v(" "),_c('li',{staticClass:"site-nav-custom-list-item site-nav-list-item-0"},[_c('h3',{attrs:{"id":"testing-site-nav"}},[_c('span',{staticClass:"anchor",attrs:{"id":"testing-site-nav"}}),_v("Testing Site-Nav"),_c('a',{staticClass:"fa fa-anchor",attrs:{"href":"#testing-site-nav","onclick":"event.stopPropagation()"}})])]),_v(" "),_c('li',[_c('div',{staticClass:"site-nav-default-list-item site-nav-list-item-0",attrs:{"onclick":"handleSiteNavClick(this)"}},[_c('strong',[_v("Dropdown ")]),_v(" "),_c('span',{staticClass:"glyphicon glyphicon-search",attrs:{"aria-hidden":"true"}}),_v(" title ✏️ "),_v(" "),_c('i',{staticClass:"site-nav-dropdown-btn-icon site-nav-rotate-icon",attrs:{"onclick":"handleSiteNavClick(this.parentNode, false); event.stopPropagation();"}},[_c('span',{staticClass:"glyphicon glyphicon-menu-down",attrs:{"aria-hidden":"true"}})])]),_c('ul',{staticClass:"site-nav-dropdown-container site-nav-dropdown-container-open site-nav-list"},[_c('li',[_c('div',{staticClass:"site-nav-default-list-item site-nav-list-item-1",attrs:{"onclick":"handleSiteNavClick(this)"}},[_c('a',{attrs:{"href":"https://www.google.com/"}},[_v("Dropdown link one")])])]),_v(" "),_c('li',[_c('div',{staticClass:"site-nav-default-list-item site-nav-list-item-1",attrs:{"onclick":"handleSiteNavClick(this)"}},[_c('a',{attrs:{"href":"https://www.google.com/"}},[_v("Html within site-nav "),_c('span',{staticStyle:{"color":"red"}},[_v("should")]),_v(" be displayed properly")])])]),_v(" "),_c('li',[_c('div',{staticClass:"site-nav-default-list-item site-nav-list-item-1",attrs:{"onclick":"handleSiteNavClick(this)"}},[_v("Nested Dropdown title 📐\n\n"),_c('i',{staticClass:"site-nav-dropdown-btn-icon",attrs:{"onclick":"handleSiteNavClick(this.parentNode, false); event.stopPropagation();"}},[_c('span',{staticClass:"glyphicon glyphicon-menu-down",attrs:{"aria-hidden":"true"}})])]),_c('ul',{staticClass:"site-nav-dropdown-container site-nav-list"},[_c('li',[_c('div',{staticClass:"site-nav-default-list-item site-nav-list-item-2",attrs:{"onclick":"handleSiteNavClick(this)"}},[_c('a',{attrs:{"href":"https://www.google.com/"}},[_c('strong',[_v("Nested")]),_v(" Dropdown link one")])])]),_v(" "),_c('li',[_c('div',{staticClass:"site-nav-default-list-item site-nav-list-item-2",attrs:{"onclick":"handleSiteNavClick(this)"}},[_c('a',{attrs:{"href":"https://www.google.com/"}},[_c('strong',[_v("Nested")]),_v(" Dropdown link two")])])])])]),_v(" "),_c('li',[_c('div',{staticClass:"site-nav-default-list-item site-nav-list-item-1",attrs:{"onclick":"handleSiteNavClick(this)"}},[_c('a',{attrs:{"href":"https://www.google.com/"}},[_v("Dropdown link two")])])])])]),_v(" "),_c('li',[_c('div',{staticClass:"site-nav-default-list-item site-nav-list-item-0",attrs:{"onclick":"handleSiteNavClick(this)"}},[_c('a',{attrs:{"href":"https://www.google.com/"}},[_c('mark',[_v("Third Link")]),_v(" 📋")])])]),_v(" "),_c('li',[_c('div',{staticClass:"site-nav-default-list-item site-nav-list-item-0",attrs:{"onclick":"handleSiteNavClick(this)"}},[_v("Filler text "),_c('a',{attrs:{"href":"https://www.youtube.com/"}},[_c('span',{staticClass:"glyphicon glyphicon-facetime-video",attrs:{"aria-hidden":"true"}}),_v(" Youtube 📺")]),_v(" filler text"),_v(" "),_c('i',{staticClass:"site-nav-dropdown-btn-icon",attrs:{"onclick":"handleSiteNavClick(this.parentNode, false); event.stopPropagation();"}},[_c('span',{staticClass:"glyphicon glyphicon-menu-down",attrs:{"aria-hidden":"true"}})])]),_c('ul',{staticClass:"site-nav-dropdown-container site-nav-list"},[_c('li',[_c('div',{staticClass:"site-nav-default-list-item site-nav-list-item-1",attrs:{"onclick":"handleSiteNavClick(this)"}},[_c('a',{attrs:{"href":"https://www.youtube.com/watch?v=dQw4w9WgXcQ"}},[_v("The answer to everything in the universe")])])]),_v(" "),_c('li',[_c('div',{staticClass:"site-nav-default-list-item site-nav-list-item-1",attrs:{"onclick":"handleSiteNavClick(this)"}},[_c('mark',[_v("Dropdown title")]),_v(" "),_c('span',{staticClass:"glyphicon glyphicon-comment",attrs:{"aria-hidden":"true"}}),_v(" ✏️ "),_v(" "),_c('i',{staticClass:"site-nav-dropdown-btn-icon site-nav-rotate-icon",attrs:{"onclick":"handleSiteNavClick(this.parentNode, false); event.stopPropagation();"}},[_c('span',{staticClass:"glyphicon glyphicon-menu-down",attrs:{"aria-hidden":"true"}})])]),_c('ul',{staticClass:"site-nav-dropdown-container site-nav-dropdown-container-open site-nav-list"},[_c('li',[_c('div',{staticClass:"site-nav-default-list-item site-nav-list-item-2",attrs:{"onclick":"handleSiteNavClick(this)"}},[_c('a',{attrs:{"href":"https://www.google.com/"}},[_c('strong',[_v("Nested")]),_v(" Dropdown link one")])])])])])])]),_v(" "),_c('li',[_c('div',{staticClass:"site-nav-default-list-item site-nav-list-item-0",attrs:{"onclick":"handleSiteNavClick(this)"}},[_v("Really Long Dropdown Title Really Long Dropdown Title Really Long Dropdown Title Really Long Dropdown\n\n"),_c('i',{staticClass:"site-nav-dropdown-btn-icon",attrs:{"onclick":"handleSiteNavClick(this.parentNode, false); event.stopPropagation();"}},[_c('span',{staticClass:"glyphicon glyphicon-menu-down",attrs:{"aria-hidden":"true"}})])]),_c('ul',{staticClass:"site-nav-dropdown-container site-nav-list"},[_c('li',{staticClass:"site-nav-custom-list-item site-nav-list-item-1"},[_v("Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text")]),_v(" "),_c('li',[_c('div',{staticClass:"site-nav-default-list-item site-nav-list-item-1",attrs:{"onclick":"handleSiteNavClick(this)"}},[_v("Nested Dropdown Title\n\n"),_c('i',{staticClass:"site-nav-dropdown-btn-icon",attrs:{"onclick":"handleSiteNavClick(this.parentNode, false); event.stopPropagation();"}},[_c('span',{staticClass:"glyphicon glyphicon-menu-down",attrs:{"aria-hidden":"true"}})])]),_c('ul',{staticClass:"site-nav-dropdown-container site-nav-list"},[_c('li',{staticClass:"site-nav-custom-list-item site-nav-list-item-2"},[_v("Hello Doge Hello Doge 🐶")]),_v(" "),_c('li',[_c('div',{staticClass:"site-nav-default-list-item site-nav-list-item-2",attrs:{"onclick":"handleSiteNavClick(this)"}},[_c('a',{attrs:{"href":"/test_site/index.html"}},[_c('strong',[_v("NESTED LINK")]),_v(" Home 🏠")])])]),_v(" "),_c('li',{staticClass:"site-nav-custom-list-item site-nav-list-item-2"},[_v("Text cut off from height limit Text cut off from height limit Text cut off from height limit Text cut off from height limit Text cut off from height limit Text cut off from height limit Text cut off from height limit Text cut off from height limit Text cut off from height limit Text cut off from height limit Text cut off from height limit Text cut off from height limit Text cut off from height limit Text cut off from height limit Text cut off from height limit Text cut off from height limit Text cut off from height limit Text cut off from height limit Text cut off from height limit Text cut off from height limit Text cut off from height limit")])])])])]),_v(" "),_c('li',[_c('div',{staticClass:"site-nav-default-list-item site-nav-list-item-0",attrs:{"onclick":"handleSiteNavClick(this)"}},[_v("Test line break in navigation layout\n\n"),_c('i',{staticClass:"site-nav-dropdown-btn-icon",attrs:{"onclick":"handleSiteNavClick(this.parentNode, false); event.stopPropagation();"}},[_c('span',{staticClass:"glyphicon glyphicon-menu-down",attrs:{"aria-hidden":"true"}})])]),_c('ul',{staticClass:"site-nav-dropdown-container site-nav-list"},[_c('li',{staticClass:"site-nav-custom-list-item site-nav-list-item-1"},[_v("Nested line break text ✂️")]),_v(" "),_c('li',[_c('div',{staticClass:"site-nav-default-list-item site-nav-list-item-1",attrs:{"onclick":"handleSiteNavClick(this)"}},[_c('a',{attrs:{"href":"/test_site/index.html"}},[_v("Nested line break href")]),_v(" "),_c('i',{staticClass:"site-nav-dropdown-btn-icon",attrs:{"onclick":"handleSiteNavClick(this.parentNode, false); event.stopPropagation();"}},[_c('span',{staticClass:"glyphicon glyphicon-menu-down",attrs:{"aria-hidden":"true"}})])]),_c('ul',{staticClass:"site-nav-dropdown-container site-nav-list"},[_c('li',{staticClass:"site-nav-custom-list-item site-nav-list-item-2"},[_v("Nested Nested line break text ✂️")])])]),_v(" "),_c('li',[_c('div',{staticClass:"site-nav-default-list-item site-nav-list-item-1",attrs:{"onclick":"handleSiteNavClick(this)"}},[_v("Nested line break dropdown menu\n\n"),_c('i',{staticClass:"site-nav-dropdown-btn-icon",attrs:{"onclick":"handleSiteNavClick(this.parentNode, false); event.stopPropagation();"}},[_c('span',{staticClass:"glyphicon glyphicon-menu-down",attrs:{"aria-hidden":"true"}})])]),_c('ul',{staticClass:"site-nav-dropdown-container site-nav-list"},[_c('li',{staticClass:"site-nav-custom-list-item site-nav-list-item-2"},[_v("Line break item 2 📘")])])])])])])],1)],1)])]),_v(" "),_c('div',{staticClass:"fixed-header-padding",attrs:{"id":"content-wrapper"}},[_m(2),_v(" "),_c('popover',{scopedSlots:_u([{key:"content",fn:function(){return [_v("Correct content")]},proxy:true},{key:"header",fn:function(){return [_v("Correct header")]},proxy:true}])},[_v("\n Hover popover\n")]),_v(" "),_c('br'),_v(" "),_c('popover',{attrs:{"trigger":"click"},scopedSlots:_u([{key:"content",fn:function(){return [_v("Correct content")]},proxy:true},{key:"header",fn:function(){return [_v("Correct header")]},proxy:true}])},[_v("\n Click popover\n")]),_v(" "),_c('br'),_v(" "),_m(3),_v(" "),_c('popover',{scopedSlots:_u([{key:"content",fn:function(){return [_c('span',[_v("Correct content")])]},proxy:true}])},[_v("\n Hover popover\n")]),_v(" "),_c('br'),_v(" "),_c('popover',{attrs:{"trigger":"click"},scopedSlots:_u([{key:"header",fn:function(){return [_c('span',[_v("Correct header")])]},proxy:true},{key:"content",fn:function(){return [_c('span',[_v("Correct content")])]},proxy:true}])},[_v(" "),_v("\n Click popover\n")]),_v(" "),_c('br'),_v(" "),_m(4),_v(" "),_c('popover',{scopedSlots:_u([{key:"header",fn:function(){return [_v("Correct header")]},proxy:true},{key:"content",fn:function(){return [_c('span',[_v("Correct content")])]},proxy:true}])},[_v(" "),_v("\n Hover popover\n")]),_v(" "),_c('br'),_v(" "),_c('popover',{attrs:{"trigger":"click"},scopedSlots:_u([{key:"header",fn:function(){return [_c('span',[_v("Correct header")])]},proxy:true},{key:"content",fn:function(){return [_c('span',[_v("Correct content")])]},proxy:true}])},[_v(" "),_v("\n Click popover\n")]),_v(" "),_c('br'),_v(" "),_m(5),_v(" "),_c('popover',{scopedSlots:_u([{key:"content",fn:function(){return [_c('h1',{attrs:{"id":"some-heading"}},[_c('span',{staticClass:"anchor",attrs:{"id":"some-heading"}}),_v("Some heading"),_c('a',{staticClass:"fa fa-anchor",attrs:{"href":"#some-heading","onclick":"event.stopPropagation()"}})]),_v(" "),_c('p',[_v("The "),_c('strong',[_v("quick")]),_v(" brown fox jumps "),_c('em',[_v("over")]),_v(" the lazy dog.")])]},proxy:true},{key:"header",fn:function(){return [_v("Correct header")]},proxy:true}])},[_v("\n src from a .md file\n")]),_v(" "),_c('br'),_v(" "),_c('popover',{scopedSlots:_u([{key:"content",fn:function(){return [_c('p',[_v("This is a HTML document")]),_v(" "),_c('span',[_v("It is "),_c('strong',[_v("possible")]),_v(" to use Markdown in HTML")])]},proxy:true},{key:"header",fn:function(){return [_v("Correct header")]},proxy:true}])},[_v("\n src from a .html file\n")]),_v(" "),_c('br'),_v(" "),_c('popover',{scopedSlots:_u([{key:"content",fn:function(){return [_v("content fragment")]},proxy:true}])},[_v("\n src with a fragment\n")]),_v(" "),_c('br'),_v(" "),_c('popover',{scopedSlots:_u([{key:"content",fn:function(){return [_c('panel',{attrs:{"src":"/test_site/testPanels/NormalPanelContent._include_.html","expanded":"","panelId":"nested-panel"},scopedSlots:_u([{key:"header",fn:function(){return [_c('h2',{attrs:{"id":"nested-panel"}},[_c('span',{staticClass:"anchor",attrs:{"id":"nested-panel"}}),_v("Nested Panel"),_c('a',{staticClass:"fa fa-anchor",attrs:{"href":"#nested-panel","onclick":"event.stopPropagation()"}})])]},proxy:true}])})]},proxy:true},{key:"header",fn:function(){return [_c('span',[_v("Reactive content")])]},proxy:true}])},[_v(" "),_v("\n src containing reactive content\n")]),_v(" "),_c('br'),_v(" "),_m(6),_v(" "),_c('popover',{scopedSlots:_u([{key:"content",fn:function(){return [_v("Correct content")]},proxy:true},{key:"header",fn:function(){return [_v("Content slot > content attrib > src attrib")]},proxy:true}])},[_v("\n Content attribute overrides src attribute\n")]),_v(" "),_c('br'),_v(" "),_c('popover',{scopedSlots:_u([{key:"header",fn:function(){return [_v("Content slot > content attrib > src attrib")]},proxy:true},{key:"content",fn:function(){return [_c('span',[_v("Correct content")])]},proxy:true}])},[_v(" "),_v("\n Content slot overrides content attribute overrides src attribute\n")]),_v(" "),_c('br'),_v(" "),_c('popover',{scopedSlots:_u([{key:"header",fn:function(){return [_v("Content slot > content attrib > src attrib")]},proxy:true},{key:"content",fn:function(){return [_c('span',[_v("Correct content")])]},proxy:true}])},[_v(" "),_v("\n Content slot overrides content attribute overrides src attribute\n")]),_v(" "),_c('br'),_v(" "),_m(7),_v(" "),_c('div',{staticStyle:{"color":"red"}},[_v("URLs are not allowed in the 'src' attribute")]),_v(" "),_c('i',{staticClass:"fa fa-arrow-circle-up fa-lg d-print-none",attrs:{"id":"scroll-top-button","onclick":"handleScrollTop()","aria-hidden":"true"}})],1),_v(" "),_c('overlay-source',{staticClass:"fixed-header-padding",attrs:{"id":"page-nav","tag-name":"nav","to":"page-nav"}},[_c('div',{staticClass:"nav-component slim-scroll"})])],1),_v(" "),_m(8)])} }; var pageVueStaticRenderFns = [function anonymous( ) { @@ -26,6 +26,9 @@ with(this){return _c('p',[_c('strong',[_v("Popover with src attribute")])])} with(this){return _c('p',[_c('strong',[_v("Popover contents should use the priority of content slot > content attribute > src attribute")])])} },function anonymous( ) { +with(this){return _c('p',[_c('strong',[_v("URLs are not valid src")])])} +},function anonymous( +) { with(this){return _c('div',[_c('footer',[_c('h1',{attrs:{"id":"heading-in-footer-should-not-be-indexed"}},[_c('span',{staticClass:"anchor",attrs:{"id":"heading-in-footer-should-not-be-indexed"}}),_v("Heading in footer should not be indexed"),_c('a',{staticClass:"fa fa-anchor",attrs:{"href":"#heading-in-footer-should-not-be-indexed","onclick":"event.stopPropagation()"}})]),_v(" "),_c('div',{staticClass:"text-center"},[_v("\n This is a dynamic height footer that supports markdown "),_c('span',[_v("😄")]),_v("!\n ")])])])} }]; \ No newline at end of file diff --git a/packages/cli/test/functional/test_site/testPopovers.md b/packages/cli/test/functional/test_site/testPopovers.md index 98141181bb..9082579094 100644 --- a/packages/cli/test/functional/test_site/testPopovers.md +++ b/packages/cli/test/functional/test_site/testPopovers.md @@ -95,3 +95,9 @@
    +**URLs are not valid src** + + + URLs should not be valid + + diff --git a/packages/core/src/html/includePanelProcessor.js b/packages/core/src/html/includePanelProcessor.js index 7db2e585c4..50c8194963 100644 --- a/packages/core/src/html/includePanelProcessor.js +++ b/packages/core/src/html/includePanelProcessor.js @@ -258,7 +258,7 @@ function processInclude(node, context, pageSources, variableProcessor, renderMd, /** * PreProcesses popovers with the src attribute. * Replaces it with an error node if the specified src is invalid. - * Else, sets the content attribute of the popover as parsed from the src. + * Else, appends the content to the node. */ function processPopoverSrc(node, context, pageSources, variableProcessor, renderMd, config) { if (!_.has(node.attribs, 'src')) { From a5ee7544ed19bef1c7f177f79e27927670fec1b0 Mon Sep 17 00:00:00 2001 From: Jovyn Tan Date: Mon, 7 Mar 2022 00:08:33 +0800 Subject: [PATCH 21/24] Revert unnecessary changes --- docs/userGuide/syntax/popovers.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/userGuide/syntax/popovers.md b/docs/userGuide/syntax/popovers.md index 46b76968ee..227f07d44d 100644 --- a/docs/userGuide/syntax/popovers.md +++ b/docs/userGuide/syntax/popovers.md @@ -111,11 +111,12 @@ Hover over the keyword to see the po
    + description :+1: +
    ``` - From d3c6b5d4713340fb05ae37a7c53ea74132e0a273 Mon Sep 17 00:00:00 2001 From: Jovyn Tan Date: Mon, 7 Mar 2022 15:26:52 +0800 Subject: [PATCH 22/24] Add popovers to defaultTagLinkMap --- packages/core/src/html/linkProcessor.js | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/core/src/html/linkProcessor.js b/packages/core/src/html/linkProcessor.js index 4f225a4386..bf4588fe7c 100644 --- a/packages/core/src/html/linkProcessor.js +++ b/packages/core/src/html/linkProcessor.js @@ -19,6 +19,7 @@ const defaultTagLinkMap = { link: 'href', include: 'src', panel: 'src', + popover: 'src', script: 'src', }; From adbcfa40322d8551798aaa60c3fb9210d864dcf6 Mon Sep 17 00:00:00 2001 From: Jovyn Tan Date: Mon, 7 Mar 2022 15:42:23 +0800 Subject: [PATCH 23/24] Update tests for relative links --- .../test_site/expected/siteData.json | 3 ++- .../test_site/expected/testPopovers.html | 19 +++++++++++++++++-- .../expected/testPopovers.page-vue-render.js | 2 +- .../test/functional/test_site/testPopovers.md | 16 ++++++++++++++-- 4 files changed, 34 insertions(+), 6 deletions(-) diff --git a/packages/cli/test/functional/test_site/expected/siteData.json b/packages/cli/test/functional/test_site/expected/siteData.json index 9b65aaf945..6a4d87dbe5 100644 --- a/packages/cli/test/functional/test_site/expected/siteData.json +++ b/packages/cli/test/functional/test_site/expected/siteData.json @@ -220,7 +220,8 @@ "headings": { "nested-panel": "Nested Panel", "normal-panel-content-heading": "Normal panel content heading", - "some-heading": "Some heading" + "some-heading": "Some heading", + "some-heading-2": "Some heading" }, "headingKeywords": {} }, diff --git a/packages/cli/test/functional/test_site/expected/testPopovers.html b/packages/cli/test/functional/test_site/expected/testPopovers.html index 4698c81407..c889d03ae6 100644 --- a/packages/cli/test/functional/test_site/expected/testPopovers.html +++ b/packages/cli/test/functional/test_site/expected/testPopovers.html @@ -245,7 +245,22 @@

    Test

    Some heading

    The quick brown fox jumps over the lazy dog.

    - src from a .md file + src from a .md file with absolute links + +
    + + src from a .md file with relative links + +
    + + src from a .html file with absolute links
    - src from a .html file + src from a .html file with relative links
    diff --git a/packages/cli/test/functional/test_site/expected/testPopovers.page-vue-render.js b/packages/cli/test/functional/test_site/expected/testPopovers.page-vue-render.js index 97102f69a8..364ed7810d 100644 --- a/packages/cli/test/functional/test_site/expected/testPopovers.page-vue-render.js +++ b/packages/cli/test/functional/test_site/expected/testPopovers.page-vue-render.js @@ -1,7 +1,7 @@ var pageVueRenderFn = function anonymous( ) { -with(this){return _c('div',{attrs:{"id":"app"}},[_c('div',[_c('header',[_c('navbar',{attrs:{"type":"dark","default-highlight-on":"sibling-or-child"},scopedSlots:_u([{key:"brand",fn:function(){return [_c('a',{staticClass:"navbar-brand",attrs:{"href":"/","title":"Home"}},[_v("Markbind Test Site")])]},proxy:true}])},[_v(" "),_c('li',[_c('a',{staticClass:"nav-link",attrs:{"href":"/test_site/bugs/index.html"}},[_v("Open Bugs")])])]),_v(" "),_m(0)],1),_v(" "),_m(1)]),_v(" "),_c('div',{attrs:{"id":"flex-body"}},[_c('overlay-source',{staticClass:"fixed-header-padding",attrs:{"id":"site-nav","tag-name":"nav","to":"site-nav"}},[_c('div',{staticClass:"site-nav-top"},[_c('div',{staticClass:"font-weight-bold mb-2",staticStyle:{"font-size":"1.25rem"}},[_c('div',[_c('h2',{attrs:{"id":"default-layout"}},[_c('span',{staticClass:"anchor",attrs:{"id":"default-layout"}}),_v("Default Layout"),_c('a',{staticClass:"fa fa-anchor",attrs:{"href":"#default-layout","onclick":"event.stopPropagation()"}})])])])]),_v(" "),_c('div',{staticClass:"nav-component slim-scroll"},[_c('div',[_c('site-nav',[_c('overlay-source',{staticClass:"site-nav-list site-nav-list-root",attrs:{"tag-name":"ul","to":"mb-site-nav"}},[_c('li',[_c('div',{staticClass:"site-nav-default-list-item site-nav-list-item-0",attrs:{"onclick":"handleSiteNavClick(this)"}},[_c('a',{attrs:{"href":"/test_site/index.html"}},[_v("Home 🏠")])])]),_v(" "),_c('li',[_c('div',{staticClass:"site-nav-default-list-item site-nav-list-item-0",attrs:{"onclick":"handleSiteNavClick(this)"}},[_c('a',{attrs:{"href":"/test_site/bugs/index.html"}},[_v("Open Bugs 🐛")])])]),_v(" "),_c('li',{staticClass:"site-nav-custom-list-item site-nav-list-item-0"},[_c('h3',{attrs:{"id":"testing-site-nav"}},[_c('span',{staticClass:"anchor",attrs:{"id":"testing-site-nav"}}),_v("Testing Site-Nav"),_c('a',{staticClass:"fa fa-anchor",attrs:{"href":"#testing-site-nav","onclick":"event.stopPropagation()"}})])]),_v(" "),_c('li',[_c('div',{staticClass:"site-nav-default-list-item site-nav-list-item-0",attrs:{"onclick":"handleSiteNavClick(this)"}},[_c('strong',[_v("Dropdown ")]),_v(" "),_c('span',{staticClass:"glyphicon glyphicon-search",attrs:{"aria-hidden":"true"}}),_v(" title ✏️ "),_v(" "),_c('i',{staticClass:"site-nav-dropdown-btn-icon site-nav-rotate-icon",attrs:{"onclick":"handleSiteNavClick(this.parentNode, false); event.stopPropagation();"}},[_c('span',{staticClass:"glyphicon glyphicon-menu-down",attrs:{"aria-hidden":"true"}})])]),_c('ul',{staticClass:"site-nav-dropdown-container site-nav-dropdown-container-open site-nav-list"},[_c('li',[_c('div',{staticClass:"site-nav-default-list-item site-nav-list-item-1",attrs:{"onclick":"handleSiteNavClick(this)"}},[_c('a',{attrs:{"href":"https://www.google.com/"}},[_v("Dropdown link one")])])]),_v(" "),_c('li',[_c('div',{staticClass:"site-nav-default-list-item site-nav-list-item-1",attrs:{"onclick":"handleSiteNavClick(this)"}},[_c('a',{attrs:{"href":"https://www.google.com/"}},[_v("Html within site-nav "),_c('span',{staticStyle:{"color":"red"}},[_v("should")]),_v(" be displayed properly")])])]),_v(" "),_c('li',[_c('div',{staticClass:"site-nav-default-list-item site-nav-list-item-1",attrs:{"onclick":"handleSiteNavClick(this)"}},[_v("Nested Dropdown title 📐\n\n"),_c('i',{staticClass:"site-nav-dropdown-btn-icon",attrs:{"onclick":"handleSiteNavClick(this.parentNode, false); event.stopPropagation();"}},[_c('span',{staticClass:"glyphicon glyphicon-menu-down",attrs:{"aria-hidden":"true"}})])]),_c('ul',{staticClass:"site-nav-dropdown-container site-nav-list"},[_c('li',[_c('div',{staticClass:"site-nav-default-list-item site-nav-list-item-2",attrs:{"onclick":"handleSiteNavClick(this)"}},[_c('a',{attrs:{"href":"https://www.google.com/"}},[_c('strong',[_v("Nested")]),_v(" Dropdown link one")])])]),_v(" "),_c('li',[_c('div',{staticClass:"site-nav-default-list-item site-nav-list-item-2",attrs:{"onclick":"handleSiteNavClick(this)"}},[_c('a',{attrs:{"href":"https://www.google.com/"}},[_c('strong',[_v("Nested")]),_v(" Dropdown link two")])])])])]),_v(" "),_c('li',[_c('div',{staticClass:"site-nav-default-list-item site-nav-list-item-1",attrs:{"onclick":"handleSiteNavClick(this)"}},[_c('a',{attrs:{"href":"https://www.google.com/"}},[_v("Dropdown link two")])])])])]),_v(" "),_c('li',[_c('div',{staticClass:"site-nav-default-list-item site-nav-list-item-0",attrs:{"onclick":"handleSiteNavClick(this)"}},[_c('a',{attrs:{"href":"https://www.google.com/"}},[_c('mark',[_v("Third Link")]),_v(" 📋")])])]),_v(" "),_c('li',[_c('div',{staticClass:"site-nav-default-list-item site-nav-list-item-0",attrs:{"onclick":"handleSiteNavClick(this)"}},[_v("Filler text "),_c('a',{attrs:{"href":"https://www.youtube.com/"}},[_c('span',{staticClass:"glyphicon glyphicon-facetime-video",attrs:{"aria-hidden":"true"}}),_v(" Youtube 📺")]),_v(" filler text"),_v(" "),_c('i',{staticClass:"site-nav-dropdown-btn-icon",attrs:{"onclick":"handleSiteNavClick(this.parentNode, false); event.stopPropagation();"}},[_c('span',{staticClass:"glyphicon glyphicon-menu-down",attrs:{"aria-hidden":"true"}})])]),_c('ul',{staticClass:"site-nav-dropdown-container site-nav-list"},[_c('li',[_c('div',{staticClass:"site-nav-default-list-item site-nav-list-item-1",attrs:{"onclick":"handleSiteNavClick(this)"}},[_c('a',{attrs:{"href":"https://www.youtube.com/watch?v=dQw4w9WgXcQ"}},[_v("The answer to everything in the universe")])])]),_v(" "),_c('li',[_c('div',{staticClass:"site-nav-default-list-item site-nav-list-item-1",attrs:{"onclick":"handleSiteNavClick(this)"}},[_c('mark',[_v("Dropdown title")]),_v(" "),_c('span',{staticClass:"glyphicon glyphicon-comment",attrs:{"aria-hidden":"true"}}),_v(" ✏️ "),_v(" "),_c('i',{staticClass:"site-nav-dropdown-btn-icon site-nav-rotate-icon",attrs:{"onclick":"handleSiteNavClick(this.parentNode, false); event.stopPropagation();"}},[_c('span',{staticClass:"glyphicon glyphicon-menu-down",attrs:{"aria-hidden":"true"}})])]),_c('ul',{staticClass:"site-nav-dropdown-container site-nav-dropdown-container-open site-nav-list"},[_c('li',[_c('div',{staticClass:"site-nav-default-list-item site-nav-list-item-2",attrs:{"onclick":"handleSiteNavClick(this)"}},[_c('a',{attrs:{"href":"https://www.google.com/"}},[_c('strong',[_v("Nested")]),_v(" Dropdown link one")])])])])])])]),_v(" "),_c('li',[_c('div',{staticClass:"site-nav-default-list-item site-nav-list-item-0",attrs:{"onclick":"handleSiteNavClick(this)"}},[_v("Really Long Dropdown Title Really Long Dropdown Title Really Long Dropdown Title Really Long Dropdown\n\n"),_c('i',{staticClass:"site-nav-dropdown-btn-icon",attrs:{"onclick":"handleSiteNavClick(this.parentNode, false); event.stopPropagation();"}},[_c('span',{staticClass:"glyphicon glyphicon-menu-down",attrs:{"aria-hidden":"true"}})])]),_c('ul',{staticClass:"site-nav-dropdown-container site-nav-list"},[_c('li',{staticClass:"site-nav-custom-list-item site-nav-list-item-1"},[_v("Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text")]),_v(" "),_c('li',[_c('div',{staticClass:"site-nav-default-list-item site-nav-list-item-1",attrs:{"onclick":"handleSiteNavClick(this)"}},[_v("Nested Dropdown Title\n\n"),_c('i',{staticClass:"site-nav-dropdown-btn-icon",attrs:{"onclick":"handleSiteNavClick(this.parentNode, false); event.stopPropagation();"}},[_c('span',{staticClass:"glyphicon glyphicon-menu-down",attrs:{"aria-hidden":"true"}})])]),_c('ul',{staticClass:"site-nav-dropdown-container site-nav-list"},[_c('li',{staticClass:"site-nav-custom-list-item site-nav-list-item-2"},[_v("Hello Doge Hello Doge 🐶")]),_v(" "),_c('li',[_c('div',{staticClass:"site-nav-default-list-item site-nav-list-item-2",attrs:{"onclick":"handleSiteNavClick(this)"}},[_c('a',{attrs:{"href":"/test_site/index.html"}},[_c('strong',[_v("NESTED LINK")]),_v(" Home 🏠")])])]),_v(" "),_c('li',{staticClass:"site-nav-custom-list-item site-nav-list-item-2"},[_v("Text cut off from height limit Text cut off from height limit Text cut off from height limit Text cut off from height limit Text cut off from height limit Text cut off from height limit Text cut off from height limit Text cut off from height limit Text cut off from height limit Text cut off from height limit Text cut off from height limit Text cut off from height limit Text cut off from height limit Text cut off from height limit Text cut off from height limit Text cut off from height limit Text cut off from height limit Text cut off from height limit Text cut off from height limit Text cut off from height limit Text cut off from height limit")])])])])]),_v(" "),_c('li',[_c('div',{staticClass:"site-nav-default-list-item site-nav-list-item-0",attrs:{"onclick":"handleSiteNavClick(this)"}},[_v("Test line break in navigation layout\n\n"),_c('i',{staticClass:"site-nav-dropdown-btn-icon",attrs:{"onclick":"handleSiteNavClick(this.parentNode, false); event.stopPropagation();"}},[_c('span',{staticClass:"glyphicon glyphicon-menu-down",attrs:{"aria-hidden":"true"}})])]),_c('ul',{staticClass:"site-nav-dropdown-container site-nav-list"},[_c('li',{staticClass:"site-nav-custom-list-item site-nav-list-item-1"},[_v("Nested line break text ✂️")]),_v(" "),_c('li',[_c('div',{staticClass:"site-nav-default-list-item site-nav-list-item-1",attrs:{"onclick":"handleSiteNavClick(this)"}},[_c('a',{attrs:{"href":"/test_site/index.html"}},[_v("Nested line break href")]),_v(" "),_c('i',{staticClass:"site-nav-dropdown-btn-icon",attrs:{"onclick":"handleSiteNavClick(this.parentNode, false); event.stopPropagation();"}},[_c('span',{staticClass:"glyphicon glyphicon-menu-down",attrs:{"aria-hidden":"true"}})])]),_c('ul',{staticClass:"site-nav-dropdown-container site-nav-list"},[_c('li',{staticClass:"site-nav-custom-list-item site-nav-list-item-2"},[_v("Nested Nested line break text ✂️")])])]),_v(" "),_c('li',[_c('div',{staticClass:"site-nav-default-list-item site-nav-list-item-1",attrs:{"onclick":"handleSiteNavClick(this)"}},[_v("Nested line break dropdown menu\n\n"),_c('i',{staticClass:"site-nav-dropdown-btn-icon",attrs:{"onclick":"handleSiteNavClick(this.parentNode, false); event.stopPropagation();"}},[_c('span',{staticClass:"glyphicon glyphicon-menu-down",attrs:{"aria-hidden":"true"}})])]),_c('ul',{staticClass:"site-nav-dropdown-container site-nav-list"},[_c('li',{staticClass:"site-nav-custom-list-item site-nav-list-item-2"},[_v("Line break item 2 📘")])])])])])])],1)],1)])]),_v(" "),_c('div',{staticClass:"fixed-header-padding",attrs:{"id":"content-wrapper"}},[_m(2),_v(" "),_c('popover',{scopedSlots:_u([{key:"content",fn:function(){return [_v("Correct content")]},proxy:true},{key:"header",fn:function(){return [_v("Correct header")]},proxy:true}])},[_v("\n Hover popover\n")]),_v(" "),_c('br'),_v(" "),_c('popover',{attrs:{"trigger":"click"},scopedSlots:_u([{key:"content",fn:function(){return [_v("Correct content")]},proxy:true},{key:"header",fn:function(){return [_v("Correct header")]},proxy:true}])},[_v("\n Click popover\n")]),_v(" "),_c('br'),_v(" "),_m(3),_v(" "),_c('popover',{scopedSlots:_u([{key:"content",fn:function(){return [_c('span',[_v("Correct content")])]},proxy:true}])},[_v("\n Hover popover\n")]),_v(" "),_c('br'),_v(" "),_c('popover',{attrs:{"trigger":"click"},scopedSlots:_u([{key:"header",fn:function(){return [_c('span',[_v("Correct header")])]},proxy:true},{key:"content",fn:function(){return [_c('span',[_v("Correct content")])]},proxy:true}])},[_v(" "),_v("\n Click popover\n")]),_v(" "),_c('br'),_v(" "),_m(4),_v(" "),_c('popover',{scopedSlots:_u([{key:"header",fn:function(){return [_v("Correct header")]},proxy:true},{key:"content",fn:function(){return [_c('span',[_v("Correct content")])]},proxy:true}])},[_v(" "),_v("\n Hover popover\n")]),_v(" "),_c('br'),_v(" "),_c('popover',{attrs:{"trigger":"click"},scopedSlots:_u([{key:"header",fn:function(){return [_c('span',[_v("Correct header")])]},proxy:true},{key:"content",fn:function(){return [_c('span',[_v("Correct content")])]},proxy:true}])},[_v(" "),_v("\n Click popover\n")]),_v(" "),_c('br'),_v(" "),_m(5),_v(" "),_c('popover',{scopedSlots:_u([{key:"content",fn:function(){return [_c('h1',{attrs:{"id":"some-heading"}},[_c('span',{staticClass:"anchor",attrs:{"id":"some-heading"}}),_v("Some heading"),_c('a',{staticClass:"fa fa-anchor",attrs:{"href":"#some-heading","onclick":"event.stopPropagation()"}})]),_v(" "),_c('p',[_v("The "),_c('strong',[_v("quick")]),_v(" brown fox jumps "),_c('em',[_v("over")]),_v(" the lazy dog.")])]},proxy:true},{key:"header",fn:function(){return [_v("Correct header")]},proxy:true}])},[_v("\n src from a .md file\n")]),_v(" "),_c('br'),_v(" "),_c('popover',{scopedSlots:_u([{key:"content",fn:function(){return [_c('p',[_v("This is a HTML document")]),_v(" "),_c('span',[_v("It is "),_c('strong',[_v("possible")]),_v(" to use Markdown in HTML")])]},proxy:true},{key:"header",fn:function(){return [_v("Correct header")]},proxy:true}])},[_v("\n src from a .html file\n")]),_v(" "),_c('br'),_v(" "),_c('popover',{scopedSlots:_u([{key:"content",fn:function(){return [_v("content fragment")]},proxy:true}])},[_v("\n src with a fragment\n")]),_v(" "),_c('br'),_v(" "),_c('popover',{scopedSlots:_u([{key:"content",fn:function(){return [_c('panel',{attrs:{"src":"/test_site/testPanels/NormalPanelContent._include_.html","expanded":"","panelId":"nested-panel"},scopedSlots:_u([{key:"header",fn:function(){return [_c('h2',{attrs:{"id":"nested-panel"}},[_c('span',{staticClass:"anchor",attrs:{"id":"nested-panel"}}),_v("Nested Panel"),_c('a',{staticClass:"fa fa-anchor",attrs:{"href":"#nested-panel","onclick":"event.stopPropagation()"}})])]},proxy:true}])})]},proxy:true},{key:"header",fn:function(){return [_c('span',[_v("Reactive content")])]},proxy:true}])},[_v(" "),_v("\n src containing reactive content\n")]),_v(" "),_c('br'),_v(" "),_m(6),_v(" "),_c('popover',{scopedSlots:_u([{key:"content",fn:function(){return [_v("Correct content")]},proxy:true},{key:"header",fn:function(){return [_v("Content slot > content attrib > src attrib")]},proxy:true}])},[_v("\n Content attribute overrides src attribute\n")]),_v(" "),_c('br'),_v(" "),_c('popover',{scopedSlots:_u([{key:"header",fn:function(){return [_v("Content slot > content attrib > src attrib")]},proxy:true},{key:"content",fn:function(){return [_c('span',[_v("Correct content")])]},proxy:true}])},[_v(" "),_v("\n Content slot overrides content attribute overrides src attribute\n")]),_v(" "),_c('br'),_v(" "),_c('popover',{scopedSlots:_u([{key:"header",fn:function(){return [_v("Content slot > content attrib > src attrib")]},proxy:true},{key:"content",fn:function(){return [_c('span',[_v("Correct content")])]},proxy:true}])},[_v(" "),_v("\n Content slot overrides content attribute overrides src attribute\n")]),_v(" "),_c('br'),_v(" "),_m(7),_v(" "),_c('div',{staticStyle:{"color":"red"}},[_v("URLs are not allowed in the 'src' attribute")]),_v(" "),_c('i',{staticClass:"fa fa-arrow-circle-up fa-lg d-print-none",attrs:{"id":"scroll-top-button","onclick":"handleScrollTop()","aria-hidden":"true"}})],1),_v(" "),_c('overlay-source',{staticClass:"fixed-header-padding",attrs:{"id":"page-nav","tag-name":"nav","to":"page-nav"}},[_c('div',{staticClass:"nav-component slim-scroll"})])],1),_v(" "),_m(8)])} +with(this){return _c('div',{attrs:{"id":"app"}},[_c('div',[_c('header',[_c('navbar',{attrs:{"type":"dark","default-highlight-on":"sibling-or-child"},scopedSlots:_u([{key:"brand",fn:function(){return [_c('a',{staticClass:"navbar-brand",attrs:{"href":"/","title":"Home"}},[_v("Markbind Test Site")])]},proxy:true}])},[_v(" "),_c('li',[_c('a',{staticClass:"nav-link",attrs:{"href":"/test_site/bugs/index.html"}},[_v("Open Bugs")])])]),_v(" "),_m(0)],1),_v(" "),_m(1)]),_v(" "),_c('div',{attrs:{"id":"flex-body"}},[_c('overlay-source',{staticClass:"fixed-header-padding",attrs:{"id":"site-nav","tag-name":"nav","to":"site-nav"}},[_c('div',{staticClass:"site-nav-top"},[_c('div',{staticClass:"font-weight-bold mb-2",staticStyle:{"font-size":"1.25rem"}},[_c('div',[_c('h2',{attrs:{"id":"default-layout"}},[_c('span',{staticClass:"anchor",attrs:{"id":"default-layout"}}),_v("Default Layout"),_c('a',{staticClass:"fa fa-anchor",attrs:{"href":"#default-layout","onclick":"event.stopPropagation()"}})])])])]),_v(" "),_c('div',{staticClass:"nav-component slim-scroll"},[_c('div',[_c('site-nav',[_c('overlay-source',{staticClass:"site-nav-list site-nav-list-root",attrs:{"tag-name":"ul","to":"mb-site-nav"}},[_c('li',[_c('div',{staticClass:"site-nav-default-list-item site-nav-list-item-0",attrs:{"onclick":"handleSiteNavClick(this)"}},[_c('a',{attrs:{"href":"/test_site/index.html"}},[_v("Home 🏠")])])]),_v(" "),_c('li',[_c('div',{staticClass:"site-nav-default-list-item site-nav-list-item-0",attrs:{"onclick":"handleSiteNavClick(this)"}},[_c('a',{attrs:{"href":"/test_site/bugs/index.html"}},[_v("Open Bugs 🐛")])])]),_v(" "),_c('li',{staticClass:"site-nav-custom-list-item site-nav-list-item-0"},[_c('h3',{attrs:{"id":"testing-site-nav"}},[_c('span',{staticClass:"anchor",attrs:{"id":"testing-site-nav"}}),_v("Testing Site-Nav"),_c('a',{staticClass:"fa fa-anchor",attrs:{"href":"#testing-site-nav","onclick":"event.stopPropagation()"}})])]),_v(" "),_c('li',[_c('div',{staticClass:"site-nav-default-list-item site-nav-list-item-0",attrs:{"onclick":"handleSiteNavClick(this)"}},[_c('strong',[_v("Dropdown ")]),_v(" "),_c('span',{staticClass:"glyphicon glyphicon-search",attrs:{"aria-hidden":"true"}}),_v(" title ✏️ "),_v(" "),_c('i',{staticClass:"site-nav-dropdown-btn-icon site-nav-rotate-icon",attrs:{"onclick":"handleSiteNavClick(this.parentNode, false); event.stopPropagation();"}},[_c('span',{staticClass:"glyphicon glyphicon-menu-down",attrs:{"aria-hidden":"true"}})])]),_c('ul',{staticClass:"site-nav-dropdown-container site-nav-dropdown-container-open site-nav-list"},[_c('li',[_c('div',{staticClass:"site-nav-default-list-item site-nav-list-item-1",attrs:{"onclick":"handleSiteNavClick(this)"}},[_c('a',{attrs:{"href":"https://www.google.com/"}},[_v("Dropdown link one")])])]),_v(" "),_c('li',[_c('div',{staticClass:"site-nav-default-list-item site-nav-list-item-1",attrs:{"onclick":"handleSiteNavClick(this)"}},[_c('a',{attrs:{"href":"https://www.google.com/"}},[_v("Html within site-nav "),_c('span',{staticStyle:{"color":"red"}},[_v("should")]),_v(" be displayed properly")])])]),_v(" "),_c('li',[_c('div',{staticClass:"site-nav-default-list-item site-nav-list-item-1",attrs:{"onclick":"handleSiteNavClick(this)"}},[_v("Nested Dropdown title 📐\n\n"),_c('i',{staticClass:"site-nav-dropdown-btn-icon",attrs:{"onclick":"handleSiteNavClick(this.parentNode, false); event.stopPropagation();"}},[_c('span',{staticClass:"glyphicon glyphicon-menu-down",attrs:{"aria-hidden":"true"}})])]),_c('ul',{staticClass:"site-nav-dropdown-container site-nav-list"},[_c('li',[_c('div',{staticClass:"site-nav-default-list-item site-nav-list-item-2",attrs:{"onclick":"handleSiteNavClick(this)"}},[_c('a',{attrs:{"href":"https://www.google.com/"}},[_c('strong',[_v("Nested")]),_v(" Dropdown link one")])])]),_v(" "),_c('li',[_c('div',{staticClass:"site-nav-default-list-item site-nav-list-item-2",attrs:{"onclick":"handleSiteNavClick(this)"}},[_c('a',{attrs:{"href":"https://www.google.com/"}},[_c('strong',[_v("Nested")]),_v(" Dropdown link two")])])])])]),_v(" "),_c('li',[_c('div',{staticClass:"site-nav-default-list-item site-nav-list-item-1",attrs:{"onclick":"handleSiteNavClick(this)"}},[_c('a',{attrs:{"href":"https://www.google.com/"}},[_v("Dropdown link two")])])])])]),_v(" "),_c('li',[_c('div',{staticClass:"site-nav-default-list-item site-nav-list-item-0",attrs:{"onclick":"handleSiteNavClick(this)"}},[_c('a',{attrs:{"href":"https://www.google.com/"}},[_c('mark',[_v("Third Link")]),_v(" 📋")])])]),_v(" "),_c('li',[_c('div',{staticClass:"site-nav-default-list-item site-nav-list-item-0",attrs:{"onclick":"handleSiteNavClick(this)"}},[_v("Filler text "),_c('a',{attrs:{"href":"https://www.youtube.com/"}},[_c('span',{staticClass:"glyphicon glyphicon-facetime-video",attrs:{"aria-hidden":"true"}}),_v(" Youtube 📺")]),_v(" filler text"),_v(" "),_c('i',{staticClass:"site-nav-dropdown-btn-icon",attrs:{"onclick":"handleSiteNavClick(this.parentNode, false); event.stopPropagation();"}},[_c('span',{staticClass:"glyphicon glyphicon-menu-down",attrs:{"aria-hidden":"true"}})])]),_c('ul',{staticClass:"site-nav-dropdown-container site-nav-list"},[_c('li',[_c('div',{staticClass:"site-nav-default-list-item site-nav-list-item-1",attrs:{"onclick":"handleSiteNavClick(this)"}},[_c('a',{attrs:{"href":"https://www.youtube.com/watch?v=dQw4w9WgXcQ"}},[_v("The answer to everything in the universe")])])]),_v(" "),_c('li',[_c('div',{staticClass:"site-nav-default-list-item site-nav-list-item-1",attrs:{"onclick":"handleSiteNavClick(this)"}},[_c('mark',[_v("Dropdown title")]),_v(" "),_c('span',{staticClass:"glyphicon glyphicon-comment",attrs:{"aria-hidden":"true"}}),_v(" ✏️ "),_v(" "),_c('i',{staticClass:"site-nav-dropdown-btn-icon site-nav-rotate-icon",attrs:{"onclick":"handleSiteNavClick(this.parentNode, false); event.stopPropagation();"}},[_c('span',{staticClass:"glyphicon glyphicon-menu-down",attrs:{"aria-hidden":"true"}})])]),_c('ul',{staticClass:"site-nav-dropdown-container site-nav-dropdown-container-open site-nav-list"},[_c('li',[_c('div',{staticClass:"site-nav-default-list-item site-nav-list-item-2",attrs:{"onclick":"handleSiteNavClick(this)"}},[_c('a',{attrs:{"href":"https://www.google.com/"}},[_c('strong',[_v("Nested")]),_v(" Dropdown link one")])])])])])])]),_v(" "),_c('li',[_c('div',{staticClass:"site-nav-default-list-item site-nav-list-item-0",attrs:{"onclick":"handleSiteNavClick(this)"}},[_v("Really Long Dropdown Title Really Long Dropdown Title Really Long Dropdown Title Really Long Dropdown\n\n"),_c('i',{staticClass:"site-nav-dropdown-btn-icon",attrs:{"onclick":"handleSiteNavClick(this.parentNode, false); event.stopPropagation();"}},[_c('span',{staticClass:"glyphicon glyphicon-menu-down",attrs:{"aria-hidden":"true"}})])]),_c('ul',{staticClass:"site-nav-dropdown-container site-nav-list"},[_c('li',{staticClass:"site-nav-custom-list-item site-nav-list-item-1"},[_v("Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text Really Really Long Text")]),_v(" "),_c('li',[_c('div',{staticClass:"site-nav-default-list-item site-nav-list-item-1",attrs:{"onclick":"handleSiteNavClick(this)"}},[_v("Nested Dropdown Title\n\n"),_c('i',{staticClass:"site-nav-dropdown-btn-icon",attrs:{"onclick":"handleSiteNavClick(this.parentNode, false); event.stopPropagation();"}},[_c('span',{staticClass:"glyphicon glyphicon-menu-down",attrs:{"aria-hidden":"true"}})])]),_c('ul',{staticClass:"site-nav-dropdown-container site-nav-list"},[_c('li',{staticClass:"site-nav-custom-list-item site-nav-list-item-2"},[_v("Hello Doge Hello Doge 🐶")]),_v(" "),_c('li',[_c('div',{staticClass:"site-nav-default-list-item site-nav-list-item-2",attrs:{"onclick":"handleSiteNavClick(this)"}},[_c('a',{attrs:{"href":"/test_site/index.html"}},[_c('strong',[_v("NESTED LINK")]),_v(" Home 🏠")])])]),_v(" "),_c('li',{staticClass:"site-nav-custom-list-item site-nav-list-item-2"},[_v("Text cut off from height limit Text cut off from height limit Text cut off from height limit Text cut off from height limit Text cut off from height limit Text cut off from height limit Text cut off from height limit Text cut off from height limit Text cut off from height limit Text cut off from height limit Text cut off from height limit Text cut off from height limit Text cut off from height limit Text cut off from height limit Text cut off from height limit Text cut off from height limit Text cut off from height limit Text cut off from height limit Text cut off from height limit Text cut off from height limit Text cut off from height limit")])])])])]),_v(" "),_c('li',[_c('div',{staticClass:"site-nav-default-list-item site-nav-list-item-0",attrs:{"onclick":"handleSiteNavClick(this)"}},[_v("Test line break in navigation layout\n\n"),_c('i',{staticClass:"site-nav-dropdown-btn-icon",attrs:{"onclick":"handleSiteNavClick(this.parentNode, false); event.stopPropagation();"}},[_c('span',{staticClass:"glyphicon glyphicon-menu-down",attrs:{"aria-hidden":"true"}})])]),_c('ul',{staticClass:"site-nav-dropdown-container site-nav-list"},[_c('li',{staticClass:"site-nav-custom-list-item site-nav-list-item-1"},[_v("Nested line break text ✂️")]),_v(" "),_c('li',[_c('div',{staticClass:"site-nav-default-list-item site-nav-list-item-1",attrs:{"onclick":"handleSiteNavClick(this)"}},[_c('a',{attrs:{"href":"/test_site/index.html"}},[_v("Nested line break href")]),_v(" "),_c('i',{staticClass:"site-nav-dropdown-btn-icon",attrs:{"onclick":"handleSiteNavClick(this.parentNode, false); event.stopPropagation();"}},[_c('span',{staticClass:"glyphicon glyphicon-menu-down",attrs:{"aria-hidden":"true"}})])]),_c('ul',{staticClass:"site-nav-dropdown-container site-nav-list"},[_c('li',{staticClass:"site-nav-custom-list-item site-nav-list-item-2"},[_v("Nested Nested line break text ✂️")])])]),_v(" "),_c('li',[_c('div',{staticClass:"site-nav-default-list-item site-nav-list-item-1",attrs:{"onclick":"handleSiteNavClick(this)"}},[_v("Nested line break dropdown menu\n\n"),_c('i',{staticClass:"site-nav-dropdown-btn-icon",attrs:{"onclick":"handleSiteNavClick(this.parentNode, false); event.stopPropagation();"}},[_c('span',{staticClass:"glyphicon glyphicon-menu-down",attrs:{"aria-hidden":"true"}})])]),_c('ul',{staticClass:"site-nav-dropdown-container site-nav-list"},[_c('li',{staticClass:"site-nav-custom-list-item site-nav-list-item-2"},[_v("Line break item 2 📘")])])])])])])],1)],1)])]),_v(" "),_c('div',{staticClass:"fixed-header-padding",attrs:{"id":"content-wrapper"}},[_m(2),_v(" "),_c('popover',{scopedSlots:_u([{key:"content",fn:function(){return [_v("Correct content")]},proxy:true},{key:"header",fn:function(){return [_v("Correct header")]},proxy:true}])},[_v("\n Hover popover\n")]),_v(" "),_c('br'),_v(" "),_c('popover',{attrs:{"trigger":"click"},scopedSlots:_u([{key:"content",fn:function(){return [_v("Correct content")]},proxy:true},{key:"header",fn:function(){return [_v("Correct header")]},proxy:true}])},[_v("\n Click popover\n")]),_v(" "),_c('br'),_v(" "),_m(3),_v(" "),_c('popover',{scopedSlots:_u([{key:"content",fn:function(){return [_c('span',[_v("Correct content")])]},proxy:true}])},[_v("\n Hover popover\n")]),_v(" "),_c('br'),_v(" "),_c('popover',{attrs:{"trigger":"click"},scopedSlots:_u([{key:"header",fn:function(){return [_c('span',[_v("Correct header")])]},proxy:true},{key:"content",fn:function(){return [_c('span',[_v("Correct content")])]},proxy:true}])},[_v(" "),_v("\n Click popover\n")]),_v(" "),_c('br'),_v(" "),_m(4),_v(" "),_c('popover',{scopedSlots:_u([{key:"header",fn:function(){return [_v("Correct header")]},proxy:true},{key:"content",fn:function(){return [_c('span',[_v("Correct content")])]},proxy:true}])},[_v(" "),_v("\n Hover popover\n")]),_v(" "),_c('br'),_v(" "),_c('popover',{attrs:{"trigger":"click"},scopedSlots:_u([{key:"header",fn:function(){return [_c('span',[_v("Correct header")])]},proxy:true},{key:"content",fn:function(){return [_c('span',[_v("Correct content")])]},proxy:true}])},[_v(" "),_v("\n Click popover\n")]),_v(" "),_c('br'),_v(" "),_m(5),_v(" "),_c('popover',{scopedSlots:_u([{key:"content",fn:function(){return [_c('h1',{attrs:{"id":"some-heading"}},[_c('span',{staticClass:"anchor",attrs:{"id":"some-heading"}}),_v("Some heading"),_c('a',{staticClass:"fa fa-anchor",attrs:{"href":"#some-heading","onclick":"event.stopPropagation()"}})]),_v(" "),_c('p',[_v("The "),_c('strong',[_v("quick")]),_v(" brown fox jumps "),_c('em',[_v("over")]),_v(" the lazy dog.")])]},proxy:true},{key:"header",fn:function(){return [_v("Correct header")]},proxy:true}])},[_v("\n src from a .md file with absolute links\n")]),_v(" "),_c('br'),_v(" "),_c('popover',{scopedSlots:_u([{key:"content",fn:function(){return [_c('h1',{attrs:{"id":"some-heading-2"}},[_c('span',{staticClass:"anchor",attrs:{"id":"some-heading-2"}}),_v("Some heading"),_c('a',{staticClass:"fa fa-anchor",attrs:{"href":"#some-heading-2","onclick":"event.stopPropagation()"}})]),_v(" "),_c('p',[_v("The "),_c('strong',[_v("quick")]),_v(" brown fox jumps "),_c('em',[_v("over")]),_v(" the lazy dog.")])]},proxy:true},{key:"header",fn:function(){return [_v("Correct header")]},proxy:true}])},[_v("\n src from a .md file with relative links\n")]),_v(" "),_c('br'),_v(" "),_c('popover',{scopedSlots:_u([{key:"content",fn:function(){return [_c('p',[_v("This is a HTML document")]),_v(" "),_c('span',[_v("It is "),_c('strong',[_v("possible")]),_v(" to use Markdown in HTML")])]},proxy:true},{key:"header",fn:function(){return [_v("Correct header")]},proxy:true}])},[_v("\n src from a .html file with absolute links\n")]),_v(" "),_c('br'),_v(" "),_c('popover',{scopedSlots:_u([{key:"content",fn:function(){return [_c('p',[_v("This is a HTML document")]),_v(" "),_c('span',[_v("It is "),_c('strong',[_v("possible")]),_v(" to use Markdown in HTML")])]},proxy:true},{key:"header",fn:function(){return [_v("Correct header")]},proxy:true}])},[_v("\n src from a .html file with relative links\n")]),_v(" "),_c('br'),_v(" "),_c('popover',{scopedSlots:_u([{key:"content",fn:function(){return [_v("content fragment")]},proxy:true}])},[_v("\n src with a fragment\n")]),_v(" "),_c('br'),_v(" "),_c('popover',{scopedSlots:_u([{key:"content",fn:function(){return [_c('panel',{attrs:{"src":"/test_site/testPanels/NormalPanelContent._include_.html","expanded":"","panelId":"nested-panel"},scopedSlots:_u([{key:"header",fn:function(){return [_c('h2',{attrs:{"id":"nested-panel"}},[_c('span',{staticClass:"anchor",attrs:{"id":"nested-panel"}}),_v("Nested Panel"),_c('a',{staticClass:"fa fa-anchor",attrs:{"href":"#nested-panel","onclick":"event.stopPropagation()"}})])]},proxy:true}])})]},proxy:true},{key:"header",fn:function(){return [_c('span',[_v("Reactive content")])]},proxy:true}])},[_v(" "),_v("\n src containing reactive content\n")]),_v(" "),_c('br'),_v(" "),_m(6),_v(" "),_c('popover',{scopedSlots:_u([{key:"content",fn:function(){return [_v("Correct content")]},proxy:true},{key:"header",fn:function(){return [_v("Content slot > content attrib > src attrib")]},proxy:true}])},[_v("\n Content attribute overrides src attribute\n")]),_v(" "),_c('br'),_v(" "),_c('popover',{scopedSlots:_u([{key:"header",fn:function(){return [_v("Content slot > content attrib > src attrib")]},proxy:true},{key:"content",fn:function(){return [_c('span',[_v("Correct content")])]},proxy:true}])},[_v(" "),_v("\n Content slot overrides content attribute overrides src attribute\n")]),_v(" "),_c('br'),_v(" "),_c('popover',{scopedSlots:_u([{key:"header",fn:function(){return [_v("Content slot > content attrib > src attrib")]},proxy:true},{key:"content",fn:function(){return [_c('span',[_v("Correct content")])]},proxy:true}])},[_v(" "),_v("\n Content slot overrides content attribute overrides src attribute\n")]),_v(" "),_c('br'),_v(" "),_m(7),_v(" "),_c('div',{staticStyle:{"color":"red"}},[_v("URLs are not allowed in the 'src' attribute")]),_v(" "),_c('i',{staticClass:"fa fa-arrow-circle-up fa-lg d-print-none",attrs:{"id":"scroll-top-button","onclick":"handleScrollTop()","aria-hidden":"true"}})],1),_v(" "),_c('overlay-source',{staticClass:"fixed-header-padding",attrs:{"id":"page-nav","tag-name":"nav","to":"page-nav"}},[_c('div',{staticClass:"nav-component slim-scroll"})])],1),_v(" "),_m(8)])} }; var pageVueStaticRenderFns = [function anonymous( ) { diff --git a/packages/cli/test/functional/test_site/testPopovers.md b/packages/cli/test/functional/test_site/testPopovers.md index 9082579094..8a775e75bf 100644 --- a/packages/cli/test/functional/test_site/testPopovers.md +++ b/packages/cli/test/functional/test_site/testPopovers.md @@ -49,13 +49,25 @@ **Popover with src attribute** - src from a .md file + src from a .md file with absolute links + + +
    + + + src from a .md file with relative links
    - src from a .html file + src from a .html file with absolute links + + +
    + + + src from a .html file with relative links
    From ab6e3d127343974408b93f0e3cc9597010d3f196 Mon Sep 17 00:00:00 2001 From: Jovyn Tan Date: Wed, 9 Mar 2022 01:15:36 +0800 Subject: [PATCH 24/24] Documentation fixes --- docs/userGuide/syntax/popovers.md | 2 ++ packages/vue-components/README.md | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/docs/userGuide/syntax/popovers.md b/docs/userGuide/syntax/popovers.md index 227f07d44d..d214271e4c 100644 --- a/docs/userGuide/syntax/popovers.md +++ b/docs/userGuide/syntax/popovers.md @@ -51,6 +51,8 @@
    +
    +

    Content using src

    diff --git a/packages/vue-components/README.md b/packages/vue-components/README.md index a0163d8d6e..5f054bb3bf 100644 --- a/packages/vue-components/README.md +++ b/packages/vue-components/README.md @@ -20,8 +20,6 @@ Some custom components and directives are also added for MarkBind's use. - Question.vue - QOption.vue - Quiz.vue -- Popover.vue -- Tooltip.vue - Trigger.vue (built on bootstrap-vue's popovers, modals, tooltips) ### MarkBind components ported from [Markbind/vue-strap](https://github.com/MarkBind/vue-strap): @@ -52,6 +50,8 @@ Some custom components and directives are also added for MarkBind's use. ### BootstrapVue components included in the bundle - Modals +- Popover.vue +- Tooltip.vue ## Installation