Skip to content

Commit

Permalink
fix(uploader): append preview operation when setting initial crop w…
Browse files Browse the repository at this point in the history
…ith `crop-preset` defined
  • Loading branch information
nd0ut committed Oct 9, 2023
1 parent 7039004 commit 5f1036c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 4 additions & 1 deletion abstract/UploaderBlock.js
Original file line number Diff line number Diff line change
Expand Up @@ -554,7 +554,10 @@ export class UploaderBlock extends ActivityBlock {
const { width, height } = fileInfo.imageInfo;
const expectedAspectRatio = aspectRatioPreset.width / aspectRatioPreset.height;
const crop = calculateMaxCenteredCropFrame(width, height, expectedAspectRatio);
const cdnUrlModifiers = createCdnUrlModifiers(`crop/${crop.width}x${crop.height}/${crop.x},${crop.y}`);
const cdnUrlModifiers = createCdnUrlModifiers(
`crop/${crop.width}x${crop.height}/${crop.x},${crop.y}`,
'preview'
);
entry.setMultipleValues({
cdnUrlModifiers,
cdnUrl: createCdnUrl(entry.getValue('cdnUrl'), cdnUrlModifiers),
Expand Down
5 changes: 4 additions & 1 deletion blocks/CloudImageEditor/src/EditorToolbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -373,12 +373,15 @@ export class EditorToolbar extends CloudImageEditorBase {

this.sub('*tabList', (tabList) => {
this.$['presence.tabToggles'] = tabList.length > 1;
this.$['*tabId'] = tabList[0];
for (const tabId of ALL_TABS) {
this.$[`presence.tabToggle.${tabId}`] = tabList.includes(tabId);
const toggleEl = this.ref[`tab-toggle-${tabId}`];
toggleEl.style.gridColumn = tabList.indexOf(tabId) + 1;
}

if (!tabList.includes(this.$['*tabId'])) {
this._activateTab(tabList[0], { fromViewer: false });
}
});

this._updateInfoTooltip();
Expand Down

0 comments on commit 5f1036c

Please sign in to comment.