@springmicro/rte 0.1.3 → 0.1.11

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.
Files changed (87) hide show
  1. package/README.md +57 -4
  2. package/dist/index.js +7361 -7279
  3. package/package.json +7 -3
  4. package/.eslintrc.cjs +0 -18
  5. package/dist/index.d.ts +0 -10
  6. package/dist/index.umd.cjs +0 -469
  7. package/index.html +0 -13
  8. package/src/App.css +0 -42
  9. package/src/App.tsx +0 -10
  10. package/src/contexts/color-context.tsx +0 -53
  11. package/src/hooks/useSimpleFormik.tsx +0 -74
  12. package/src/index.css +0 -68
  13. package/src/index.tsx +0 -3
  14. package/src/main.tsx +0 -10
  15. package/src/slate/base-editor.stories.tsx +0 -16
  16. package/src/slate/base-editor.tsx +0 -116
  17. package/src/slate/blog-rte.stories.tsx +0 -16
  18. package/src/slate/blog-rte.tsx +0 -126
  19. package/src/slate/common/button.tsx +0 -35
  20. package/src/slate/common/element.tsx +0 -13
  21. package/src/slate/common/icon.jsx +0 -97
  22. package/src/slate/components/code-to-text/CodeToTextButton.jsx +0 -19
  23. package/src/slate/components/code-to-text/HtmlCode.jsx +0 -64
  24. package/src/slate/components/code-to-text/HtmlContextMenu.jsx +0 -39
  25. package/src/slate/components/code-to-text/index.jsx +0 -111
  26. package/src/slate/components/color-picker/color-cursor.stories.tsx +0 -16
  27. package/src/slate/components/color-picker/color-cursor.tsx +0 -34
  28. package/src/slate/components/color-picker/color-formats-view.stories.tsx +0 -25
  29. package/src/slate/components/color-picker/color-formats-view.tsx +0 -115
  30. package/src/slate/components/color-picker/color-gradient.stories.tsx +0 -48
  31. package/src/slate/components/color-picker/color-gradient.tsx +0 -128
  32. package/src/slate/components/color-picker/color-hue.stories.tsx +0 -41
  33. package/src/slate/components/color-picker/color-hue.tsx +0 -110
  34. package/src/slate/components/color-picker/color-picker.stories.tsx +0 -25
  35. package/src/slate/components/color-picker/color-picker.tsx +0 -41
  36. package/src/slate/components/color-picker/color-popover.stories.tsx +0 -26
  37. package/src/slate/components/color-picker/color-popover.tsx +0 -58
  38. package/src/slate/components/color-picker/color-swatch.stories.tsx +0 -16
  39. package/src/slate/components/color-picker/color-swatch.tsx +0 -76
  40. package/src/slate/components/color-picker/default-colors.ts +0 -38
  41. package/src/slate/components/color-picker/slate-color-button.tsx +0 -128
  42. package/src/slate/components/embed/Embed.jsx +0 -96
  43. package/src/slate/components/embed/Image.jsx +0 -45
  44. package/src/slate/components/embed/Video.jsx +0 -65
  45. package/src/slate/components/equation/Equation.jsx +0 -19
  46. package/src/slate/components/equation/EquationButton.jsx +0 -68
  47. package/src/slate/components/id/Id.jsx +0 -57
  48. package/src/slate/components/image/image.stories.tsx +0 -17
  49. package/src/slate/components/image/image.tsx +0 -62
  50. package/src/slate/components/image/insert-image-button.stories.tsx +0 -83
  51. package/src/slate/components/image/insert-image-button.tsx +0 -132
  52. package/src/slate/components/image/types.ts +0 -9
  53. package/src/slate/components/link/Link.jsx +0 -56
  54. package/src/slate/components/link/LinkButton.tsx +0 -106
  55. package/src/slate/components/table/Table.jsx +0 -11
  56. package/src/slate/components/table/TableSelector.jsx +0 -97
  57. package/src/slate/components/table-context-menu/TableContextMenu.tsx +0 -106
  58. package/src/slate/custom-types.d.ts +0 -152
  59. package/src/slate/editor.module.css +0 -226
  60. package/src/slate/paper-rte.stories.tsx +0 -16
  61. package/src/slate/paper-rte.tsx +0 -47
  62. package/src/slate/plugins/withEmbeds.js +0 -33
  63. package/src/slate/plugins/withEquation.js +0 -8
  64. package/src/slate/plugins/withImages.ts +0 -69
  65. package/src/slate/plugins/withLinks.js +0 -9
  66. package/src/slate/plugins/withTable.js +0 -74
  67. package/src/slate/serializers/generic.ts +0 -44
  68. package/src/slate/serializers/types.ts +0 -20
  69. package/src/slate/toolbar/index.tsx +0 -186
  70. package/src/slate/toolbar/paper-toolbar.tsx +0 -494
  71. package/src/slate/toolbar/shortcuts.tsx +0 -77
  72. package/src/slate/toolbar/toolbar-groups.ts +0 -213
  73. package/src/slate/types/index.ts +0 -0
  74. package/src/slate/utils/customHooks/useContextMenu.js +0 -42
  75. package/src/slate/utils/customHooks/useFormat.js +0 -26
  76. package/src/slate/utils/customHooks/usePopup.jsx +0 -26
  77. package/src/slate/utils/customHooks/useResize.js +0 -27
  78. package/src/slate/utils/embed.js +0 -18
  79. package/src/slate/utils/equation.js +0 -22
  80. package/src/slate/utils/index.jsx +0 -267
  81. package/src/slate/utils/link.js +0 -44
  82. package/src/slate/utils/p.js +0 -4
  83. package/src/slate/utils/table.js +0 -131
  84. package/src/vite-env.d.ts +0 -1
  85. package/tsconfig.json +0 -32
  86. package/tsconfig.node.json +0 -10
  87. package/vite.config.ts +0 -41
