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

add title

parent 8e4fe385
No related branches found
No related tags found
1 merge request!526new wrapper component
...@@ -58,9 +58,9 @@ const Editoria = () => { ...@@ -58,9 +58,9 @@ const Editoria = () => {
value={demo} value={demo}
// readonly // readonly
layout={layout} layout={layout}
// onChange={debounce(source => { onChange={debounce(source => {
// console.log(JSON.stringify(source)); console.log(JSON.stringify(source));
// }, 200)} }, 200)}
user={user} user={user}
scrollMargin={200} scrollMargin={200}
scrollThreshold={200} scrollThreshold={200}
......
...@@ -90,7 +90,7 @@ const Editors = () => { ...@@ -90,7 +90,7 @@ const Editors = () => {
case 'oen': case 'oen':
return <OEN />; return <OEN />;
default: default:
return <HHMI />; return <Editoria />;
} }
}; };
......
/* eslint-disable no-multi-assign */
import { v4 as uuidv4 } from 'uuid'; import { v4 as uuidv4 } from 'uuid';
import { toggleMark } from 'prosemirror-commands'; import { toggleMark } from 'prosemirror-commands';
import { AddMarkStep } from 'prosemirror-transform'; import { AddMarkStep } from 'prosemirror-transform';
...@@ -178,6 +179,7 @@ const createComment = ( ...@@ -178,6 +179,7 @@ const createComment = (
group, group,
conversation, conversation,
viewid, viewid,
title,
})(state, dispatch); })(state, dispatch);
}; };
......
...@@ -72,64 +72,6 @@ export default ({ comment, top, commentId, recalculateTops, users }) => { ...@@ -72,64 +72,6 @@ export default ({ comment, top, commentId, recalculateTops, users }) => {
} }
}, [activeComment]); }, [activeComment]);
// const onClickPost = ({ commentValue, title }) => {
// setClickPost(true);
// const currentUser = user || (users || []).find(u => u.currentUser === true);
// const obj = {
// content: commentValue,
// displayName: currentUser
// ? currentUser.displayName || currentUser.username
// : 'Anonymous',
// userId: currentUser ? currentUser.userId : '1',
// timestamp: Math.floor(Date.now()),
// };
// comment.attrs.title = title || comment.attrs.title;
// comment.attrs.conversation.push(obj);
// const id = uuidv4();
// allCommentsWithSameId.forEach(singleComment => {
// activeView.dispatch(
// activeView.state.tr.removeMark(
// singleComment.pos,
// singleComment.pos + singleComment.node.nodeSize,
// commentMark,
// ),
// );
// if (activeViewId !== 'main') {
// activeView.dispatch(
// activeView.state.tr
// .addMark(
// singleComment.pos,
// singleComment.pos + singleComment.node.nodeSize,
// commentMark.create({
// id,
// group: comment.attrs.group,
// viewid: comment.attrs.viewid,
// conversation: comment.attrs.conversation,
// title: comment.attrs.title,
// }),
// )
// .setMeta('forceUpdate', true),
// );
// }
// });
// if (activeViewId === 'main') {
// Commands.createComment(
// pmViews.main.state,
// pmViews.main.dispatch,
// comment.attrs.group,
// comment.attrs.viewid,
// comment.attrs.conversation,
// );
// }
// activeView.focus();
// recalculateTops();
// };
const onClickPost = ({ commentValue, title }) => { const onClickPost = ({ commentValue, title }) => {
setClickPost(true); setClickPost(true);
const currentUser = user || (users || []).find(u => u.currentUser === true); const currentUser = user || (users || []).find(u => u.currentUser === true);
...@@ -156,22 +98,35 @@ export default ({ comment, top, commentId, recalculateTops, users }) => { ...@@ -156,22 +98,35 @@ export default ({ comment, top, commentId, recalculateTops, users }) => {
), ),
); );
activeView.dispatch( if (activeViewId !== 'main') {
activeView.state.tr activeView.dispatch(
.addMark( activeView.state.tr
singleComment.pos, .addMark(
singleComment.pos + singleComment.node.nodeSize, singleComment.pos,
commentMark.create({ singleComment.pos + singleComment.node.nodeSize,
id, commentMark.create({
group: comment.attrs.group, id,
viewid: comment.attrs.viewid, group: comment.attrs.group,
conversation: comment.attrs.conversation, viewid: comment.attrs.viewid,
title: comment.attrs.title, conversation: comment.attrs.conversation,
}), title: comment.attrs.title,
) }),
.setMeta('forceUpdate', true), )
); .setMeta('forceUpdate', true),
);
}
}); });
if (activeViewId === 'main') {
Commands.createComment(
pmViews.main.state,
pmViews.main.dispatch,
comment.attrs.group,
comment.attrs.viewid,
comment.attrs.conversation,
comment.attrs.title,
);
}
activeView.focus(); activeView.focus();
recalculateTops(); recalculateTops();
}; };
......
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