Skip to content

Commit c3d9bc9

Browse files
committed
refactor(studio): delete the move writer no Studio path calls
1 parent ed20d67 commit c3d9bc9

3 files changed

Lines changed: 0 additions & 55 deletions

File tree

‎packages/studio/src/hooks/useDomEditCommits.ts‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,6 @@ export function useDomEditCommits({
271271

272272
const {
273273
stageElementPositionOffset,
274-
handleDomPathOffsetCommit,
275274
handleDomBoxSizeCommit,
276275
handleDomRotationCommit,
277276
handleDomManualEditsReset,
@@ -316,7 +315,6 @@ export function useDomEditCommits({
316315
handleDomRemoveTextField,
317316
stageElementPositionOffset,
318317
commitPositionPatchToHtml,
319-
handleDomPathOffsetCommit,
320318
handleDomBoxSizeCommit,
321319
handleDomRotationCommit,
322320
handleDomManualEditsReset,

‎packages/studio/src/hooks/useDomGeometryCommits.test.tsx‎

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,6 @@ describe("useDomGeometryCommits rollback", () => {
7070
}
7171

7272
act(() => root.render(<Probe />));
73-
await expect(commits!.handleDomPathOffsetCommit(selection, { x: 50, y: 60 })).rejects.toBe(
74-
failure,
75-
);
7673
await expect(
7774
commits!.handleDomBoxSizeCommit(selection, { width: 200, height: 160 }, { x: 30, y: 40 }),
7875
).rejects.toBe(failure);
@@ -90,20 +87,6 @@ describe("useDomGeometryCommits read-only preview", () => {
9087
const selectionOn = (element: HTMLElement) =>
9188
({ id: element.id, selector: `#${element.id}`, element }) as unknown as DomEditSelection;
9289

93-
it("refuses a manual offset commit: no write, no history entry", async () => {
94-
const element = document.createElement("div");
95-
element.id = "ro-offset";
96-
document.body.append(element);
97-
applyStudioPathOffset(element, { x: 1, y: 2 });
98-
const commitPositionPatchToHtml =
99-
vi.fn<UseDomGeometryCommitsParams["commitPositionPatchToHtml"]>();
100-
const { commits, unmount } = mountCommits(commitPositionPatchToHtml, true);
101-
await commits().handleDomPathOffsetCommit(selectionOn(element), { x: 99, y: 99 });
102-
expect(readStudioPathOffset(element)).toEqual({ x: 1, y: 2 });
103-
expect(commitPositionPatchToHtml).not.toHaveBeenCalled();
104-
unmount();
105-
});
106-
10790
it("refuses a manual box-size commit: no write, no history entry", async () => {
10891
const element = document.createElement("div");
10992
element.id = "ro-size";
@@ -131,19 +114,6 @@ describe("useDomGeometryCommits read-only preview", () => {
131114
expect(commitPositionPatchToHtml).not.toHaveBeenCalled();
132115
unmount();
133116
});
134-
135-
it("still commits an offset with the flag off", async () => {
136-
const element = document.createElement("div");
137-
element.id = "rw-offset";
138-
document.body.append(element);
139-
const commitPositionPatchToHtml = vi
140-
.fn<UseDomGeometryCommitsParams["commitPositionPatchToHtml"]>()
141-
.mockResolvedValue(undefined);
142-
const { commits, unmount } = mountCommits(commitPositionPatchToHtml);
143-
await commits().handleDomPathOffsetCommit(selectionOn(element), { x: 5, y: 6 });
144-
expect(commitPositionPatchToHtml).toHaveBeenCalledTimes(1);
145-
unmount();
146-
});
147117
});
148118

149119
describe("useDomGeometryCommits element position offset", () => {

‎packages/studio/src/hooks/useDomGeometryCommits.ts‎

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -71,28 +71,6 @@ export function useDomGeometryCommits({
7171
[commitPositionPatchToHtml, readOnlyPreview, showToast],
7272
);
7373

74-
const handleDomPathOffsetCommit = useCallback(
75-
(selection: DomEditSelection, next: { x: number; y: number }) => {
76-
if (readOnlyPreview) return Promise.resolve();
77-
// ponytail: GSAP-targeted elements are blocked (no SDK position-in-script op); CSS-path
78-
// elements fall through to commitPositionPatchToHtml → persistDomEditOperations →
79-
// onTrySdkPersist and are already SDK-cut-over as setStyle/setAttribute (§3.3 done).
80-
// Upgrade path for GSAP: add a moveElementGsap SDK op in a separate SDK PR.
81-
const gsapFallback = rejectGsapCssFallback(selection, previewIframeRef, showToast);
82-
if (gsapFallback) return gsapFallback;
83-
const before = captureStudioPathOffset(selection.element);
84-
applyStudioPathOffset(selection.element, next);
85-
return commitPositionPatchToHtml(selection, buildPathOffsetPatches(selection.element), {
86-
label: "Move layer",
87-
coalesceKey: `path-offset:${getDomEditTargetKey(selection)}`,
88-
}).catch((error) => {
89-
restoreStudioPathOffset(selection.element, before);
90-
throw error;
91-
});
92-
},
93-
[commitPositionPatchToHtml, previewIframeRef, showToast, readOnlyPreview],
94-
);
95-
9674
const handleDomBoxSizeCommit = useCallback(
9775
(
9876
selection: DomEditSelection,
@@ -181,7 +159,6 @@ export function useDomGeometryCommits({
181159

182160
return {
183161
stageElementPositionOffset,
184-
handleDomPathOffsetCommit,
185162
handleDomBoxSizeCommit,
186163
handleDomRotationCommit,
187164
handleDomManualEditsReset,

0 commit comments

Comments
 (0)