@tldraw/editor 5.3.0-next.c9d39e46c83b → 5.3.0-next.fc37bd96825b
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist-cjs/index.d.ts +0 -23
- package/dist-cjs/index.js +1 -1
- package/dist-cjs/lib/editor/Editor.js +2 -7
- package/dist-cjs/lib/editor/Editor.js.map +2 -2
- package/dist-cjs/lib/editor/shapes/ShapeUtil.js.map +2 -2
- package/dist-cjs/version.js +3 -3
- package/dist-cjs/version.js.map +1 -1
- package/dist-esm/index.d.mts +0 -23
- package/dist-esm/index.mjs +1 -1
- package/dist-esm/lib/editor/Editor.mjs +2 -7
- package/dist-esm/lib/editor/Editor.mjs.map +2 -2
- package/dist-esm/lib/editor/shapes/ShapeUtil.mjs.map +2 -2
- package/dist-esm/version.mjs +3 -3
- package/dist-esm/version.mjs.map +1 -1
- package/package.json +7 -7
- package/src/lib/editor/Editor.ts +2 -14
- package/src/lib/editor/shapes/ShapeUtil.ts +0 -24
- package/src/version.ts +3 -3
package/dist-cjs/index.d.ts
CHANGED
|
@@ -6793,29 +6793,6 @@ export declare abstract class ShapeUtil<Shape extends TLShape = TLShape> {
|
|
|
6793
6793
|
* @public
|
|
6794
6794
|
*/
|
|
6795
6795
|
onBeforeCreate?(next: Shape): Shape | void;
|
|
6796
|
-
/**
|
|
6797
|
-
* A callback called when a shape is reproduced from an existing shape, either by duplicating
|
|
6798
|
-
* ({@link Editor.duplicateShapes}) or by pasting/putting content onto the page
|
|
6799
|
-
* ({@link Editor.putContentOntoCurrentPage}). This provides a last chance to modify the copy
|
|
6800
|
-
* before it's created — for example, to re-stamp attribution so the copy is credited to the
|
|
6801
|
-
* current user rather than the original author. It is not called when content is put with
|
|
6802
|
-
* `preserveIds` (e.g. {@link Editor.moveShapesToPage}), since the shape keeps its identity
|
|
6803
|
-
* and no copy is made.
|
|
6804
|
-
*
|
|
6805
|
-
* @example
|
|
6806
|
-
*
|
|
6807
|
-
* ```ts
|
|
6808
|
-
* onBeforeDuplicate = (source, duplicate) => {
|
|
6809
|
-
* return { ...duplicate, props: { ...duplicate.props, editedBy: this.editor.getAttributionUserId() } }
|
|
6810
|
-
* }
|
|
6811
|
-
* ```
|
|
6812
|
-
*
|
|
6813
|
-
* @param source - The shape being copied from.
|
|
6814
|
-
* @param duplicate - The new copy (with its own id), before it's created.
|
|
6815
|
-
* @returns The next shape or void.
|
|
6816
|
-
* @public
|
|
6817
|
-
*/
|
|
6818
|
-
onBeforeDuplicate?(source: Shape, duplicate: Shape): Shape | void;
|
|
6819
6796
|
/**
|
|
6820
6797
|
* A callback called just before a shape is updated. This method provides a last chance to modify
|
|
6821
6798
|
* the updated shape.
|
package/dist-cjs/index.js
CHANGED
|
@@ -379,7 +379,7 @@ var import_uniq = require("./lib/utils/uniq");
|
|
|
379
379
|
var import_defaultThemes2 = require("./lib/editor/managers/ThemeManager/defaultThemes");
|
|
380
380
|
(0, import_utils.registerTldrawLibraryVersion)(
|
|
381
381
|
"@tldraw/editor",
|
|
382
|
-
"5.3.0-next.
|
|
382
|
+
"5.3.0-next.fc37bd96825b",
|
|
383
383
|
"cjs"
|
|
384
384
|
);
|
|
385
385
|
//# sourceMappingURL=index.js.map
|
|
@@ -5171,9 +5171,7 @@ class Editor extends import_eventemitter3.default {
|
|
|
5171
5171
|
const index = (0, import_utils.getIndexBetween)(originalShape.index, siblingAbove?.index);
|
|
5172
5172
|
shape.index = index;
|
|
5173
5173
|
});
|
|
5174
|
-
const shapesToCreate = shapesToCreateWithOriginals.map(({ shape
|
|
5175
|
-
return this.getShapeUtil(shape).onBeforeDuplicate?.(originalShape, shape) ?? shape;
|
|
5176
|
-
});
|
|
5174
|
+
const shapesToCreate = shapesToCreateWithOriginals.map(({ shape }) => shape);
|
|
5177
5175
|
if (!this.canCreateShapes(shapesToCreate)) {
|
|
5178
5176
|
alertMaxShapes(this);
|
|
5179
5177
|
return;
|
|
@@ -7199,10 +7197,7 @@ class Editor extends import_eventemitter3.default {
|
|
|
7199
7197
|
const rootShapes = [];
|
|
7200
7198
|
const newShapes = shapes.map((oldShape) => {
|
|
7201
7199
|
const newId = shapeIdMap.get(oldShape.id);
|
|
7202
|
-
|
|
7203
|
-
if (!preserveIds) {
|
|
7204
|
-
newShape = this.getShapeUtil(newShape).onBeforeDuplicate?.(oldShape, newShape) ?? newShape;
|
|
7205
|
-
}
|
|
7200
|
+
const newShape = { ...oldShape, id: newId };
|
|
7206
7201
|
if (rootShapeIds.includes(oldShape.id)) {
|
|
7207
7202
|
newShape.parentId = currentPageId;
|
|
7208
7203
|
rootShapes.push(newShape);
|