@blocksuite/virgo
Advanced tools
Comparing version 0.0.0-20230411151359-929de326-nightly to 0.0.0-20230412041719-76e5b5b9-nightly
@@ -145,3 +145,3 @@ import { assertExists } from '@blocksuite/global/utils'; | ||
const { data, vRange: newVRange } = ctx; | ||
if (newVRange.index >= 0 && data && data.length > 0) { | ||
if (newVRange.index >= 0) { | ||
const selection = window.getSelection(); | ||
@@ -171,12 +171,14 @@ if (selection && selection.rangeCount !== 0) { | ||
} | ||
this._editor.insertText(newVRange, data, ctx.attributes ?? {}); | ||
this._editor.slots.updated.once(() => { | ||
this._editor.slots.vRangeUpdated.emit([ | ||
{ | ||
index: newVRange.index + data.length, | ||
length: 0, | ||
}, | ||
'input', | ||
]); | ||
}); | ||
if (data && data.length > 0) { | ||
this._editor.insertText(newVRange, data, ctx.attributes ?? {}); | ||
this._editor.slots.updated.once(() => { | ||
this._editor.slots.vRangeUpdated.emit([ | ||
{ | ||
index: newVRange.index + data.length, | ||
length: 0, | ||
}, | ||
'input', | ||
]); | ||
}); | ||
} | ||
} | ||
@@ -183,0 +185,0 @@ }; |
{ | ||
"name": "@blocksuite/virgo", | ||
"version": "0.0.0-20230411151359-929de326-nightly", | ||
"version": "0.0.0-20230412041719-76e5b5b9-nightly", | ||
"description": "A micro editor.", | ||
@@ -27,3 +27,3 @@ "main": "dist/index.js", | ||
"zod": "^3.21.4", | ||
"@blocksuite/global": "0.0.0-20230411151359-929de326-nightly" | ||
"@blocksuite/global": "0.0.0-20230412041719-76e5b5b9-nightly" | ||
}, | ||
@@ -30,0 +30,0 @@ "scripts": { |
@@ -209,7 +209,6 @@ import { assertExists } from '@blocksuite/global/utils'; | ||
} | ||
if (ctx.skipDefault) return; | ||
const { data, vRange: newVRange } = ctx; | ||
if (newVRange.index >= 0 && data && data.length > 0) { | ||
if (newVRange.index >= 0) { | ||
const selection = window.getSelection(); | ||
@@ -241,17 +240,19 @@ if (selection && selection.rangeCount !== 0) { | ||
this._editor.insertText( | ||
newVRange, | ||
data, | ||
ctx.attributes ?? ({} as TextAttributes) | ||
); | ||
if (data && data.length > 0) { | ||
this._editor.insertText( | ||
newVRange, | ||
data, | ||
ctx.attributes ?? ({} as TextAttributes) | ||
); | ||
this._editor.slots.updated.once(() => { | ||
this._editor.slots.vRangeUpdated.emit([ | ||
{ | ||
index: newVRange.index + data.length, | ||
length: 0, | ||
}, | ||
'input', | ||
]); | ||
}); | ||
this._editor.slots.updated.once(() => { | ||
this._editor.slots.vRangeUpdated.emit([ | ||
{ | ||
index: newVRange.index + data.length, | ||
length: 0, | ||
}, | ||
'input', | ||
]); | ||
}); | ||
} | ||
} | ||
@@ -258,0 +259,0 @@ }; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
460710
6495
+ Added@blocksuite/global@0.0.0-20230412041719-76e5b5b9-nightly(transitive)
- Removed@blocksuite/global@0.0.0-20230411151359-929de326-nightly(transitive)
Updated@blocksuite/global@0.0.0-20230412041719-76e5b5b9-nightly