1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-08-29 09:59:48 +02:00

Add marks option to Text.createFromString

This commit is contained in:
Soreine
2016-11-08 15:13:38 +01:00
parent e28b76b709
commit 49f6331075

View File

@@ -48,15 +48,16 @@ class Text extends new Record(DEFAULTS) {
* Create a new `Text` from a string
*
* @param {String} content
* @param {Set<Mark>} marks (optional)
* @return {Text}
*/
static createFromString(content) {
static createFromString(content, marks = Set()) {
return Text.create({
characters: Character.createList(
content.split('')
.map(c => {
return { text: c }
return { text: c, marks }
})
)
})