diff --git a/entry_types/scrolled/package/src/contentElements/heading/stories.js b/entry_types/scrolled/package/src/contentElements/heading/stories.js index 50aa7d8893..2188602cb3 100644 --- a/entry_types/scrolled/package/src/contentElements/heading/stories.js +++ b/entry_types/scrolled/package/src/contentElements/heading/stories.js @@ -117,6 +117,29 @@ storiesOfContentElement(module, { configuration: { color: 'accent' } - } + }, + { + name: 'With text effects', + configuration: { + typographyVariant: 'highlight', + children: 'Some Heading\nText', + }, + themeOptions: { + typography: { + 'heading-highlight': { + transform: 'rotate(-2.7deg)', + 'font-style': 'italic', + '--text-highlight-padding': '0 0.2em', + '--text-highlight-background-color': '#fff', + '--text-highlight-line-height': '1.5', + '--background-clip-text-fallback-color': '#000', + '--background-clip-text-background': 'linear-gradient(90deg, red 0%, #ff00ff 100%)', + '--background-clip-text-background-clip': 'text', + '--background-clip-text-color': 'transparent', + '--background-clip-text-padding': '0 0.2em 0 0' + } + } + } + }, ] }); diff --git a/entry_types/scrolled/package/src/contentElements/hotspots/Tooltip.js b/entry_types/scrolled/package/src/contentElements/hotspots/Tooltip.js index df7ca38086..c1e11b9f99 100644 --- a/entry_types/scrolled/package/src/contentElements/hotspots/Tooltip.js +++ b/entry_types/scrolled/package/src/contentElements/hotspots/Tooltip.js @@ -16,7 +16,6 @@ import {insidePagerButton} from './PagerButton'; import { EditableText, EditableInlineText, - EditableLink, InlineFileRights, Image, Text, diff --git a/entry_types/scrolled/package/src/frontend/EditableInlineText.js b/entry_types/scrolled/package/src/frontend/EditableInlineText.js index ea1f36b5ff..efcdf2e536 100644 --- a/entry_types/scrolled/package/src/frontend/EditableInlineText.js +++ b/entry_types/scrolled/package/src/frontend/EditableInlineText.js @@ -8,10 +8,13 @@ import styles from './EditableInlineText.module.css'; export const EditableInlineText = withInlineEditingAlternative( 'EditableInlineText', function EditableInlineText({value, hyphens, defaultValue = ''}) { + const text = value ? value[0]?.children[0]?.text : defaultValue; + return ( - {value ? value[0]?.children[0]?.text : defaultValue} + {text} ); } diff --git a/entry_types/scrolled/package/src/frontend/EditableInlineText.module.css b/entry_types/scrolled/package/src/frontend/EditableInlineText.module.css index 48faa59a10..e20bcd4aeb 100644 --- a/entry_types/scrolled/package/src/frontend/EditableInlineText.module.css +++ b/entry_types/scrolled/package/src/frontend/EditableInlineText.module.css @@ -31,3 +31,28 @@ hyphens: none; word-wrap: normal; } + +.textEffects { + padding: var(--text-highlight-padding); + line-height: var(--text-highlight-line-height); + box-decoration-break: clone; +} + +.textEffects:not(:has([data-slate-zero-width="n"])) { + background-color: var(--text-highlight-background-color); +} + +.textEffects > span { + color: var(--background-clip-text-fallback-color); + padding: var(--background-clip-text-padding); + box-decoration-break: clone; +} + +@supports ((background-clip: text) or (-webkit-background-clip: text)) { + .textEffects > span { + background: var(--background-clip-text-background); + background-clip: var(--background-clip-text-background-clip); + color: var(--background-clip-text-color); + caret-color: var(--background-clip-text-fallback-color); + } +} diff --git a/entry_types/scrolled/package/src/frontend/Text.js b/entry_types/scrolled/package/src/frontend/Text.js index 95cef96131..a9b0b36c11 100644 --- a/entry_types/scrolled/package/src/frontend/Text.js +++ b/entry_types/scrolled/package/src/frontend/Text.js @@ -2,8 +2,6 @@ import React from 'react'; import classNames from 'classnames'; import PropTypes from 'prop-types'; -import {camelize} from './utils/camelize'; - import styles from './Text.module.css'; /** diff --git a/entry_types/scrolled/package/src/frontend/inlineEditing/EditableInlineText/index.js b/entry_types/scrolled/package/src/frontend/inlineEditing/EditableInlineText/index.js index faaee50dbf..31a35b08df 100644 --- a/entry_types/scrolled/package/src/frontend/inlineEditing/EditableInlineText/index.js +++ b/entry_types/scrolled/package/src/frontend/inlineEditing/EditableInlineText/index.js @@ -49,6 +49,7 @@ export const EditableInlineText = memo(function EditableInlineText({ } renderLeaf={renderLeaf} /> + + {children} + + + ); +} + function renderLeaf({attributes, children, leaf}) { if (leaf.shy) { children = {children}; diff --git a/entry_types/scrolled/package/src/frontend/inlineEditing/EditableInlineText/index.module.css b/entry_types/scrolled/package/src/frontend/inlineEditing/EditableInlineText/index.module.css index 5f7a8cbc6a..bca10137cd 100644 --- a/entry_types/scrolled/package/src/frontend/inlineEditing/EditableInlineText/index.module.css +++ b/entry_types/scrolled/package/src/frontend/inlineEditing/EditableInlineText/index.module.css @@ -1,6 +1,7 @@ .shy [data-slate-string], .newLine { position: relative; + color: var(--background-clip-text-fallback-color); } .selected.manualHyphens .shy [data-slate-string]::before {