@thangph2146/lexical-editor 0.0.1 → 0.0.2
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 +3 -0
- 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 +3 -0
- 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/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(
|