diff --git a/addons/web_editor/static/src/components/media_dialog/file_selector.js b/addons/web_editor/static/src/components/media_dialog/file_selector.js index 15a9d065c37..6a7817be989 100644 --- a/addons/web_editor/static/src/components/media_dialog/file_selector.js +++ b/addons/web_editor/static/src/components/media_dialog/file_selector.js @@ -146,7 +146,7 @@ export class FileSelector extends Component { needle: '', }); - this.NUMBER_OF_ATTACHMENTS_TO_DISPLAY = 10; + this.NUMBER_OF_ATTACHMENTS_TO_DISPLAY = 30; onWillStart(async () => { this.state.attachments = await this.fetchAttachments(this.NUMBER_OF_ATTACHMENTS_TO_DISPLAY, 0); diff --git a/addons/web_editor/static/src/components/media_dialog/image_selector.js b/addons/web_editor/static/src/components/media_dialog/image_selector.js index 4578f349959..b67f49aff66 100644 --- a/addons/web_editor/static/src/components/media_dialog/image_selector.js +++ b/addons/web_editor/static/src/components/media_dialog/image_selector.js @@ -53,6 +53,7 @@ export class ImageSelector extends FileSelector { this.state.isFetchingLibrary = false; this.state.searchService = 'all'; this.state.showOptimized = false; + this.NUMBER_OF_MEDIA_TO_DISPLAY = 10; this.uploadText = this.env._t("Upload an image"); this.urlPlaceholder = "https://www.odoo.com/logo.png"; @@ -169,7 +170,8 @@ export class ImageSelector extends FileSelector { } ); this.state.isFetchingLibrary = false; - return { media: response.media || [], results: response.results }; + const media = (response.media || []).slice(0, this.NUMBER_OF_MEDIA_TO_DISPLAY); + return { media, results: response.results }; } catch { // Either API endpoint doesn't exist or is misconfigured. console.error(`Couldn't reach API endpoint.`); diff --git a/addons/web_unsplash/static/src/components/media_dialog/image_selector.js b/addons/web_unsplash/static/src/components/media_dialog/image_selector.js index 2c9c5381853..1dc575e715f 100644 --- a/addons/web_unsplash/static/src/components/media_dialog/image_selector.js +++ b/addons/web_unsplash/static/src/components/media_dialog/image_selector.js @@ -49,6 +49,7 @@ patch(ImageSelector.prototype, 'image_selector_unsplash', { this.state.isMaxed = false; this.state.unsplashError = null; this.state.useUnsplash = true; + this.NUMBER_OF_RECORDS_TO_DISPLAY = 30; this.errorMessages = { 'key_not_found': { @@ -123,7 +124,7 @@ patch(ImageSelector.prototype, 'image_selector_unsplash', { } this.state.isFetchingUnsplash = true; try { - const { isMaxed, images } = await this.unsplash.getImages(this.state.needle, offset, this.NUMBER_OF_ATTACHMENTS_TO_DISPLAY, this.props.orientation); + const { isMaxed, images } = await this.unsplash.getImages(this.state.needle, offset, this.NUMBER_OF_RECORDS_TO_DISPLAY, this.props.orientation); this.state.isFetchingUnsplash = false; this.state.unsplashError = false; const records = images.map(record => {