@springmicro/rte 0.6.0 → 0.6.2
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_g4nbi_3", bR = "_popup_g4nbi_3", vR = "_editorWrapper_g4nbi_29", yR = "_slate_g4nbi_59", ER = "_btnActive_g4nbi_101", _R = "_codeToTextWrapper_g4nbi_181", AR = "_codeToText_g4nbi_181", DR = "_textOutput_g4nbi_205", CR = "_done_g4nbi_251", TR = "_clear_g4nbi_259", wR = "_embed_g4nbi_273", xR = "_contextMenu_g4nbi_359", SR = "_menuOption_g4nbi_385", OR = "_toolbar_g4nbi_397", 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_g4nbi_157",
|
|
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_g4nbi_307",
|
|
32654
|
+
"table-option": "_table-option_g4nbi_319",
|
|
32655
|
+
"table-input": "_table-input_g4nbi_335",
|
|
32656
|
+
"table-unit": "_table-unit_g4nbi_345",
|
|
32657
32657
|
contextMenu: xR,
|
|
32658
32658
|
menuOption: SR,
|
|
32659
32659
|
toolbar: OR,
|
|
32660
|
-
"toolbar-grp": "_toolbar-
|
|
32660
|
+
"toolbar-grp": "_toolbar-grp_g4nbi_429"
|
|
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_g4nbi_3{display:inline;position:relative}._popup_g4nbi_3{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_g4nbi_29{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_g4nbi_29>div:focus-visible{border:none;outline:none}._slate_g4nbi_59 blockquote{border-left:2px solid #ddd;margin-left:0;margin-right:0;padding-left:10px;color:#aaa;font-style:italic}._slate_g4nbi_59 table,._slate_g4nbi_59 th,._slate_g4nbi_59 td{border:1px solid black}._slate_g4nbi_59 table{border-collapse:collapse}._slate_g4nbi_59 button{background-color:#fff;border:none;opacity:.5}._slate_g4nbi_59 ._btnActive_g4nbi_101{opacity:1}._slate_g4nbi_59 table{width:100%}._slate_g4nbi_59 td{height:50px;padding:0 5px}._slate_g4nbi_59 ul,._slate_g4nbi_59 ol{padding-left:1rem}._slate_g4nbi_59 button{cursor:pointer}._slate_g4nbi_59 code{font-family:source-code-pro,Menlo,Monaco,Consolas,Courier New,monospace}._slate_g4nbi_59 [data-slate-node=element]:not(li){margin:10px 0}._slate_g4nbi_59 ._code-wrapper_g4nbi_157{position:fixed;top:0;left:0;width:100vw;height:100vh;background:#000000e6;z-index:2;display:flex;justify-content:center;align-items:center}._slate_g4nbi_59 ._codeToTextWrapper_g4nbi_181{width:80%;height:80%;grid-template-columns:45% 10% 45%}._slate_g4nbi_59 ._codeToText_g4nbi_181{width:100%;height:90%;display:grid;grid-template-columns:45% 10% 45%}._slate_g4nbi_59 ._codeToText_g4nbi_181 textarea,._textOutput_g4nbi_205{border-radius:15px;padding:10px}._slate_g4nbi_59 ._codeToText_g4nbi_181 textarea{resize:none}._slate_g4nbi_59 ._codeToText_g4nbi_181 textarea:focus{outline:none}._slate_g4nbi_59 ._textOutput_g4nbi_205{background:#fff;overflow:scroll}._slate_g4nbi_59 ._codeToTextWrapper_g4nbi_181 button{margin:3% 1%;padding:10px 37px;cursor:pointer;border-radius:5px;opacity:1;font-weight:bolder}._slate_g4nbi_59 ._done_g4nbi_251{background:#3fc79a;color:#fff}._slate_g4nbi_59 ._clear_g4nbi_259{background:#fff;color:#a9a4a4;border:1px solid #e6e8f0}._slate_g4nbi_59 ._embed_g4nbi_273{width:-moz-fit-content;width:fit-content;position:relative;margin-right:20px}._slate_g4nbi_59 ._embed_g4nbi_273 img,._slate_g4nbi_59 ._embed_g4nbi_273 iframe{width:100%;height:100%}._slate_g4nbi_59 ._embed_g4nbi_273 button{position:absolute;bottom:-6px;right:0}._slate_g4nbi_59 ._equation-inline_g4nbi_307{display:inline;position:relative}._slate_g4nbi_59 ._table-option_g4nbi_319{display:flex;margin:5px 2px;gap:5px;white-space:nowrap}._slate_g4nbi_59 ._table-input_g4nbi_335{display:grid;grid-template-columns:auto auto auto auto auto auto;gap:3px}._slate_g4nbi_59 ._table-unit_g4nbi_345{width:15px;height:15px;border:1px solid #e6e8f0}._slate_g4nbi_59 ._contextMenu_g4nbi_359{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_g4nbi_59 ._menuOption_g4nbi_385{display:flex;gap:15px}._slate_g4nbi_59 ._toolbar_g4nbi_397{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_g4nbi_59 ._toolbar-grp_g4nbi_429>*{margin-right:10px;cursor:pointer}._slate_g4nbi_59 ._toolbar-grp_g4nbi_429{margin:0 10px}._slate_g4nbi_59 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.6.
|
|
3
|
+
"version": "0.6.2",
|
|
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.6.
|
|
29
|
+
"@springmicro/utils": "^0.6.2",
|
|
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": "f0aee01ae9b45595f59d70a5fdf9cae8933edb24"
|
|
56
56
|
}
|