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

images in progress

parent 9f0f19a7
No related branches found
No related tags found
1 merge request!307Answer nodeview
...@@ -15,7 +15,7 @@ const Wrapper = styled.div` ...@@ -15,7 +15,7 @@ const Wrapper = styled.div`
const ImageUpload = ({ item, fileUpload, view }) => { const ImageUpload = ({ item, fileUpload, view }) => {
const { const {
app, app,
activeViewId, activeView,
view: { main }, view: { main },
} = useContext(WaxContext); } = useContext(WaxContext);
...@@ -37,7 +37,7 @@ const ImageUpload = ({ item, fileUpload, view }) => { ...@@ -37,7 +37,7 @@ const ImageUpload = ({ item, fileUpload, view }) => {
insertImage(urls, view, placeholderPlugin); insertImage(urls, view, placeholderPlugin);
} }
let isDisabled = !item.select(view.state, activeViewId); let isDisabled = !item.select(activeView);
const isEditable = main.props.editable(editable => { const isEditable = main.props.editable(editable => {
return editable; return editable;
......
...@@ -27,9 +27,6 @@ const CreateTable = ({ view = {}, item }) => { ...@@ -27,9 +27,6 @@ const CreateTable = ({ view = {}, item }) => {
activeView, activeView,
activeViewId, activeViewId,
} = useContext(WaxContext); } = useContext(WaxContext);
if (item.onlyOnMain) {
view = main;
}
const { icon, run, select, title } = item; const { icon, run, select, title } = item;
const ref = useRef(); const ref = useRef();
...@@ -48,7 +45,7 @@ const CreateTable = ({ view = {}, item }) => { ...@@ -48,7 +45,7 @@ const CreateTable = ({ view = {}, item }) => {
setIsOpen(!isOpen); setIsOpen(!isOpen);
}; };
let isDisabled = !select(activeView, activeViewId); let isDisabled = !select(activeView);
const isEditable = main.props.editable(editable => { const isEditable = main.props.editable(editable => {
return editable; return editable;
......
...@@ -18,8 +18,9 @@ class Image extends Tools { ...@@ -18,8 +18,9 @@ class Image extends Tools {
return true; return true;
} }
select = (state, activeViewId) => { select = activeView => {
if (activeViewId !== 'main') return false; const { disallowedTools } = activeView.props;
if (disallowedTools.includes('images')) return false;
return true; return true;
}; };
......
...@@ -37,7 +37,7 @@ export default ({ node, view }) => { ...@@ -37,7 +37,7 @@ export default ({ node, view }) => {
}), }),
// This is the magic part // This is the magic part
dispatchTransaction, dispatchTransaction,
disallowedTools: ['tables'], disallowedTools: ['tables', 'images'],
handleDOMEvents: { handleDOMEvents: {
blur: () => { blur: () => {
if (context.view[noteId]) { if (context.view[noteId]) {
......
...@@ -19,8 +19,8 @@ class Table extends Tools { ...@@ -19,8 +19,8 @@ class Table extends Tools {
}; };
} }
select = (view, activeViewId) => { select = activeView => {
const { disallowedTools } = view.props; const { disallowedTools } = activeView.props;
if (disallowedTools.includes('tables')) return false; if (disallowedTools.includes('tables')) return false;
return true; return true;
}; };
......
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