diff --git a/packages/wp-story-editor/src/api/utils/getResourceFromAttachment.js b/packages/wp-story-editor/src/api/utils/getResourceFromAttachment.js index fc409b411f4c..a3380c18228e 100644 --- a/packages/wp-story-editor/src/api/utils/getResourceFromAttachment.js +++ b/packages/wp-story-editor/src/api/utils/getResourceFromAttachment.js @@ -52,7 +52,7 @@ function getImageResourceFromAttachment(attachment) { const { id, date_gmt, - media_details: { width, height, sizes: _sizes }, + media_details: { width, height, sizes: _sizes = {} } = {}, mime_type: mimeType, alt_text: alt, source_url: src, diff --git a/packages/wp-story-editor/src/components/mediaUpload/mediaPicker/utils/getResourceFromMediaPicker.js b/packages/wp-story-editor/src/components/mediaUpload/mediaPicker/utils/getResourceFromMediaPicker.js index 027034122c83..07fc39ba1fb1 100644 --- a/packages/wp-story-editor/src/components/mediaUpload/mediaPicker/utils/getResourceFromMediaPicker.js +++ b/packages/wp-story-editor/src/components/mediaUpload/mediaPicker/utils/getResourceFromMediaPicker.js @@ -46,8 +46,8 @@ const getResourceFromMediaPicker = (mediaPickerEl) => { height, length, length_formatted: lengthFormatted, - sizes: _sizes, - }, + sizes: _sizes = {}, + } = {}, web_stories_media_source: mediaSource, web_stories_is_muted: isMuted, web_stories_base_color: baseColor, diff --git a/packages/wp-story-editor/src/components/mediaUpload/mediaPicker/utils/test/getResourceFromMediaPicker.js b/packages/wp-story-editor/src/components/mediaUpload/mediaPicker/utils/test/getResourceFromMediaPicker.js index 58f02cdac1dd..10a6a692c82c 100644 --- a/packages/wp-story-editor/src/components/mediaUpload/mediaPicker/utils/test/getResourceFromMediaPicker.js +++ b/packages/wp-story-editor/src/components/mediaUpload/mediaPicker/utils/test/getResourceFromMediaPicker.js @@ -209,4 +209,69 @@ describe('getResourceFromMediaPicker', () => { }) ); }); + + it('should return resource for VTT file', () => { + const mediaPickerEl = { + id: 1234, + title: 'captions', + filename: 'captions.vtt', + url: 'https://example.com/wp-content/uploads/captions.vtt', + link: 'https://example.com/captions/', + alt: 'captions', + author: '1', + description: '', + caption: '', + name: 'captions', + status: 'inherit', + uploadedTo: 0, + date: '2021-11-12T11:15:56.000Z', + modified: '2021-11-12T11:15:56.000Z', + menuOrder: 0, + mime: 'text/vtt', + type: 'text', + subtype: 'vtt', + icon: 'https://example.com/wp-includes/images/media/text.png', + dateFormatted: 'November 12, 2021', + nonces: { + update: 'a43563250f', + delete: '813aa798e6', + edit: '2a2853a1b9', + }, + editLink: 'https://example.com/wp-admin/post.php?post=1234&action=edit', + meta: false, + authorName: 'Pascal', + authorLink: 'https://example.com/wp-admin/profile.php', + filesizeInBytes: 17551, + filesizeHumanReadable: '17 KB', + context: '', + compat: { + item: '', + meta: '', + }, + web_stories_base_color: '', + web_stories_blurhash: '', + media_details: [], + web_stories_media_source: 'editor', + }; + + expect(getResourceFromMediaPicker(mediaPickerEl)).toStrictEqual( + expect.objectContaining({ + alt: 'captions', + baseColor: '', + blurHash: '', + creationDate: '2021-11-12T11:15:56.000Z', + id: 1234, + isExternal: false, + isMuted: false, + isOptimized: false, + isPlaceholder: false, + mimeType: 'text/vtt', + needsProxy: false, + length: 0, + src: 'https://example.com/wp-content/uploads/captions.vtt', + type: 'text', + sizes: {}, + }) + ); + }); }); diff --git a/readme.txt b/readme.txt index 1a96b1fbab31..01c1249f78dd 100644 --- a/readme.txt +++ b/readme.txt @@ -109,6 +109,12 @@ Web Stories are powered by [AMP](https://amp.dev/), which adds some restrictions For the plugin's full changelog, please see [the Releases page on GitHub](https://github.com/googleforcreators/web-stories-wp/releases). += 1.18.1 = + +**Release Date:** March 8, 2022. + +* Fixes an issue where adding video captions did not work. + = 1.18.0 = **Release Date:** March 1, 2022. @@ -129,18 +135,11 @@ For the plugin's full changelog, please see [the Releases page on GitHub](https: * Enhancement: improved element resizing handling. * Bug fixes and performance improvements. -= 1.16.0 = +== Upgrade Notice == -**Release Date:** January 18, 2022. += 1.18.1 = -* Compatibility with WordPress 5.9 -* New feature: improved video captions appearance in the editor. -* New feature: duplicate elements via right-click menu. -* Enhancement: use static images for displaying saved templates in the editor. -* Enhancement: improved appearance when exploring templates in the dashboard. -* Bug fixes and performance improvements. - -== Upgrade Notice == +This release fixes an issue where adding video captions did not work. = 1.18.0 = @@ -149,7 +148,3 @@ New pre-publish confirmation dialog, semantic headings, and several bug fixes an = 1.17.0 = Various smaller enhancements throughout the editor, plus several bug fixes and performance improvements. - -= 1.16.0 = - -WordPress 5.9 compatibility, various UI refinements, right-click menu element duplication, and several bug fixes and performance improvements.