Merge pull request #153 from calibr/124-text-embeds
process embeds in YText.toDelta
This commit is contained in:
commit
3fba4f25a5
@ -782,6 +782,13 @@ export class YText extends AbstractType {
|
||||
// @ts-ignore
|
||||
str += n.string
|
||||
break
|
||||
case ItemEmbed:
|
||||
packStr()
|
||||
ops.push({
|
||||
// @ts-ignore item is ItemFormat
|
||||
insert: n.embed
|
||||
})
|
||||
break
|
||||
case ItemFormat:
|
||||
packStr()
|
||||
// @ts-ignore
|
||||
|
@ -74,3 +74,16 @@ export const testBasicFormat = tc => {
|
||||
t.compare(delta, [{ retain: 1 }, { retain: 1, attributes: { bold: null } }])
|
||||
compare(users)
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {t.TestCase} tc
|
||||
*/
|
||||
export const testGetDeltaWithEmbeds = tc => {
|
||||
const { users, text0 } = init(tc, { users: 1 })
|
||||
text0.applyDelta([{
|
||||
insert: {linebreak: "s"}
|
||||
}])
|
||||
t.compare(text0.toDelta(), [{
|
||||
insert: {linebreak: "s"}
|
||||
}])
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user