fix: allow adding text via enter only for text containers (#5891)
* fix: allow adding text via enter only for text containers * fix * fix * fix * move check isTextElement outside
This commit is contained in:
@ -584,6 +584,17 @@ describe("textWysiwyg", () => {
|
||||
expect((h.elements[1] as ExcalidrawTextElement).containerId).toBe(null);
|
||||
});
|
||||
|
||||
it("shouldn't create text element when pressing 'Enter' key on non text bindable container", async () => {
|
||||
h.elements = [];
|
||||
const freeDraw = UI.createElement("freedraw", {
|
||||
width: 100,
|
||||
height: 50,
|
||||
});
|
||||
API.setSelectedElements([freeDraw]);
|
||||
Keyboard.keyPress(KEYS.ENTER);
|
||||
expect(h.elements.length).toBe(1);
|
||||
});
|
||||
|
||||
it("should'nt bind text to container when not double clicked on center", async () => {
|
||||
expect(h.elements.length).toBe(1);
|
||||
expect(h.elements[0].id).toBe(rectangle.id);
|
||||
|
Reference in New Issue
Block a user