fix: Refactor and merge duplication and binding (#9246)
All checks were successful
Tests / test (push) Successful in 4m52s

This commit is contained in:
Márk Tolmács 2025-03-23 18:39:33 +01:00 committed by GitHub
parent 58990b41ae
commit 77aca48c84
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
29 changed files with 1293 additions and 1085 deletions

View file

@ -2606,8 +2606,8 @@ exports[`contextMenu element > selecting 'Duplicate' in context menu duplicates
"strokeWidth": 2,
"type": "rectangle",
"updated": 1,
"version": 4,
"versionNonce": 238820263,
"version": 5,
"versionNonce": 400692809,
"width": 20,
"x": 0,
"y": 10,

View file

@ -15172,9 +15172,11 @@ History {
"selectedElementIds": {
"id61": true,
},
"selectedLinearElementId": "id61",
},
"inserted": {
"selectedElementIds": {},
"selectedLinearElementId": null,
},
},
},
@ -18946,7 +18948,7 @@ exports[`history > singleplayer undo/redo > should support duplication of groups
"strokeWidth": 2,
"type": "rectangle",
"updated": 1,
"version": 3,
"version": 4,
"width": 100,
"x": 10,
"y": 10,
@ -18980,7 +18982,7 @@ exports[`history > singleplayer undo/redo > should support duplication of groups
"strokeWidth": 2,
"type": "rectangle",
"updated": 1,
"version": 3,
"version": 4,
"width": 100,
"x": 110,
"y": 110,
@ -19014,7 +19016,7 @@ exports[`history > singleplayer undo/redo > should support duplication of groups
"strokeWidth": 2,
"type": "rectangle",
"updated": 1,
"version": 6,
"version": 7,
"width": 100,
"x": 10,
"y": 10,
@ -19048,7 +19050,7 @@ exports[`history > singleplayer undo/redo > should support duplication of groups
"strokeWidth": 2,
"type": "rectangle",
"updated": 1,
"version": 6,
"version": 7,
"width": 100,
"x": 110,
"y": 110,

View file

@ -11,7 +11,7 @@ exports[`duplicate element on move when ALT is clicked > rectangle 5`] = `
"groupIds": [],
"height": 50,
"id": "id2",
"index": "a0",
"index": "Zz",
"isDeleted": false,
"link": null,
"locked": false,
@ -26,8 +26,8 @@ exports[`duplicate element on move when ALT is clicked > rectangle 5`] = `
"strokeWidth": 2,
"type": "rectangle",
"updated": 1,
"version": 5,
"versionNonce": 400692809,
"version": 6,
"versionNonce": 1604849351,
"width": 30,
"x": 30,
"y": 20,
@ -45,7 +45,7 @@ exports[`duplicate element on move when ALT is clicked > rectangle 6`] = `
"groupIds": [],
"height": 50,
"id": "id0",
"index": "a1",
"index": "a0",
"isDeleted": false,
"link": null,
"locked": false,
@ -60,7 +60,7 @@ exports[`duplicate element on move when ALT is clicked > rectangle 6`] = `
"strokeWidth": 2,
"type": "rectangle",
"updated": 1,
"version": 6,
"version": 5,
"versionNonce": 23633383,
"width": 30,
"x": -10,

View file

@ -2139,7 +2139,7 @@ History {
"frameId": null,
"groupIds": [],
"height": 10,
"index": "a0",
"index": "Zz",
"isDeleted": false,
"link": null,
"locked": false,
@ -2164,12 +2164,10 @@ History {
"updated": Map {
"id0" => Delta {
"deleted": {
"index": "a1",
"x": 20,
"y": 20,
},
"inserted": {
"index": "a0",
"x": 10,
"y": 10,
},
@ -10631,7 +10629,7 @@ History {
"id7",
],
"height": 10,
"index": "a0",
"index": "Zx",
"isDeleted": false,
"link": null,
"locked": false,
@ -10664,7 +10662,7 @@ History {
"id7",
],
"height": 10,
"index": "a1",
"index": "Zy",
"isDeleted": false,
"link": null,
"locked": false,
@ -10697,7 +10695,7 @@ History {
"id7",
],
"height": 10,
"index": "a2",
"index": "Zz",
"isDeleted": false,
"link": null,
"locked": false,
@ -10722,36 +10720,30 @@ History {
"updated": Map {
"id0" => Delta {
"deleted": {
"index": "a3",
"x": 20,
"y": 20,
},
"inserted": {
"index": "a0",
"x": 10,
"y": 10,
},
},
"id1" => Delta {
"deleted": {
"index": "a4",
"x": 40,
"y": 20,
},
"inserted": {
"index": "a1",
"x": 30,
"y": 10,
},
},
"id2" => Delta {
"deleted": {
"index": "a5",
"x": 60,
"y": 20,
},
"inserted": {
"index": "a2",
"x": 50,
"y": 10,
},

View file

@ -1,7 +1,6 @@
/* eslint-disable no-lone-blocks */
import { generateKeyBetween } from "fractional-indexing";
import { deepCopyElement } from "../element/newElement";
import { InvalidFractionalIndexError } from "../errors";
import {
syncInvalidIndices,
@ -10,6 +9,8 @@ import {
} from "../fractionalIndex";
import { arrayToMap } from "../utils";
import { deepCopyElement } from "../element/duplicate";
import { API } from "./helpers/api";
import type { ExcalidrawElement, FractionalIndex } from "../element/types";

View file

@ -1184,3 +1184,7 @@ it(
expect(API.getSelectedElements().length).toBe(1);
},
);
//
// DEPRECATED: DO NOT ADD TESTS HERE
//