From f1aec1ff5f80c14c7b5f510c9b483a706059f911 Mon Sep 17 00:00:00 2001 From: chris <kokosias@yahoo.gr> Date: Fri, 29 Sep 2023 11:31:08 +0300 Subject: [PATCH] display on toggle Change --- editors/demo/src/Editoria/Editoria.js | 6 +++--- wax-prosemirror-core/src/WaxContext.js | 2 +- .../src/AiService/components/ToggleAiComponent.js | 4 +++- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/editors/demo/src/Editoria/Editoria.js b/editors/demo/src/Editoria/Editoria.js index 9bda4b113..3a72be1e7 100644 --- a/editors/demo/src/Editoria/Editoria.js +++ b/editors/demo/src/Editoria/Editoria.js @@ -53,9 +53,9 @@ const Editoria = () => { value={demo} // readonly layout={layout} - onChange={debounce(source => { - console.log(JSON.stringify(source)); - }, 200)} + // onChange={debounce(source => { + // console.log(JSON.stringify(source)); + // }, 200)} user={user} scrollMargin={200} scrollThreshold={200} diff --git a/wax-prosemirror-core/src/WaxContext.js b/wax-prosemirror-core/src/WaxContext.js index d97ec379c..4d3ee58f9 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 }, + options: { fullScreen: false, AiOn: 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 412a61351..ddadd7b7c 100644 --- a/wax-prosemirror-services/src/AiService/components/ToggleAiComponent.js +++ b/wax-prosemirror-services/src/AiService/components/ToggleAiComponent.js @@ -23,8 +23,10 @@ const ToggleAiComponent = () => { if (!isEditable) isDisabled = true; const handleChange = () => { - setChecked(!checked); context.setOption({ AiOn: !checked }); + setChecked(!checked); + main.dispatch(main.state.tr.setMeta('addToHistory', false)); + main.focus(); }; return useMemo( -- GitLab