@tldraw/editor 5.7.0-next.00b91eeeda00 → 5.7.0-next.10b39a06acf6
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 +9 -1
- package/dist-cjs/index.js +1 -1
- package/dist-cjs/lib/editor/Editor.js +11 -4
- package/dist-cjs/lib/editor/Editor.js.map +2 -2
- package/dist-cjs/lib/editor/shapes/group/GroupShapeUtil.js +8 -0
- package/dist-cjs/lib/editor/shapes/group/GroupShapeUtil.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 +9 -1
- package/dist-esm/index.mjs +1 -1
- package/dist-esm/lib/editor/Editor.mjs +11 -4
- package/dist-esm/lib/editor/Editor.mjs.map +2 -2
- package/dist-esm/lib/editor/shapes/group/GroupShapeUtil.mjs +8 -0
- package/dist-esm/lib/editor/shapes/group/GroupShapeUtil.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 +11 -4
- package/src/lib/editor/shapes/group/GroupShapeUtil.tsx +10 -0
- package/src/version.ts +3 -3
package/dist-cjs/index.d.ts
CHANGED
|
@@ -1977,7 +1977,14 @@ export declare class Editor extends EventEmitter<TLEventMap> {
|
|
|
1977
1977
|
* @public
|
|
1978
1978
|
*/
|
|
1979
1979
|
getCurrentPageShapesInReadingOrder(): TLShape[];
|
|
1980
|
-
|
|
1980
|
+
/**
|
|
1981
|
+
* Sort the given shapes into reading order (left-to-right, top-to-bottom), dropping any that
|
|
1982
|
+
* can't be tabbed to. Use this for the children of a frame or group, which
|
|
1983
|
+
* {@link Editor.getCurrentPageShapesInReadingOrder} leaves out.
|
|
1984
|
+
*
|
|
1985
|
+
* @public
|
|
1986
|
+
*/
|
|
1987
|
+
getShapesInReadingOrder(shapes: TLShape[]): TLShape[];
|
|
1981
1988
|
/**
|
|
1982
1989
|
* Find the nearest adjacent shape in a specific direction.
|
|
1983
1990
|
*
|
|
@@ -5119,6 +5126,7 @@ export declare class GroupShapeUtil extends ShapeUtil<TLGroupShape> {
|
|
|
5119
5126
|
static type: 'group';
|
|
5120
5127
|
static props: RecordProps<TLGroupShape>;
|
|
5121
5128
|
static migrations: TLPropsMigrations;
|
|
5129
|
+
getShapeName(): string;
|
|
5122
5130
|
hideSelectionBoundsFg(shape: TLGroupShape): boolean;
|
|
5123
5131
|
canFlip(): boolean;
|
|
5124
5132
|
canBind(): boolean;
|
package/dist-cjs/index.js
CHANGED
|
@@ -398,7 +398,7 @@ var import_uniq = require("./lib/utils/uniq");
|
|
|
398
398
|
var import_defaultThemes2 = require("./lib/editor/managers/ThemeManager/defaultThemes");
|
|
399
399
|
(0, import_utils.registerTldrawLibraryVersion)(
|
|
400
400
|
"@tldraw/editor",
|
|
401
|
-
"5.7.0-next.
|
|
401
|
+
"5.7.0-next.10b39a06acf6",
|
|
402
402
|
"cjs"
|
|
403
403
|
);
|
|
404
404
|
//# sourceMappingURL=index.js.map
|
|
@@ -1627,7 +1627,7 @@ class Editor extends import_eventemitter3.default {
|
|
|
1627
1627
|
const filteredShapes = this.getCurrentPageShapes().filter(
|
|
1628
1628
|
(shape2) => isSelectedWithinContainer ? shape2.parentId === firstParentId : (0, import_tlschema.isPageId)(shape2.parentId)
|
|
1629
1629
|
);
|
|
1630
|
-
const readingOrderShapes = this.
|
|
1630
|
+
const readingOrderShapes = this.getShapesInReadingOrder(filteredShapes);
|
|
1631
1631
|
const currentShapeId = selectedShapeIds.length === 1 ? selectedShapeIds[0] : readingOrderShapes.find((shape2) => selectedShapeIds.includes(shape2.id))?.id;
|
|
1632
1632
|
let adjacentShapeId;
|
|
1633
1633
|
if (direction === "next" || direction === "prev") {
|
|
@@ -1647,9 +1647,16 @@ class Editor extends import_eventemitter3.default {
|
|
|
1647
1647
|
}
|
|
1648
1648
|
getCurrentPageShapesInReadingOrder() {
|
|
1649
1649
|
const shapes = this.getCurrentPageShapes().filter((shape) => (0, import_tlschema.isPageId)(shape.parentId));
|
|
1650
|
-
return this.
|
|
1650
|
+
return this.getShapesInReadingOrder(shapes);
|
|
1651
1651
|
}
|
|
1652
|
-
|
|
1652
|
+
/**
|
|
1653
|
+
* Sort the given shapes into reading order (left-to-right, top-to-bottom), dropping any that
|
|
1654
|
+
* can't be tabbed to. Use this for the children of a frame or group, which
|
|
1655
|
+
* {@link Editor.getCurrentPageShapesInReadingOrder} leaves out.
|
|
1656
|
+
*
|
|
1657
|
+
* @public
|
|
1658
|
+
*/
|
|
1659
|
+
getShapesInReadingOrder(shapes) {
|
|
1653
1660
|
const SHALLOW_ANGLE = 20;
|
|
1654
1661
|
const ROW_THRESHOLD = 100;
|
|
1655
1662
|
const tabbableShapes = shapes.filter((shape) => this.getShapeUtil(shape).canTabTo(shape));
|
|
@@ -1763,7 +1770,7 @@ class Editor extends import_eventemitter3.default {
|
|
|
1763
1770
|
const children = (0, import_utils.compact)(
|
|
1764
1771
|
this.getSortedChildIdsForParent(selectedShape.id).map((id) => this.getShape(id))
|
|
1765
1772
|
);
|
|
1766
|
-
const sortedChildren = this.
|
|
1773
|
+
const sortedChildren = this.getShapesInReadingOrder(children);
|
|
1767
1774
|
if (sortedChildren.length === 0) return;
|
|
1768
1775
|
this._selectShapesAndZoom([sortedChildren[0].id]);
|
|
1769
1776
|
}
|