Skip to content
Snippets Groups Projects

Find and replace

Merged Christos requested to merge find-and-replace into master
8 files
+ 16
10
Compare changes
  • Side-by-side
  • Inline
Files
8
@@ -30,11 +30,14 @@ export default ({ comment, top, commentId, recalculateTops }) => {
@@ -30,11 +30,14 @@ export default ({ comment, top, commentId, recalculateTops }) => {
const { state, dispatch } = activeView;
const { state, dispatch } = activeView;
const viewId = comment.attrs.viewid;
const viewId = comment.attrs.viewid;
 
let allCommentsWithSameId = [];
const allCommentsWithSameId = DocumentHelpers.findAllMarksWithSameId(
if (view[viewId]) {
view[viewId].state,
allCommentsWithSameId = DocumentHelpers.findAllMarksWithSameId(
comment,
view[viewId].state,
);
comment,
 
);
 
}
const commentMark = state.schema.marks.comment;
const commentMark = state.schema.marks.comment;
@@ -53,13 +56,6 @@ export default ({ comment, top, commentId, recalculateTops }) => {
@@ -53,13 +56,6 @@ export default ({ comment, top, commentId, recalculateTops }) => {
}
}
const onClickPost = content => {
const onClickPost = content => {
// TODO find out why on enter comment posts twice.
if (
comment.attrs.conversation.length !== 0 &&
last(comment.attrs.conversation).content === content
)
return;
const { tr } = state;
const { tr } = state;
const obj = {
const obj = {
@@ -128,14 +124,16 @@ export default ({ comment, top, commentId, recalculateTops }) => {
@@ -128,14 +124,16 @@ export default ({ comment, top, commentId, recalculateTops }) => {
const onTextAreaBlur = (content, isNewComment) => {
const onTextAreaBlur = (content, isNewComment) => {
// TODO Save into local storage
// TODO Save into local storage
if (content !== '') {
// if (content !== '') {
onClickPost(content);
// onClickPost(content);
}
// }
if (content === '' && isNewComment) {
setTimeout(() => {
onClickResolve();
if (comment.attrs.conversation.length === 0 && isNewComment) {
activeView.focus();
onClickResolve();
}
activeView.focus();
 
}
 
}, 200);
};
};
const MemorizedComponent = useMemo(
const MemorizedComponent = useMemo(