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

set comments into context

parent 046d1152
No related branches found
No related tags found
2 merge requests!548Merge yjs with standard comments,!545Overlapping comments
...@@ -18,7 +18,7 @@ export default props => { ...@@ -18,7 +18,7 @@ export default props => {
pmViews: props.view || {}, pmViews: props.view || {},
activeView: props.activeView || {}, activeView: props.activeView || {},
activeViewId: props.activeViewId || {}, activeViewId: props.activeViewId || {},
options: { fullScreen: false, AiOn: false }, options: { fullScreen: false },
transaction: {}, transaction: {},
setTransaction: tr => { setTransaction: tr => {
Object.assign(context.transaction, tr); Object.assign(context.transaction, tr);
......
...@@ -37,13 +37,20 @@ const ToggleAiComponent = ({ item }) => { ...@@ -37,13 +37,20 @@ const ToggleAiComponent = ({ item }) => {
enableService.AiOn ? ( enableService.AiOn ? (
<MenuButton <MenuButton
active={checked} active={checked}
disabled={!isEditable} disabled={
!isEditable || main.state.selection.from === main.state.selection.to
}
iconName={item.icon} iconName={item.icon}
onMouseDown={onMouseDown} onMouseDown={onMouseDown}
title={item.title} title={item.title}
/> />
) : null, ) : null,
[checked, isDisabled, enableService.AiOn], [
checked,
isDisabled,
enableService.AiOn,
main.state.selection.from === main.state.selection.to,
],
); );
}; };
......
...@@ -12,7 +12,7 @@ const PLUGIN_KEY = 'commentPlugin'; ...@@ -12,7 +12,7 @@ const PLUGIN_KEY = 'commentPlugin';
export default class CommentsService extends Service { export default class CommentsService extends Service {
boot() { boot() {
const commentsConfig = this.app.config.get('config.CommentsService'); const commentsConfig = this.app.config.get('config.CommentsService');
console.log(commentsConfig);
this.app.PmPlugins.add(PLUGIN_KEY, CommentPlugin(PLUGIN_KEY)); this.app.PmPlugins.add(PLUGIN_KEY, CommentPlugin(PLUGIN_KEY));
this.app.PmPlugins.add( this.app.PmPlugins.add(
'copyPasteCommentPlugin', 'copyPasteCommentPlugin',
...@@ -21,7 +21,10 @@ export default class CommentsService extends Service { ...@@ -21,7 +21,10 @@ export default class CommentsService extends Service {
const options = { const options = {
styles: {}, styles: {},
onSelectionChange: items => commentsConfig.getComments(items), onSelectionChange: items => {
commentsConfig.getComments(items);
this.app.context.setOption({ comments: items });
},
onAnnotationListChange: () => true, onAnnotationListChange: () => true,
document: '', document: '',
field: 'annotations', field: 'annotations',
......
...@@ -12,8 +12,9 @@ export default ({ area, users }) => { ...@@ -12,8 +12,9 @@ export default ({ area, users }) => {
pmViews: { main }, pmViews: { main },
app, app,
activeView, activeView,
options,
} = useContext(WaxContext); } = useContext(WaxContext);
console.log(options);
const commentPlugin = app.PmPlugins.get('commentPlugin'); const commentPlugin = app.PmPlugins.get('commentPlugin');
const trakChangePlugin = app.PmPlugins.get('trackChangePlugin'); const trakChangePlugin = app.PmPlugins.get('trackChangePlugin');
......
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