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 = () => {
value={demo}
// readonly
layout={layout}
// onChange={debounce(source => {
// console.log(JSON.stringify(source));
// }, 200)}
onChange={debounce(source => {
console.log(JSON.stringify(source));
}, 200)}
user={user}
scrollMargin={200}
scrollThreshold={200}
......
......@@ -90,7 +90,7 @@ const Editors = () => {
case 'oen':
return <OEN />;
default:
return <HHMI />;
return <Editoria />;
}
};
......
/* eslint-disable no-multi-assign */
import { v4 as uuidv4 } from 'uuid';
import { toggleMark } from 'prosemirror-commands';
import { AddMarkStep } from 'prosemirror-transform';
......@@ -178,6 +179,7 @@ const createComment = (
group,
conversation,
viewid,
title,
})(state, dispatch);
};
......
......@@ -72,64 +72,6 @@ export default ({ comment, top, commentId, recalculateTops, users }) => {
}
}, [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 }) => {
setClickPost(true);
const currentUser = user || (users || []).find(u => u.currentUser === true);
......@@ -156,22 +98,35 @@ export default ({ comment, top, commentId, recalculateTops, users }) => {
),
);
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') {
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,
comment.attrs.title,
);
}
activeView.focus();
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