Skip to content

Commit dd0a2c0

Browse files
committed
Support inline text effects in via custom theme properties
REDMINE-20977
1 parent 32fdc01 commit dd0a2c0

6 files changed

Lines changed: 41 additions & 4 deletions

File tree

entry_types/scrolled/package/src/contentElements/hotspots/Tooltip.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ import {insidePagerButton} from './PagerButton';
1616
import {
1717
EditableText,
1818
EditableInlineText,
19-
EditableLink,
2019
InlineFileRights,
2120
Image,
2221
Text,

entry_types/scrolled/package/src/frontend/EditableInlineText.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,13 @@ import styles from './EditableInlineText.module.css';
88
export const EditableInlineText = withInlineEditingAlternative(
99
'EditableInlineText',
1010
function EditableInlineText({value, hyphens, defaultValue = ''}) {
11+
const text = value ? value[0]?.children[0]?.text : defaultValue;
12+
1113
return (
1214
<span className={classNames(styles.root,
15+
styles.textEffects,
1316
styles[`hyphens-${hyphens}`])}>
14-
{value ? value[0]?.children[0]?.text : defaultValue}
17+
<span>{text}</span>
1518
</span>
1619
);
1720
}

entry_types/scrolled/package/src/frontend/EditableInlineText.module.css

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,28 @@
3131
hyphens: none;
3232
word-wrap: normal;
3333
}
34+
35+
.textEffects {
36+
padding: var(--text-highlight-padding);
37+
line-height: var(--text-highlight-line-height);
38+
box-decoration-break: clone;
39+
}
40+
41+
.textEffects:not(:has([data-slate-zero-width="n"])) {
42+
background-color: var(--text-highlight-background-color);
43+
}
44+
45+
.textEffects > span {
46+
color: var(--background-clip-text-fallback-color);
47+
padding: var(--background-clip-text-padding);
48+
box-decoration-break: clone;
49+
}
50+
51+
@supports ((background-clip: text) or (-webkit-background-clip: text)) {
52+
.textEffects > span {
53+
background: var(--background-clip-text-background);
54+
background-clip: var(--background-clip-text-background-clip);
55+
color: var(--background-clip-text-color);
56+
caret-color: var(--background-clip-text-fallback-color);
57+
}
58+
}

entry_types/scrolled/package/src/frontend/Text.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ import React from 'react';
22
import classNames from 'classnames';
33
import PropTypes from 'prop-types';
44

5-
import {camelize} from './utils/camelize';
6-
75
import styles from './Text.module.css';
86

97
/**

entry_types/scrolled/package/src/frontend/inlineEditing/EditableInlineText/index.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ export const EditableInlineText = memo(function EditableInlineText({
4949
<Slate editor={editor} value={cachedValue} onChange={setCachedValue}>
5050
<Editable decorate={decorateLineBreaks}
5151
onKeyDown={handleKeyDown}
52+
renderElement={props => <Element {...props} />}
5253
renderLeaf={renderLeaf} />
5354
</Slate>
5455
<TextPlaceholder text={placeholder}
@@ -57,6 +58,16 @@ export const EditableInlineText = memo(function EditableInlineText({
5758
);
5859
});
5960

61+
function Element({attributes, children, element}) {
62+
return (
63+
<div {...attributes} style={{position: 'relative'}}>
64+
<span className={frontendStyles.textEffects}>
65+
{children}
66+
</span>
67+
</div>
68+
);
69+
}
70+
6071
function renderLeaf({attributes, children, leaf}) {
6172
if (leaf.shy) {
6273
children = <span className={styles.shy}>{children}</span>;

entry_types/scrolled/package/src/frontend/inlineEditing/EditableInlineText/index.module.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
.shy [data-slate-string],
22
.newLine {
33
position: relative;
4+
color: var(--background-clip-text-fallback-color);
45
}
56

67
.selected.manualHyphens .shy [data-slate-string]::before {

0 commit comments

Comments
 (0)