@springmicro/rte 0.5.17 → 0.6.0
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/README.md +68 -68
- package/dist/index.js +7 -7
- package/dist/style.css +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -1,68 +1,68 @@
|
|
|
1
|
-
# @springmicro/rte
|
|
2
|
-
|
|
3
|
-
> WARNING: This package will likely see many breaking changes until its first major release.
|
|
4
|
-
|
|
5
|
-
## Styling
|
|
6
|
-
|
|
7
|
-
For the slate editor styles.
|
|
8
|
-
|
|
9
|
-
```tsx
|
|
10
|
-
import "@springmicro/rte/dist/style.css";
|
|
11
|
-
```
|
|
12
|
-
|
|
13
|
-
## PaperEditor
|
|
14
|
-
|
|
15
|
-
```tsx
|
|
16
|
-
import { PaperEditor } from "@springmicro/rte";
|
|
17
|
-
|
|
18
|
-
declare type PaperEditorProps = {
|
|
19
|
-
value?: Descendant[];
|
|
20
|
-
};
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
## InlineEditor
|
|
24
|
-
|
|
25
|
-
```tsx
|
|
26
|
-
import { InlineEditor } from "@springmicro/rte";
|
|
27
|
-
|
|
28
|
-
declare type InlineEditorProps = {
|
|
29
|
-
value?: Descendant[];
|
|
30
|
-
setValue?: React.Dispatch<React.SetStateAction<Descendant[]>>;
|
|
31
|
-
readOnly: boolean;
|
|
32
|
-
editor?: BaseEditor & ReactEditor;
|
|
33
|
-
scrollElement?: HTMLElement;
|
|
34
|
-
};
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
`scrollElement` refers to a parent scroll element. The default is the global `window` but if you are placing the `InlineEditor` in a custom scroll element then a reference to that element needs to be placed here to properly position the toolbar either above or below the editor.
|
|
38
|
-
|
|
39
|
-
```jsx
|
|
40
|
-
/**
|
|
41
|
-
* Scroll Element Example
|
|
42
|
-
* Put other content above and below to scroll and see the menu move.
|
|
43
|
-
*/
|
|
44
|
-
export function InlineEditorWithScrolling(props) {
|
|
45
|
-
const [ref, setRef] = React.useState();
|
|
46
|
-
return (
|
|
47
|
-
<div
|
|
48
|
-
style={{ height: "50vh", overflowY: "scroll" }}
|
|
49
|
-
ref={(newRef) => setRef(newRef)}
|
|
50
|
-
>
|
|
51
|
-
<div style={{ color: "#aaa" }}>
|
|
52
|
-
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Iure sint fuga
|
|
53
|
-
reprehenderit unde dolores expedita, nam, enim repellendus sit
|
|
54
|
-
doloremque eveniet quas vel perferendis! Cumque, eveniet? Dignissimos
|
|
55
|
-
mollitia voluptas provident?
|
|
56
|
-
</div>
|
|
57
|
-
<InlineEditor {...props} scrollElement={ref} />
|
|
58
|
-
<div style={{ color: "#aaa" }}>
|
|
59
|
-
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Iure sint fuga
|
|
60
|
-
reprehenderit unde dolores expedita, nam, enim repellendus sit
|
|
61
|
-
doloremque eveniet quas vel perferendis! Cumque, eveniet? Dignissimos
|
|
62
|
-
mollitia voluptas provident?
|
|
63
|
-
</div>
|
|
64
|
-
<div style={{ height: "100vh" }}></div>
|
|
65
|
-
</div>
|
|
66
|
-
);
|
|
67
|
-
}
|
|
68
|
-
```
|
|
1
|
+
# @springmicro/rte
|
|
2
|
+
|
|
3
|
+
> WARNING: This package will likely see many breaking changes until its first major release.
|
|
4
|
+
|
|
5
|
+
## Styling
|
|
6
|
+
|
|
7
|
+
For the slate editor styles.
|
|
8
|
+
|
|
9
|
+
```tsx
|
|
10
|
+
import "@springmicro/rte/dist/style.css";
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## PaperEditor
|
|
14
|
+
|
|
15
|
+
```tsx
|
|
16
|
+
import { PaperEditor } from "@springmicro/rte";
|
|
17
|
+
|
|
18
|
+
declare type PaperEditorProps = {
|
|
19
|
+
value?: Descendant[];
|
|
20
|
+
};
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## InlineEditor
|
|
24
|
+
|
|
25
|
+
```tsx
|
|
26
|
+
import { InlineEditor } from "@springmicro/rte";
|
|
27
|
+
|
|
28
|
+
declare type InlineEditorProps = {
|
|
29
|
+
value?: Descendant[];
|
|
30
|
+
setValue?: React.Dispatch<React.SetStateAction<Descendant[]>>;
|
|
31
|
+
readOnly: boolean;
|
|
32
|
+
editor?: BaseEditor & ReactEditor;
|
|
33
|
+
scrollElement?: HTMLElement;
|
|
34
|
+
};
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
`scrollElement` refers to a parent scroll element. The default is the global `window` but if you are placing the `InlineEditor` in a custom scroll element then a reference to that element needs to be placed here to properly position the toolbar either above or below the editor.
|
|
38
|
+
|
|
39
|
+
```jsx
|
|
40
|
+
/**
|
|
41
|
+
* Scroll Element Example
|
|
42
|
+
* Put other content above and below to scroll and see the menu move.
|
|
43
|
+
*/
|
|
44
|
+
export function InlineEditorWithScrolling(props) {
|
|
45
|
+
const [ref, setRef] = React.useState();
|
|
46
|
+
return (
|
|
47
|
+
<div
|
|
48
|
+
style={{ height: "50vh", overflowY: "scroll" }}
|
|
49
|
+
ref={(newRef) => setRef(newRef)}
|
|
50
|
+
>
|
|
51
|
+
<div style={{ color: "#aaa" }}>
|
|
52
|
+
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Iure sint fuga
|
|
53
|
+
reprehenderit unde dolores expedita, nam, enim repellendus sit
|
|
54
|
+
doloremque eveniet quas vel perferendis! Cumque, eveniet? Dignissimos
|
|
55
|
+
mollitia voluptas provident?
|
|
56
|
+
</div>
|
|
57
|
+
<InlineEditor {...props} scrollElement={ref} />
|
|
58
|
+
<div style={{ color: "#aaa" }}>
|
|
59
|
+
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Iure sint fuga
|
|
60
|
+
reprehenderit unde dolores expedita, nam, enim repellendus sit
|
|
61
|
+
doloremque eveniet quas vel perferendis! Cumque, eveniet? Dignissimos
|
|
62
|
+
mollitia voluptas provident?
|
|
63
|
+
</div>
|
|
64
|
+
<div style={{ height: "100vh" }}></div>
|
|
65
|
+
</div>
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
```
|
package/dist/index.js
CHANGED
|
@@ -32637,27 +32637,27 @@ const d2 = (e) => {
|
|
|
32637
32637
|
}, m2 = (e) => {
|
|
32638
32638
|
const { isInline: t } = e;
|
|
32639
32639
|
return e.isInline = (r) => r.type === "equation" && r.inline ? !0 : t(r), e;
|
|
32640
|
-
}, gR = "
|
|
32640
|
+
}, gR = "_popupWrapper_fx5ji_2", bR = "_popup_fx5ji_2", vR = "_editorWrapper_fx5ji_15", yR = "_slate_fx5ji_30", ER = "_btnActive_fx5ji_51", _R = "_codeToTextWrapper_fx5ji_91", AR = "_codeToText_fx5ji_91", DR = "_textOutput_fx5ji_103", CR = "_done_fx5ji_126", TR = "_clear_fx5ji_130", wR = "_embed_fx5ji_137", xR = "_contextMenu_fx5ji_180", SR = "_menuOption_fx5ji_193", OR = "_toolbar_fx5ji_199", Jh = {
|
|
32641
32641
|
popupWrapper: gR,
|
|
32642
32642
|
popup: bR,
|
|
32643
32643
|
editorWrapper: vR,
|
|
32644
32644
|
slate: yR,
|
|
32645
32645
|
btnActive: ER,
|
|
32646
|
-
"code-wrapper": "_code-
|
|
32646
|
+
"code-wrapper": "_code-wrapper_fx5ji_79",
|
|
32647
32647
|
codeToTextWrapper: _R,
|
|
32648
32648
|
codeToText: AR,
|
|
32649
32649
|
textOutput: DR,
|
|
32650
32650
|
done: CR,
|
|
32651
32651
|
clear: TR,
|
|
32652
32652
|
embed: wR,
|
|
32653
|
-
"equation-inline": "_equation-
|
|
32654
|
-
"table-option": "_table-
|
|
32655
|
-
"table-input": "_table-
|
|
32656
|
-
"table-unit": "_table-
|
|
32653
|
+
"equation-inline": "_equation-inline_fx5ji_154",
|
|
32654
|
+
"table-option": "_table-option_fx5ji_160",
|
|
32655
|
+
"table-input": "_table-input_fx5ji_168",
|
|
32656
|
+
"table-unit": "_table-unit_fx5ji_173",
|
|
32657
32657
|
contextMenu: xR,
|
|
32658
32658
|
menuOption: SR,
|
|
32659
32659
|
toolbar: OR,
|
|
32660
|
-
"toolbar-grp": "_toolbar-
|
|
32660
|
+
"toolbar-grp": "_toolbar-grp_fx5ji_215"
|
|
32661
32661
|
}, g7 = (e) => {
|
|
32662
32662
|
const { html: t, action: r, location: n, handleCodeToText: a } = e, i = ea(), s = ea(), l = Si(), f = (d) => {
|
|
32663
32663
|
var p, h;
|
package/dist/style.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.
|
|
1
|
+
._popupWrapper_fx5ji_2{display:inline;position:relative}._popup_fx5ji_2{position:absolute;left:0;background-color:#fff;padding:6px 10px;border:1px solid #e6e8f0;height:-moz-fit-content;height:fit-content;z-index:1000}._editorWrapper_fx5ji_15{border-radius:8px;min-height:100px;min-width:100%;width:-moz-fit-content;width:fit-content;height:-moz-fit-content;height:fit-content;margin-top:6px;border:1px solid #e6e8f0;padding:0 10px}._editorWrapper_fx5ji_15>div:focus-visible{border:none;outline:none}._slate_fx5ji_30 blockquote{border-left:2px solid #ddd;margin-left:0;margin-right:0;padding-left:10px;color:#aaa;font-style:italic}._slate_fx5ji_30 table,._slate_fx5ji_30 th,._slate_fx5ji_30 td{border:1px solid black}._slate_fx5ji_30 table{border-collapse:collapse}._slate_fx5ji_30 button{background-color:#fff;border:none;opacity:.5}._slate_fx5ji_30 ._btnActive_fx5ji_51{opacity:1}._slate_fx5ji_30 table{width:100%}._slate_fx5ji_30 td{height:50px;padding:0 5px}._slate_fx5ji_30 ul,._slate_fx5ji_30 ol{padding-left:1rem}._slate_fx5ji_30 button{cursor:pointer}._slate_fx5ji_30 code{font-family:source-code-pro,Menlo,Monaco,Consolas,Courier New,monospace}._slate_fx5ji_30 [data-slate-node=element]:not(li){margin:10px 0}._slate_fx5ji_30 ._code-wrapper_fx5ji_79{position:fixed;top:0;left:0;width:100vw;height:100vh;background:#000000e6;z-index:2;display:flex;justify-content:center;align-items:center}._slate_fx5ji_30 ._codeToTextWrapper_fx5ji_91{width:80%;height:80%;grid-template-columns:45% 10% 45%}._slate_fx5ji_30 ._codeToText_fx5ji_91{width:100%;height:90%;display:grid;grid-template-columns:45% 10% 45%}._slate_fx5ji_30 ._codeToText_fx5ji_91 textarea,._textOutput_fx5ji_103{border-radius:15px;padding:10px}._slate_fx5ji_30 ._codeToText_fx5ji_91 textarea{resize:none}._slate_fx5ji_30 ._codeToText_fx5ji_91 textarea:focus{outline:none}._slate_fx5ji_30 ._textOutput_fx5ji_103{background:#fff;overflow:scroll}._slate_fx5ji_30 ._codeToTextWrapper_fx5ji_91 button{margin:3% 1%;padding:10px 37px;cursor:pointer;border-radius:5px;opacity:1;font-weight:bolder}._slate_fx5ji_30 ._done_fx5ji_126{background:#3fc79a;color:#fff}._slate_fx5ji_30 ._clear_fx5ji_130{background:#fff;color:#a9a4a4;border:1px solid #e6e8f0}._slate_fx5ji_30 ._embed_fx5ji_137{width:-moz-fit-content;width:fit-content;position:relative;margin-right:20px}._slate_fx5ji_30 ._embed_fx5ji_137 img,._slate_fx5ji_30 ._embed_fx5ji_137 iframe{width:100%;height:100%}._slate_fx5ji_30 ._embed_fx5ji_137 button{position:absolute;bottom:-6px;right:0}._slate_fx5ji_30 ._equation-inline_fx5ji_154{display:inline;position:relative}._slate_fx5ji_30 ._table-option_fx5ji_160{display:flex;margin:5px 2px;gap:5px;white-space:nowrap}._slate_fx5ji_30 ._table-input_fx5ji_168{display:grid;grid-template-columns:auto auto auto auto auto auto;gap:3px}._slate_fx5ji_30 ._table-unit_fx5ji_173{width:15px;height:15px;border:1px solid #e6e8f0}._slate_fx5ji_30 ._contextMenu_fx5ji_180{width:-moz-fit-content;width:fit-content;height:-moz-fit-content;height:fit-content;position:fixed;background:#fff;border:1px solid #e6e8f0;border-radius:10px;padding:.5%;display:flex;gap:15px;flex-direction:column;cursor:pointer}._slate_fx5ji_30 ._menuOption_fx5ji_193{display:flex;gap:15px}._slate_fx5ji_30 ._toolbar_fx5ji_199{border-radius:10px;background:#fff;box-shadow:-8px 8px 13px #ededed,8px -8px 13px #fff;margin:5% 0;display:flex;flex-direction:row;flex-wrap:wrap;align-items:center;padding:15px 10px;row-gap:15px;position:sticky;top:0;z-index:2}._slate_fx5ji_30 ._toolbar-grp_fx5ji_215>*{margin-right:10px;cursor:pointer}._slate_fx5ji_30 ._toolbar-grp_fx5ji_215{margin:0 10px}._slate_fx5ji_30 select{height:30px;border:none;width:6.9rem}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@springmicro/rte",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"private": false,
|
|
6
6
|
"publishConfig": {
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"@emotion/css": "^11.11.2",
|
|
29
|
-
"@springmicro/utils": "^0.
|
|
29
|
+
"@springmicro/utils": "^0.6.0",
|
|
30
30
|
"@uiw/react-textarea-code-editor": "^3.0.2",
|
|
31
31
|
"domhandler": "^5.0.3",
|
|
32
32
|
"escape-html": "^1.0.3",
|
|
@@ -52,5 +52,5 @@
|
|
|
52
52
|
"vite": "^5.2.0",
|
|
53
53
|
"vite-plugin-dts": "^3.9.0"
|
|
54
54
|
},
|
|
55
|
-
"gitHead": "
|
|
55
|
+
"gitHead": "37c816671357a3b1af66ad231880216fbda2fb72"
|
|
56
56
|
}
|