@liveblocks/react-ui
Version:
A set of React pre-built components for the Liveblocks products. Liveblocks is the all-in-one toolkit to build collaborative products like Figma, Notion, and more.
1 lines • 1.05 kB
Source Map (JSON)
{"version":3,"file":"empty-clear-formatting.cjs","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":["isEmpty","removeMarks"],"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,IAAIA,eAAQ,CAAA,MAAA,EAAQ,MAAO,CAAA,QAAQ,CAAG,EAAA;AACpC,MAAAC,iBAAA,CAAY,MAAM,CAAA,CAAA;AAAA,KACpB;AAEA,IAAA,QAAA,CAAS,OAAO,CAAA,CAAA;AAAA,GAClB,CAAA;AAEA,EAAO,OAAA,MAAA,CAAA;AACT;;;;"}