@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/dist/editor-x/editor.cjs +6 -16
- package/dist/editor-x/editor.cjs.map +1 -1
- package/dist/editor-x/editor.css +2 -0
- package/dist/editor-x/editor.css.map +1 -1
- package/dist/editor-x/editor.js +6 -16
- package/dist/editor-x/editor.js.map +1 -1
- package/dist/index.cjs +6 -16
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +2 -0
- package/dist/index.css.map +1 -1
- package/dist/index.js +6 -16
- package/dist/index.js.map +1 -1
- package/package.json +87 -86
- package/src/editor-ui/content-editable.tsx +30 -42
- package/src/editor-x/plugins.tsx +3 -1
- package/src/plugins/layout-plugin.tsx +1 -5
- package/src/themes/plugins/_menus-and-pickers.scss +2 -0
package/package.json
CHANGED
|
@@ -1,86 +1,87 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@thangph2146/lexical-editor",
|
|
3
|
-
"version": "0.0.
|
|
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
|
-
"
|
|
19
|
-
"
|
|
20
|
-
"
|
|
21
|
-
"
|
|
22
|
-
"
|
|
23
|
-
"
|
|
24
|
-
"
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
"@lexical/
|
|
28
|
-
"@lexical/
|
|
29
|
-
"@lexical/
|
|
30
|
-
"@lexical/
|
|
31
|
-
"@
|
|
32
|
-
"@
|
|
33
|
-
"
|
|
34
|
-
"
|
|
35
|
-
"
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
"@lexical/
|
|
39
|
-
"
|
|
40
|
-
"react": "
|
|
41
|
-
"
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
"@
|
|
47
|
-
"
|
|
48
|
-
"
|
|
49
|
-
"
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
"
|
|
53
|
-
"@
|
|
54
|
-
"@
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
"
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
"
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
"
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
"
|
|
74
|
-
"
|
|
75
|
-
},
|
|
76
|
-
"./
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
"
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
"
|
|
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
|
|
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-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
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
|
+
}
|
package/src/editor-x/plugins.tsx
CHANGED
|
@@ -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=
|
|
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
|
|