diff --git a/wax-prosemirror-plugins/src/comments/CommentPlugin.js b/wax-prosemirror-plugins/src/comments/CommentPlugin.js index 41b62258d2d1f86a31bf3a79abefe7e7d3f6c8c7..0e52c83f8fa781de1d2fec902a6a1ab607e1ad07 100644 --- a/wax-prosemirror-plugins/src/comments/CommentPlugin.js +++ b/wax-prosemirror-plugins/src/comments/CommentPlugin.js @@ -40,10 +40,18 @@ const getComment = state => { }); }); - if (allCommentsWithSameId.length > 1) { - const minPos = minBy(allCommentsWithSameId, 'pos'); - const maxPos = maxBy(allCommentsWithSameId, 'pos'); + const minPos = minBy(allCommentsWithSameId, 'pos'); + const maxPos = maxBy(allCommentsWithSameId, 'pos'); + if ( + state.selection.from === + maxPos.pos + last(allCommentsWithSameId).node.nodeSize + ) { + state.schema.marks.comment.spec.inclusive = false; + } else { + state.schema.marks.comment.spec.inclusive = true; + } + if (allCommentsWithSameId.length > 1) { return { from: minPos.pos, to: maxPos.pos + last(allCommentsWithSameId).node.nodeSize, diff --git a/wax-prosemirror-services/src/InlineAnnotations/EmphasisService/Emphasis.js b/wax-prosemirror-services/src/InlineAnnotations/EmphasisService/Emphasis.js index afacd594df18c469bec40fed3ef4e4c9c3e5a3f8..10967a14cab1abd2495551105739f2bbc018444d 100644 --- a/wax-prosemirror-services/src/InlineAnnotations/EmphasisService/Emphasis.js +++ b/wax-prosemirror-services/src/InlineAnnotations/EmphasisService/Emphasis.js @@ -13,6 +13,7 @@ class Emphasis extends Tools { get run() { return (state, dispatch) => { + console.log('run'); toggleMark(state.config.schema.marks.em)(state, dispatch); }; } diff --git a/wax-prosemirror-services/src/ShortCutsService/ShortCuts.js b/wax-prosemirror-services/src/ShortCutsService/ShortCuts.js index 7c5157b8c08e153c7067d387aca81c1096825b30..e91dee7ffef79dffc2090ee514c4e741d4eec7cb 100644 --- a/wax-prosemirror-services/src/ShortCutsService/ShortCuts.js +++ b/wax-prosemirror-services/src/ShortCutsService/ShortCuts.js @@ -60,15 +60,6 @@ class ShortCuts { } pressEnter(state, dispatch) { - const commentMark = state.schema.marks.comment; - const commentOnSelection = DocumentHelpers.findFragmentedMark( - state, - commentMark, - ); - if (commentOnSelection) { - state.schema.marks.comment.spec.inclusive = true; - } - // LISTS if (splitListItem(this.schema.nodes.list_item)(state)) { splitListItem(this.schema.nodes.list_item)(state, dispatch);