@vonaffenfels/slate-editor 1.1.41 → 1.1.43
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.js +2 -2
- package/dist/Renderer.js +1 -1
- package/dist/index.js +1 -1
- package/package.json +2 -2
- package/src/BlockEditor.js +15 -0
- package/src/Nodes/StorybookDisplay.js +1 -1
- package/src/Serializer/Serializer.js +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vonaffenfels/slate-editor",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.43",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -72,7 +72,7 @@
|
|
|
72
72
|
"cssnano": "^5.0.1",
|
|
73
73
|
"escape-html": "^1.0.3"
|
|
74
74
|
},
|
|
75
|
-
"gitHead": "
|
|
75
|
+
"gitHead": "d3645e92a4ccd3e5033de4e79de4d9b7d03af4a9",
|
|
76
76
|
"publishConfig": {
|
|
77
77
|
"access": "public"
|
|
78
78
|
}
|
package/src/BlockEditor.js
CHANGED
|
@@ -128,6 +128,21 @@ export default function BlockEditor({
|
|
|
128
128
|
isInline: undefined,
|
|
129
129
|
};
|
|
130
130
|
}
|
|
131
|
+
} else if (node?.type === "heading") {
|
|
132
|
+
if (!node?.attributes) {
|
|
133
|
+
node.attributes = {};
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
// set an id for linking directly to headlines
|
|
137
|
+
if (!node.attributes.id) {
|
|
138
|
+
return {
|
|
139
|
+
...node,
|
|
140
|
+
attributes: {
|
|
141
|
+
...node.attributes,
|
|
142
|
+
id: ObjectId(),
|
|
143
|
+
},
|
|
144
|
+
};
|
|
145
|
+
}
|
|
131
146
|
}
|
|
132
147
|
|
|
133
148
|
return node;
|
|
@@ -149,5 +149,5 @@ const BlockComponent = ({
|
|
|
149
149
|
return <LoadedComponent {...loadedAttributes} />;
|
|
150
150
|
}
|
|
151
151
|
|
|
152
|
-
return <WrapperTag
|
|
152
|
+
return <WrapperTag className={wrapperClassName}><LoadedComponent {...loadedAttributes} /></WrapperTag>;
|
|
153
153
|
};
|
|
@@ -124,7 +124,7 @@ export function Serializer({
|
|
|
124
124
|
storybookComponentDataLoader: storybookComponentDataLoader,
|
|
125
125
|
};
|
|
126
126
|
|
|
127
|
-
return <Wrapper type={props.type} block={props.block}><StorybookDisplay {...storyProps} /></Wrapper>;
|
|
127
|
+
return <Wrapper id={props?.attributes?.id} type={props.type} block={props.block}><StorybookDisplay {...storyProps} /></Wrapper>;
|
|
128
128
|
}
|
|
129
129
|
case 'layout': {
|
|
130
130
|
let isGrid = true;
|