{"version":3,"file":"empty-clear-formatting.mjs","sources":["../../../src/slate/plugins/empty-clear-formatting.ts"],"sourcesContent":["import type { Editor as SlateEditor } from \"slate\";\n\nimport { isEmpty } from \"../utils/is-empty\";\nimport { removeMarks } from \"../utils/marks\";\n\n// This plugins clears formatting on empty blocks\n// https://github.com/ianstormtaylor/slate/issues/2908\nexport function withEmptyClearFormatting<T extends SlateEditor>(editor: T): T {\n  const { onChange } = editor;\n\n  editor.onChange = (options) => {\n    if (isEmpty(editor, editor.children)) {\n      removeMarks(editor);\n    }\n\n    onChange(options);\n  };\n\n  return editor;\n}\n"],"names":[],"mappings":";;;AAOO,SAAS,yBAAgD,MAAc,EAAA;AAC5E,EAAM,MAAA,EAAE,UAAa,GAAA,MAAA,CAAA;AAErB,EAAO,MAAA,CAAA,QAAA,GAAW,CAAC,OAAY,KAAA;AAC7B,IAAA,IAAI,OAAQ,CAAA,MAAA,EAAQ,MAAO,CAAA,QAAQ,CAAG,EAAA;AACpC,MAAA,WAAA,CAAY,MAAM,CAAA,CAAA;AAAA,KACpB;AAEA,IAAA,QAAA,CAAS,OAAO,CAAA,CAAA;AAAA,GAClB,CAAA;AAEA,EAAO,OAAA,MAAA,CAAA;AACT;;;;"}