Skip to content
Snippets Groups Projects
Commit c07966cf authored by chris's avatar chris
Browse files

add image id

parent 1339f5f5
No related branches found
No related tags found
1 merge request!413Image alt text
......@@ -2,6 +2,7 @@ import { SchemaHelpers } from 'wax-prosemirror-utilities';
const image = {
attrs: {
id: { default: '' },
src: {},
alt: { default: null },
title: { default: null },
......
......@@ -18,6 +18,7 @@ export default ({ setPosition, position }) => {
useLayoutEffect(() => {
const WaxSurface = activeView.dom.getBoundingClientRect();
console.log(activeView.state.selection);
const left = 300;
const top = 500;
setPosition({ ...position, left, top });
......
import { v4 as uuidv4 } from 'uuid';
const findPlaceholder = (state, id, placeholderPlugin) => {
const decos = placeholderPlugin.getState(state);
const found = decos.find(null, null, spec => spec.id === id);
......@@ -39,6 +41,7 @@ export default (view, fileUpload, placeholderPlugin) => file => {
// }),
view.state.schema.nodes.image.create({
src: url,
id: uuidv4(),
}),
)
.setMeta(placeholderPlugin, { remove: { id } }),
......
......@@ -30,4 +30,5 @@ figcaption:focus {
figcaption:before {
content: 'Caption: ';
font-weight: bold;
}
\ No newline at end of file
}
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment