Skip to content

Commit

Permalink
[DEV-19138] Drop unused serialize() method from the Extension inter…
Browse files Browse the repository at this point in the history
…face
  • Loading branch information
e1himself committed Jan 15, 2025
1 parent 11439c4 commit d629ae0
Show file tree
Hide file tree
Showing 8 changed files with 0 additions and 55 deletions.
2 changes: 0 additions & 2 deletions packages/slate-commons/src/types/Extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import type { Normalize } from './Normalize';
import type { OnKeyDown } from './OnKeyDown';
import type { RenderElement } from './RenderElement';
import type { RenderLeaf } from './RenderLeaf';
import type { Serialize } from './Serialize';
import type { WithOverrides } from './WithOverrides';

export interface Extension {
Expand All @@ -26,6 +25,5 @@ export interface Extension {
onKeyDown?: OnKeyDown | null;
renderElement?: RenderElement;
renderLeaf?: RenderLeaf;
serialize?: Serialize;
withOverrides?: WithOverrides;
}
7 changes: 0 additions & 7 deletions packages/slate-commons/src/types/Serialize.ts

This file was deleted.

2 changes: 0 additions & 2 deletions packages/slate-editor/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,13 @@ import type {
DefaultTextBlockEditor,
ElementsEqualityCheckEditor,
RichBlocksAwareEditor,
SerializingEditor,
} from '#modules/editor';

type Editor = BaseEditor &
HistoryEditor &
DefaultTextBlockEditor<ParagraphNode> &
ElementsEqualityCheckEditor &
RichBlocksAwareEditor &
SerializingEditor &
FlashEditor;

declare module 'slate' {
Expand Down
2 changes: 0 additions & 2 deletions packages/slate-editor/src/modules/editor/createEditor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import {
withDeserializeHtml,
withElementsEqualityCheck,
withRichBlocks,
withSerialization,
} from './plugins';

export function createEditor(
Expand All @@ -42,7 +41,6 @@ export function createEditor(
withDeserializeHtml(getExtensions),
withRichBlocks(getExtensions),
withElementsEqualityCheck(getExtensions),
withSerialization(getExtensions),
...overrides,
])(baseEditor);
}
2 changes: 0 additions & 2 deletions packages/slate-editor/src/modules/editor/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,11 @@ export {
withDeserializeHtml,
withElementsEqualityCheck,
withRichBlocks,
withSerialization,
} from './plugins';
export type {
DefaultTextBlockEditor,
ElementsEqualityCheckEditor,
RichBlocksAwareEditor,
SerializingEditor,
} from './plugins';
export type { EditorRef, EditorProps, Value } from './types';
export { useEditorEvents } from './useEditorEvents';
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { withoutNodes } from '@prezly/slate-commons';
import { isQuoteNode } from '@prezly/slate-types';
import { createEditor as createSlateEditor } from 'slate';

import { createEditor } from '#modules/editor';
Expand Down Expand Up @@ -63,21 +61,4 @@ describe('isEditorValueEqual', () => {

expect(isEditorValueEqual(editor, a, b)).toBe(true);
});

it('should run pre-serialization cleanup from extensions', () => {
const editor = createEditor(createSlateEditor(), () => [
{
id: 'PreSerializationCleanup',
serialize: (nodes) => withoutNodes(nodes, isQuoteNode),
},
]);

const a = [
{ type: 'paragraph', children: [{ text: 'A wise man once said:' }] },
{ type: 'block-quote', children: [{ text: 'Hello' }] },
];
const b = [{ type: 'paragraph', children: [{ text: 'A wise man once said:' }] }];

expect(isEditorValueEqual(editor, a, b)).toBe(true);
});
});
1 change: 0 additions & 1 deletion packages/slate-editor/src/modules/editor/plugins/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,3 @@ export {
withElementsEqualityCheck,
} from './withElementsEqualityCheck';
export { type RichBlocksAwareEditor, withRichBlocks } from './withRichBlocks';
export { type SerializingEditor, withSerialization } from './withSerialization';

This file was deleted.

0 comments on commit d629ae0

Please sign in to comment.