@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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thangph2146/lexical-editor",
3
- "version": "0.0.1",
3
+ "version": "0.0.2",
4
4
  "type": "module",
5
5
  "private": false,
6
6
  "main": "./dist/index.cjs",
@@ -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("ContentEditable__root relative block min-h-72 px-8 py-4 focus:outline-none", className)}
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}
@@ -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(
@@ -133,6 +133,10 @@
133
133
  position: relative;
134
134
  width: 100%;
135
135
  height: 100%;
136
+
137
+ &--padding {
138
+ padding: 0.5rem 2rem; // py-2 px-8 equivalent
139
+ }
136
140
  }
137
141
 
138
142
  .editor-inline-block {