@platejs/ai 50.2.1 → 50.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3202,7 +3202,7 @@ var removeAnchorAIChat = (editor, options) => {
3202
3202
  // src/react/ai-chat/utils/resetAIChat.ts
3203
3203
  import { KEYS as KEYS8 } from "platejs";
3204
3204
  import { getEditorPlugin as getEditorPlugin2 } from "platejs/react";
3205
- var resetAIChat = (editor) => {
3205
+ var resetAIChat = (editor, { undo = true } = {}) => {
3206
3206
  const { api, getOptions, setOptions } = getEditorPlugin2(
3207
3207
  editor,
3208
3208
  {
@@ -3220,7 +3220,9 @@ var resetAIChat = (editor) => {
3220
3220
  mode: "insert",
3221
3221
  toolName: "generate"
3222
3222
  });
3223
- editor.getTransforms(AIPlugin).ai.undo();
3223
+ if (undo) {
3224
+ editor.getTransforms(AIPlugin).ai.undo();
3225
+ }
3224
3226
  };
3225
3227
 
3226
3228
  // src/react/ai-chat/utils/submitAIChat.ts
@@ -3420,8 +3422,11 @@ var AIChatPlugin = createTPlatePlugin({
3420
3422
  }
3421
3423
  };
3422
3424
  }).extendApi(({ api, editor, getOptions, setOption, tf, type }) => ({
3423
- hide: ({ focus = true } = {}) => {
3424
- api.aiChat.reset();
3425
+ hide: ({
3426
+ focus = true,
3427
+ undo = true
3428
+ } = {}) => {
3429
+ api.aiChat.reset({ undo });
3425
3430
  setOption("open", false);
3426
3431
  if (focus) {
3427
3432
  if (editor.getOption(BlockSelectionPlugin4, "isSelectingSome")) {