Dont include attributes in embed retains
This commit is contained in:
parent
adaa95ebb8
commit
63aafba52b
@ -625,6 +625,10 @@ export class YTextEvent extends YEvent {
|
|||||||
*/
|
*/
|
||||||
let insert = ''
|
let insert = ''
|
||||||
let retain = 0
|
let retain = 0
|
||||||
|
/**
|
||||||
|
* @type {string?}
|
||||||
|
*/
|
||||||
|
let retainType = null;
|
||||||
let deleteLen = 0
|
let deleteLen = 0
|
||||||
const addOp = () => {
|
const addOp = () => {
|
||||||
if (action !== null) {
|
if (action !== null) {
|
||||||
@ -656,8 +660,10 @@ export class YTextEvent extends YEvent {
|
|||||||
case 'retain':
|
case 'retain':
|
||||||
if (retain > 0) {
|
if (retain > 0) {
|
||||||
op = { retain }
|
op = { retain }
|
||||||
if (!object.isEmpty(attributes)) {
|
if (retainType === 'ContentString') {
|
||||||
op.attributes = object.assign({}, attributes)
|
if (!object.isEmpty(attributes)) {
|
||||||
|
op.attributes = object.assign({}, attributes)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
retain = 0
|
retain = 0
|
||||||
@ -685,9 +691,10 @@ export class YTextEvent extends YEvent {
|
|||||||
}
|
}
|
||||||
deleteLen += 1
|
deleteLen += 1
|
||||||
} else if (!item.deleted) {
|
} else if (!item.deleted) {
|
||||||
if (action !== 'retain') {
|
if (action !== 'retain' || retainType !== 'ContentEmbed') {
|
||||||
addOp()
|
addOp()
|
||||||
action = 'retain'
|
action = 'retain'
|
||||||
|
retainType = 'ContentEmbed'
|
||||||
}
|
}
|
||||||
retain += 1
|
retain += 1
|
||||||
}
|
}
|
||||||
@ -708,9 +715,10 @@ export class YTextEvent extends YEvent {
|
|||||||
}
|
}
|
||||||
deleteLen += item.length
|
deleteLen += item.length
|
||||||
} else if (!item.deleted) {
|
} else if (!item.deleted) {
|
||||||
if (action !== 'retain') {
|
if (action !== 'retain' || retainType !== 'ContentString') {
|
||||||
addOp()
|
addOp()
|
||||||
action = 'retain'
|
action = 'retain'
|
||||||
|
retainType = 'ContentString'
|
||||||
}
|
}
|
||||||
retain += item.length
|
retain += item.length
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user