@thangph2146/lexical-editor 0.0.1
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 +33121 -0
- package/dist/editor-x/editor.cjs.map +1 -0
- package/dist/editor-x/editor.css +2854 -0
- package/dist/editor-x/editor.css.map +1 -0
- package/dist/editor-x/editor.d.cts +12 -0
- package/dist/editor-x/editor.d.ts +12 -0
- package/dist/editor-x/editor.js +33095 -0
- package/dist/editor-x/editor.js.map +1 -0
- package/dist/index.cjs +33210 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.css +2854 -0
- package/dist/index.css.map +1 -0
- package/dist/index.d.cts +15 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.js +33183 -0
- package/dist/index.js.map +1 -0
- package/package.json +84 -0
- package/src/components/lexical-editor.tsx +123 -0
- package/src/context/editor-container-context.tsx +29 -0
- package/src/context/priority-image-context.tsx +7 -0
- package/src/context/toolbar-context.tsx +60 -0
- package/src/context/uploads-context.tsx +53 -0
- package/src/editor-hooks/use-debounce.ts +80 -0
- package/src/editor-hooks/use-modal.tsx +64 -0
- package/src/editor-hooks/use-report.ts +57 -0
- package/src/editor-hooks/use-update-toolbar.ts +41 -0
- package/src/editor-ui/broken-image.tsx +18 -0
- package/src/editor-ui/caption-composer.tsx +45 -0
- package/src/editor-ui/code-button.tsx +75 -0
- package/src/editor-ui/color-picker.tsx +2010 -0
- package/src/editor-ui/content-editable.tsx +37 -0
- package/src/editor-ui/hooks/use-image-caption-controls.ts +118 -0
- package/src/editor-ui/hooks/use-image-node-interactions.ts +245 -0
- package/src/editor-ui/hooks/use-responsive-image-dimensions.ts +202 -0
- package/src/editor-ui/image-component.tsx +321 -0
- package/src/editor-ui/image-placeholder.tsx +57 -0
- package/src/editor-ui/image-resizer.tsx +499 -0
- package/src/editor-ui/image-sizing.ts +120 -0
- package/src/editor-ui/lazy-image.tsx +136 -0
- package/src/editor-x/editor.tsx +117 -0
- package/src/editor-x/nodes.ts +79 -0
- package/src/editor-x/plugins.tsx +380 -0
- package/src/hooks/use-click-outside.ts +27 -0
- package/src/hooks/use-element-size.ts +54 -0
- package/src/hooks/use-header-height.ts +95 -0
- package/src/hooks/use-isomorphic-layout-effect.ts +4 -0
- package/src/index.ts +4 -0
- package/src/lib/logger.ts +6 -0
- package/src/lib/utils.ts +19 -0
- package/src/nodes/autocomplete-node.tsx +94 -0
- package/src/nodes/embeds/tweet-node.tsx +224 -0
- package/src/nodes/embeds/youtube-node.tsx +519 -0
- package/src/nodes/emoji-node.tsx +83 -0
- package/src/nodes/image-node.tsx +328 -0
- package/src/nodes/keyword-node.tsx +58 -0
- package/src/nodes/layout-container-node.tsx +128 -0
- package/src/nodes/layout-item-node.tsx +118 -0
- package/src/nodes/list-with-color-node.tsx +160 -0
- package/src/nodes/mention-node.ts +122 -0
- package/src/plugins/actions/actions-plugin.tsx +3 -0
- package/src/plugins/actions/character-limit-plugin.tsx +27 -0
- package/src/plugins/actions/clear-editor-plugin.tsx +70 -0
- package/src/plugins/actions/counter-character-plugin.tsx +80 -0
- package/src/plugins/actions/edit-mode-toggle-plugin.tsx +49 -0
- package/src/plugins/actions/import-export-plugin.tsx +61 -0
- package/src/plugins/actions/markdown-toggle-plugin.tsx +78 -0
- package/src/plugins/actions/max-length-plugin.tsx +59 -0
- package/src/plugins/actions/share-content-plugin.tsx +72 -0
- package/src/plugins/actions/speech-to-text-plugin.tsx +159 -0
- package/src/plugins/actions/tree-view-plugin.tsx +63 -0
- package/src/plugins/align-plugin.tsx +86 -0
- package/src/plugins/auto-link-plugin.tsx +34 -0
- package/src/plugins/autocomplete-plugin.tsx +2574 -0
- package/src/plugins/code-action-menu-plugin.tsx +240 -0
- package/src/plugins/code-highlight-plugin.tsx +22 -0
- package/src/plugins/component-picker-menu-plugin.tsx +427 -0
- package/src/plugins/context-menu-plugin.tsx +311 -0
- package/src/plugins/drag-drop-paste-plugin.tsx +52 -0
- package/src/plugins/draggable-block-plugin.tsx +50 -0
- package/src/plugins/embeds/auto-embed-plugin.tsx +324 -0
- package/src/plugins/embeds/twitter-plugin.tsx +45 -0
- package/src/plugins/embeds/youtube-plugin.tsx +84 -0
- package/src/plugins/emoji-picker-plugin.tsx +206 -0
- package/src/plugins/emojis-plugin.tsx +84 -0
- package/src/plugins/floating-link-editor-plugin.tsx +791 -0
- package/src/plugins/floating-text-format-plugin.tsx +710 -0
- package/src/plugins/images-plugin.tsx +671 -0
- package/src/plugins/keywords-plugin.tsx +59 -0
- package/src/plugins/layout-plugin.tsx +658 -0
- package/src/plugins/link-plugin.tsx +18 -0
- package/src/plugins/list-color-plugin.tsx +178 -0
- package/src/plugins/list-max-indent-level-plugin.tsx +85 -0
- package/src/plugins/mentions-plugin.tsx +714 -0
- package/src/plugins/picker/alignment-picker-plugin.tsx +40 -0
- package/src/plugins/picker/bulleted-list-picker-plugin.tsx +14 -0
- package/src/plugins/picker/check-list-picker-plugin.tsx +14 -0
- package/src/plugins/picker/code-picker-plugin.tsx +30 -0
- package/src/plugins/picker/columns-layout-picker-plugin.tsx +16 -0
- package/src/plugins/picker/component-picker-option.tsx +47 -0
- package/src/plugins/picker/divider-picker-plugin.tsx +14 -0
- package/src/plugins/picker/embeds-picker-plugin.tsx +24 -0
- package/src/plugins/picker/heading-picker-plugin.tsx +32 -0
- package/src/plugins/picker/image-picker-plugin.tsx +16 -0
- package/src/plugins/picker/numbered-list-picker-plugin.tsx +14 -0
- package/src/plugins/picker/paragraph-picker-plugin.tsx +20 -0
- package/src/plugins/picker/quote-picker-plugin.tsx +21 -0
- package/src/plugins/picker/table-picker-plugin.tsx +56 -0
- package/src/plugins/tab-focus-plugin.tsx +66 -0
- package/src/plugins/table-column-resizer-plugin.tsx +309 -0
- package/src/plugins/table-plugin.tsx +299 -0
- package/src/plugins/toolbar/block-format/block-format-data.tsx +69 -0
- package/src/plugins/toolbar/block-format/format-bulleted-list.tsx +40 -0
- package/src/plugins/toolbar/block-format/format-check-list.tsx +40 -0
- package/src/plugins/toolbar/block-format/format-code-block.tsx +45 -0
- package/src/plugins/toolbar/block-format/format-heading.tsx +34 -0
- package/src/plugins/toolbar/block-format/format-list-with-marker.tsx +74 -0
- package/src/plugins/toolbar/block-format/format-numbered-list.tsx +40 -0
- package/src/plugins/toolbar/block-format/format-paragraph.tsx +31 -0
- package/src/plugins/toolbar/block-format/format-quote.tsx +32 -0
- package/src/plugins/toolbar/block-format-toolbar-plugin.tsx +117 -0
- package/src/plugins/toolbar/block-insert/insert-columns-layout.tsx +32 -0
- package/src/plugins/toolbar/block-insert/insert-embeds.tsx +31 -0
- package/src/plugins/toolbar/block-insert/insert-horizontal-rule.tsx +30 -0
- package/src/plugins/toolbar/block-insert/insert-image.tsx +32 -0
- package/src/plugins/toolbar/block-insert/insert-table.tsx +32 -0
- package/src/plugins/toolbar/block-insert-plugin.tsx +30 -0
- package/src/plugins/toolbar/clear-formatting-toolbar-plugin.tsx +92 -0
- package/src/plugins/toolbar/code-language-toolbar-plugin.tsx +121 -0
- package/src/plugins/toolbar/element-format-toolbar-plugin.tsx +251 -0
- package/src/plugins/toolbar/font-background-toolbar-plugin.tsx +179 -0
- package/src/plugins/toolbar/font-color-toolbar-plugin.tsx +101 -0
- package/src/plugins/toolbar/font-family-toolbar-plugin.tsx +91 -0
- package/src/plugins/toolbar/font-format-toolbar-plugin.tsx +85 -0
- package/src/plugins/toolbar/font-size-toolbar-plugin.tsx +177 -0
- package/src/plugins/toolbar/history-toolbar-plugin.tsx +87 -0
- package/src/plugins/toolbar/link-toolbar-plugin.tsx +90 -0
- package/src/plugins/toolbar/subsuper-toolbar-plugin.tsx +69 -0
- package/src/plugins/toolbar/toolbar-plugin.tsx +66 -0
- package/src/plugins/typing-pref-plugin.tsx +118 -0
- package/src/shared/can-use-dom.ts +4 -0
- package/src/shared/environment.ts +47 -0
- package/src/shared/invariant.ts +16 -0
- package/src/shared/use-layout-effect.ts +12 -0
- package/src/themes/_mixins.scss +107 -0
- package/src/themes/_variables.scss +33 -0
- package/src/themes/editor-theme.scss +622 -0
- package/src/themes/editor-theme.ts +118 -0
- package/src/themes/plugins.scss +1180 -0
- package/src/themes/ui-components.scss +936 -0
- package/src/transformers/markdown-emoji-transformer.ts +20 -0
- package/src/transformers/markdown-hr-transformer.ts +28 -0
- package/src/transformers/markdown-image-transformer.ts +31 -0
- package/src/transformers/markdown-list-transformer.ts +51 -0
- package/src/transformers/markdown-table-transformer.ts +200 -0
- package/src/transformers/markdown-tweet-transformer.ts +26 -0
- package/src/ui/button-group.tsx +10 -0
- package/src/ui/button.tsx +29 -0
- package/src/ui/collapsible.tsx +67 -0
- package/src/ui/command.tsx +48 -0
- package/src/ui/dialog.tsx +146 -0
- package/src/ui/flex.tsx +38 -0
- package/src/ui/input.tsx +20 -0
- package/src/ui/label.tsx +20 -0
- package/src/ui/popover.tsx +128 -0
- package/src/ui/scroll-area.tsx +17 -0
- package/src/ui/select.tsx +171 -0
- package/src/ui/separator.tsx +20 -0
- package/src/ui/slider.tsx +14 -0
- package/src/ui/slot.tsx +3 -0
- package/src/ui/tabs.tsx +87 -0
- package/src/ui/toggle-group.tsx +109 -0
- package/src/ui/toggle.tsx +28 -0
- package/src/ui/tooltip.tsx +28 -0
- package/src/ui/typography.tsx +44 -0
- package/src/utils/doc-serialization.ts +68 -0
- package/src/utils/emoji-list.ts +16604 -0
- package/src/utils/get-dom-range-rect.ts +20 -0
- package/src/utils/get-selected-node.ts +20 -0
- package/src/utils/is-mobile-width.ts +0 -0
- package/src/utils/set-floating-elem-position-for-link-editor.ts +39 -0
- package/src/utils/set-floating-elem-position.ts +44 -0
- package/src/utils/swipe.ts +119 -0
- package/src/utils/url.ts +32 -0
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { EditorThemeClasses } from "lexical"
|
|
2
|
+
|
|
3
|
+
import "./editor-theme.scss"
|
|
4
|
+
|
|
5
|
+
export const editorTheme: EditorThemeClasses = {
|
|
6
|
+
ltr: "editor-ltr",
|
|
7
|
+
rtl: "editor-rtl",
|
|
8
|
+
heading: {
|
|
9
|
+
h1: "editor-h1",
|
|
10
|
+
h2: "editor-h2",
|
|
11
|
+
h3: "editor-h3",
|
|
12
|
+
h4: "editor-h4",
|
|
13
|
+
h5: "editor-h5",
|
|
14
|
+
h6: "editor-h6",
|
|
15
|
+
},
|
|
16
|
+
paragraph: "editor-paragraph",
|
|
17
|
+
quote: "editor-quote",
|
|
18
|
+
link: "editor-link",
|
|
19
|
+
list: {
|
|
20
|
+
checklist: "editor-checklist",
|
|
21
|
+
listitem: "editor-listitem",
|
|
22
|
+
listitemChecked: "editor-listitem-checked",
|
|
23
|
+
listitemUnchecked: "editor-listitem-unchecked",
|
|
24
|
+
nested: {
|
|
25
|
+
listitem: "editor-nested-listitem",
|
|
26
|
+
},
|
|
27
|
+
ol: "editor-ol",
|
|
28
|
+
olDepth: [
|
|
29
|
+
"editor-ol-depth-1",
|
|
30
|
+
"editor-ol-depth-2",
|
|
31
|
+
"editor-ol-depth-3",
|
|
32
|
+
"editor-ol-depth-4",
|
|
33
|
+
"editor-ol-depth-5",
|
|
34
|
+
],
|
|
35
|
+
ul: "editor-ul",
|
|
36
|
+
ulDepth: [
|
|
37
|
+
"editor-ul-depth-1",
|
|
38
|
+
"editor-ul-depth-2",
|
|
39
|
+
"editor-ul-depth-3",
|
|
40
|
+
"editor-ul-depth-4",
|
|
41
|
+
"editor-ul-depth-5",
|
|
42
|
+
],
|
|
43
|
+
},
|
|
44
|
+
hashtag: "editor-hashtag",
|
|
45
|
+
text: {
|
|
46
|
+
bold: "editor-text-bold",
|
|
47
|
+
code: "editor-text-code",
|
|
48
|
+
italic: "editor-text-italic",
|
|
49
|
+
strikethrough: "editor-text-strikethrough",
|
|
50
|
+
subscript: "editor-text-subscript",
|
|
51
|
+
superscript: "editor-text-superscript",
|
|
52
|
+
underline: "editor-text-underline",
|
|
53
|
+
underlineStrikethrough: "editor-text-underline-strikethrough",
|
|
54
|
+
},
|
|
55
|
+
textAlign: {
|
|
56
|
+
left: "editor-text-align-left",
|
|
57
|
+
center: "editor-text-align-center",
|
|
58
|
+
right: "editor-text-align-right",
|
|
59
|
+
justify: "editor-text-align-justify",
|
|
60
|
+
},
|
|
61
|
+
image: "editor-image",
|
|
62
|
+
inlineImage: "editor-inline-image",
|
|
63
|
+
code: "editor-code",
|
|
64
|
+
codeHighlight: {
|
|
65
|
+
atrule: "editor-token--keyword",
|
|
66
|
+
attr: "editor-token--attr-name",
|
|
67
|
+
boolean: "editor-token--property",
|
|
68
|
+
builtin: "editor-token--selector",
|
|
69
|
+
cdata: "editor-token--comment",
|
|
70
|
+
char: "editor-token--selector",
|
|
71
|
+
class: "editor-token--function",
|
|
72
|
+
"class-name": "editor-token--function",
|
|
73
|
+
comment: "editor-token--comment",
|
|
74
|
+
constant: "editor-token--property",
|
|
75
|
+
deleted: "editor-token--property",
|
|
76
|
+
doctype: "editor-token--comment",
|
|
77
|
+
entity: "editor-token--operator",
|
|
78
|
+
function: "editor-token--function",
|
|
79
|
+
important: "editor-token--variable",
|
|
80
|
+
inserted: "editor-token--selector",
|
|
81
|
+
keyword: "editor-token--keyword",
|
|
82
|
+
namespace: "editor-token--variable",
|
|
83
|
+
number: "editor-token--property",
|
|
84
|
+
operator: "editor-token--operator",
|
|
85
|
+
prolog: "editor-token--comment",
|
|
86
|
+
property: "editor-token--property",
|
|
87
|
+
punctuation: "editor-token--punctuation",
|
|
88
|
+
regex: "editor-token--variable",
|
|
89
|
+
selector: "editor-token--selector",
|
|
90
|
+
string: "editor-token--string",
|
|
91
|
+
symbol: "editor-token--property",
|
|
92
|
+
tag: "editor-token--property",
|
|
93
|
+
url: "editor-token--operator",
|
|
94
|
+
variable: "editor-token--variable",
|
|
95
|
+
},
|
|
96
|
+
table: "editor-table",
|
|
97
|
+
tableCell: "editor-table-cell",
|
|
98
|
+
tableCellActionButton: "editor-table-cell-action-button",
|
|
99
|
+
tableCellActionButtonContainer: "editor-table-cell-action-button-container",
|
|
100
|
+
tableCellEditing: "editor-table-cell-editing",
|
|
101
|
+
tableCellHeader: "editor-table-cell-header",
|
|
102
|
+
tableCellPrimarySelected: "editor-table-cell-primary-selected",
|
|
103
|
+
tableCellResizer: "editor-table-cell-resizer",
|
|
104
|
+
tableCellSelected: "editor-table-cell-selected",
|
|
105
|
+
tableCellSortedIndicator: "editor-table-cell-sorted-indicator",
|
|
106
|
+
tableResizeRuler: "editor-table-cell-resize-ruler",
|
|
107
|
+
tableRowStriping: "editor-table-row-striping",
|
|
108
|
+
tableSelected: "editor-table-selected",
|
|
109
|
+
tableSelection: "editor-table-selection",
|
|
110
|
+
layoutItem: "editor-layout-item",
|
|
111
|
+
layoutContainer: "editor-layout-container",
|
|
112
|
+
autocomplete: "editor-autocomplete",
|
|
113
|
+
embedBlock: {
|
|
114
|
+
base: "editor-embed-block",
|
|
115
|
+
focus: "editor-embed-block-focused",
|
|
116
|
+
},
|
|
117
|
+
hr: "editor-hr",
|
|
118
|
+
}
|