fix: binding text to non-bindable containers and not always preferring selection (#4655)

This commit is contained in:
David Luzar
2022-03-02 17:04:09 +01:00
committed by GitHub
parent 8e26d5b500
commit 6d0716eb6b
13 changed files with 336 additions and 85 deletions

View File

@ -14,6 +14,7 @@ import util from "util";
import path from "path";
import { getMimeType } from "../../data/blob";
import { newFreeDrawElement } from "../../element/newElement";
import { Point } from "../../types";
const readFile = util.promisify(fs.readFile);
@ -98,6 +99,7 @@ export class API {
containerId?: T extends "text"
? ExcalidrawTextElement["containerId"]
: never;
points?: T extends "arrow" | "line" ? readonly Point[] : never;
}): T extends "arrow" | "line"
? ExcalidrawLinearElement
: T extends "freedraw"
@ -158,10 +160,13 @@ export class API {
case "arrow":
case "line":
element = newLinearElement({
...base,
width,
height,
type: type as "arrow" | "line",
startArrowhead: null,
endArrowhead: null,
...base,
points: rest.points ?? [],
});
break;
}