@pareto-engineering/design-system 4.0.0-alpha.70 → 4.0.0-alpha.72
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/{c/ContentSlides/common/Slide/Slide.js → a/LexicalPreview/LexicalPreview.js} +43 -28
- package/dist/cjs/{c/ContentSlides/common/Sidebar → a/LexicalPreview}/index.js +3 -3
- package/dist/cjs/a/LexicalPreview/styles.scss +46 -0
- package/dist/cjs/a/People/common/Person/Person.js +7 -2
- package/dist/cjs/a/ProgressBar/ProgressBar.js +3 -2
- package/dist/cjs/a/ProgressBar/styles.scss +11 -1
- package/dist/cjs/a/XMLEditor/XMLEditor.js +14 -6
- package/dist/cjs/a/index.js +8 -1
- package/dist/cjs/b/ExpandableLexicalPreview/ExpandableLexicalPreview.js +125 -0
- package/dist/cjs/b/ExpandableLexicalPreview/common/ExpandButton/ExpandButton.js +112 -0
- package/dist/cjs/{c/ContentSlides/common/Navigator → b/ExpandableLexicalPreview/common/ExpandButton}/index.js +3 -3
- package/dist/cjs/b/ExpandableLexicalPreview/common/index.js +12 -0
- package/dist/cjs/b/ExpandableLexicalPreview/index.js +13 -0
- package/dist/cjs/b/ExpandableLexicalPreview/styles.scss +84 -0
- package/dist/cjs/b/index.js +8 -1
- package/dist/cjs/c/index.js +0 -13
- package/dist/cjs/f/fields/EditorInput/EditorInput.js +14 -3
- package/dist/cjs/f/fields/EditorInput/common/StopPropagationPlugin.js +30 -0
- package/dist/cjs/f/fields/EditorInput/common/index.js +7 -0
- package/dist/cjs/index.js +0 -11
- package/dist/es/a/LexicalPreview/LexicalPreview.js +80 -0
- package/dist/es/a/LexicalPreview/index.js +2 -0
- package/dist/es/a/LexicalPreview/styles.scss +46 -0
- package/dist/es/a/People/common/Person/Person.js +22 -15
- package/dist/es/a/ProgressBar/ProgressBar.js +3 -2
- package/dist/es/a/ProgressBar/styles.scss +11 -1
- package/dist/es/a/XMLEditor/XMLEditor.js +16 -10
- package/dist/es/a/index.js +2 -1
- package/dist/es/b/ExpandableLexicalPreview/ExpandableLexicalPreview.js +115 -0
- package/dist/es/b/ExpandableLexicalPreview/common/ExpandButton/ExpandButton.js +102 -0
- package/dist/es/b/ExpandableLexicalPreview/common/ExpandButton/index.js +1 -0
- package/dist/es/b/ExpandableLexicalPreview/common/index.js +1 -0
- package/dist/es/b/ExpandableLexicalPreview/index.js +2 -0
- package/dist/es/b/ExpandableLexicalPreview/styles.scss +84 -0
- package/dist/es/b/index.js +2 -1
- package/dist/es/c/index.js +0 -1
- package/dist/es/f/fields/EditorInput/EditorInput.js +15 -4
- package/dist/es/f/fields/EditorInput/common/StopPropagationPlugin.js +23 -0
- package/dist/es/f/fields/EditorInput/common/index.js +2 -1
- package/dist/es/index.js +0 -1
- package/package.json +5 -5
- package/src/stories/a/LexicalPreview.stories.jsx +28 -0
- package/src/stories/a/ProgressBar.stories.jsx +1 -1
- package/src/stories/b/ExpandableLexicalPreview.stories.jsx +29 -0
- package/src/stories/colors.js +4 -0
- package/src/ui/a/LexicalPreview/LexicalPreview.jsx +109 -0
- package/src/ui/a/LexicalPreview/index.js +2 -0
- package/src/ui/a/LexicalPreview/styles.scss +46 -0
- package/src/ui/a/People/common/Person/Person.jsx +31 -19
- package/src/ui/a/ProgressBar/ProgressBar.jsx +2 -0
- package/src/ui/a/ProgressBar/styles.scss +11 -1
- package/src/ui/a/XMLEditor/XMLEditor.jsx +16 -5
- package/src/ui/a/index.js +1 -0
- package/src/ui/b/ExpandableLexicalPreview/ExpandableLexicalPreview.jsx +157 -0
- package/src/ui/b/ExpandableLexicalPreview/common/ExpandButton/ExpandButton.jsx +123 -0
- package/src/ui/b/ExpandableLexicalPreview/common/ExpandButton/index.js +1 -0
- package/src/ui/b/ExpandableLexicalPreview/common/index.js +1 -0
- package/src/ui/b/ExpandableLexicalPreview/index.js +2 -0
- package/src/ui/b/ExpandableLexicalPreview/styles.scss +84 -0
- package/src/ui/b/index.js +1 -0
- package/src/ui/c/index.js +0 -1
- package/src/ui/f/fields/EditorInput/EditorInput.jsx +16 -2
- package/src/ui/f/fields/EditorInput/common/StopPropagationPlugin.jsx +29 -0
- package/src/ui/f/fields/EditorInput/common/index.jsx +1 -0
- package/src/ui/index.js +0 -1
- package/tests/__snapshots__/Storyshots.test.js.snap +1249 -641
- package/dist/cjs/c/ContentSlides/ContentSlides.js +0 -172
- package/dist/cjs/c/ContentSlides/Context.js +0 -10
- package/dist/cjs/c/ContentSlides/common/HorizontalMenu/HorizontalMenu.js +0 -126
- package/dist/cjs/c/ContentSlides/common/HorizontalMenu/index.js +0 -13
- package/dist/cjs/c/ContentSlides/common/Navigator/Navigator.js +0 -128
- package/dist/cjs/c/ContentSlides/common/Sidebar/Sidebar.js +0 -94
- package/dist/cjs/c/ContentSlides/common/Slide/index.js +0 -13
- package/dist/cjs/c/ContentSlides/common/index.js +0 -33
- package/dist/cjs/c/ContentSlides/index.js +0 -27
- package/dist/cjs/c/ContentSlides/styles.scss +0 -312
- package/dist/cjs/c/ContentSlides/useContentSlides.js +0 -11
- package/dist/cjs/r/SwitchRouteMap/SwitchRouteMap.js +0 -58
- package/dist/cjs/r/SwitchRouteMap/index.js +0 -13
- package/dist/cjs/r/common/PrivateRoute/PrivateRoute.js +0 -74
- package/dist/cjs/r/common/PrivateRoute/index.js +0 -13
- package/dist/cjs/r/common/index.js +0 -12
- package/dist/cjs/r/index.js +0 -27
- package/dist/es/c/ContentSlides/ContentSlides.js +0 -160
- package/dist/es/c/ContentSlides/Context.js +0 -2
- package/dist/es/c/ContentSlides/common/HorizontalMenu/HorizontalMenu.js +0 -116
- package/dist/es/c/ContentSlides/common/HorizontalMenu/index.js +0 -2
- package/dist/es/c/ContentSlides/common/Navigator/Navigator.js +0 -118
- package/dist/es/c/ContentSlides/common/Navigator/index.js +0 -2
- package/dist/es/c/ContentSlides/common/Sidebar/Sidebar.js +0 -84
- package/dist/es/c/ContentSlides/common/Sidebar/index.js +0 -2
- package/dist/es/c/ContentSlides/common/Slide/Slide.js +0 -65
- package/dist/es/c/ContentSlides/common/Slide/index.js +0 -2
- package/dist/es/c/ContentSlides/common/index.js +0 -4
- package/dist/es/c/ContentSlides/index.js +0 -4
- package/dist/es/c/ContentSlides/styles.scss +0 -312
- package/dist/es/c/ContentSlides/useContentSlides.js +0 -3
- package/dist/es/r/SwitchRouteMap/SwitchRouteMap.js +0 -45
- package/dist/es/r/SwitchRouteMap/index.js +0 -2
- package/dist/es/r/common/PrivateRoute/PrivateRoute.js +0 -66
- package/dist/es/r/common/PrivateRoute/index.js +0 -2
- package/dist/es/r/common/index.js +0 -1
- package/dist/es/r/index.js +0 -2
- package/src/stories/c/ContentSlides.stories.jsx +0 -214
- package/src/ui/c/ContentSlides/ContentSlides.jsx +0 -214
- package/src/ui/c/ContentSlides/Context.js +0 -3
- package/src/ui/c/ContentSlides/common/HorizontalMenu/HorizontalMenu.jsx +0 -145
- package/src/ui/c/ContentSlides/common/HorizontalMenu/index.js +0 -2
- package/src/ui/c/ContentSlides/common/Navigator/Navigator.jsx +0 -150
- package/src/ui/c/ContentSlides/common/Navigator/index.js +0 -2
- package/src/ui/c/ContentSlides/common/Sidebar/Sidebar.jsx +0 -135
- package/src/ui/c/ContentSlides/common/Sidebar/index.js +0 -2
- package/src/ui/c/ContentSlides/common/Slide/Slide.jsx +0 -87
- package/src/ui/c/ContentSlides/common/Slide/index.js +0 -2
- package/src/ui/c/ContentSlides/common/index.js +0 -4
- package/src/ui/c/ContentSlides/index.js +0 -4
- package/src/ui/c/ContentSlides/styles.scss +0 -312
- package/src/ui/c/ContentSlides/useContentSlides.js +0 -4
- package/src/ui/r/SwitchRouteMap/SwitchRouteMap.jsx +0 -64
- package/src/ui/r/SwitchRouteMap/index.js +0 -2
- package/src/ui/r/common/PrivateRoute/PrivateRoute.jsx +0 -73
- package/src/ui/r/common/PrivateRoute/index.js +0 -2
- package/src/ui/r/common/index.js +0 -1
- package/src/ui/r/index.js +0 -2
- /package/src/stories/a/{CodeEditor.stories.jsx → XMLEditor.stories.jsx} +0 -0
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
/* @pareto-engineering/generator-front 1.0.12 */
|
|
2
|
+
/* eslint-disable import/no-extraneous-dependencies -- required here */
|
|
3
|
+
import * as React from 'react'
|
|
4
|
+
import { useState, useMemo } from 'react'
|
|
5
|
+
import { LexicalComposer } from '@lexical/react/LexicalComposer'
|
|
6
|
+
import { RichTextPlugin } from '@lexical/react/LexicalRichTextPlugin'
|
|
7
|
+
import { ContentEditable } from '@lexical/react/LexicalContentEditable'
|
|
8
|
+
import { AutoLinkNode, LinkNode } from '@lexical/link'
|
|
9
|
+
import { ListItemNode, ListNode } from '@lexical/list'
|
|
10
|
+
|
|
11
|
+
import PropTypes from 'prop-types'
|
|
12
|
+
import styleNames from '@pareto-engineering/bem/exports'
|
|
13
|
+
import { Button } from '@pareto-engineering/design-system'
|
|
14
|
+
import './styles.scss'
|
|
15
|
+
import { ExpandButton } from './common'
|
|
16
|
+
|
|
17
|
+
// Local Definitions
|
|
18
|
+
|
|
19
|
+
const baseClassName = styleNames.base
|
|
20
|
+
const componentClassName = 'expandable-lexical-preview'
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* This is the component description.
|
|
24
|
+
*/
|
|
25
|
+
const ExpandableLexicalPreview = ({
|
|
26
|
+
id,
|
|
27
|
+
className:userClassName,
|
|
28
|
+
style,
|
|
29
|
+
nodes,
|
|
30
|
+
color,
|
|
31
|
+
resize,
|
|
32
|
+
title,
|
|
33
|
+
// ...otherProps
|
|
34
|
+
}) => {
|
|
35
|
+
const initialConfig = {
|
|
36
|
+
nameSpace :id,
|
|
37
|
+
editable :false,
|
|
38
|
+
editorState:nodes,
|
|
39
|
+
theme :{
|
|
40
|
+
text:{
|
|
41
|
+
italic :'italic',
|
|
42
|
+
strikethrough:'strikethrough',
|
|
43
|
+
underline :'underlined',
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
nodes:[
|
|
47
|
+
AutoLinkNode,
|
|
48
|
+
LinkNode,
|
|
49
|
+
ListNode,
|
|
50
|
+
ListItemNode,
|
|
51
|
+
],
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const [isExpanded, setIsExpanded] = useState(false)
|
|
55
|
+
|
|
56
|
+
const handleButtonClick = () => {
|
|
57
|
+
setIsExpanded(!isExpanded)
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
const Content = useMemo(() => (
|
|
61
|
+
<div className="lexical-content">
|
|
62
|
+
<RichTextPlugin
|
|
63
|
+
contentEditable={(
|
|
64
|
+
<ContentEditable
|
|
65
|
+
id={id}
|
|
66
|
+
className="content-editable"
|
|
67
|
+
/>
|
|
68
|
+
)}
|
|
69
|
+
/>
|
|
70
|
+
<ExpandButton
|
|
71
|
+
title={title}
|
|
72
|
+
onResolve={handleButtonClick}
|
|
73
|
+
/>
|
|
74
|
+
</div>
|
|
75
|
+
), [id])
|
|
76
|
+
|
|
77
|
+
return (
|
|
78
|
+
<LexicalComposer
|
|
79
|
+
initialConfig={initialConfig}
|
|
80
|
+
>
|
|
81
|
+
<div
|
|
82
|
+
id={id}
|
|
83
|
+
className={[
|
|
84
|
+
baseClassName,
|
|
85
|
+
componentClassName,
|
|
86
|
+
userClassName,
|
|
87
|
+
`y-${color}`,
|
|
88
|
+
isExpanded && 'collapsed',
|
|
89
|
+
]
|
|
90
|
+
.filter((e) => e)
|
|
91
|
+
.join(' ')}
|
|
92
|
+
style={{
|
|
93
|
+
'--resize':resize,
|
|
94
|
+
...style,
|
|
95
|
+
}}
|
|
96
|
+
>
|
|
97
|
+
{typeof title === 'string' ? <p className="title h2">{title}</p> : title}
|
|
98
|
+
{isExpanded && (
|
|
99
|
+
<Button
|
|
100
|
+
onClick={handleButtonClick}
|
|
101
|
+
color="background-far"
|
|
102
|
+
isCompact
|
|
103
|
+
>
|
|
104
|
+
<span className="ai-icon c-x x-paragraph">
|
|
105
|
+
C
|
|
106
|
+
</span>
|
|
107
|
+
</Button>
|
|
108
|
+
)}
|
|
109
|
+
{!isExpanded && Content}
|
|
110
|
+
</div>
|
|
111
|
+
</LexicalComposer>
|
|
112
|
+
)
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
ExpandableLexicalPreview.propTypes = {
|
|
116
|
+
/**
|
|
117
|
+
* The HTML id for this element
|
|
118
|
+
*/
|
|
119
|
+
id:PropTypes.string,
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* The HTML class names for this element
|
|
123
|
+
*/
|
|
124
|
+
className:PropTypes.string,
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* The React-written, css properties for this element.
|
|
128
|
+
*/
|
|
129
|
+
style:PropTypes.objectOf(PropTypes.string),
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* Color of the text
|
|
133
|
+
*/
|
|
134
|
+
color:PropTypes.string,
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* The nodes to render in the form of a json string
|
|
138
|
+
*/
|
|
139
|
+
nodes:PropTypes.string,
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* The resize property of the textarea
|
|
143
|
+
*/
|
|
144
|
+
resize:PropTypes.string,
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* The title for the preview.
|
|
148
|
+
*/
|
|
149
|
+
title:PropTypes.string,
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
ExpandableLexicalPreview.defaultProps = {
|
|
153
|
+
color :'paragraph',
|
|
154
|
+
resize:'vertical',
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
export default ExpandableLexicalPreview
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
/* @pareto-engineering/generator-front 1.0.12 */
|
|
2
|
+
/* eslint-disable import/no-extraneous-dependencies -- required here */
|
|
3
|
+
import * as React from 'react'
|
|
4
|
+
import { $generateHtmlFromNodes } from '@lexical/html'
|
|
5
|
+
import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext'
|
|
6
|
+
|
|
7
|
+
import PropTypes from 'prop-types'
|
|
8
|
+
import styleNames from '@pareto-engineering/bem/exports'
|
|
9
|
+
import { Button } from '@pareto-engineering/design-system'
|
|
10
|
+
|
|
11
|
+
// Local Definitions
|
|
12
|
+
|
|
13
|
+
const baseClassName = styleNames.base
|
|
14
|
+
const componentClassName = 'expand-button'
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* This is the component description.
|
|
18
|
+
*/
|
|
19
|
+
const ExpandButton = ({
|
|
20
|
+
id,
|
|
21
|
+
className: userClassName,
|
|
22
|
+
style,
|
|
23
|
+
onResolve,
|
|
24
|
+
title,
|
|
25
|
+
// ...otherProps
|
|
26
|
+
}) => {
|
|
27
|
+
const [editor] = useLexicalComposerContext()
|
|
28
|
+
|
|
29
|
+
return (
|
|
30
|
+
<Button
|
|
31
|
+
id={id}
|
|
32
|
+
className={[
|
|
33
|
+
baseClassName,
|
|
34
|
+
componentClassName,
|
|
35
|
+
userClassName,
|
|
36
|
+
'ai-icon',
|
|
37
|
+
]
|
|
38
|
+
.filter((e) => e)
|
|
39
|
+
.join(' ')}
|
|
40
|
+
style={style}
|
|
41
|
+
color="background-far"
|
|
42
|
+
isCompact
|
|
43
|
+
onClick={() => {
|
|
44
|
+
editor.getEditorState().read(() => {
|
|
45
|
+
const rawHtml = $generateHtmlFromNodes(editor)
|
|
46
|
+
const preview = window.open('', '_blank', 'width=600,height=600')
|
|
47
|
+
preview.document.write(
|
|
48
|
+
`<html>
|
|
49
|
+
<title>${title || 'Preview'}</title>
|
|
50
|
+
<style>
|
|
51
|
+
li:has(ol, ul) {
|
|
52
|
+
list-style-type: none;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
p,
|
|
56
|
+
span,
|
|
57
|
+
strong,
|
|
58
|
+
em,
|
|
59
|
+
li {
|
|
60
|
+
&.underlined {
|
|
61
|
+
text-decoration: underline;
|
|
62
|
+
|
|
63
|
+
&.strikethrough {
|
|
64
|
+
text-decoration: underline line-through;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
&.strikethrough {
|
|
69
|
+
text-decoration: line-through;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
&.italic {
|
|
73
|
+
font-style: italic;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
:first-child {
|
|
78
|
+
margin-top: 0;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
&::placeholder {
|
|
82
|
+
color: #abadb3;
|
|
83
|
+
}
|
|
84
|
+
</style>
|
|
85
|
+
<body>
|
|
86
|
+
<style></style>
|
|
87
|
+
${rawHtml}
|
|
88
|
+
<button onclick="window.close()">Close Preview</button>
|
|
89
|
+
</body></html>`,
|
|
90
|
+
)
|
|
91
|
+
})
|
|
92
|
+
onResolve()
|
|
93
|
+
}}
|
|
94
|
+
>
|
|
95
|
+
D
|
|
96
|
+
</Button>
|
|
97
|
+
|
|
98
|
+
)
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
ExpandButton.propTypes = {
|
|
102
|
+
/**
|
|
103
|
+
* The HTML id for this element
|
|
104
|
+
*/
|
|
105
|
+
id:PropTypes.string,
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* The HTML class names for this element
|
|
109
|
+
*/
|
|
110
|
+
className:PropTypes.string,
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* The React-written, css properties for this element.
|
|
114
|
+
*/
|
|
115
|
+
style:PropTypes.objectOf(PropTypes.string),
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
ExpandButton.defaultProps = {
|
|
119
|
+
// color: 'paragraph',
|
|
120
|
+
// resize: 'vertical',
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
export default ExpandButton
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as ExpandButton } from './ExpandButton'
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ExpandButton } from './ExpandButton'
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/* @pareto-engineering/generator-front 1.0.12 */
|
|
2
|
+
/* stylelint-disable max-nesting-depth -- required */
|
|
3
|
+
|
|
4
|
+
@use "@pareto-engineering/bem";
|
|
5
|
+
@use "@pareto-engineering/styles/src/mixins";
|
|
6
|
+
@use "@pareto-engineering/styles/src/globals" as *;
|
|
7
|
+
|
|
8
|
+
.#{bem.$base}.expandable-lexical-preview {
|
|
9
|
+
display: flex;
|
|
10
|
+
flex-direction: column;
|
|
11
|
+
flex-wrap: wrap;
|
|
12
|
+
gap: var(--gap);
|
|
13
|
+
width: 100%;
|
|
14
|
+
|
|
15
|
+
&.collapsed {
|
|
16
|
+
flex-direction: row;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
> .title {
|
|
20
|
+
margin: 0;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
> .#{bem.$base}.button {
|
|
25
|
+
align-items: center;
|
|
26
|
+
border: 1px solid var(--outline-inputs);
|
|
27
|
+
display: flex;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
> .lexical-content {
|
|
31
|
+
position: relative;
|
|
32
|
+
|
|
33
|
+
> .content-editable {
|
|
34
|
+
background: var(--background-inputs);
|
|
35
|
+
border: 1px solid var(--outline-inputs);
|
|
36
|
+
border-radius: var(--theme-default-border-radius);
|
|
37
|
+
color: var(--y);
|
|
38
|
+
overflow: auto;
|
|
39
|
+
padding: var(--gap);
|
|
40
|
+
resize: var(--resize);
|
|
41
|
+
|
|
42
|
+
li:has(ol, ul) {
|
|
43
|
+
list-style-type: none;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
p,
|
|
47
|
+
span,
|
|
48
|
+
strong,
|
|
49
|
+
em,
|
|
50
|
+
li {
|
|
51
|
+
&.underlined {
|
|
52
|
+
text-decoration: underline;
|
|
53
|
+
|
|
54
|
+
&.strikethrough {
|
|
55
|
+
text-decoration: underline line-through;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
&.strikethrough {
|
|
60
|
+
text-decoration: line-through;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
&.italic {
|
|
64
|
+
font-style: italic;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
:first-child {
|
|
69
|
+
margin-top: 0;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
&::placeholder {
|
|
73
|
+
color: var(--metadata);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
> .#{bem.$base}.expand-button {
|
|
78
|
+
border: 1px solid var(--outline-inputs);
|
|
79
|
+
position: absolute;
|
|
80
|
+
right: 1em;
|
|
81
|
+
top: 1em;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
package/src/ui/b/index.js
CHANGED
package/src/ui/c/index.js
CHANGED
|
@@ -20,7 +20,7 @@ import styleNames from '@pareto-engineering/bem/exports'
|
|
|
20
20
|
// Local Definitions
|
|
21
21
|
|
|
22
22
|
import { FormLabel, FormDescription } from '../../common'
|
|
23
|
-
import { Toolbar, TreeViewPlugin } from './common'
|
|
23
|
+
import { Toolbar, TreeViewPlugin, StopPropagationPlugin } from './common'
|
|
24
24
|
|
|
25
25
|
import './styles.scss'
|
|
26
26
|
|
|
@@ -45,6 +45,7 @@ const EditorInput = ({
|
|
|
45
45
|
description,
|
|
46
46
|
disabled,
|
|
47
47
|
showDebugger,
|
|
48
|
+
stopPropagationKeys,
|
|
48
49
|
// ...otherProps
|
|
49
50
|
}) => {
|
|
50
51
|
const formik = useFormikContext()
|
|
@@ -158,8 +159,11 @@ const EditorInput = ({
|
|
|
158
159
|
<ListPlugin />
|
|
159
160
|
<TabIndentationPlugin />
|
|
160
161
|
<HistoryPlugin />
|
|
162
|
+
{ stopPropagationKeys && (
|
|
163
|
+
<StopPropagationPlugin stopPropagationKeys={stopPropagationKeys} />
|
|
164
|
+
)}
|
|
161
165
|
<FormDescription className="s-1" description={description} name={name} />
|
|
162
|
-
{ showDebugger && <TreeViewPlugin />}
|
|
166
|
+
{ showDebugger && <TreeViewPlugin /> }
|
|
163
167
|
</div>
|
|
164
168
|
</LexicalComposer>
|
|
165
169
|
)
|
|
@@ -230,6 +234,16 @@ EditorInput.propTypes = {
|
|
|
230
234
|
* The resize property of the text area
|
|
231
235
|
*/
|
|
232
236
|
resize:PropTypes.oneOf(['none', 'both', 'horizontal', 'vertical']),
|
|
237
|
+
|
|
238
|
+
/**
|
|
239
|
+
* Whether to show the debugger or not
|
|
240
|
+
*/
|
|
241
|
+
showDebugger:PropTypes.bool,
|
|
242
|
+
|
|
243
|
+
/**
|
|
244
|
+
* Map to stop propagation of the given keys
|
|
245
|
+
*/
|
|
246
|
+
stopPropagationKeys:PropTypes.arrayOf(PropTypes.string),
|
|
233
247
|
}
|
|
234
248
|
|
|
235
249
|
EditorInput.defaultProps = {
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { useInsertionEffect } from 'react'
|
|
2
|
+
import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext'
|
|
3
|
+
|
|
4
|
+
const StopPropagationPlugin = ({
|
|
5
|
+
stopPropagationKeys,
|
|
6
|
+
}) => {
|
|
7
|
+
const [editor] = useLexicalComposerContext()
|
|
8
|
+
|
|
9
|
+
useInsertionEffect(() => {
|
|
10
|
+
const onKeyDown = (e) => {
|
|
11
|
+
if (stopPropagationKeys?.includes(e.key)) {
|
|
12
|
+
e.stopPropagation()
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
return editor.registerRootListener(
|
|
17
|
+
(rootElement, prevRootElement) => {
|
|
18
|
+
if (prevRootElement !== null) {
|
|
19
|
+
prevRootElement.removeEventListener('keydown', onKeyDown)
|
|
20
|
+
}
|
|
21
|
+
if (rootElement !== null) {
|
|
22
|
+
rootElement.addEventListener('keydown', onKeyDown)
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
)
|
|
26
|
+
}, [editor])
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export default StopPropagationPlugin
|
package/src/ui/index.js
CHANGED