diff --git a/wax-prosemirror-core/src/WaxContext.js b/wax-prosemirror-core/src/WaxContext.js index 4d3ee58f9760b54b40e156a29e7b0f38a6ed72b1..d97ec379c28c616b9f6b18945d31ae29ab0c433d 100644 --- a/wax-prosemirror-core/src/WaxContext.js +++ b/wax-prosemirror-core/src/WaxContext.js @@ -18,7 +18,7 @@ export default props => { pmViews: props.view || {}, activeView: props.activeView || {}, activeViewId: props.activeViewId || {}, - options: { fullScreen: false, AiOn: false }, + options: { fullScreen: false }, transaction: {}, setTransaction: tr => { Object.assign(context.transaction, tr); diff --git a/wax-prosemirror-services/src/AiService/components/ToggleAiComponent.js b/wax-prosemirror-services/src/AiService/components/ToggleAiComponent.js index 6575a79f97262bbe6a17c86cd3b80a347266cdd2..b730ea0763650ff342529e6f3dbce9e01873872b 100644 --- a/wax-prosemirror-services/src/AiService/components/ToggleAiComponent.js +++ b/wax-prosemirror-services/src/AiService/components/ToggleAiComponent.js @@ -37,13 +37,20 @@ const ToggleAiComponent = ({ item }) => { enableService.AiOn ? ( <MenuButton active={checked} - disabled={!isEditable} + disabled={ + !isEditable || main.state.selection.from === main.state.selection.to + } iconName={item.icon} onMouseDown={onMouseDown} title={item.title} /> ) : null, - [checked, isDisabled, enableService.AiOn], + [ + checked, + isDisabled, + enableService.AiOn, + main.state.selection.from === main.state.selection.to, + ], ); }; diff --git a/wax-prosemirror-services/src/CommentsService/CommentsService.js b/wax-prosemirror-services/src/CommentsService/CommentsService.js index 5a6454014c4ae584db0447836dfe506575425ee0..5bf33affe306bb445fdfb84e96c26d63803e8a5d 100644 --- a/wax-prosemirror-services/src/CommentsService/CommentsService.js +++ b/wax-prosemirror-services/src/CommentsService/CommentsService.js @@ -12,7 +12,7 @@ const PLUGIN_KEY = 'commentPlugin'; export default class CommentsService extends Service { boot() { const commentsConfig = this.app.config.get('config.CommentsService'); - console.log(commentsConfig); + this.app.PmPlugins.add(PLUGIN_KEY, CommentPlugin(PLUGIN_KEY)); this.app.PmPlugins.add( 'copyPasteCommentPlugin', @@ -21,7 +21,10 @@ export default class CommentsService extends Service { const options = { styles: {}, - onSelectionChange: items => commentsConfig.getComments(items), + onSelectionChange: items => { + commentsConfig.getComments(items); + this.app.context.setOption({ comments: items }); + }, onAnnotationListChange: () => true, document: '', field: 'annotations', diff --git a/wax-prosemirror-services/src/CommentsService/components/RightArea.js b/wax-prosemirror-services/src/CommentsService/components/RightArea.js index d3644d9b52cacec690047c71d8c5ce807471df55..59e3b81f11ae0a28966770012c933bcbe8c2a041 100644 --- a/wax-prosemirror-services/src/CommentsService/components/RightArea.js +++ b/wax-prosemirror-services/src/CommentsService/components/RightArea.js @@ -12,8 +12,9 @@ export default ({ area, users }) => { pmViews: { main }, app, activeView, + options, } = useContext(WaxContext); - + console.log(options); const commentPlugin = app.PmPlugins.get('commentPlugin'); const trakChangePlugin = app.PmPlugins.get('trackChangePlugin');