Merge pull request #198 from toeverything/feature/fix-backspace

Feature/fix backspace
This commit is contained in:
Qi
2022-08-12 14:43:49 +08:00
committed by GitHub
2 changed files with 13 additions and 8 deletions

View File

@@ -113,6 +113,10 @@ export const TextView = ({
block.id, block.id,
'end' 'end'
); );
if (
block.getProperty('text').value[0] &&
block.getProperty('text').value[0]?.text !== ''
) {
const value = [ const value = [
...preNode.getProperty('text').value, ...preNode.getProperty('text').value,
...block.getProperty('text').value, ...block.getProperty('text').value,
@@ -120,6 +124,7 @@ export const TextView = ({
await preNode.setProperty('text', { await preNode.setProperty('text', {
value, value,
}); });
}
await preNode.append(...children); await preNode.append(...children);
await block.remove(); await block.remove();
editor.suspend(false); editor.suspend(false);

View File

@@ -690,7 +690,7 @@ export class SelectionManager implements VirgoSelection {
this.emit(nodeId, SelectEventTypes.active, this.lastPoint); this.emit(nodeId, SelectEventTypes.active, this.lastPoint);
// TODO: Optimize the related logic after implementing the scroll bar // TODO: Optimize the related logic after implementing the scroll bar
setTimeout(() => { setTimeout(() => {
// this._editor.scrollManager.keepBlockInView(node); this._editor.scrollManager.keepBlockInView(node);
}, this._scrollDelay); }, this._scrollDelay);
} else { } else {
console.warn('Can not find node by this id'); console.warn('Can not find node by this id');