@thangph2146/lexical-editor 0.0.5 → 0.0.6

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/README.md ADDED
@@ -0,0 +1,47 @@
1
+ # @thangph2146/lexical-editor
2
+
3
+ Một thư viện soạn thảo văn bản (Rich Text Editor) dựa trên [Lexical](https://lexical.dev/) dành cho React/Next.js.
4
+
5
+ ## Tính năng chính
6
+
7
+ - **Rich Text Editing**: Hỗ trợ đầy đủ các định dạng văn bản (Bold, Italic, Underline, Code, v.v.)
8
+ - **Plugins Hệ thống**: Tích hợp sẵn nhiều plugin mạnh mẽ (Toolbar, Images, Tables, Layout, v.v.)
9
+ - **Dynamic Placeholder**: Hỗ trợ thay đổi placeholder linh hoạt thông qua prop.
10
+ - **Modern UI**: Giao diện hiện đại, dễ dàng tùy chỉnh qua CSS Variables.
11
+ - **TypeScript Support**: Được viết hoàn toàn bằng TypeScript với định nghĩa kiểu đầy đủ.
12
+
13
+ ## Cài đặt
14
+
15
+ Sử dụng `npm`:
16
+ ```bash
17
+ npm install @thangph2146/lexical-editor lexical @lexical/react
18
+ ```
19
+
20
+ Sử dụng `pnpm`:
21
+ ```bash
22
+ pnpm add @thangph2146/lexical-editor lexical @lexical/react
23
+ ```
24
+
25
+ ## Cách sử dụng
26
+
27
+ ```tsx
28
+ import { LexicalEditor } from "@thangph2146/lexical-editor";
29
+ import "@thangph2146/lexical-editor/style.css";
30
+
31
+ function MyEditor() {
32
+ const handleChange = (editorState) => {
33
+ // Xử lý khi nội dung thay đổi
34
+ };
35
+
36
+ return (
37
+ <LexicalEditor
38
+ placeholder="Nhập nội dung tại đây..."
39
+ onChange={handleChange}
40
+ />
41
+ );
42
+ }
43
+ ```
44
+
45
+ ## Giấy phép
46
+
47
+ MIT
@@ -5063,7 +5063,7 @@ var init_image_placeholder = __esm({
5063
5063
  }
5064
5064
  });
5065
5065
  function ContentEditable({
5066
- placeholder: placeholder2,
5066
+ placeholder,
5067
5067
  className,
5068
5068
  placeholderClassName,
5069
5069
  placeholderDefaults = true
@@ -5077,8 +5077,8 @@ function ContentEditable({
5077
5077
  !isReadOnlyOrReview && "min-h-72 px-8 py-4",
5078
5078
  className
5079
5079
  ),
5080
- "aria-placeholder": placeholder2,
5081
- "aria-label": placeholder2 || "Editor n\u1ED9i dung",
5080
+ "aria-placeholder": placeholder,
5081
+ "aria-label": placeholder || "Editor n\u1ED9i dung",
5082
5082
  placeholder: /* @__PURE__ */ jsxRuntime.jsx(
5083
5083
  "div",
5084
5084
  {
@@ -5087,7 +5087,7 @@ function ContentEditable({
5087
5087
  "text-muted-foreground pointer-events-none select-none",
5088
5088
  placeholderDefaults && !isReadOnlyOrReview && "absolute top-0 left-0 overflow-hidden px-8 py-[18px] text-ellipsis"
5089
5089
  ),
5090
- children: placeholder2
5090
+ children: placeholder
5091
5091
  }
5092
5092
  )
5093
5093
  }
@@ -7221,10 +7221,10 @@ function SelectTrigger({ className, children, size = "default", ...props }) {
7221
7221
  }
7222
7222
  );
7223
7223
  }
7224
- function SelectValue({ placeholder: placeholder2 }) {
7224
+ function SelectValue({ placeholder }) {
7225
7225
  const context = React20__namespace.useContext(SelectContext);
7226
7226
  if (!context) throw new Error("SelectValue must be used within Select");
7227
- return /* @__PURE__ */ jsxRuntime.jsx("span", { children: context.value || placeholder2 });
7227
+ return /* @__PURE__ */ jsxRuntime.jsx("span", { children: context.value || placeholder });
7228
7228
  }
7229
7229
  function SelectContent({ className, children, ...props }) {
7230
7230
  const context = React20__namespace.useContext(SelectContext);
@@ -32865,7 +32865,8 @@ __export(plugins_exports, {
32865
32865
  Plugins: () => Plugins
32866
32866
  });
32867
32867
  function Plugins({
32868
- readOnly = false
32868
+ readOnly = false,
32869
+ placeholder = ""
32869
32870
  }) {
32870
32871
  const [floatingAnchorElem, setFloatingAnchorElem] = React20.useState(null);
32871
32872
  const [isLinkEditMode, setIsLinkEditMode] = React20.useState(false);
@@ -33105,7 +33106,6 @@ function Plugins({
33105
33106
  ] }) })
33106
33107
  ] });
33107
33108
  }
33108
- var placeholder;
33109
33109
  var init_plugins = __esm({
33110
33110
  "src/editor-x/plugins.tsx"() {
33111
33111
  "use client";
@@ -33194,7 +33194,6 @@ var init_plugins = __esm({
33194
33194
  init_markdown_tweet_transformer();
33195
33195
  init_markdown_list_transformer();
33196
33196
  init_separator();
33197
- placeholder = "Press / for commands...";
33198
33197
  }
33199
33198
  });
33200
33199
 
@@ -33338,7 +33337,8 @@ function Editor({
33338
33337
  editorSerializedState,
33339
33338
  onChange,
33340
33339
  onSerializedChange,
33341
- readOnly = false
33340
+ readOnly = false,
33341
+ placeholder = ""
33342
33342
  }) {
33343
33343
  const { ref: editorRef, width: editorWidth } = useElementSize();
33344
33344
  const editorMaxWidth = editorWidth || void 0;
@@ -33392,7 +33392,7 @@ function Editor({
33392
33392
  ...editorSerializedState ? { editorState: JSON.stringify(editorSerializedState) } : {}
33393
33393
  },
33394
33394
  children: /* @__PURE__ */ jsxRuntime.jsxs(TooltipProvider, { children: [
33395
- /* @__PURE__ */ jsxRuntime.jsx(Plugins2, { readOnly }),
33395
+ /* @__PURE__ */ jsxRuntime.jsx(Plugins2, { readOnly, placeholder }),
33396
33396
  !readOnly && /* @__PURE__ */ jsxRuntime.jsx(
33397
33397
  LexicalOnChangePlugin.OnChangePlugin,
33398
33398
  {