pull/2825/head
Mime Čuvalo 2024-04-03 14:35:34 +01:00
rodzic f62406fb66
commit 809c0a4fa8
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: BA84499022AC984D
7 zmienionych plików z 15 dodań i 50 usunięć

Wyświetl plik

@ -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[];

Wyświetl plik

@ -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)",

Wyświetl plik

@ -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) {

Wyświetl plik

@ -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<HTMLTextAreaElement>) => void;
handleKeyDown: (e: React_2.KeyboardEvent<HTMLTextAreaElement>) => Promise<void>;
handleChange: (e: React_2.ChangeEvent<HTMLTextAreaElement>) => void;
handleInputPointerDown: (e: React_2.PointerEvent) => void;
handleDoubleClick: (e: any) => any;

Wyświetl plik

@ -27608,7 +27608,16 @@
},
{
"kind": "Content",
"text": ">) => void;\n handleChange: (e: "
"text": ">) => "
},
{
"kind": "Reference",
"text": "Promise",
"canonicalReference": "!Promise:interface"
},
{
"kind": "Content",
"text": "<void>;\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,

Wyświetl plik

@ -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

Wyświetl plik

@ -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<HTMLTextAreaElement>) => {
async (e: React.KeyboardEvent<HTMLTextAreaElement>) => {
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
}