fix: sentry AFFINE-84T (#9368)
Fixes [BS-2243](https://linear.app/affine-design/issue/BS-2243/typeerror-cannot-read-properties-of-undefined-reading-length)
This commit is contained in:
@@ -436,13 +436,15 @@ export class EdgelessPageKeyboardManager extends PageKeyboardManager {
|
|||||||
'keyDown',
|
'keyDown',
|
||||||
ctx => {
|
ctx => {
|
||||||
const event = ctx.get('keyboardState').raw;
|
const event = ctx.get('keyboardState').raw;
|
||||||
const service = this.rootComponent.service;
|
const gfx = this.rootComponent.gfx;
|
||||||
const selection = service.selection;
|
const selection = gfx.selection;
|
||||||
|
|
||||||
if (event.code === 'Space' && !event.repeat) {
|
if (event.code === 'Space' && !event.repeat) {
|
||||||
this._space(event);
|
this._space(event);
|
||||||
} else if (
|
} else if (
|
||||||
!selection.editing &&
|
!selection.editing &&
|
||||||
event.key.length === 1 &&
|
// the key might be `Unidentified` according to mdn
|
||||||
|
event.key?.length === 1 &&
|
||||||
!event.shiftKey &&
|
!event.shiftKey &&
|
||||||
!event.ctrlKey &&
|
!event.ctrlKey &&
|
||||||
!event.altKey &&
|
!event.altKey &&
|
||||||
@@ -452,7 +454,7 @@ export class EdgelessPageKeyboardManager extends PageKeyboardManager {
|
|||||||
const doc = this.rootComponent.doc;
|
const doc = this.rootComponent.doc;
|
||||||
|
|
||||||
if (isSingleMindMapNode(elements)) {
|
if (isSingleMindMapNode(elements)) {
|
||||||
const target = service.getElementById(
|
const target = gfx.getElementById(
|
||||||
elements[0].id
|
elements[0].id
|
||||||
) as ShapeElementModel;
|
) as ShapeElementModel;
|
||||||
if (target.text) {
|
if (target.text) {
|
||||||
|
|||||||
Reference in New Issue
Block a user