diff --git a/packages/editor/api-report.md b/packages/editor/api-report.md index afd9d36e8..d18e942c0 100644 --- a/packages/editor/api-report.md +++ b/packages/editor/api-report.md @@ -1135,8 +1135,6 @@ export class Group2d extends Geometry2d { // (undocumented) distanceToPoint(point: Vec, hitInside?: boolean): number; // (undocumented) - findLabels(): Geometry2d[]; - // (undocumented) getArea(): number; // (undocumented) getVertices(): Vec[]; diff --git a/packages/editor/api/api.json b/packages/editor/api/api.json index 7e8a6f6cf..3a6a9d506 100644 --- a/packages/editor/api/api.json +++ b/packages/editor/api/api.json @@ -22692,42 +22692,6 @@ "isAbstract": false, "name": "distanceToPoint" }, - { - "kind": "Method", - "canonicalReference": "@tldraw/editor!Group2d#findLabels:member(1)", - "docComment": "", - "excerptTokens": [ - { - "kind": "Content", - "text": "findLabels(): " - }, - { - "kind": "Reference", - "text": "Geometry2d", - "canonicalReference": "@tldraw/editor!Geometry2d:class" - }, - { - "kind": "Content", - "text": "[]" - }, - { - "kind": "Content", - "text": ";" - } - ], - "isStatic": false, - "returnTypeTokenRange": { - "startIndex": 1, - "endIndex": 3 - }, - "releaseTag": "Public", - "isProtected": false, - "overloadIndex": 1, - "parameters": [], - "isOptional": false, - "isAbstract": false, - "name": "findLabels" - }, { "kind": "Method", "canonicalReference": "@tldraw/editor!Group2d#getArea:member(1)", diff --git a/packages/editor/src/lib/primitives/geometry/Group2d.ts b/packages/editor/src/lib/primitives/geometry/Group2d.ts index b9b8e2648..3caeabfc8 100644 --- a/packages/editor/src/lib/primitives/geometry/Group2d.ts +++ b/packages/editor/src/lib/primitives/geometry/Group2d.ts @@ -70,10 +70,6 @@ export class Group2d extends Geometry2d { return this.children[0].area } - findLabels() { - return this.children.filter((c) => c.isLabel) - } - toSimpleSvgPath() { let path = '' for (const child of this.children) { diff --git a/packages/tldraw/api-report.md b/packages/tldraw/api-report.md index 2727eaa74..220adb106 100644 --- a/packages/tldraw/api-report.md +++ b/packages/tldraw/api-report.md @@ -2512,7 +2512,7 @@ export function useEditableText(id: TLShapeId, type: string, text: string, optio isEditing: boolean; handleFocus: () => void; handleBlur: () => void; - handleKeyDown: (e: React_2.KeyboardEvent) => void; + handleKeyDown: (e: React_2.KeyboardEvent) => Promise; handleChange: (e: React_2.ChangeEvent) => void; handleInputPointerDown: (e: React_2.PointerEvent) => void; handleDoubleClick: (e: any) => any; diff --git a/packages/tldraw/api/api.json b/packages/tldraw/api/api.json index d03645afa..7207a036e 100644 --- a/packages/tldraw/api/api.json +++ b/packages/tldraw/api/api.json @@ -27608,7 +27608,16 @@ }, { "kind": "Content", - "text": ">) => void;\n handleChange: (e: " + "text": ">) => " + }, + { + "kind": "Reference", + "text": "Promise", + "canonicalReference": "!Promise:interface" + }, + { + "kind": "Content", + "text": ";\n handleChange: (e: " }, { "kind": "Reference", @@ -27645,7 +27654,7 @@ "fileUrlPath": "packages/tldraw/src/lib/shapes/shared/useEditableText.ts", "returnTypeTokenRange": { "startIndex": 11, - "endIndex": 26 + "endIndex": 28 }, "releaseTag": "Public", "overloadIndex": 1, diff --git a/packages/tldraw/src/lib/shapes/shared/default-shape-constants.ts b/packages/tldraw/src/lib/shapes/shared/default-shape-constants.ts index f4074d59e..1f64351b1 100644 --- a/packages/tldraw/src/lib/shapes/shared/default-shape-constants.ts +++ b/packages/tldraw/src/lib/shapes/shared/default-shape-constants.ts @@ -55,5 +55,3 @@ export const LABEL_TO_ARROW_PADDING = 20 export const ARROW_LABEL_PADDING = 4.25 /** @internal */ export const LABEL_PADDING = 16 -/** @internal */ -export const WAY_TOO_BIG_ARROW_BEND_FACTOR = 10 diff --git a/packages/tldraw/src/lib/shapes/shared/useEditableText.ts b/packages/tldraw/src/lib/shapes/shared/useEditableText.ts index fc0b402bd..8d15e4bf1 100644 --- a/packages/tldraw/src/lib/shapes/shared/useEditableText.ts +++ b/packages/tldraw/src/lib/shapes/shared/useEditableText.ts @@ -14,7 +14,7 @@ import { import React, { useCallback, useEffect, useRef } from 'react' import { INDENT, TextHelpers } from './TextHelpers' -const DefaultTextTriggerHook = () => ({ onKeyDown: () => false }) +const DefaultTextTriggerHook = () => ({ onKeyDown: async () => false }) /** @public */ export function useEditableText( @@ -111,14 +111,14 @@ export function useEditableText( // When the user presses ctrl / meta enter, complete the editing state. // When the user presses tab, indent or unindent the text. const handleKeyDown = useCallback( - (e: React.KeyboardEvent) => { + async (e: React.KeyboardEvent) => { if (!isEditing) return const inputEl = e.target as HTMLTextAreaElement // Here we possibly pass control to a custom text handling component passed in by the user, if present. if (inputEl && inputEl.previousSibling) { const coords = getCaretPosition(editor, inputEl, inputEl.previousSibling) - const isHandledByCustomLogic = onCustomKeyDown(e, coords) + const isHandledByCustomLogic = await onCustomKeyDown(e, coords) if (isHandledByCustomLogic) { return }