Skip to content

Commit

Permalink
fix(editor): insert new line in fixed items only the last entity
Browse files Browse the repository at this point in the history
  • Loading branch information
Novout committed Jan 10, 2022
1 parent 099b991 commit bc27fc5
Showing 1 changed file with 35 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,8 @@
}
watch(data, async (_data: string) => {
const _last = last.value
if (_data === env.emptyLine()) {
setData('')
}
Expand Down Expand Up @@ -250,15 +252,19 @@
new: factory.entity().create('page-break'),
})
await nextTick
if (_last) {
await nextTick
CONTEXT.newInPagePosEdit({
entity: props.entity,
type: 'paragraph',
raw: data.value,
})
CONTEXT.newInPagePosEdit({
entity: props.entity,
type: 'paragraph',
raw: data.value,
})
emitter.emit('entity-not-mutate-down', props.entity)
await nextTick
emitter.emit('entity-not-mutate-down', props.entity)
}
}
if (
Expand All @@ -273,15 +279,19 @@
new: factory.entity().create('line-break'),
})
await nextTick
if (_last) {
await nextTick
CONTEXT.newInPagePosEdit({
entity: props.entity,
type: 'paragraph',
raw: data.value,
})
CONTEXT.newInPagePosEdit({
entity: props.entity,
type: 'paragraph',
raw: data.value,
})
await nextTick
emitter.emit('entity-not-mutate-down', props.entity)
emitter.emit('entity-not-mutate-down', props.entity)
}
}
if (
Expand All @@ -298,15 +308,19 @@
new: content,
})
await nextTick
if (_last) {
await nextTick
CONTEXT.newInPagePosEdit({
entity: props.entity,
type: 'paragraph',
raw: data.value,
})
CONTEXT.newInPagePosEdit({
entity: props.entity,
type: 'paragraph',
raw: data.value,
})
await nextTick
emitter.emit('entity-not-mutate-down', props.entity)
emitter.emit('entity-not-mutate-down', props.entity)
}
},
() => {
toast.error(t('toast.generics.error'))
Expand Down

0 comments on commit bc27fc5

Please sign in to comment.