From 95abe5b2ad8121b20cee4086c4550fbcc32941c6 Mon Sep 17 00:00:00 2001 From: chris <kokosias@yahoo.gr> Date: Fri, 5 Feb 2021 21:07:47 +0200 Subject: [PATCH] remove unused file --- .../src/components/fileUpload.js | 53 ------------------- 1 file changed, 53 deletions(-) delete mode 100644 wax-prosemirror-components/src/components/fileUpload.js diff --git a/wax-prosemirror-components/src/components/fileUpload.js b/wax-prosemirror-components/src/components/fileUpload.js deleted file mode 100644 index 47dfc151f..000000000 --- a/wax-prosemirror-components/src/components/fileUpload.js +++ /dev/null @@ -1,53 +0,0 @@ -const findPlaceholder = (state, id, placeholderPlugin) => { - const decos = placeholderPlugin.getState(state); - const found = decos.find(null, null, spec => spec.id === id); - return found.length ? found[0].from : null; -}; - -export default (view, fileUpload, placeholderPlugin) => file => { - console.log('flffl', fileUpload); - const { state } = view; - - // A fresh object to act as the ID for this upload - const id = {}; - - // Replace the selection with a placeholder - const { tr } = state; - if (!tr.selection.empty) tr.deleteSelection(); - - tr.setMeta(placeholderPlugin, { - add: { id, pos: tr.selection.from }, - }); - - view.dispatch(tr); - - const pos = findPlaceholder(view.state, id, placeholderPlugin); - // If the content around the placeholder has been deleted, drop - // the image - if (pos == null) { - return; - } - // Otherwise, insert it at the placeholder's position, and remove - // the placeholder - view.dispatch( - state.tr - .replaceWith( - pos, - pos, - view.state.schema.nodes.image.create({ - src: url, - }), - ) - .setMeta(placeholderPlugin, { remove: { id } }), - ); - - // fileUpload(file).then( - // url => { - - // }, - // () => { - // // On failure, just clean up the placeholder - // view.dispatch(tr.setMeta(placeholderPlugin, { remove: { id } })); - // } - // ); -}; -- GitLab