Commit 1cf609d 1 parent 92803be commit 1cf609d Copy full SHA for 1cf609d
File tree 1 file changed +5
-2
lines changed
packages/markdown/src/lib/serializer
1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -12,13 +12,14 @@ import { serializeMdNodes } from './serializeMdNodes';
12
12
/** Serialize the editor value to Markdown. */
13
13
export const serializeMd = (
14
14
editor : SlateEditor ,
15
+ nodes ?: Parameters < typeof serializeMdNodes > [ '0' ] ,
15
16
options ?: Parameters < typeof serializeMdNodes > [ '1' ]
16
17
) => {
17
18
const plugins = editor . pluginList . filter (
18
19
( p ) => p . node . isElement || p . node . isLeaf
19
20
) ;
20
21
21
- const nodes = plugins . reduce (
22
+ const pluginNodes = plugins . reduce (
22
23
( acc , plugin ) => {
23
24
( acc as any ) [ plugin . key ] = {
24
25
isLeaf : plugin . node . isLeaf ,
@@ -31,7 +32,9 @@ export const serializeMd = (
31
32
{ } as SerializeMdOptions [ 'nodes' ]
32
33
) ;
33
34
34
- return serializeMdNodes ( editor . children , {
35
+ const nodesToSerialize = nodes ?? editor . children ;
36
+
37
+ return serializeMdNodes ( nodesToSerialize , {
35
38
...options ,
36
39
nodes : merge ( nodes , options ?. nodes ) ,
37
40
} ) ;
You can’t perform that action at this time.
0 commit comments