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

disabled tools

parent ee418fdd
No related branches found
No related tags found
2 merge requests!293Inline question,!292Inline question
...@@ -54,7 +54,7 @@ const Editors = () => { ...@@ -54,7 +54,7 @@ const Editors = () => {
case 'ncbi': case 'ncbi':
break; break;
default: default:
return <Editoria />; return <HHMI />;
} }
}; };
......
...@@ -45,27 +45,10 @@ export default css` ...@@ -45,27 +45,10 @@ export default css`
} }
div[contenteditable='false'] { div[contenteditable='false'] {
// pointer-events: none; math-display {
// user-select: none; pointer-events: none;
} user-select: none;
}
/* .ProseMirror title {
display: inline;
font-size: 14px;
} */
hr {
border: none;
margin: 1em 0;
padding: 2px 10px;
}
hr:after {
background-color: silver;
content: '';
display: block;
height: 1px;
line-height: 2px;
} }
ul, ul,
......
...@@ -31,12 +31,12 @@ const TextHighlightComponent = styled.div` ...@@ -31,12 +31,12 @@ const TextHighlightComponent = styled.div`
flex-direction: column; flex-direction: column;
`; `;
const Highlighter = styled.div` const Highlighter = styled.div`
min-width: 25px; border: 1px solid gray;
cursor: pointer;
display: inline-grid;
height: 25px; height: 25px;
margin: 5px; margin: 5px;
display: inline-grid; min-width: 25px;
cursor: pointer;
border: 1px solid gray;
`; `;
const TextHighlightingTool = ({ view: { dispatch, state }, item }) => { const TextHighlightingTool = ({ view: { dispatch, state }, item }) => {
...@@ -56,7 +56,10 @@ const TextHighlightingTool = ({ view: { dispatch, state }, item }) => { ...@@ -56,7 +56,10 @@ const TextHighlightingTool = ({ view: { dispatch, state }, item }) => {
]; ];
const ref = useRef(); const ref = useRef();
const { activeViewId, activeView } = useContext(WaxContext); const { activeViewId, activeView, view } = useContext(WaxContext);
const isEditable = view.main.props.editable(editable => {
return editable;
});
useOnClickOutside(ref, () => setIsOpen(false)); useOnClickOutside(ref, () => setIsOpen(false));
...@@ -94,7 +97,8 @@ const TextHighlightingTool = ({ view: { dispatch, state }, item }) => { ...@@ -94,7 +97,8 @@ const TextHighlightingTool = ({ view: { dispatch, state }, item }) => {
item.run(state, dispatch, color); item.run(state, dispatch, color);
}; };
const isDisabled = !select(state, activeViewId, activeView); let isDisabled = !select(state, activeViewId, activeView);
if (!isEditable) isDisabled = true;
const MenuButtonComponent = useMemo( const MenuButtonComponent = useMemo(
() => ( () => (
......
...@@ -43,8 +43,12 @@ const TransformCaseComponent = ({ view: { state }, item }) => { ...@@ -43,8 +43,12 @@ const TransformCaseComponent = ({ view: { state }, item }) => {
const { icon, title, select } = item; const { icon, title, select } = item;
const [isOpen, setIsOpen] = useState(false); const [isOpen, setIsOpen] = useState(false);
const ref = useRef(); const ref = useRef();
const { activeViewId, activeView } = useContext(WaxContext); const { activeViewId, activeView, view } = useContext(WaxContext);
const isDisabled = !select(state, activeViewId, activeView); const isEditable = view.main.props.editable(editable => {
return editable;
});
let isDisabled = !select(state, activeViewId, activeView);
if (!isEditable) isDisabled = true;
useOnClickOutside(ref, () => setIsOpen(false)); useOnClickOutside(ref, () => setIsOpen(false));
......
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