@innoviatech/lexical-text-editor 2.0.2 → 2.0.3

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": "@innoviatech/lexical-text-editor",
3
- "version": "2.0.2",
3
+ "version": "2.0.3",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.esm.js",
@@ -21,7 +21,7 @@ export function AlignmentSelectionList({ onAction, alignmentSelectionMap }: Prop
21
21
  <Popover open={isOpen} onOpenChange={setIsOpen}>
22
22
  <PopoverTrigger triggerRef={triggerRef}>
23
23
 
24
- <button
24
+ <button type="button"
25
25
  className={`lexical-btn heading-trigger ${isOpen ? "toolbar-active" : "toolbar"}`}
26
26
  onClick={() => setIsOpen((prev) => !prev)}
27
27
  style={{
@@ -40,7 +40,7 @@ export function AlignmentSelectionList({ onAction, alignmentSelectionMap }: Prop
40
40
  }}>
41
41
  {
42
42
  RICH_ALIGNMENT_OPTIONS.map(({ id, label, icon }) => (
43
- <button
43
+ <button type="button"
44
44
  key={id}
45
45
  className={`lexical-btn ${alignmentSelectionMap[id] ? "toolbar-active" : "toolbar"
46
46
  }`}
@@ -32,7 +32,7 @@ export default function ColorPicker({ color, onChange, icon }: ColorPickerProps)
32
32
 
33
33
  return (
34
34
  <div className="color-picker-wrapper">
35
- <button
35
+ <button type="button"
36
36
  ref={triggerRef}
37
37
  className={`size-8 lexical-btn ${open ? "toolbarActive" : "toolbar"} icon`}
38
38
  onClick={() => setOpen((prev) => !prev)}
@@ -25,11 +25,12 @@ export default function ContentPreviewDialog({
25
25
  triggerLabel = "Preview",
26
26
  }: ContentPreviewDialogProps) {
27
27
  const [isOpen, setIsOpen] = useState(false);
28
+ console.log(value);
28
29
  return (
29
30
  <div className="lexical-text-editor-dialog">
30
31
  {/* Trigger button */}
31
32
 
32
- <button
33
+ <button type="button"
33
34
  className={`lexical-btn heading-trigger ${isOpen ? "toolbar-active" : "toolbar"}`}
34
35
  onClick={() => setIsOpen((prev) => !prev)}
35
36
  >
@@ -16,7 +16,7 @@ export function DropdownList({ onAction, selectionMap }: Props) {
16
16
  return (
17
17
  <Popover open={isOpen} onOpenChange={setIsOpen}>
18
18
  <PopoverTrigger triggerRef={triggerRef}>
19
- <button
19
+ <button type="button"
20
20
  className={`lexical-btn heading-trigger ${isOpen ? "toolbar-active" : "toolbar"}`}
21
21
  onClick={() => setIsOpen((prev) => !prev)}
22
22
  >
@@ -32,7 +32,7 @@ export function DropdownList({ onAction, selectionMap }: Props) {
32
32
  >
33
33
  {
34
34
  RICH_TEXT_FORMAT_OPTIONS.map(({ id, label, icon }) => (
35
- <button
35
+ <button type="button"
36
36
  key={id}
37
37
  className={`lexical-btn ${selectionMap[id] ? "toolbar-active" : "toolbar"
38
38
  }`}
@@ -21,7 +21,7 @@ export function HeadingSelectionList({ updateHeading, headingSelectionMap }: Pro
21
21
  return (
22
22
  <Popover open={open} onOpenChange={setOpen}>
23
23
  <PopoverTrigger triggerRef={triggerRef}>
24
- <button
24
+ <button type="button"
25
25
  className={`lexical-btn heading-trigger ${open ? "toolbar-active" : "toolbar"}`}
26
26
  onClick={() => setOpen((prev) => !prev)}
27
27
  style={{
@@ -40,7 +40,7 @@ export function HeadingSelectionList({ updateHeading, headingSelectionMap }: Pro
40
40
  display: 'flex', flexDirection: 'column', gap: 5
41
41
  }}>
42
42
  {HEADINGS.map(({ id, label, icon }) => (
43
- <button
43
+ <button type="button"
44
44
  key={id}
45
45
  className={`lexical-btn ${headingSelectionMap[id] ? "toolbar-active" : "toolbar"
46
46
  }`}
@@ -79,7 +79,7 @@ export default function LinkModal({
79
79
 
80
80
  <div className="link-editor-buttons">
81
81
 
82
- <button
82
+ <button type="button"
83
83
  className={`lexical-btn heading-trigger toolbar`}
84
84
  onClick={() => {
85
85
  if (isEditMode) {
@@ -91,7 +91,7 @@ export default function LinkModal({
91
91
  {isEditMode ? <MdCheck size={18} /> : <BsPencilSquare size={14} />}
92
92
  </button>
93
93
 
94
- <button
94
+ <button type="button"
95
95
  className={`lexical-btn heading-trigger toolbar`}
96
96
  onMouseDown={(e) => e.preventDefault()}
97
97
  onClick={removeLink}
@@ -101,7 +101,7 @@ export default function LinkModal({
101
101
 
102
102
 
103
103
 
104
- {/* <button
104
+ {/* <button type="button"
105
105
  onMouseDown={(e) => e.preventDefault()}
106
106
  onClick={() => {
107
107
  if (isEditMode) {
@@ -114,7 +114,7 @@ export default function LinkModal({
114
114
  {isEditMode ? <MdCheck size={18} /> : <BsPencilSquare size={14} />}
115
115
  </button> */}
116
116
 
117
- {/* <button
117
+ {/* <button type="button"
118
118
  onMouseDown={(e) => e.preventDefault()}
119
119
  onClick={removeLink}
120
120
  className={`size-8 toolbar icon`}
@@ -37,7 +37,7 @@ export default function RawDialog({ open, onClose, forPreview = false, children
37
37
  return (
38
38
  <div className="lexical-text-editor-dialog lte-dialog-overlay">
39
39
  <div ref={dialogRef} className={`lte-dialog ${forPreview ? 'preview' : ''}`}>
40
- <button className="lte-dialog-close" onClick={onClose}>
40
+ <button type="button" className="lte-dialog-close" onClick={onClose}>
41
41
  ×
42
42
  </button>
43
43
  {children}
@@ -29,7 +29,6 @@ export type ImageNodePayload = {
29
29
  };
30
30
 
31
31
 
32
-
33
32
  export const $createImageNode = (payload: ImageNodePayload) => {
34
33
  return $applyNodeReplacement(new ImageNode(payload));
35
34
  };
@@ -99,7 +98,6 @@ export class ImageNode extends DecoratorNode<JSX.Element> {
99
98
  this.__height = height;
100
99
  }
101
100
 
102
-
103
101
  static getType(): string {
104
102
  return "image";
105
103
  }
@@ -175,7 +173,6 @@ export class ImageNode extends DecoratorNode<JSX.Element> {
175
173
  });
176
174
  }
177
175
 
178
-
179
176
  updateDimensions(width: number, height: number) {
180
177
  const writable = this.getWritable();
181
178
  writable.__width = width;
@@ -46,7 +46,7 @@ export default function ImagePlugin() {
46
46
  />
47
47
 
48
48
  {/* Open dialog button */}
49
- <button
49
+ <button type="button"
50
50
  className={`size-8 lexical-btn ${isOpen ? "toolbarActive" : "toolbar"} icon`}
51
51
  onClick={() => setIsOpen((prev) => !prev)}
52
52
  >
@@ -78,7 +78,7 @@ export default function ImagePlugin() {
78
78
  <span>or</span>
79
79
  </div>
80
80
 
81
- {/* <button
81
+ {/* <button type="button"
82
82
  className="lte-outline-btn"
83
83
  onClick={() => inputRef.current?.click()}
84
84
  >
@@ -86,7 +86,7 @@ export default function ImagePlugin() {
86
86
  Upload Image
87
87
  </button> */}
88
88
 
89
- <button
89
+ <button type="button"
90
90
  className={`lexical-btn heading-trigger toolbar-active`}
91
91
  onClick={() => inputRef.current?.click()}
92
92
  style={{
@@ -104,7 +104,7 @@ export default function ImagePlugin() {
104
104
  </div>
105
105
 
106
106
  <div className="lte-dialog-footer">
107
- <button
107
+ <button type="button"
108
108
  className="lte-primary-btn"
109
109
  disabled={!url && !file}
110
110
  onClick={addImage}
@@ -34,7 +34,7 @@ export default function ListPlugin({ blockType }: ListPluginProps) {
34
34
  return (
35
35
  <>
36
36
  <TooltipX content="Ordered list" direction="bottom">
37
- <button
37
+ <button type="button"
38
38
  className={`size-8 lexical-btn ${blockType === "ol" ? "toolbarActive" : "toolbar"
39
39
  } icon`}
40
40
  onClick={handleOrderedList}
@@ -44,7 +44,7 @@ export default function ListPlugin({ blockType }: ListPluginProps) {
44
44
  </TooltipX>
45
45
 
46
46
  <TooltipX content="Unordered list" direction="bottom">
47
- <button
47
+ <button type="button"
48
48
  className={`size-8 lexical-btn ${blockType === "ul" ? "toolbarActive" : "toolbar"
49
49
  } icon`}
50
50
  onClick={handleUnorderedList}
@@ -392,7 +392,7 @@ export const ToolbarPlugin = ({ value }: { value: string }) => {
392
392
  RICH_REDO_UNDO_OPTIONS.map(({ id, label, icon }) => (
393
393
  id === RichTextAction.Divider ? <Separator key={id} /> :
394
394
  <TooltipX content={label} direction="bottom" key={label}>
395
- <button
395
+ <button type="button"
396
396
  className={`size-8 lexical-btn ${selectionMap[id] ? "toolbarActive" : "toolbar"
397
397
  } icon`}
398
398
  onClick={() => onAction(id)}
@@ -412,7 +412,7 @@ export const ToolbarPlugin = ({ value }: { value: string }) => {
412
412
  RICH_TEXT_OPTIONS.map(({ id, label, icon }) => (
413
413
  id === RichTextAction.Divider ? <Separator key={id} /> :
414
414
  <TooltipX key={id} content={label} direction="bottom">
415
- <button
415
+ <button type="button"
416
416
  className={`size-8 lexical-btn ${selectionMap[id] ? "toolbarActive" : "toolbar"
417
417
  } icon`}
418
418
  onClick={() => onAction(id)}
@@ -448,7 +448,7 @@ export const ToolbarPlugin = ({ value }: { value: string }) => {
448
448
 
449
449
 
450
450
  <TooltipX content="Link" direction="bottom">
451
- <button
451
+ <button type="button"
452
452
  className={`size-8 lexical-btn ${selectionMap[RichTextAction.Link] ? "toolbarActive" : "toolbar"
453
453
  } icon`}
454
454
  onClick={() => onAction(RichTextAction.Link)}
@@ -59,8 +59,7 @@ export default function VideoPlugin() {
59
59
  return (
60
60
  <div className="lexical-text-editor-dialog">
61
61
  {/* Open dialog button */}
62
- <button
63
- type="button"
62
+ <button type="button"
64
63
  className={`size-8 lexical-btn ${isOpen ? "toolbarActive" : "toolbar"} icon`}
65
64
  onClick={() => setIsOpen(true)}
66
65
  >
@@ -87,7 +86,7 @@ export default function VideoPlugin() {
87
86
  </div>
88
87
 
89
88
  <div className="lte-dialog-footer">
90
- <button
89
+ <button type="button"
91
90
  className="lte-primary-btn"
92
91
  disabled={!url}
93
92
  onClick={onEmbed}
@@ -1,16 +1,16 @@
1
1
 
2
+ /* Minimal Reset */
3
+
2
4
 
3
5
  .lexical-text-editor * {
4
6
  box-sizing: border-box;
5
7
  font-family: inherit;
6
8
  }
7
9
 
8
- .lexical-text-editor{
10
+ .lexical-text-editor {
9
11
  height: fit-content;
10
12
  }
11
13
 
12
-
13
-
14
14
  .lexical-text-editor button {
15
15
  background: transparent;
16
16
  border: 1px solid transparent;