ソースを参照

Merge branch 'whiteboards' into enhance/whiteboards-ui

Konstantinos Kaloutas 3 年 前
コミット
8037e455c4

+ 2 - 2
tldraw/apps/tldraw-logseq/src/lib/shapes/LogseqPortalShape.tsx

@@ -641,7 +641,7 @@ export class LogseqPortalShape extends TLBoxShape<LogseqPortalShapeProps> {
 
     this.persist = () => app.persist()
     const isMoving = useCameraMovingRef()
-    const isSelected = app.selectedIds.has(this.id)
+    const isSelected = app.selectedIds.has(this.id) && app.selectedIds.size === 1
 
     const isCreating = app.isIn('logseq-portal.creating') && !pageId
     const tlEventsEnabled =
@@ -721,7 +721,7 @@ export class LogseqPortalShape extends TLBoxShape<LogseqPortalShapeProps> {
           style={{
             width: '100%',
             height: '100%',
-            pointerEvents: isEditing ? 'all' : 'none',
+            pointerEvents: !isMoving && (isEditing || isSelected) ? 'all' : 'none',
           }}
         >
           {isCreating ? (

+ 1 - 1
tldraw/apps/tldraw-logseq/src/lib/tools/LogseqPortalTool/states/CreatingState.tsx

@@ -59,13 +59,13 @@ export class CreatingState extends TLToolState<
 
   onExit = () => {
     if (!this.creatingShape) return
-    this.app.clearEditingShape()
     this.app.history.resume()
 
     if (this.creatingShape?.props.pageId) {
       this.app.setSelectedShapes([this.creatingShape.id])
     } else {
       this.app.deleteShapes([this.creatingShape.id])
+      this.app.clearEditingShape()
     }
   }
 }

+ 3 - 0
tldraw/packages/core/src/lib/TLApp/TLApp.ts

@@ -529,6 +529,9 @@ export class TLApp<
     } else {
       this.selectionRotation = 0
     }
+    if (shapes.length === 0) {
+      this.clearEditingShape()
+    }
     return this
   }
 

+ 3 - 0
tldraw/packages/core/src/lib/tools/TLSelectTool/states/EditingShapeState.ts

@@ -20,6 +20,9 @@ export class EditingShapeState<
   onExit = () => {
     this.app.persist()
     this.app.clearEditingShape()
+
+    // Blur all inputs when exit idle
+    document.querySelectorAll<HTMLElement>('input,textarea').forEach(el => el.blur())
   }
 
   onPointerDown: TLEvents<S>['pointer'] = info => {

+ 3 - 0
tldraw/packages/core/src/lib/tools/TLSelectTool/states/TranslatingState.ts

@@ -104,6 +104,9 @@ export class TranslatingState<
     )
     this.initialPoints = this.initialShapePoints
 
+    // Blur all inputs when moving shapes
+    document.querySelectorAll<HTMLElement>('input,textarea').forEach(el => el.blur())
+
     if (inputs.altKey) {
       this.startCloning()
     } else {