@@ -1,213 +0,0 @@
1
- export type ToolbarGroup = {
2
- id: number;
3
- format: string;
4
- type: string;
5
- options?: Array<{ text: string; value: string }>;
6
- };
7
-
8
- const fonts: ToolbarGroup[] = [
9
- {
10
- id: 1,
11
- format: "fontFamily",
12
- type: "dropdown",
13
- options: [
14
- { text: "Sans Serif", value: "sans-serif" },
15
- { text: "Serif", value: "serif" },
16
- { text: "MonoSpace", value: "monospace" },
17
- ],
18
- },
19
- {
20
- id: 2,
21
- format: "fontSize",
22
- type: "dropdown",
23
- options: [
24
- { text: "Small", value: "small" },
25
- { text: "Normal", value: "normal" },
26
- { text: "Medium", value: "medium" },
27
- { text: "Huge", value: "huge" },
28
- ],
29
- },
30
- ];
31
-
32
- const fontStyles: ToolbarGroup[] = [
33
- {
34
- id: 3,
35
- format: "bold",
36
- type: "mark",
37
- },
38
- {
39
- id: 4,
40
- format: "italic",
41
- type: "mark",
42
- },
43
- {
44
- id: 5,
45
- format: "underline",
46
- type: "mark",
47
- },
48
- {
49
- id: 6,
50
- format: "strikethrough",
51
- type: "mark",
52
- },
53
- ];
54
-
55
- const colors: ToolbarGroup[] = [
56
- {
57
- id: 7,
58
- format: "color",
59
- type: "color-picker",
60
- },
61
- {
62
- id: 8,
63
- format: "bgColor",
64
- type: "color-picker",
65
- },
66
- ];
67
-
68
- const subsuper: ToolbarGroup[] = [
69
- {
70
- id: 9,
71
- format: "superscript",
72
- type: "mark",
73
- },
74
- {
75
- id: 10,
76
- format: "subscript",
77
- type: "mark",
78
- },
79
- ];
80
-
81
- const headings: ToolbarGroup[] = [
82
- {
83
- id: 11,
84
- format: "h1",
85
- type: "block",
86
- },
87
- {
88
- id: 12,
89
- format: "h2",
90
- type: "block",
91
- },
92
- {
93
- id: 13,
94
- format: "h3",
95
- type: "block",
96
- },
97
- {
98
- id: 14,
99
- format: "blockquote",
100
- type: "block",
101
- },
102
- ];
103
-
104
- const lists: ToolbarGroup[] = [
105
- {
106
- id: 15,
107
- format: "orderedList",
108
- type: "block",
109
- },
110
- {
111
- id: 16,
112
- format: "unorderedList",
113
- type: "block",
114
- },
115
- ];
116
-
117
- const align: ToolbarGroup[] = [
118
- {
119
- id: 17,
120
- format: "alignLeft",
121
- type: "block",
122
- },
123
- {
124
- id: 18,
125
- format: "alignCenter",
126
- type: "block",
127
- },
128
- {
129
- id: 19,
130
- format: "alignRight",
131
- type: "block",
132
- },
133
- ];
134
- const links: ToolbarGroup[] = [
135
- {
136
- id: 20,
137
- format: "link",
138
- type: "link",
139
- },
140
- ];
141
-
142
- const images: ToolbarGroup[] = [
143
- {
144
- id: 21,
145
- format: "image",
146
- type: "image",
147
- },
148
- ];
149
-
150
- // const embed = [
151
- // {
152
- // id: 21,
153
- // format: "image",
154
- // type: "embed",
155
- // },
156
- // {
157
- // id: 22,
158
- // format: "video",
159
- // type: "embed",
160
- // },
161
- // ]
162
- const tables: ToolbarGroup[] = [
163
- {
164
- id: 23,
165
- type: "table",
166
- format: "table",
167
- },
168
- ];
169
-
170
- // Not currently serialized
171
- // const mathAndCode: ToolbarGroup[] = [
172
- // {
173
- // id: 25,
174
- // type: "id",
175
- // },
176
- // {
177
- // id: 26,
178
- // type: "equation",
179
- // },
180
- // {
181
- // id: 27,
182
- // type: "codeToText",
183
- // },
184
- // ];
185
-
186
- export const allToolbarGroups = [
187
- fonts,
188
- headings,
189
- fontStyles,
190
- colors,
191
- subsuper,
192
- lists,
193
- align,
194
- links,
195
- images,
196
- tables,
197
- // mathAndCode,
198
- ];
199
-
200
- export const issuesToolbarGroups = [headings, fontStyles, lists, links];
201
-
202
- export const blogToolbarGroups = [
203
- headings,
204
- fonts,
205
- align,
206
- subsuper,
207
- tables,
208
- fontStyles,
209
- colors,
210
- lists,
211
- links,
212
- images,
213
- ];
File without changes
@@ -1,42 +0,0 @@
1
- import { useState, useEffect } from 'react';
2
- import useFormat from './useFormat.js';
3
-
4
-
5
- //This hook returns should we show the custom context menu and where to show it.
6
- const useContextMenu = (editor,format,setSelection) => {
7
- const isFormat = useFormat(editor,format);
8
- const [showMenu,setShowMenu] = useState(false);
9
- const [menuLocation,setMenuLocation] = useState({
10
- top:'0px',
11
- left:'0px'
12
- });
13
-
14
- const handleClick = ()=>{
15
- setShowMenu(false);
16
- }
17
- const handleContextMenu = (e) => {
18
- if(!isFormat) return;
19
- setSelection(editor.selection);
20
- e.preventDefault();
21
- setShowMenu(true);
22
- const xPos = e.pageX + "px";
23
- const yPos = e.pageY + "px";
24
- setMenuLocation({
25
- top:yPos,
26
- left:xPos
27
- })
28
- }
29
- useEffect(()=>{
30
- document.addEventListener('click',handleClick);
31
- document.addEventListener('contextmenu',handleContextMenu);
32
-
33
- return ()=>{
34
- document.removeEventListener('click',handleClick);
35
- document.removeEventListener('contextmenu',handleContextMenu);
36
- }
37
- },[isFormat])
38
-
39
- return [showMenu,menuLocation];
40
- }
41
-
42
- export default useContextMenu;
@@ -1,26 +0,0 @@
1
- import { useEffect, useState } from 'react';
2
- import { Editor, Element } from 'slate'
3
-
4
-
5
- // This hook returns if the node in the current selection matches the format passed to it.
6
- const useFormat = (editor,format)=>{
7
- const [isFormat,setIsFormat] = useState(false);
8
- useEffect(()=>{
9
- if(editor.selection){
10
- // It matches at the editor.selection location by default, so if null handle it seperately.
11
- const [node] = Editor.nodes(editor,{
12
- match:n => !Editor.isEditor(n) && Element.isElement(n) && n.type === format
13
- })
14
-
15
- setIsFormat(!!node);
16
- }
17
- else{
18
- setIsFormat(false);
19
- }
20
- // eslint-disable-next-line react-hooks/exhaustive-deps
21
- },[editor.selection])
22
-
23
- return isFormat;
24
- }
25
-
26
- export default useFormat;
@@ -1,26 +0,0 @@
1
- import { useState, useEffect } from 'react'
2
-
3
- //This hook returns if the click was inside the popUp ref or outside it .
4
- function usePopup(popupRef) {
5
- const [showPopup,setShowPopup] = useState(false);
6
-
7
- useEffect(()=>{
8
- const handleDocumentClick = (e)=>{
9
- const clickedComponent = e.target;
10
- if(!popupRef?.current?.contains(clickedComponent)){
11
- setShowPopup(false);
12
- }
13
- }
14
- document.addEventListener('click',handleDocumentClick);
15
-
16
- return ()=>{
17
- document.removeEventListener('click',handleDocumentClick)
18
- }
19
- // eslint-disable-next-line react-hooks/exhaustive-deps
20
- }, [])
21
-
22
- return [showPopup,setShowPopup];
23
- }
24
-
25
- export default usePopup
26
-
@@ -1,27 +0,0 @@
1
- import { useState } from 'react';
2
-
3
- const useResize = ()=>{
4
- const [size,setSize] = useState({width:300,height:300});
5
- const [resizing,setResizing] = useState(false);
6
- const onMouseDown = ()=>{
7
- document.addEventListener("mousemove", onMouseMove);
8
- document.addEventListener("mouseup", onMouseUp);
9
- setResizing(true);
10
- }
11
- const onMouseUp = () =>{
12
- document.removeEventListener("mousemove", onMouseMove);
13
- document.removeEventListener("mouseup", onMouseUp);
14
- setResizing(false);
15
- }
16
- const onMouseMove = (e) => {
17
- setSize(currentSize => ({
18
- width: currentSize.width + e.movementX ,
19
- height: currentSize.height + e.movementY
20
- }));
21
- }
22
-
23
- return [size,onMouseDown,resizing];
24
- }
25
-
26
-
27
- export default useResize;
@@ -1,18 +0,0 @@
1
- import { Transforms } from "slate"
2
-
3
- import { createParagraph } from "./p"
4
- export const createEmbedNode = (type, { url, alt }) => ({
5
- type,
6
- alt,
7
- url,
8
- children: [{ text: "" }],
9
- })
10
-
11
- export const insertEmbed = (editor, embedData, format) => {
12
- const { url } = embedData
13
- if (!url) return
14
- const embed = createEmbedNode(format, embedData)
15
-
16
- Transforms.insertNodes(editor, embed, { select: true })
17
- Transforms.insertNodes(editor, createParagraph(""))
18
- }
@@ -1,22 +0,0 @@
1
- import { Transforms, Range } from "slate";
2
-
3
- const createEquationNode = (math,inline) =>({
4
- type:'equation',
5
- inline,
6
- math,
7
- children:[{text:''}]
8
- })
9
-
10
- export const insertEquation = (editor,math,inline) =>{
11
- const equation = createEquationNode(math,inline);
12
-
13
- const {selection} = editor;
14
- if(!!selection){
15
- if(Range.isExpanded(selection)) Transforms.collapse(editor,{edge:'end'});
16
-
17
- Transforms.insertNodes(editor,equation,{select:true})
18
- }
19
-
20
-
21
-
22
- }
@@ -1,267 +0,0 @@
1
- import { Editor, Transforms, Element as SlateElement } from "slate";
2
- import { useSlateStatic } from "slate-react";
3
- import Link from "../components/link/Link";
4
- import Image from "../components/image/image";
5
- import Video from "../components/embed/Video";
6
- import Equation from "../components/equation/Equation";
7
- import HtmlCode from "../components/code-to-text/HtmlCode";
8
- import Table from "../components/table/Table";
9
-
10
- const alignment = ["alignLeft", "alignRight", "alignCenter"];
11
- const list_types = ["orderedList", "unorderedList"];
12
-
13
- export const sizeMap = {
14
- small: "0.75em",
15
- normal: "1em",
16
- medium: "1.75em",
17
- huge: "2.5em",
18
- };
19
- export const fontFamilyMap = {
20
- sans: "Helvetica, Arial, sans serif",
21
- serif: "Georgia, Times New Roman, serif",
22
- monospace: "Monaco, Courier New, monospace",
23
- };
24
-
25
- export const defaultMarkData = {
26
- color: "black",
27
- bgColor: "yellow",
28
- fontSize: "normal",
29
- fontFamily: "sans-serif",
30
- };
31
-
32
- export const toggleBlock = (editor, format) => {
33
- const isActive = isBlockActive(editor, format);
34
- const isList = list_types.includes(format);
35
- const isIndent = alignment.includes(format);
36
- const isAligned = alignment.some((alignmentType) =>
37
- isBlockActive(editor, alignmentType)
38
- );
39
-
40
- /*If the node is already aligned and change in indent is called we should unwrap it first and split the node to prevent
41
- messy, nested DOM structure and bugs due to that.*/
42
- if (isAligned && isIndent) {
43
- Transforms.unwrapNodes(editor, {
44
- match: (n) =>
45
- alignment.includes(
46
- !Editor.isEditor(n) && SlateElement.isElement(n) && n.type
47
- ),
48
- split: true,
49
- });
50
- }
51
-
52
- /* Wraping the nodes for alignment, to allow it to co-exist with other block level operations*/
53
- if (isIndent) {
54
- Transforms.wrapNodes(editor, {
55
- type: format,
56
- children: [],
57
- });
58
- return;
59
- }
60
- Transforms.unwrapNodes(editor, {
61
- match: (n) =>
62
- list_types.includes(
63
- !Editor.isEditor(n) && SlateElement.isElement(n) && n.type
64
- ),
65
- split: true,
66
- });
67
-
68
- Transforms.setNodes(editor, {
69
- type: isActive ? "p" : isList ? "list-item" : format,
70
- });
71
-
72
- if (isList && !isActive) {
73
- Transforms.wrapNodes(editor, {
74
- type: format,
75
- children: [],
76
- });
77
- }
78
- };
79
- export const addMarkData = (editor, data) => {
80
- Editor.addMark(editor, data.format, data.value);
81
- };
82
- export const toggleMark = (editor, format) => {
83
- const isActive = isMarkActive(editor, format);
84
-
85
- if (isActive) {
86
- Editor.removeMark(editor, format);
87
- } else {
88
- Editor.addMark(editor, format, true);
89
- }
90
- };
91
- export const isMarkActive = (editor, format) => {
92
- const marks = Editor.marks(editor);
93
-
94
- return marks ? marks[format] === true : false;
95
- };
96
-
97
- export const isBlockActive = (editor, format) => {
98
- const [match] = Editor.nodes(editor, {
99
- match: (n) =>
100
- !Editor.isEditor(n) && SlateElement.isElement(n) && n.type === format,
101
- });
102
-
103
- return !!match;
104
- };
105
-
106
- export const activeMark = (editor, format) => {
107
- const marks = Editor.marks(editor);
108
- const defaultValue = defaultMarkData[format];
109
- return marks?.[format] ?? defaultValue;
110
- };
111
-
112
- export const getMarked = (leaf, children) => {
113
- if (leaf.bold) {
114
- children = <strong>{children}</strong>;
115
- }
116
-
117
- if (leaf.code) {
118
- children = <code>{children}</code>;
119
- }
120
-
121
- if (leaf.italic) {
122
- children = <em>{children}</em>;
123
- }
124
- if (leaf.strikethrough) {
125
- children = (
126
- <span style={{ textDecoration: "line-through" }}>{children}</span>
127
- );
128
- }
129
- if (leaf.underline) {
130
- children = <u>{children}</u>;
131
- }
132
- if (leaf.superscript) {
133
- children = <sup>{children}</sup>;
134
- }
135
- if (leaf.subscript) {
136
- children = <sub>{children}</sub>;
137
- }
138
- if (leaf.color) {
139
- children = <span style={{ color: leaf.color }}>{children}</span>;
140
- }
141
- if (leaf.bgColor) {
142
- children = (
143
- <span style={{ backgroundColor: leaf.bgColor }}>{children}</span>
144
- );
145
- }
146
- if (leaf.fontSize) {
147
- const size = sizeMap[leaf.fontSize];
148
- children = <span style={{ fontSize: size }}>{children}</span>;
149
- }
150
- if (leaf.fontFamily) {
151
- const family = fontFamilyMap[leaf.fontFamily];
152
- children = <span style={{ fontFamily: family }}>{children}</span>;
153
- }
154
- return children;
155
- };
156
-
157
- export const getBlock = (props) => {
158
- const { element, children } = props;
159
- const attributes = props.attributes ?? {};
160
-
161
- switch (element.type) {
162
- case "h1":
163
- return (
164
- <h1 {...attributes} {...element.attr}>
165
- {children}
166
- </h1>
167
- );
168
- case "h2":
169
- return (
170
- <h2 {...attributes} {...element.attr}>
171
- {children}
172
- </h2>
173
- );
174
- case "h3":
175
- return (
176
- <h3 {...attributes} {...element.attr}>
177
- {children}
178
- </h3>
179
- );
180
- case "blockquote":
181
- return (
182
- <blockquote {...attributes} {...element.attr}>
183
- {children}
184
- </blockquote>
185
- );
186
- case "alignLeft":
187
- return (
188
- <div
189
- style={{ listStylePosition: "inside" }}
190
- {...attributes}
191
- {...element.attr}
192
- >
193
- {children}
194
- </div>
195
- );
196
- case "alignCenter":
197
- return (
198
- <div
199
- style={{
200
- display: "flex",
201
- alignItems: "center",
202
- listStylePosition: "inside",
203
- flexDirection: "column",
204
- }}
205
- {...attributes}
206
- {...element.attr}
207
- >
208
- {children}
209
- </div>
210
- );
211
- case "alignRight":
212
- return (
213
- <div
214
- style={{
215
- display: "flex",
216
- alignItems: "flex-end",
217
- listStylePosition: "inside",
218
- flexDirection: "column",
219
- }}
220
- {...attributes}
221
- {...element.attr}
222
- >
223
- {children}
224
- </div>
225
- );
226
- case "list-item":
227
- return (
228
- <li {...attributes} {...element.attr}>
229
- {children}
230
- </li>
231
- );
232
- case "orderedList":
233
- return (
234
- <ol type="1" {...attributes}>
235
- {children}
236
- </ol>
237
- );
238
- case "unorderedList":
239
- return <ul {...attributes}>{children}</ul>;
240
- case "link":
241
- return <Link {...props} />;
242
- case "table":
243
- return <Table {...props} />;
244
- case "table-row":
245
- return <tr {...attributes}>{children}</tr>;
246
- case "table-cell":
247
- return (
248
- <td {...element.attr} {...attributes}>
249
- {children}
250
- </td>
251
- );
252
- case "image":
253
- return <Image {...props} />;
254
- case "video":
255
- return <Video {...props} />;
256
- case "equation":
257
- return <Equation {...props} />;
258
- case "htmlCode":
259
- return <HtmlCode {...props} />;
260
- default:
261
- return (
262
- <div {...element.attr} {...attributes}>
263
- {children}
264
- </div>
265
- );
266
- }
267
- };
@@ -1,44 +0,0 @@
1
- import { Editor, Transforms, Path, Range, Element } from "slate"
2
-
3
- export const createLinkNode = (href, showInNewTab, text) => ({
4
- type: "link",
5
- href,
6
- target: showInNewTab ? "_blank" : "_self",
7
- children: [{ text }],
8
- })
9
-
10
- export const insertLink = (editor, { url, showInNewTab }) => {
11
- if (!url) return
12
-
13
- const { selection } = editor
14
- const link = createLinkNode(url, showInNewTab, "Link")
15
- if (!!selection) {
16
- const [parent, parentPath] = Editor.parent(editor, selection.focus.path)
17
- if (parent.type === "link") {
18
- removeLink(editor)
19
- }
20
-
21
- if (editor.isVoid(parent)) {
22
- Transforms.insertNodes(
23
- editor,
24
- { type: "p", children: [link] },
25
- {
26
- at: Path.next(parentPath),
27
- select: true,
28
- }
29
- )
30
- } else if (Range.isCollapsed(selection)) {
31
- Transforms.insertNodes(editor, link, { select: true })
32
- } else {
33
- Transforms.wrapNodes(editor, link, { split: true })
34
- }
35
- } else {
36
- Transforms.insertNodes(editor, { type: "p", children: [link] })
37
- }
38
- }
39
-
40
- export const removeLink = (editor) => {
41
- Transforms.unwrapNodes(editor, {
42
- match: (n) => !Editor.isEditor(n) && Element.isElement(n) && n.type === "link",
43
- })
44
- }
@@ -1,4 +0,0 @@
1
- export const createParagraph = (text) => ({
2
- type: "p",
3
- children: [{ text }],
4
- })