-
Notifications
You must be signed in to change notification settings - Fork 785
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ee06331
commit e6ab3af
Showing
8 changed files
with
28 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 0 additions & 34 deletions
34
packages/code-block/src/lib/deserializer/htmlDeserializerCodeBlockStatic.ts
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,4 +3,3 @@ | |
*/ | ||
|
||
export * from './htmlDeserializerCodeBlock'; | ||
export * from './htmlDeserializerCodeBlockStatic'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 12 additions & 5 deletions
17
packages/core/src/lib/plugins/html/utils/deserializeHtmlNodeChildren.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,19 @@ | ||
import type { SlateEditor } from '../../../editor'; | ||
import type { DeserializeHtmlChildren } from '../types'; | ||
|
||
import { isSlateNode } from '../../../static'; | ||
import { deserializeHtmlNode } from './deserializeHtmlNode'; | ||
|
||
export const deserializeHtmlNodeChildren = ( | ||
editor: SlateEditor, | ||
node: ChildNode | HTMLElement | ||
) => | ||
Array.from(node.childNodes).flatMap( | ||
deserializeHtmlNode(editor) | ||
) as DeserializeHtmlChildren[]; | ||
node: ChildNode | HTMLElement, | ||
isSlate = false | ||
): DeserializeHtmlChildren[] => { | ||
return Array.from(node.childNodes).flatMap((child) => { | ||
if (child.nodeType === 1 && !isSlateNode(child as HTMLElement) && isSlate) { | ||
return deserializeHtmlNodeChildren(editor, child as HTMLElement, isSlate); | ||
} | ||
|
||
return deserializeHtmlNode(editor)(child); | ||
}) as DeserializeHtmlChildren[]; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters