@springmicro/rte 0.7.0 → 0.7.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/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
|
@@ -44653,27 +44653,27 @@ const H3 = (e) => {
|
|
|
44653
44653
|
}, G3 = (e) => {
|
|
44654
44654
|
const { isInline: t } = e;
|
|
44655
44655
|
return e.isInline = (r) => r.type === "equation" && r.inline ? !0 : t(r), e;
|
|
44656
|
-
}, jW = "
|
|
44656
|
+
}, jW = "_popupWrapper_g4nbi_3", qW = "_popup_g4nbi_3", $W = "_editorWrapper_g4nbi_29", HW = "_slate_g4nbi_59", UW = "_btnActive_g4nbi_101", zW = "_codeToTextWrapper_g4nbi_181", GW = "_codeToText_g4nbi_181", VW = "_textOutput_g4nbi_205", WW = "_done_g4nbi_251", YW = "_clear_g4nbi_259", KW = "_embed_g4nbi_273", XW = "_contextMenu_g4nbi_359", QW = "_menuOption_g4nbi_385", ZW = "_toolbar_g4nbi_397", sg = {
|
|
44657
44657
|
popupWrapper: jW,
|
|
44658
44658
|
popup: qW,
|
|
44659
44659
|
editorWrapper: $W,
|
|
44660
44660
|
slate: HW,
|
|
44661
44661
|
btnActive: UW,
|
|
44662
|
-
"code-wrapper": "_code-
|
|
44662
|
+
"code-wrapper": "_code-wrapper_g4nbi_157",
|
|
44663
44663
|
codeToTextWrapper: zW,
|
|
44664
44664
|
codeToText: GW,
|
|
44665
44665
|
textOutput: VW,
|
|
44666
44666
|
done: WW,
|
|
44667
44667
|
clear: YW,
|
|
44668
44668
|
embed: KW,
|
|
44669
|
-
"equation-inline": "_equation-
|
|
44670
|
-
"table-option": "_table-
|
|
44671
|
-
"table-input": "_table-
|
|
44672
|
-
"table-unit": "_table-
|
|
44669
|
+
"equation-inline": "_equation-inline_g4nbi_307",
|
|
44670
|
+
"table-option": "_table-option_g4nbi_319",
|
|
44671
|
+
"table-input": "_table-input_g4nbi_335",
|
|
44672
|
+
"table-unit": "_table-unit_g4nbi_345",
|
|
44673
44673
|
contextMenu: XW,
|
|
44674
44674
|
menuOption: QW,
|
|
44675
44675
|
toolbar: ZW,
|
|
44676
|
-
"toolbar-grp": "_toolbar-
|
|
44676
|
+
"toolbar-grp": "_toolbar-grp_g4nbi_429"
|
|
44677
44677
|
}, yT = (e) => {
|
|
44678
44678
|
const { html: t, action: r, location: n, handleCodeToText: a } = e, i = ma(), s = ma(), c = us(), f = (d) => {
|
|
44679
44679
|
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.7.
|
|
3
|
+
"version": "0.7.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"private": false,
|
|
6
6
|
"publishConfig": {
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"@emotion/css": "^11.11.2",
|
|
30
|
-
"@springmicro/utils": "^0.7.
|
|
30
|
+
"@springmicro/utils": "^0.7.1",
|
|
31
31
|
"@uiw/react-textarea-code-editor": "^3.0.2",
|
|
32
32
|
"domhandler": "^5.0.3",
|
|
33
33
|
"escape-html": "^1.0.3",
|
|
@@ -54,5 +54,5 @@
|
|
|
54
54
|
"vite": "^5.2.0",
|
|
55
55
|
"vite-plugin-dts": "^3.9.0"
|
|
56
56
|
},
|
|
57
|
-
"gitHead": "
|
|
57
|
+
"gitHead": "3fba722cf2e25b298d1b774c2b39ae8ac5743076"
|
|
58
58
|
}
|