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

find inline comments in the whole document

parent 0b8c99ab
No related branches found
No related tags found
1 merge request!72Comments
import React, { useEffect, useRef, useContext } from "react";
import styled from "styled-components";
export default ({ node, view }) => {
useEffect(() => {}, []);
};
// export default ({ node, view }) => {
// useEffect(() => {}, []);
// };
const CommentBoxStyled = styled.div`
height: 50px;
width: 50px;
display: flex;
flex-direction: column;
margin-top: 10px;
background: black;
`;
const CommentBox = () => <CommentBoxStyled />;
export default CommentBox;
......@@ -30,7 +30,11 @@ export default () => {
const updateComments = view => {
if (view) {
// TODO find comments
return DocumentHelpers.findChildrenByMark(
view.state.doc,
view.state.schema.marks.comment,
true
);
}
return [];
};
......@@ -171,7 +171,7 @@ const NotesContainer = styled.div`
const CommentsContainer = styled.div`
display: flex;
flex-direction: row;
flex-direction: column;
width: 35%;
height: 100%;
`;
......
......@@ -55,9 +55,14 @@ const findInlineNodes = (node, descend) => {
return findChildren(node, child => child.isInline, descend);
};
const findChildrenByMark = (node, markType, descend) => {
return findChildren(node, child => markType.isInSet(child.marks), descend);
};
export default {
findMark,
findBlockNodes,
findChildrenByType,
findInlineNodes
findInlineNodes,
findChildrenByMark
};
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