@vonaffenfels/slate-editor 1.0.33 → 1.0.34
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/dist/BlockEditor.css +1 -1
- package/dist/BlockEditor.js +1 -1
- package/dist/BlockEditor.js.LICENSE.txt +33 -0
- package/dist/Renderer.js +1 -1
- package/dist/index.css +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.LICENSE.txt +33 -0
- package/package.json +2 -2
- package/scss/sidebarEditor.scss +1 -1
- package/src/BlockEditor.js +1 -0
- package/src/Nodes/StorybookDisplay.js +18 -10
- package/src/SidebarEditor/SidebarEditorField.js +15 -1
- package/src/SidebarEditor.js +4 -2
|
@@ -4,6 +4,30 @@
|
|
|
4
4
|
http://jedwatson.github.io/classnames
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
+
/*!
|
|
8
|
+
Copyright (c) 2015 Jed Watson.
|
|
9
|
+
Based on code that is Copyright 2013-2015, Facebook, Inc.
|
|
10
|
+
All rights reserved.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
/*!
|
|
14
|
+
Copyright (c) 2018 Jed Watson.
|
|
15
|
+
Licensed under the MIT License (MIT), see
|
|
16
|
+
http://jedwatson.github.io/classnames
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
/*!
|
|
20
|
+
* Adapted from jQuery UI core
|
|
21
|
+
*
|
|
22
|
+
* http://jqueryui.com
|
|
23
|
+
*
|
|
24
|
+
* Copyright 2014 jQuery Foundation and other contributors
|
|
25
|
+
* Released under the MIT license.
|
|
26
|
+
* http://jquery.org/license
|
|
27
|
+
*
|
|
28
|
+
* http://api.jqueryui.com/category/ui-core/
|
|
29
|
+
*/
|
|
30
|
+
|
|
7
31
|
/*!
|
|
8
32
|
* Font Awesome Free 5.15.4 by @fontawesome - https://fontawesome.com
|
|
9
33
|
* License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License)
|
|
@@ -34,3 +58,12 @@
|
|
|
34
58
|
/*! https://mths.be/esrever v0.2.0 by @mathias */
|
|
35
59
|
|
|
36
60
|
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
|
|
61
|
+
|
|
62
|
+
/** @license React v16.13.1
|
|
63
|
+
* react-is.production.min.js
|
|
64
|
+
*
|
|
65
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
66
|
+
*
|
|
67
|
+
* This source code is licensed under the MIT license found in the
|
|
68
|
+
* LICENSE file in the root directory of this source tree.
|
|
69
|
+
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vonaffenfels/slate-editor",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.34",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
"cssnano": "^5.0.1",
|
|
72
72
|
"escape-html": "^1.0.3"
|
|
73
73
|
},
|
|
74
|
-
"gitHead": "
|
|
74
|
+
"gitHead": "09afee2ada365a370687380dbcb426fdb6e4d51f",
|
|
75
75
|
"publishConfig": {
|
|
76
76
|
"access": "public"
|
|
77
77
|
}
|
package/scss/sidebarEditor.scss
CHANGED
package/src/BlockEditor.js
CHANGED
|
@@ -170,6 +170,7 @@ export default function BlockEditor({
|
|
|
170
170
|
isEmpty: false,
|
|
171
171
|
isInline: selectedStorybookElement.isInline,
|
|
172
172
|
attributes: newStorybookElement.attributes,
|
|
173
|
+
type: "storybook",
|
|
173
174
|
};
|
|
174
175
|
|
|
175
176
|
Transforms.setNodes(editor, newNodeProps, {at: selectedStorybookElement.path});
|
|
@@ -68,15 +68,7 @@ const BlockComponent = ({
|
|
|
68
68
|
attributes,
|
|
69
69
|
}) => {
|
|
70
70
|
const [loadedAttributes, setLoadedAttributes] = useState(attributes);
|
|
71
|
-
let LoadedComponent = storybookComponentLoader(block);
|
|
72
|
-
|
|
73
|
-
if (!LoadedComponent) {
|
|
74
|
-
LoadedComponent = EmptyBlock;
|
|
75
|
-
} else {
|
|
76
|
-
if (!LoadedComponent.displayName) {
|
|
77
|
-
LoadedComponent.displayName = block;
|
|
78
|
-
}
|
|
79
|
-
}
|
|
71
|
+
let [LoadedComponent, setLoadedComponent] = useState(storybookComponentLoader(block));
|
|
80
72
|
|
|
81
73
|
useEffect(() => {
|
|
82
74
|
const loadData = async () => {
|
|
@@ -97,10 +89,26 @@ const BlockComponent = ({
|
|
|
97
89
|
}
|
|
98
90
|
});
|
|
99
91
|
|
|
92
|
+
let loadedComponent = storybookComponentLoader(block);
|
|
93
|
+
|
|
94
|
+
setLoadedAttributes({...attributes});
|
|
95
|
+
|
|
96
|
+
setLoadedComponent(loadedComponent);
|
|
97
|
+
|
|
98
|
+
console.log({loadedAttributes});
|
|
99
|
+
|
|
100
100
|
return () => {
|
|
101
101
|
mounted = false;
|
|
102
102
|
};
|
|
103
|
-
}, [attributes, block, storybookComponentDataLoader]);
|
|
103
|
+
}, [attributes, block, storybookComponentDataLoader, storybookComponentLoader]);
|
|
104
|
+
|
|
105
|
+
if (!LoadedComponent) {
|
|
106
|
+
LoadedComponent = EmptyBlock;
|
|
107
|
+
} else {
|
|
108
|
+
if (!LoadedComponent.displayName) {
|
|
109
|
+
LoadedComponent.displayName = block;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
104
112
|
|
|
105
113
|
if (loadedAttributes.blockWidth || loadedAttributes.margin) {
|
|
106
114
|
return <span className={classNames({
|
|
@@ -134,7 +134,21 @@ export const SidebarEditorField = ({
|
|
|
134
134
|
return (
|
|
135
135
|
<textarea
|
|
136
136
|
value={typeof value === "object" ? JSON.stringify(value, null, 2) || "" : value}
|
|
137
|
-
onChange={e =>
|
|
137
|
+
onChange={e => {
|
|
138
|
+
if (isJson(e.target.value)) {
|
|
139
|
+
onChange(fieldKey, JSON.parse(e.target.value));
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
e.target.style.height = "5px";
|
|
143
|
+
e.target.style.height = e.target.scrollHeight + 2 + "px";
|
|
144
|
+
}}
|
|
145
|
+
onBlur={(e) => {
|
|
146
|
+
e.target.style.height = "42px";
|
|
147
|
+
}}
|
|
148
|
+
onFocus={e => {
|
|
149
|
+
e.target.style.height = "5px";
|
|
150
|
+
e.target.style.height = e.target.scrollHeight + 2 + "px";
|
|
151
|
+
}} />
|
|
138
152
|
);
|
|
139
153
|
case "radio":
|
|
140
154
|
return (
|
package/src/SidebarEditor.js
CHANGED
|
@@ -7,6 +7,7 @@ import {ToolMargin} from "./Tools/Margin";
|
|
|
7
7
|
import "../scss/sidebarEditor.scss";
|
|
8
8
|
import {FontAwesomeIcon} from "@fortawesome/react-fontawesome";
|
|
9
9
|
import {faSpinner} from "@fortawesome/free-solid-svg-icons";
|
|
10
|
+
import {Spinner} from "@contentful/forma-36-react-components";
|
|
10
11
|
|
|
11
12
|
const devMode = localStorage.getItem("dev-mode") === "true";
|
|
12
13
|
|
|
@@ -171,8 +172,9 @@ const SidebarEditor = ({
|
|
|
171
172
|
return (
|
|
172
173
|
<div id="sidebar-editor">
|
|
173
174
|
{isLoading ? (
|
|
174
|
-
<div className="flex h-full items-center justify-center">
|
|
175
|
-
<
|
|
175
|
+
<div className="flex h-full flex-col items-center justify-center">
|
|
176
|
+
<Spinner />
|
|
177
|
+
<span className="mt-2">Elemente werden geladen</span>
|
|
176
178
|
</div>
|
|
177
179
|
) : (
|
|
178
180
|
<>
|