-
-
Notifications
You must be signed in to change notification settings - Fork 128
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
494b887
commit 5fdbd75
Showing
6 changed files
with
38 additions
and
16 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,13 @@ | ||
export function deserializeText() {} | ||
import { buildBlockData, generateId, YooEditor, YooptaContentValue } from '@yoopta/editor'; | ||
|
||
export function deserializeText(editor: YooEditor, text: string): YooptaContentValue { | ||
const blockId = generateId(); | ||
const paragraphBlock = buildBlockData({ | ||
id: blockId, | ||
value: [{ id: generateId(), children: [{ text }] }], | ||
}); | ||
|
||
return { | ||
[blockId]: paragraphBlock, | ||
}; | ||
} |
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 +1,11 @@ | ||
export function serializeText() {} | ||
import { YooEditor, YooptaContentValue } from '@yoopta/editor'; | ||
import { serializeHTML } from '../html/serialize'; | ||
|
||
export function serializeText(editor: YooEditor, content: YooptaContentValue) { | ||
const htmlString = serializeHTML(editor, content); | ||
console.log('htmlString', htmlString); | ||
|
||
const div = document.createElement('div'); | ||
div.innerHTML = htmlString; | ||
return div.innerText; | ||
} |
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