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

fix: reset active state

parent 8bc10573
No related branches found
No related tags found
1 merge request!540Allow book owner to set AI use
import React, { useContext, useMemo, useState } from 'react';
import React, { useContext, useEffect, useMemo, useState } from 'react';
import { WaxContext, MenuButton } from 'wax-prosemirror-core';
import PropTypes from 'prop-types';
......@@ -26,6 +26,12 @@ const ToggleAiComponent = ({ item }) => {
main.focus();
};
useEffect(() => {
setChecked(false);
context.setOption({ AiOn: false });
main.dispatch(main.state.tr.setMeta('addToHistory', false));
}, [checked && main.state.selection.from === main.state.selection.to]);
return useMemo(
() =>
enableService.AiOn ? (
......
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