@thangph2146/lexical-editor 0.0.7 → 0.0.9

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,86 +1,87 @@
1
- {
2
- "name": "@thangph2146/lexical-editor",
3
- "version": "0.0.7",
4
- "description": "Rich Text Editor library based on Lexical for React/Next.js",
5
- "license": "MIT",
6
- "type": "module",
7
- "private": false,
8
- "main": "./dist/index.cjs",
9
- "module": "./dist/index.js",
10
- "types": "./dist/index.d.ts",
11
- "files": [
12
- "dist",
13
- "src"
14
- ],
15
- "publishConfig": {
16
- "access": "public"
17
- },
18
- "dependencies": {
19
- "@lexical/code": "^0.38.2",
20
- "@lexical/file": "^0.38.2",
21
- "@lexical/hashtag": "^0.38.2",
22
- "@lexical/link": "^0.38.2",
23
- "@lexical/list": "^0.38.2",
24
- "@lexical/markdown": "^0.38.2",
25
- "@lexical/overflow": "^0.38.2",
26
- "@lexical/rich-text": "^0.38.2",
27
- "@lexical/selection": "^0.38.2",
28
- "@lexical/table": "^0.38.2",
29
- "@lexical/text": "^0.38.2",
30
- "@lexical/utils": "^0.38.2",
31
- "@radix-ui/react-slider": "^1.2.3",
32
- "@radix-ui/react-slot": "^1.2.4",
33
- "framer-motion": "^12.4.7",
34
- "lucide-react": "^0.552.0",
35
- "sonner": "^2.0.7"
36
- },
37
- "peerDependencies": {
38
- "@lexical/react": "^0.38.2",
39
- "lexical": "^0.38.2",
40
- "react": ">=18",
41
- "react-dom": ">=18"
42
- },
43
- "devDependencies": {
44
- "@types/node": "^25.1.0",
45
- "@types/react": "^19.2.10",
46
- "@types/react-dom": "^19.2.3",
47
- "esbuild-sass-plugin": "^3.3.1",
48
- "eslint": "^9.39.2",
49
- "next": "16.1.6",
50
- "sass": "^1.83.0",
51
- "tsup": "^8.4.0",
52
- "typescript": "^5.9.3",
53
- "@workspace/eslint-config": "0.0.0",
54
- "@workspace/typescript-config": "0.0.0"
55
- },
56
- "exports": {
57
- ".": {
58
- "types": "./dist/index.d.ts",
59
- "import": "./dist/index.js",
60
- "require": "./dist/index.cjs"
61
- },
62
- "./style.css": "./dist/index.css",
63
- "./editor": {
64
- "types": "./dist/editor-x/editor.d.ts",
65
- "import": "./dist/editor-x/editor.js",
66
- "require": "./dist/editor-x/editor.cjs"
67
- },
68
- "./styles": {
69
- "sass": "./src/themes/editor-theme.scss",
70
- "default": "./src/themes/editor-theme.scss"
71
- },
72
- "./variables": {
73
- "sass": "./src/themes/_variables.scss",
74
- "default": "./src/themes/_variables.scss"
75
- },
76
- "./themes/*": "./src/themes/*.ts",
77
- "./utils/*": "./src/utils/*.ts"
78
- },
79
- "scripts": {
80
- "build": "tsup",
81
- "dev": "tsup --watch",
82
- "lint": "eslint",
83
- "format": "prettier --write \"**/*.{ts,tsx}\"",
84
- "typecheck": "tsc --noEmit"
85
- }
86
- }
1
+ {
2
+ "name": "@thangph2146/lexical-editor",
3
+ "version": "0.0.9",
4
+ "description": "Rich Text Editor library based on Lexical for React/Next.js",
5
+ "license": "MIT",
6
+ "type": "module",
7
+ "private": false,
8
+ "main": "./dist/index.cjs",
9
+ "module": "./dist/index.js",
10
+ "types": "./dist/index.d.ts",
11
+ "files": [
12
+ "dist",
13
+ "src"
14
+ ],
15
+ "publishConfig": {
16
+ "access": "public"
17
+ },
18
+ "scripts": {
19
+ "build": "tsup",
20
+ "dev": "tsup --watch",
21
+ "lint": "eslint",
22
+ "format": "prettier --write \"**/*.{ts,tsx}\"",
23
+ "typecheck": "tsc --noEmit",
24
+ "prepublishOnly": "pnpm build && pnpm typecheck"
25
+ },
26
+ "dependencies": {
27
+ "@lexical/code": "^0.38.2",
28
+ "@lexical/file": "^0.38.2",
29
+ "@lexical/hashtag": "^0.38.2",
30
+ "@lexical/link": "^0.38.2",
31
+ "@lexical/list": "^0.38.2",
32
+ "@lexical/markdown": "^0.38.2",
33
+ "@lexical/overflow": "^0.38.2",
34
+ "@lexical/rich-text": "^0.38.2",
35
+ "@lexical/selection": "^0.38.2",
36
+ "@lexical/table": "^0.38.2",
37
+ "@lexical/text": "^0.38.2",
38
+ "@lexical/utils": "^0.38.2",
39
+ "@radix-ui/react-slider": "^1.2.3",
40
+ "@radix-ui/react-slot": "^1.2.4",
41
+ "framer-motion": "^12.4.7",
42
+ "lucide-react": "^0.552.0",
43
+ "sonner": "^2.0.7"
44
+ },
45
+ "peerDependencies": {
46
+ "@lexical/react": "^0.38.2",
47
+ "lexical": "^0.38.2",
48
+ "react": ">=18",
49
+ "react-dom": ">=18"
50
+ },
51
+ "devDependencies": {
52
+ "@types/node": "^25.1.0",
53
+ "@types/react": "^19.2.10",
54
+ "@types/react-dom": "^19.2.3",
55
+ "@workspace/eslint-config": "workspace:*",
56
+ "@workspace/typescript-config": "workspace:*",
57
+ "esbuild-sass-plugin": "^3.3.1",
58
+ "eslint": "^9.39.2",
59
+ "next": "16.1.6",
60
+ "sass": "^1.83.0",
61
+ "tsup": "^8.4.0",
62
+ "typescript": "^5.9.3"
63
+ },
64
+ "exports": {
65
+ ".": {
66
+ "types": "./dist/index.d.ts",
67
+ "import": "./dist/index.js",
68
+ "require": "./dist/index.cjs"
69
+ },
70
+ "./style.css": "./dist/index.css",
71
+ "./editor": {
72
+ "types": "./dist/editor-x/editor.d.ts",
73
+ "import": "./dist/editor-x/editor.js",
74
+ "require": "./dist/editor-x/editor.cjs"
75
+ },
76
+ "./styles": {
77
+ "sass": "./src/themes/editor-theme.scss",
78
+ "default": "./src/themes/editor-theme.scss"
79
+ },
80
+ "./variables": {
81
+ "sass": "./src/themes/_variables.scss",
82
+ "default": "./src/themes/_variables.scss"
83
+ },
84
+ "./themes/*": "./src/themes/*.ts",
85
+ "./utils/*": "./src/utils/*.ts"
86
+ }
87
+ }
@@ -1,42 +1,30 @@
1
- import { JSX } from "react"
2
- import { ContentEditable as LexicalContentEditable } from "@lexical/react/LexicalContentEditable"
3
- import { cn } from "../lib/utils"
4
-
5
- type Props = {
6
- placeholder: string
7
- className?: string
8
- placeholderClassName?: string
9
- placeholderDefaults?: boolean // apply default positioning/padding for placeholder
10
- }
11
-
12
- export function ContentEditable({
13
- placeholder,
14
- className,
15
- placeholderClassName,
16
- placeholderDefaults = true,
17
- }: Props): JSX.Element {
18
- const isReadOnlyOrReview = className?.includes("--readonly") || className?.includes("--review")
19
-
20
- return (
21
- <LexicalContentEditable
22
- className={cn(
23
- "ContentEditable__root relative block focus:outline-none",
24
- !isReadOnlyOrReview && "min-h-72 px-8 py-4",
25
- className
26
- )}
27
- aria-placeholder={placeholder}
28
- aria-label={placeholder || "Editor nội dung"}
29
- placeholder={
30
- <div
31
- className={cn(
32
- placeholderClassName,
33
- "text-muted-foreground pointer-events-none select-none",
34
- placeholderDefaults && !isReadOnlyOrReview && "absolute top-0 left-0 overflow-hidden px-8 py-[18px] text-ellipsis"
35
- )}
36
- >
37
- {placeholder}
38
- </div>
39
- }
40
- />
41
- )
42
- }
1
+ import { JSX } from "react"
2
+ import { ContentEditable as LexicalContentEditable } from "@lexical/react/LexicalContentEditable"
3
+ import { cn } from "../lib/utils"
4
+
5
+ type Props = {
6
+ placeholder?: string
7
+ className?: string
8
+ placeholderClassName?: string
9
+ placeholderDefaults?: boolean // apply default positioning/padding for placeholder
10
+ }
11
+
12
+ export function ContentEditable({
13
+ placeholder,
14
+ className,
15
+ placeholderClassName,
16
+ placeholderDefaults = true,
17
+ }: Props): JSX.Element {
18
+ const isReadOnlyOrReview = className?.includes("--readonly") || className?.includes("--review")
19
+
20
+ return (
21
+ <LexicalContentEditable
22
+ className={cn(
23
+ "ContentEditable__root relative block focus:outline-none",
24
+ !isReadOnlyOrReview && "min-h-72 px-8 py-4",
25
+ className
26
+ )}
27
+ aria-label={"Editor nội dung"}
28
+ />
29
+ )
30
+ }
@@ -228,11 +228,13 @@ export function Plugins({
228
228
  <div className={cn("editor-relative-full")}>
229
229
  <div className={cn("editor-relative-full")} ref={onRef}>
230
230
  <ContentEditable
231
- placeholder={readOnly ? "" : placeholder}
231
+ placeholder=""
232
232
  className={cn(
233
233
  "editor-content-editable",
234
234
  readOnly && "editor-content-editable--readonly"
235
235
  )}
236
+ placeholderClassName="editor-placeholder"
237
+ placeholderDefaults={false}
236
238
  />
237
239
  </div>
238
240
  </div>
@@ -63,7 +63,6 @@ import {
63
63
  ColorPickerPresets,
64
64
  ColorPickerTrigger,
65
65
  } from "../editor-ui/color-picker"
66
- import { Input } from "../ui/input"
67
66
  import { Flex } from "../ui/flex"
68
67
  import { useEditorModal } from "../editor-hooks/use-modal"
69
68
  import { logger } from "../lib/logger"
@@ -468,10 +467,7 @@ export function LayoutPlugin(): JSX.Element | null {
468
467
  template: parentContainer.getTemplateColumns(),
469
468
  itemBackgroundColor:
470
469
  extractStyleValue(style, "background-color") ?? "#ffffff",
471
- itemPaddingXPx:
472
- paddingValues && paddingValues.length > 1
473
- ? paddingValues[1]
474
- : (paddingValues?.[0] ?? 12),
470
+ itemPaddingXPx: paddingValues?.[1] ?? paddingValues?.[0] ?? 12,
475
471
  itemPaddingYPx: paddingValues?.[0] ?? 12,
476
472
  itemBorderRadiusPx: borderRadiusValues?.[0] ?? 8,
477
473
  },
@@ -121,6 +121,8 @@
121
121
  overflow-x: auto;
122
122
  flex-wrap: nowrap;
123
123
  border-top: $editor-border-width solid var(--border);
124
+ border-bottom-left-radius: 8px;
125
+ border-bottom-right-radius: 8px;
124
126
  padding: $editor-gap-1-5 $editor-gap-3;
125
127
  @include backdrop-blur($editor-dialog-overlay-blur * 2, color-mix(in srgb, var(--background), transparent 50%));
126
128