@vonaffenfels/slate-editor 1.0.45 → 1.0.46
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/componentLoader.js +14 -2
- package/dist/BlockEditor.js +1 -1
- package/dist/index.js +1 -1
- package/package.json +2 -2
- package/src/BlockEditor.js +11 -5
- package/src/ObjectId.js +4 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vonaffenfels/slate-editor",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.46",
|
|
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": "39c70a07e3c6f82a79775993560a4e902467bf21",
|
|
75
75
|
"publishConfig": {
|
|
76
76
|
"access": "public"
|
|
77
77
|
}
|
package/src/BlockEditor.js
CHANGED
|
@@ -17,9 +17,8 @@ import "../scss/editor.scss";
|
|
|
17
17
|
import {ListItemPlugin} from "./plugins/ListItem";
|
|
18
18
|
import ErrorBoundary from "../src/Blocks/ErrorBoundary";
|
|
19
19
|
import SidebarEditor from './SidebarEditor';
|
|
20
|
-
import {FontAwesomeIcon} from "@fortawesome/react-fontawesome";
|
|
21
|
-
import {faSpinner} from '@fortawesome/free-solid-svg-icons';
|
|
22
20
|
import {Spinner} from '@contentful/forma-36-react-components';
|
|
21
|
+
import {ObjectId} from "./ObjectId";
|
|
23
22
|
|
|
24
23
|
export default function BlockEditor({
|
|
25
24
|
onChange,
|
|
@@ -170,17 +169,24 @@ export default function BlockEditor({
|
|
|
170
169
|
block: newStorybookElement.block,
|
|
171
170
|
isEmpty: false,
|
|
172
171
|
isInline: selectedStorybookElement.isInline,
|
|
173
|
-
attributes: newStorybookElement.attributes,
|
|
172
|
+
attributes: newStorybookElement.attributes || {},
|
|
174
173
|
type: "storybook",
|
|
175
174
|
};
|
|
176
175
|
|
|
177
176
|
Transforms.setNodes(editor, newNodeProps, {at: selectedStorybookElement.path});
|
|
178
177
|
|
|
179
178
|
onSlateChange(editor.children);
|
|
180
|
-
|
|
179
|
+
|
|
180
|
+
const mergedValue = {
|
|
181
181
|
...selectedStorybookElement,
|
|
182
182
|
...newNodeProps,
|
|
183
|
-
}
|
|
183
|
+
};
|
|
184
|
+
|
|
185
|
+
if (!mergedValue.attributes.teasermanagerSlotId) {
|
|
186
|
+
mergedValue.attributes.teasermanagerSlotId = ObjectId();
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
setSelectedStorybookElement(mergedValue);
|
|
184
190
|
};
|
|
185
191
|
|
|
186
192
|
const handleSidebarDeleteClick = (element) => {
|
package/src/ObjectId.js
ADDED