diff --git a/README.md b/README.md index d562da2..07599a5 100644 --- a/README.md +++ b/README.md @@ -55,3 +55,17 @@ config.settings.glossary.matchOnlyFirstOccurence = true; User can opt-out by setting glossarytooltips to false. Add a boolean member field *glossarytooltips* for it. + +## Further configurations + +Hide alphabet navigation of glossary view: + +```js +config.settings.glossary.showAlphabetNavigation = false; +``` + +Show glossary term in tooltips header: + +```js +config.settings.glossary.mentionTermInTooltip = true; +``` diff --git a/packages/policy/src/index.js b/packages/policy/src/index.js index c3ac63d..7cf13ea 100644 --- a/packages/policy/src/index.js +++ b/packages/policy/src/index.js @@ -5,6 +5,7 @@ const applyConfig = (config) => { config.settings.glossary.caseSensitive = false; config.settings.glossary.matchOnlyFirstOccurence = false; config.settings.glossary.showAlphabetNavigation = true; + config.settings.glossary.mentionTermInTooltip = false; // Tooltips everywhere config.settings.appExtras = [ diff --git a/packages/volto-slate-glossary/news/12.feature b/packages/volto-slate-glossary/news/12.feature index 7cd9e12..023e0a6 100644 --- a/packages/volto-slate-glossary/news/12.feature +++ b/packages/volto-slate-glossary/news/12.feature @@ -1,3 +1 @@ -Show a header in the tooltip. -This repeats the term, which can look nice. -@mauritsvanrees +Mention the term in the header of its tooltip. @mauritsvanrees, @ksuess diff --git a/packages/volto-slate-glossary/src/components/Tooltips.jsx b/packages/volto-slate-glossary/src/components/Tooltips.jsx index 341dbe6..59e2548 100644 --- a/packages/volto-slate-glossary/src/components/Tooltips.jsx +++ b/packages/volto-slate-glossary/src/components/Tooltips.jsx @@ -99,8 +99,8 @@ export const applyLineBreakSupport = (children) => { */ export const enhanceTextWithTooltips = (text, remainingGlossaryterms) => { const caseSensitive = config.settings.glossary.caseSensitive; - const matchOnlyFirstOccurence = - config.settings.glossary.matchOnlyFirstOccurence; + const { matchOnlyFirstOccurence, mentionTermInTooltip } = + config.settings.glossary; let result = [{ type: 'text', val: text }]; let matchedGlossaryTerms = []; if (remainingGlossaryterms.length > 0) { @@ -190,7 +190,9 @@ export const enhanceTextWithTooltips = (text, remainingGlossaryterms) => { key={j} className="tooltip" > - {el.val} + {mentionTermInTooltip ? ( + {el.val} + ) : null}
{ caseSensitive: false, matchOnlyFirstOccurence: false, showAlphabetNavigation: true, + mentionTermInTooltip: false, }; config.settings.slate.leafs = {