Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Asset Modal #46

Merged
merged 119 commits into from
Mar 14, 2024
Merged
Show file tree
Hide file tree
Changes from 118 commits
Commits
Show all changes
119 commits
Select commit Hold shift + click to select a range
b268606
fix: update fstab
synox Nov 23, 2023
a9c30b8
Update README.md
synox Nov 23, 2023
7a78ad3
Merge branch 'main' of github.com:adobe/assets-distribution-portal
synox Nov 30, 2023
58fc064
Merge branch 'main' of github.com:adobe/assets-distribution-portal
synox Dec 1, 2023
d7a0175
ASSETS-3207 integrate Unified shell (#3)
synox Dec 1, 2023
2ca4993
ASSETS-32004 use discovery service to find instances with content hu…
synox Dec 1, 2023
767ba48
docs: update readme
synox Dec 2, 2023
bdebb31
docs: update readme
synox Dec 2, 2023
6c659b8
chore: allow showing 404 page
synox Dec 4, 2023
c88161b
chore: update sidekick host
synox Dec 4, 2023
6022945
chore: remove old comment
synox Dec 4, 2023
62cb628
fix: update serviceCode===dma_aem_contenthub
synox Dec 4, 2023
f3457f3
fix: don't open browser on "aem up"
synox Dec 4, 2023
779f0c0
Merge branch 'main' of github.com:adobe/assets-distribution-portal
synox Dec 4, 2023
917063b
ASSETS-32078: Handle changes of imsOrg from Unified Shell
synox Dec 4, 2023
5f59359
Show spinner while imsOrg changes
synox Dec 4, 2023
2c497f6
fix: use delivery urls from discovery
synox Dec 4, 2023
d38c0cc
fix: use delivery urls from discovery
synox Dec 4, 2023
fc4b48e
refactor: use page.iframeReload(false);
synox Dec 5, 2023
43c8742
adapt 404 error page for Unified Shell
synox Dec 5, 2023
2346009
feat: reflect url changes from unified shell in app
synox Dec 5, 2023
03e23d4
ASSETS-32075 Hide header bar (logo, user switcher) when using Unified…
synox Dec 5, 2023
7c57ff6
ASSETS-32055: POC integration with Upload MFE (#8)
synox Dec 6, 2023
5b714b1
ASSETS-32055: provide bearer token
synox Dec 6, 2023
90c3c56
chore: remove dialog after closing
synox Dec 6, 2023
affa0ce
ASSETS-31831 - Portal style changes for content hub (#6)
andrewmkhoury Dec 6, 2023
fc21740
chore: fix typo in jsdocs: BrandingConfig.portalTheme
synox Dec 7, 2023
0e54d7e
Merge branch 'main' of github.com:adobe/assets-distribution-portal
synox Dec 7, 2023
472411e
Load Reporting MFE using pure JS
Dec 5, 2023
15a45d8
Add css
Dec 5, 2023
d318a26
Add css
Dec 6, 2023
535404e
Point the reporting MFE to prod
Dec 6, 2023
a7ad093
Add discovery call
Dec 6, 2023
fb1baae
Merge branch 'main' of github.com:adobe/assets-distribution-portal
synox Dec 7, 2023
53fe46b
ASSETS-32176 Keep url in unified shell updated. React to url changes.…
synox Dec 7, 2023
c547d63
Accessibility: add role and aria-labels where missing (#10)
synox Dec 7, 2023
febe3c2
quick fix to show reporting in CH
Dec 7, 2023
6b2908e
Remove bar graph
Dec 7, 2023
da21fac
fix: cleanup eslint errors
synox Dec 7, 2023
9125474
ASSETS-31803 - Refactor Modal code for Unified Shell (#12)
andrewmkhoury Dec 8, 2023
b0ba869
add platform connector
synox Dec 8, 2023
4f73f91
add platform connector with rollup
synox Dec 8, 2023
6de4742
poc of PlatformConnector
synox Dec 8, 2023
054f4b7
docs: describe rollup
synox Dec 8, 2023
358f450
Merge remote-tracking branch 'origin/main'
synox Dec 8, 2023
e428623
docs: no sudo
synox Dec 8, 2023
f0067ea
cleanup
synox Dec 8, 2023
c4417ae
add PlatformConnector lib
synox Dec 8, 2023
b03c3e5
fix: keep existing discovery
synox Dec 8, 2023
fe59a3f
cleanup: remove old libs
synox Dec 8, 2023
e8bd909
Update README.md
synox Dec 8, 2023
f073137
Merge branch 'platform-connector' into reporting
lsun-adobe Dec 8, 2023
d3419ab
ASSETS-31899 use PlatfromConnector API for repositoryID
lsun-adobe Dec 8, 2023
2420886
Merge branch 'main' into reporting
SUNLINGLING98 Dec 8, 2023
b44976b
Merge branch 'platform-connector' of github.com:adobe-rnd/assets-cont…
synox Dec 8, 2023
58772a9
cleanup: only delete dependencies selectively
synox Dec 8, 2023
55b25be
cleanup: remove unused dependencies
synox Dec 8, 2023
f945db5
Merge branch 'platform-connector' of github.com:adobe-rnd/assets-cont…
synox Dec 8, 2023
9dd4454
cleanup: undo comment out
synox Dec 8, 2023
91419be
cleanup: undo comment out
synox Dec 8, 2023
6b985e6
Merge branch 'main' of github.com:adobe-rnd/assets-contenthub into pl…
synox Dec 8, 2023
7e20519
chore: cleanup imports
synox Dec 8, 2023
0e06666
PlatformConnector: initial draft (#15)
synox Dec 8, 2023
399b22e
Merge branch 'platform-connector' into reporting
synox Dec 8, 2023
0502bc6
cleanup after merge
synox Dec 8, 2023
77acdde
Merge branch 'main' of github.com:adobe-rnd/assets-contenthub into re…
synox Dec 8, 2023
30762b1
update readme
synox Dec 11, 2023
cb9ce37
Merge remote-tracking branch 'origin/main'
synox Dec 11, 2023
99b8fc1
ASSETS-31899 use franklin lib loadScript based on feedback
lsun-adobe Dec 11, 2023
e9de3db
ASSETS-31899 add delivery and storageUsage
lsun-adobe Dec 11, 2023
4ff7fb7
ASSETS-31831 - Portal changes for content hub (#14)
andrewmkhoury Dec 11, 2023
c4b6d1f
docs: add sharepoint
synox Dec 11, 2023
5353d6f
Merge remote-tracking branch 'origin/main'
synox Dec 11, 2023
12628d0
Merge branch 'main' of github.com:adobe/assets-distribution-portal
synox Dec 12, 2023
42df422
fix merge conflicts
synox Dec 12, 2023
5e2e8ba
ASSETS-31831 - Update style for content hub (#17)
andrewmkhoury Dec 12, 2023
0e08006
Feat: implement user settings
synox Dec 12, 2023
f90e1df
Merge remote-tracking branch 'origin/main'
synox Dec 12, 2023
81ecef3
Feat: implement user settings and redirect users
synox Dec 12, 2023
6497459
ASSETS-31899 clear up
lsun-adobe Dec 12, 2023
2cf5116
Fix modal dialog styling (#18)
andrewmkhoury Dec 12, 2023
29082e9
ASSETS-31899 remove storageUsage
lsun-adobe Dec 12, 2023
37b5bfa
Merge branch 'main' into reporting
SUNLINGLING98 Dec 12, 2023
66d51b4
ASSETS-32522 - Fix upload dialog styling (#19)
andrewmkhoury Dec 12, 2023
ff17c83
Merge pull request #16 from adobe-rnd/reporting
SUNLINGLING98 Dec 12, 2023
5870f07
add missing import
Dec 12, 2023
f9b0de4
Merging from ch main
klcodanr Dec 12, 2023
fe8cc1d
Feat: Playwright End-2-End test (#11)
synox Dec 13, 2023
23c36f3
fix: export everything from platform connector
synox Dec 13, 2023
b0ca211
chore: refactor exc-app import/exports
synox Dec 13, 2023
3fe9d6f
fix: remove text-transform: capitalize;
synox Dec 13, 2023
518f08b
fix: improve error message when run without unified shell
synox Dec 13, 2023
b2910b1
Fixing to use the IMS org from the site config for GMO
klcodanr Dec 13, 2023
314fc51
don't call getRepositoryList
synox Dec 13, 2023
ec50339
Upload dialog (#23)
andrewmkhoury Dec 13, 2023
a6480dd
Merging latest from CH main
klcodanr Dec 13, 2023
46692e1
Fixing to use the distribution url to determine the author repoId
klcodanr Dec 14, 2023
dd46948
Changing clientid
klcodanr Dec 14, 2023
f0ca354
Adding the version supporting setting metadata
klcodanr Dec 15, 2023
69fb8ed
Updating to latest version of the upload MFE
klcodanr Dec 15, 2023
32d23e8
Fixing incorrect mappings
klcodanr Dec 15, 2023
5494d44
Updating to latest PR build
klcodanr Dec 18, 2023
1341621
Updating to new schema
klcodanr Jan 10, 2024
12b2864
Styling tweaks to the upload dialog
klcodanr Jan 10, 2024
528d712
Commented out ProductFamily from 'Add Asset' (#30)
staware30 Jan 25, 2024
ad4c2fe
Alphabetize Product List on 'Add Assets' Modal (#32)
staware30 Jan 26, 2024
a27d002
DXI-23343: New Multi-required fields. Enable upload on form filled (#34)
mathieu-lessard Feb 8, 2024
989e54c
DXI-23346: Hydration uses values from Algolia for selections (#35)
mathieu-lessard Feb 13, 2024
d02b9e7
Updated Asset Upload Experience (#37)
mathieu-lessard Feb 21, 2024
87c1452
Enabled Perpetuity Option
Mar 5, 2024
d816fb8
Fixed license date to use ISO instead of epoch
Mar 6, 2024
27bfdc9
Refactored code
Mar 6, 2024
7293e19
'Add Assets' button can now be hidden by IMS group (#44)
cheintzman Mar 8, 2024
40191c9
Removed Keywords from Asset Upload
Mar 13, 2024
73743f1
Renamed LisenceDate Property
Mar 13, 2024
353f504
Renamed LisenceDate Property
Mar 13, 2024
1197aa9
Merge branch 'chdemo' of https://github.com/hlxsites/adobe-gmo into c…
Mar 13, 2024
26f65a6
Merge remote-tracking branch 'origin/HEAD' into chdemo
Mar 14, 2024
2406f64
Merge commit '94b1229b6a27964d67b116a75d322964543eb24d' into HEAD
Mar 14, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
AEM_TLS_CERT=env/server.crt
AEM_TLS_KEY=env/server.key
AEM_OPEN=/
AEM_PORT=443
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
scripts/libs/**
test/e2e/
3 changes: 2 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ module.exports = {
'no-use-before-define': 'off',
'no-return-await': 'off',
'no-restricted-syntax': 'off',
'max-len': ['warn', { code: 140 }],
'no-else-return': 'off',
'import/prefer-default-export': 'off',
'max-len': ['warn', { code: 140 }],
},
};
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
README.md merge=ours
39 changes: 39 additions & 0 deletions .github/workflows/playwright.yml.disabled
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Does not work, because Adobe flags the source IP as untrusted, and requires confirming a code sent by email.

name: Playwright Tests
mathieu-lessard marked this conversation as resolved.
Show resolved Hide resolved
on:
push:
branches: [ main, master ]
pull_request:
branches: [ main, master ]
jobs:
test:
timeout-minutes: 60
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18
- name: Install dependencies
run: npm ci
working-directory: test/e2e/
- name: Install Playwright Browsers
run: npx playwright install --with-deps
working-directory: test/e2e/
- name: Run Playwright tests
run: |
mkdir -p .auth;
echo "{}" > .auth/user.json;
npx playwright test
working-directory: test/e2e/
env:
TEST_USERNAME: ${{ secrets.TEST_USERNAME }}
TEST_PASSWORD: ${{ secrets.TEST_PASSWORD }}
SHELL_SOURCE: stage
- uses: actions/upload-artifact@v3
if: always()
with:
name: playwright-report
path: test/e2e/playwright-report/
retention-days: 30
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@ helix-importer-ui
/env/
.env
server.crt
server.key
server.key
/test/e2e/test-results
2 changes: 2 additions & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
registry=https://artifactory.corp.adobe.com:443/artifactory/api/npm/npm-adobe-release/
//artifactory.corp.adobe.com:443/artifactory/api/npm/npm-adobe-release/:always-auth=false
10 changes: 7 additions & 3 deletions 404.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,14 @@
<script src="/scripts/scripts.js" type="module" crossorigin="use-credentials"></script>
<script type="module">
import { sampleRUM } from '/scripts/lib-franklin.js';
import { bootstrapUnifiedShell, page } from '/contenthub/unified-shell.js';

window.addEventListener('load', async () => {
await bootstrapUnifiedShell();
page.notFound();

window.addEventListener('load', () => {
if (document.referrer) {
const { origin, pathname } = new URL(document.referrer);
const {origin, pathname} = new URL(document.referrer);
if (origin === window.location.origin) {
const backBtn = document.createElement('a');
backBtn.classList.add('button', 'error-button-back');
Expand All @@ -28,7 +32,7 @@
btnContainer.append(backBtn);
}
}
sampleRUM('404', { source: document.referrer, target: window.location.href });
sampleRUM('404', {source: document.referrer, target: window.location.href});
});
</script>
<link rel="stylesheet" href="/styles/styles.css">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
flex-direction: column;
row-gap: 31px;
width: 100%;
height: 100%;
}

.adp-add-to-collection-modal-container .dialog-header {
Expand Down
50 changes: 20 additions & 30 deletions blocks/adp-add-to-collection-modal/adp-add-to-collection-modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,10 @@ import { decorateIcons } from '../../scripts/lib-franklin.js';
import {
listCollection, createCollection, patchCollection, getCollection,
} from '../../scripts/collections.js';
import { getSelectedAssetsFromInfiniteResultsBlock, populateAssetViewLeftDialog } from '../../scripts/scripts.js';
import { populateAssetViewLeftDialog } from '../../scripts/scripts.js';
import { getSelectedAssetsFromInfiniteResultsBlock } from '../../scripts/shared.js';
import createMultiSelectedAssetsTable from '../../scripts/multi-selected-assets-table.js';

function closeDialog(dialog) {
dialog.close();
}
import { addDialogEventListeners } from '../../scripts/dialog-html-builder.js';

// Function to create the new collection input
function createNewCollectionInput(newCollectionRadioInputContainer) {
Expand Down Expand Up @@ -164,12 +162,11 @@ export async function openModal(items) {
}

// Close the dialog
closeDialog(dialog);
dialog.close();
});

dialog.querySelector('.action-cancel').addEventListener('click', () => {
resetDialogState();
closeDialog(dialog);
dialog.close();
});

dialog.showModal();
Expand Down Expand Up @@ -259,8 +256,10 @@ async function populateMultiAssetView(dialog) {
}

export default async function decorate(block) {
block.innerHTML = `<dialog autofocus aria-label="Add To Collection">
<div class='adp-add-to-collection-modal-container'>
block.innerHTML = '';
const dialog = document.createElement('dialog');
dialog.setAttribute('aria-label', 'Add To Collection');
dialog.innerHTML = `<div class='adp-add-to-collection-modal-container'>
<div class='dialog-header'>
<div class='dialog-header-left'>Add To Collection</div>
<div class='dialog-header-right'>
Expand Down Expand Up @@ -293,19 +292,19 @@ export default async function decorate(block) {
</div>

</div>
</div>
</dialog>`;

await decorateIcons(block);
const dialog = block.querySelector('dialog');
</div>`;
await decorateIcons(dialog);
block.appendChild(dialog);
dialog.querySelector('.action-close').addEventListener('click', () => {
resetDialogState();
closeDialog(dialog);
dialog.close();
});
document.addEventListener('keydown', (event) => {
if (event.key === 'Escape' && dialog.open) {
closeDialog(dialog);
}

addDialogEventListeners(dialog, {
closeModalOnEscape: false,
closeModalOnOutsideClick: true,
onClose: () => {
resetDialogState();
},
});

const newCollectionRadio = dialog.querySelector('#collection-selector-new-collection');
Expand All @@ -326,13 +325,4 @@ export default async function decorate(block) {
createDropdown(addToExistingRadioDropboxContainer);
}
});

dialog.addEventListener('click', (event) => {
// only react to clicks outside the dialog. https://stackoverflow.com/a/70593278/79461
const dialogDimensions = dialog.getBoundingClientRect();
if (event.clientX < dialogDimensions.left || event.clientX > dialogDimensions.right
|| event.clientY < dialogDimensions.top || event.clientY > dialogDimensions.bottom) {
closeDialog(dialog);
}
});
}
25 changes: 12 additions & 13 deletions blocks/adp-asset-details-modal/adp-asset-details-modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@ import {
getAnchorVariable,
createTag,
sortMetadata,
removeParamFromWindowURL,
setHashParamInWindowURL,
} from '../../scripts/scripts.js';
import { closeModal } from '../../scripts/shared.js';
removeParamFromWindowURL,
closeAssetDetailsModal,
} from '../../scripts/shared.js';
import { addDialogEventListeners } from '../../scripts/dialog-html-builder.js';
import { authorizeURL, getAssetMetadata } from '../../scripts/polaris.js';
import {
getAssetName, getAssetMimeType, getAssetTitle, isLicensedContent,
Expand Down Expand Up @@ -119,9 +120,6 @@ export async function openAssetDetailsModal(id, resultsManager) {
setHashParamInWindowURL('assetId', assetId);
}
if (assetId) {
if (!document.body.classList.contains('no-scroll')) {
document.body.classList.add('no-scroll');
}
const modal = document.querySelector('.modal-container');
if (!modal.classList.contains('open')) {
modal.classList.add('open');
Expand Down Expand Up @@ -275,15 +273,16 @@ export default function decorate(block) {
</div>
</dialog>`;
decorateIcons(block);

const dialog = block.querySelector('dialog');
block.querySelector('#asset-details-close').addEventListener('click', () => {
closeModal(block);
dialog.close();
});

document.addEventListener('keydown', (event) => {
if (event.key === 'Escape' && block.querySelector('.modal-container').open) {
closeModal(block);
}
addDialogEventListeners(dialog, {
closeModalOnEscape: true,
closeModalOnOutsideClick: true,
onClose: () => {
closeAssetDetailsModal(block);
},
});

// eslint-disable-next-line func-names
Expand Down
6 changes: 5 additions & 1 deletion blocks/adp-asset-details-panel/adp-asset-details-panel.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,17 @@
max-height: calc(100vh - 155px);
min-height: calc(100vh - 235px);
position: sticky;
top: 151px;
top: calc(var(--nav-height) + var(--main-container-padding-top));
box-shadow: 0 0 7px rgb(0 0 0 / 10%);
border-radius: 10px;
scrollbar-width: none;
overflow: auto;
}

.contenthub .adp-asset-details-panel-wrapper {
top: calc(var(--nav-height) + var(--main-container-padding-top) + 46px);
}

.adp-asset-details-panel-wrapper::-webkit-scrollbar {
width: 0;
}
Expand Down
2 changes: 1 addition & 1 deletion blocks/adp-asset-details-panel/adp-asset-details-panel.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ export async function openAssetDetailsPanel(assetId, resultsManagerObj) {
}

export default async function decorate(block) {
block.innerHTML = `
block.innerHTML = `
<div class="asset-details-header-container">
<div class="asset-details-header">
<div class="top-left">
Expand Down
35 changes: 35 additions & 0 deletions blocks/adp-assets-actions/adp-assets-actions.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
.adp-assets-actions-wrapper {
grid-area: assets-actions;
}

.adp-assets-actions {
display: flex;
justify-content: space-between;
align-items: center;
flex-direction: row-reverse;
}

.adp-assets-actions button {
background-color: var(--button-focus-outline-color);
border-radius: 16px;
font: var(--bold-font-size-s);
color: var(--button-text-color);
height: 37px;
display: flex;
justify-content: center;
align-items: center;
padding: 0 16px;
}

.adp-assets-actions button svg {
height: 17px;
width: 17px;
fill: #fff;
}

.adp-assets-actions button .icon {
height: 17px;
width: 17px;
margin-right: 8px;
fill: #fff;
}
25 changes: 25 additions & 0 deletions blocks/adp-assets-actions/adp-assets-actions.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { openUploadDialog } from '../../contenthub/hydration/hydration.js';
import { decorateIcons } from '../../scripts/lib-franklin.js';
import { checkAddAssetsAccess } from '../../scripts/security.js';
import { isContentHub } from '../../scripts/site-config.js';

export default async function decorate(block) {
block.innerHTML = '';
const assetActionsDiv = document.createElement('div');
assetActionsDiv.className = 'actions-container';
//add Asset actions button
if (await isContentHub() && await checkAddAssetsAccess()) {
const addAssetsButton = document.createElement('button');
addAssetsButton.classList.add('action', 'add-assets');
const addAssetsSpan = document.createElement('span');
addAssetsSpan.classList.add('icon', 'icon-addAssets');
addAssetsButton.appendChild(addAssetsSpan);
assetActionsDiv.appendChild(addAssetsButton);
addAssetsButton.appendChild(document.createTextNode('Add Assets'));
addAssetsButton.addEventListener('click', () => {
openUploadDialog();
});
}
block.appendChild(assetActionsDiv);
decorateIcons(block);
}
2 changes: 1 addition & 1 deletion blocks/adp-collection-header/adp-collection-header.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { getCollection, getCollectionIdFromURL, deleteCollection } from '../../scripts/collections.js';
import createConfirmDialog from '../../scripts/confirm-dialog.js';
import { decorateIcons } from '../../scripts/lib-franklin.js';
import { createLinkHref, navigateTo } from '../../scripts/scripts.js';
import { createLinkHref, navigateTo } from '../../scripts/shared.js';

import {
selectAllAssets, deselectAllAssets,
Expand Down
24 changes: 10 additions & 14 deletions blocks/adp-download-modal/adp-download-modal.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { decorateIcons } from '../../scripts/lib-franklin.js';
import { getAvailableRenditions } from '../../scripts/renditions.js';
import { createTag, closeDialogEvent, logError } from '../../scripts/scripts.js';
import { logError } from '../../scripts/scripts.js';
import { createTag, closeDialogEvent } from '../../scripts/shared.js';
import { addDialogEventListeners } from '../../scripts/dialog-html-builder.js';
import { addAssetToContainer } from '../../scripts/asset-panel-html-builder.js';
import { emitEvent, EventNames } from '../../scripts/events.js';
import { getBearerToken } from '../../scripts/security.js';
Expand Down Expand Up @@ -31,14 +33,15 @@ export default function decorate(block) {
</dialog>`;
decorateIcons(block);
const dialog = block.querySelector('dialog');
dialog.querySelector('.action-close').addEventListener('click', () => {
closeDialog(dialog);
addDialogEventListeners(dialog, {
removeDialogElementOnClose: false,
closeModalOnEscape: true,
closeModalOnOutsideClick: true,
});
document.addEventListener('keydown', (event) => {
if (event.key === 'Escape' && dialog.open) {
closeDialog(dialog);
}
dialog.querySelector('.action-close').addEventListener('click', () => {
dialog.close();
});

closeDialogEvent(dialog);
}

Expand Down Expand Up @@ -309,7 +312,6 @@ export async function openDownloadModal(assetId) {
const format = getAssetMimeType(assetJSON);

// add no-scroll to disable scrolling for the main page in the background
document.body.classList.add('no-scroll');
const dialog = document.querySelector('.adp-download-modal.block dialog');
dialog.classList.remove('multi-select');
dialog.querySelector('.modal-header-left').textContent = 'Download';
Expand All @@ -333,13 +335,7 @@ export async function openDownloadModal(assetId) {
document.querySelector('.adp-download-modal.block .action-close').blur();
}

function closeDialog(dialog) {
dialog.close();
document.body.classList.remove('no-scroll');
}

export async function openMultiSelectDownloadModal() {
document.body.classList.add('no-scroll');
const dialog = document.querySelector('.adp-download-modal.block dialog');
dialog.classList.add('multi-select');

Expand Down
Loading
Loading