kopia lustrzana https://github.com/Tldraw/Tldraw
cleanup
rodzic
f62406fb66
commit
809c0a4fa8
|
@ -1135,8 +1135,6 @@ export class Group2d extends Geometry2d {
|
||||||
// (undocumented)
|
// (undocumented)
|
||||||
distanceToPoint(point: Vec, hitInside?: boolean): number;
|
distanceToPoint(point: Vec, hitInside?: boolean): number;
|
||||||
// (undocumented)
|
// (undocumented)
|
||||||
findLabels(): Geometry2d[];
|
|
||||||
// (undocumented)
|
|
||||||
getArea(): number;
|
getArea(): number;
|
||||||
// (undocumented)
|
// (undocumented)
|
||||||
getVertices(): Vec[];
|
getVertices(): Vec[];
|
||||||
|
|
|
@ -22692,42 +22692,6 @@
|
||||||
"isAbstract": false,
|
"isAbstract": false,
|
||||||
"name": "distanceToPoint"
|
"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",
|
"kind": "Method",
|
||||||
"canonicalReference": "@tldraw/editor!Group2d#getArea:member(1)",
|
"canonicalReference": "@tldraw/editor!Group2d#getArea:member(1)",
|
||||||
|
|
|
@ -70,10 +70,6 @@ export class Group2d extends Geometry2d {
|
||||||
return this.children[0].area
|
return this.children[0].area
|
||||||
}
|
}
|
||||||
|
|
||||||
findLabels() {
|
|
||||||
return this.children.filter((c) => c.isLabel)
|
|
||||||
}
|
|
||||||
|
|
||||||
toSimpleSvgPath() {
|
toSimpleSvgPath() {
|
||||||
let path = ''
|
let path = ''
|
||||||
for (const child of this.children) {
|
for (const child of this.children) {
|
||||||
|
|
|
@ -2512,7 +2512,7 @@ export function useEditableText(id: TLShapeId, type: string, text: string, optio
|
||||||
isEditing: boolean;
|
isEditing: boolean;
|
||||||
handleFocus: () => void;
|
handleFocus: () => void;
|
||||||
handleBlur: () => 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;
|
handleChange: (e: React_2.ChangeEvent<HTMLTextAreaElement>) => void;
|
||||||
handleInputPointerDown: (e: React_2.PointerEvent) => void;
|
handleInputPointerDown: (e: React_2.PointerEvent) => void;
|
||||||
handleDoubleClick: (e: any) => any;
|
handleDoubleClick: (e: any) => any;
|
||||||
|
|
|
@ -27608,7 +27608,16 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"kind": "Content",
|
"kind": "Content",
|
||||||
"text": ">) => void;\n handleChange: (e: "
|
"text": ">) => "
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"kind": "Reference",
|
||||||
|
"text": "Promise",
|
||||||
|
"canonicalReference": "!Promise:interface"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"kind": "Content",
|
||||||
|
"text": "<void>;\n handleChange: (e: "
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"kind": "Reference",
|
"kind": "Reference",
|
||||||
|
@ -27645,7 +27654,7 @@
|
||||||
"fileUrlPath": "packages/tldraw/src/lib/shapes/shared/useEditableText.ts",
|
"fileUrlPath": "packages/tldraw/src/lib/shapes/shared/useEditableText.ts",
|
||||||
"returnTypeTokenRange": {
|
"returnTypeTokenRange": {
|
||||||
"startIndex": 11,
|
"startIndex": 11,
|
||||||
"endIndex": 26
|
"endIndex": 28
|
||||||
},
|
},
|
||||||
"releaseTag": "Public",
|
"releaseTag": "Public",
|
||||||
"overloadIndex": 1,
|
"overloadIndex": 1,
|
||||||
|
|
|
@ -55,5 +55,3 @@ export const LABEL_TO_ARROW_PADDING = 20
|
||||||
export const ARROW_LABEL_PADDING = 4.25
|
export const ARROW_LABEL_PADDING = 4.25
|
||||||
/** @internal */
|
/** @internal */
|
||||||
export const LABEL_PADDING = 16
|
export const LABEL_PADDING = 16
|
||||||
/** @internal */
|
|
||||||
export const WAY_TOO_BIG_ARROW_BEND_FACTOR = 10
|
|
||||||
|
|
|
@ -14,7 +14,7 @@ import {
|
||||||
import React, { useCallback, useEffect, useRef } from 'react'
|
import React, { useCallback, useEffect, useRef } from 'react'
|
||||||
import { INDENT, TextHelpers } from './TextHelpers'
|
import { INDENT, TextHelpers } from './TextHelpers'
|
||||||
|
|
||||||
const DefaultTextTriggerHook = () => ({ onKeyDown: () => false })
|
const DefaultTextTriggerHook = () => ({ onKeyDown: async () => false })
|
||||||
|
|
||||||
/** @public */
|
/** @public */
|
||||||
export function useEditableText(
|
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 ctrl / meta enter, complete the editing state.
|
||||||
// When the user presses tab, indent or unindent the text.
|
// When the user presses tab, indent or unindent the text.
|
||||||
const handleKeyDown = useCallback(
|
const handleKeyDown = useCallback(
|
||||||
(e: React.KeyboardEvent<HTMLTextAreaElement>) => {
|
async (e: React.KeyboardEvent<HTMLTextAreaElement>) => {
|
||||||
if (!isEditing) return
|
if (!isEditing) return
|
||||||
|
|
||||||
const inputEl = e.target as HTMLTextAreaElement
|
const inputEl = e.target as HTMLTextAreaElement
|
||||||
// Here we possibly pass control to a custom text handling component passed in by the user, if present.
|
// Here we possibly pass control to a custom text handling component passed in by the user, if present.
|
||||||
if (inputEl && inputEl.previousSibling) {
|
if (inputEl && inputEl.previousSibling) {
|
||||||
const coords = getCaretPosition(editor, inputEl, inputEl.previousSibling)
|
const coords = getCaretPosition(editor, inputEl, inputEl.previousSibling)
|
||||||
const isHandledByCustomLogic = onCustomKeyDown(e, coords)
|
const isHandledByCustomLogic = await onCustomKeyDown(e, coords)
|
||||||
if (isHandledByCustomLogic) {
|
if (isHandledByCustomLogic) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
Ładowanie…
Reference in New Issue