From 070678adbf836cf6e1c54aaadcee5e8714589109 Mon Sep 17 00:00:00 2001 From: Fienny Angelina Date: Sat, 27 Oct 2018 23:34:14 +0800 Subject: [PATCH] - Move addEventListener part to lib/static - Remove comments --- v1/lib/core/CodeTabsMarkdownBlock.js | 2 +- v1/lib/core/Doc.js | 2 -- v1/lib/core/Head.js | 1 + v1/website/static/js/code-blocks-buttons.js | 21 --------------------- 4 files changed, 2 insertions(+), 24 deletions(-) diff --git a/v1/lib/core/CodeTabsMarkdownBlock.js b/v1/lib/core/CodeTabsMarkdownBlock.js index f735cc6c62815..85199898484c2 100644 --- a/v1/lib/core/CodeTabsMarkdownBlock.js +++ b/v1/lib/core/CodeTabsMarkdownBlock.js @@ -12,7 +12,7 @@ class MarkdownBlock extends React.Component { const tabs = this.props.children.map(({title, content}) => ({ id: _.uniqueId(), - groupId: groupId, + groupId, label: title, lang: title, panelContent: , diff --git a/v1/lib/core/Doc.js b/v1/lib/core/Doc.js index b5fbeae0b7941..9d240aa6d6a95 100644 --- a/v1/lib/core/Doc.js +++ b/v1/lib/core/Doc.js @@ -98,8 +98,6 @@ class Doc extends React.Component { ); } - // const a = this.props.content.split(/(DOCUSAURUS_CODE_TABS)(.*?)(END_DOCUSAURUS_CODE_TABS)/gms) - // console.log(a.length, a); return (
diff --git a/v1/lib/core/Head.js b/v1/lib/core/Head.js index 3024d7113f7ae..4bf4afb14ad63 100644 --- a/v1/lib/core/Head.js +++ b/v1/lib/core/Head.js @@ -188,6 +188,7 @@ class Head extends React.Component { rel="stylesheet" href={`${this.props.config.baseUrl}css/main.css`} /> + ); } diff --git a/v1/website/static/js/code-blocks-buttons.js b/v1/website/static/js/code-blocks-buttons.js index 01436c7a51691..e4fb913d98700 100644 --- a/v1/website/static/js/code-blocks-buttons.js +++ b/v1/website/static/js/code-blocks-buttons.js @@ -44,25 +44,4 @@ window.addEventListener('load', function() { textEl.textContent = 'Copy'; }, 2000); }); - - // add event listener for all tab - document.querySelectorAll('.nav-link').forEach(function(el) { - el.addEventListener('click', function(e) { - const groupId = e.target.getAttribute('data-group'); - document - .querySelectorAll(`.nav-link[data-group=${groupId}]`) - .forEach(function(el) { - el.classList.remove('active'); - }); - document - .querySelectorAll(`.tab-pane[data-group=${groupId}]`) - .forEach(function(el) { - el.classList.remove('active'); - }); - e.target.classList.add('active'); - document - .querySelector(`#${e.target.getAttribute('data-tab')}`) - .classList.add('active'); - }); - }); });