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

fix questions feedback

parent 5ce22c6d
No related branches found
No related tags found
1 merge request!519Move tool groups
...@@ -195,7 +195,7 @@ const Hhmi = () => { ...@@ -195,7 +195,7 @@ const Hhmi = () => {
// targetFormat="JSON" // targetFormat="JSON"
readonly={readOnly} readonly={readOnly}
layout={HhmiLayout} layout={HhmiLayout}
onChange={source => console.log(source)} // onChange={source => console.log(source)}
/> />
</> </>
); );
......
...@@ -52,3 +52,8 @@ export { default as Button } from './src/components/Button'; ...@@ -52,3 +52,8 @@ export { default as Button } from './src/components/Button';
/* Plugins */ /* Plugins */
export { default as FakeCursorPlugin } from './src/config/plugins/FakeCursorPlugin'; export { default as FakeCursorPlugin } from './src/config/plugins/FakeCursorPlugin';
// export * from 'prosemirror-state';
// export * from 'prosemirror-view';
// export * from 'prosemirror-model';
// export * from 'prosemirror-transform';
...@@ -53,6 +53,14 @@ export default ({ node, getPos, readOnly }) => { ...@@ -53,6 +53,14 @@ export default ({ node, getPos, readOnly }) => {
const [feedBack, setFeedBack] = useState(node.attrs.feedback); const [feedBack, setFeedBack] = useState(node.attrs.feedback);
const feedBackRef = useRef(null); const feedBackRef = useRef(null);
const setHeight = () => {
const textarea = feedBackRef.current;
if (!textarea) return;
const heightLimit = 200;
textarea.style.height = '';
textarea.style.height = `${Math.min(textarea.scrollHeight, heightLimit)}px`;
};
const feedBackInput = () => { const feedBackInput = () => {
setFeedBack(feedBackRef.current.value); setFeedBack(feedBackRef.current.value);
const allNodes = getNodes(main); const allNodes = getNodes(main);
...@@ -71,14 +79,6 @@ export default ({ node, getPos, readOnly }) => { ...@@ -71,14 +79,6 @@ export default ({ node, getPos, readOnly }) => {
return false; return false;
}; };
const setHeight = () => {
const textarea = feedBackRef.current;
if (!textarea) return;
const heightLimit = 200;
textarea.style.height = '';
textarea.style.height = `${Math.min(textarea.scrollHeight, heightLimit)}px`;
};
const setNullSelection = () => { const setNullSelection = () => {
main.dispatch( main.dispatch(
main.state.tr.setSelection(TextSelection.create(main.state.tr.doc, null)), main.state.tr.setSelection(TextSelection.create(main.state.tr.doc, null)),
...@@ -101,7 +101,6 @@ export default ({ node, getPos, readOnly }) => { ...@@ -101,7 +101,6 @@ export default ({ node, getPos, readOnly }) => {
readOnly={readOnly} readOnly={readOnly}
ref={feedBackRef} ref={feedBackRef}
rows="1" rows="1"
style={{ height: setHeight() }}
type="text" type="text"
value={feedBack} value={feedBack}
/> />
......
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