@thangph2146/lexical-editor 0.0.1 → 0.0.3
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/editor-x/editor.cjs +9 -4
- package/dist/editor-x/editor.cjs.map +1 -1
- package/dist/editor-x/editor.css +11 -1
- package/dist/editor-x/editor.css.map +1 -1
- package/dist/editor-x/editor.js +9 -4
- package/dist/editor-x/editor.js.map +1 -1
- package/dist/index.cjs +9 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +11 -1
- package/dist/index.css.map +1 -1
- package/dist/index.js +9 -4
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/editor-ui/content-editable.tsx +8 -3
- package/src/editor-x/plugins.tsx +3 -3
- package/src/themes/editor-theme.scss +11 -2
- package/src/themes/ui-components.scss +4 -0
package/package.json
CHANGED
|
@@ -15,9 +15,15 @@ export function ContentEditable({
|
|
|
15
15
|
placeholderClassName,
|
|
16
16
|
placeholderDefaults = true,
|
|
17
17
|
}: Props): JSX.Element {
|
|
18
|
+
const isReadOnly = className?.includes("--readonly")
|
|
19
|
+
|
|
18
20
|
return (
|
|
19
21
|
<LexicalContentEditable
|
|
20
|
-
className={cn(
|
|
22
|
+
className={cn(
|
|
23
|
+
"ContentEditable__root relative block focus:outline-none",
|
|
24
|
+
!isReadOnly && "min-h-72 px-8 py-4",
|
|
25
|
+
className
|
|
26
|
+
)}
|
|
21
27
|
aria-placeholder={placeholder}
|
|
22
28
|
aria-label={placeholder || "Editor nội dung"}
|
|
23
29
|
placeholder={
|
|
@@ -25,8 +31,7 @@ export function ContentEditable({
|
|
|
25
31
|
className={cn(
|
|
26
32
|
placeholderClassName,
|
|
27
33
|
"text-muted-foreground pointer-events-none select-none",
|
|
28
|
-
placeholderDefaults &&
|
|
29
|
-
"absolute top-0 left-0 overflow-hidden px-8 py-[18px] text-ellipsis"
|
|
34
|
+
placeholderDefaults && !isReadOnly && "absolute top-0 left-0 overflow-hidden px-8 py-[18px] text-ellipsis"
|
|
30
35
|
)}
|
|
31
36
|
>
|
|
32
37
|
{placeholder}
|
package/src/editor-x/plugins.tsx
CHANGED
|
@@ -215,12 +215,12 @@ export function Plugins({
|
|
|
215
215
|
</ToolbarPlugin>
|
|
216
216
|
)}
|
|
217
217
|
|
|
218
|
-
<div className="editor-relative-full">
|
|
218
|
+
<div className={cn("editor-relative-full")}>
|
|
219
219
|
{/* AutoFocusPlugin removed to prevent auto-scroll on page load */}
|
|
220
220
|
<RichTextPlugin
|
|
221
221
|
contentEditable={
|
|
222
|
-
<div className="editor-relative-full">
|
|
223
|
-
<div className="editor-relative-full" ref={onRef}>
|
|
222
|
+
<div className={cn("editor-relative-full")}>
|
|
223
|
+
<div className={cn("editor-relative-full")} ref={onRef}>
|
|
224
224
|
<ContentEditable
|
|
225
225
|
placeholder={readOnly ? "" : placeholder}
|
|
226
226
|
className={cn(
|
|
@@ -595,10 +595,13 @@
|
|
|
595
595
|
.editor-content-editable {
|
|
596
596
|
position: relative !important;
|
|
597
597
|
display: block !important;
|
|
598
|
-
min-height: 288px !important; // min-h-72
|
|
599
|
-
padding: 16px 32px !important; // py-4 px-8
|
|
600
598
|
outline: none !important;
|
|
601
599
|
|
|
600
|
+
&:not(&--readonly) {
|
|
601
|
+
min-height: 288px !important; // min-h-72
|
|
602
|
+
padding: 16px 32px !important; // py-4 px-8
|
|
603
|
+
}
|
|
604
|
+
|
|
602
605
|
&:focus {
|
|
603
606
|
outline: none !important;
|
|
604
607
|
}
|
|
@@ -606,6 +609,8 @@
|
|
|
606
609
|
&--readonly {
|
|
607
610
|
cursor: default !important;
|
|
608
611
|
user-select: text !important;
|
|
612
|
+
min-height: unset !important;
|
|
613
|
+
padding: 0 !important;
|
|
609
614
|
}
|
|
610
615
|
}
|
|
611
616
|
|
|
@@ -619,4 +624,8 @@
|
|
|
619
624
|
padding: 18px 32px !important; // py-[18px] px-8
|
|
620
625
|
text-overflow: ellipsis !important;
|
|
621
626
|
user-select: none !important;
|
|
627
|
+
|
|
628
|
+
.editor-content-editable--readonly + & {
|
|
629
|
+
display: none !important;
|
|
630
|
+
}
|
|
622
631
|
}
|