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

[RNMobile] Audio Block: Proper caption field #27689

Merged
merged 4 commits into from
Dec 17, 2020

Conversation

ceyhun
Copy link
Member

@ceyhun ceyhun commented Dec 11, 2020

Description

Used BlockCaption component for Audio Block's caption field.

Depends on: #27401. But I think we can review and merge this to that branch.

How has this been tested?

  1. Open demo app
  2. Add Audio block
  3. Choose an audio
  4. The block should be selected with "Write caption..." placeholder for caption field
  5. De-select block
  6. Caption field should be hidden
  7. Switch to HTML
  8. Check there are no <figcaption> tags
  9. Switch to Visual
  10. Select Audio block
  11. Type some words in the caption field
  12. Add some bold/italic words
  13. Move the cursor to the middle and press enter
  14. Caption should have a new line
  15. Move the cursor to the end and press enter
  16. A new paragraph block should be created
  17. Switch to HTML
  18. Check if <figcaption> tags contain correct information (for bold, italic, etc. and <br> tags for new lines)
  19. Save the post and open it from the web browser
  20. Check if the caption shows correctly

Screenshots

iOS Android

Types of changes

New feature (non-breaking change which adds functionality)

Checklist:

  • My code is tested.
  • My code follows the WordPress code style.
  • My code follows the accessibility standards.
  • My code has proper inline documentation.
  • I've included developer documentation if appropriate.
  • I've updated all React Native files affected by any refactorings/renamings in this PR.

@ceyhun ceyhun added the Mobile App - i.e. Android or iOS Native mobile impl of the block editor. (Note: used in scripts, ping mobile folks to change) label Dec 11, 2020
@github-actions
Copy link

github-actions bot commented Dec 11, 2020

Size Change: 0 B

Total Size: 1.21 MB

ℹ️ View Unchanged
Filename Size Change
build/a11y/index.js 1.14 kB 0 B
build/annotations/index.js 3.8 kB 0 B
build/api-fetch/index.js 3.42 kB 0 B
build/autop/index.js 2.83 kB 0 B
build/blob/index.js 665 B 0 B
build/block-directory/index.js 8.72 kB 0 B
build/block-directory/style-rtl.css 943 B 0 B
build/block-directory/style.css 942 B 0 B
build/block-editor/index.js 128 kB 0 B
build/block-editor/style-rtl.css 11.2 kB 0 B
build/block-editor/style.css 11.2 kB 0 B
build/block-library/editor-rtl.css 9.07 kB 0 B
build/block-library/editor.css 9.07 kB 0 B
build/block-library/index.js 149 kB 0 B
build/block-library/style-rtl.css 8.35 kB 0 B
build/block-library/style.css 8.35 kB 0 B
build/block-library/theme-rtl.css 789 B 0 B
build/block-library/theme.css 790 B 0 B
build/block-serialization-default-parser/index.js 1.88 kB 0 B
build/block-serialization-spec-parser/index.js 3.06 kB 0 B
build/blocks/index.js 48.1 kB 0 B
build/components/index.js 172 kB 0 B
build/components/style-rtl.css 15.4 kB 0 B
build/components/style.css 15.3 kB 0 B
build/compose/index.js 10.2 kB 0 B
build/core-data/index.js 15.4 kB 0 B
build/data-controls/index.js 827 B 0 B
build/data/index.js 8.97 kB 0 B
build/date/index.js 31.8 kB 0 B
build/deprecated/index.js 769 B 0 B
build/dom-ready/index.js 571 B 0 B
build/dom/index.js 4.95 kB 0 B
build/edit-navigation/index.js 11.1 kB 0 B
build/edit-navigation/style-rtl.css 881 B 0 B
build/edit-navigation/style.css 885 B 0 B
build/edit-post/index.js 306 kB 0 B
build/edit-post/style-rtl.css 6.49 kB 0 B
build/edit-post/style.css 6.47 kB 0 B
build/edit-site/index.js 24.7 kB 0 B
build/edit-site/style-rtl.css 3.93 kB 0 B
build/edit-site/style.css 3.93 kB 0 B
build/edit-widgets/index.js 26.3 kB 0 B
build/edit-widgets/style-rtl.css 3.13 kB 0 B
build/edit-widgets/style.css 3.13 kB 0 B
build/editor/editor-styles-rtl.css 476 B 0 B
build/editor/editor-styles.css 478 B 0 B
build/editor/index.js 43.4 kB 0 B
build/editor/style-rtl.css 3.84 kB 0 B
build/editor/style.css 3.84 kB 0 B
build/element/index.js 4.62 kB 0 B
build/escape-html/index.js 735 B 0 B
build/format-library/index.js 6.74 kB 0 B
build/format-library/style-rtl.css 547 B 0 B
build/format-library/style.css 548 B 0 B
build/hooks/index.js 2.27 kB 0 B
build/html-entities/index.js 622 B 0 B
build/i18n/index.js 3.57 kB 0 B
build/is-shallow-equal/index.js 698 B 0 B
build/keyboard-shortcuts/index.js 2.54 kB 0 B
build/keycodes/index.js 1.93 kB 0 B
build/list-reusable-blocks/index.js 3.1 kB 0 B
build/list-reusable-blocks/style-rtl.css 476 B 0 B
build/list-reusable-blocks/style.css 476 B 0 B
build/media-utils/index.js 5.31 kB 0 B
build/notices/index.js 1.82 kB 0 B
build/nux/index.js 3.42 kB 0 B
build/nux/style-rtl.css 671 B 0 B
build/nux/style.css 668 B 0 B
build/plugins/index.js 2.54 kB 0 B
build/primitives/index.js 1.43 kB 0 B
build/priority-queue/index.js 789 B 0 B
build/redux-routine/index.js 2.84 kB 0 B
build/reusable-blocks/index.js 2.92 kB 0 B
build/rich-text/index.js 13.4 kB 0 B
build/server-side-render/index.js 2.77 kB 0 B
build/shortcode/index.js 1.69 kB 0 B
build/token-list/index.js 1.27 kB 0 B
build/url/index.js 2.84 kB 0 B
build/viewport/index.js 1.86 kB 0 B
build/warning/index.js 1.14 kB 0 B
build/wordcount/index.js 1.22 kB 0 B

compressed-size-action

@ceyhun ceyhun mentioned this pull request Dec 14, 2020
6 tasks
@ceyhun ceyhun requested a review from jd-alexander December 14, 2020 17:36
@ceyhun ceyhun marked this pull request as ready for review December 14, 2020 17:36
Copy link
Contributor

@jd-alexander jd-alexander left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this implementation @ceyhun I tested the overall behavior of the component and it works as expected! I observed all the behaviors you mentioned in the testing instructions:

✅ Audio block is selected with "Write caption..." placeholder for caption field
✅ Deselecting Audio Block causes the Caption field to be hidden
✅ Switching to html mode without modifying the caption of the Audio block resulted in no

tags being seen in the audio block.
✅ Audio caption supports multiline behavior & when enter is pressed at the end of the caption text a new paragraph is added.
<figcaption> contained the expected tags and content.
✅ The caption is rendered correctly.

I left a few comments to verify a few things. Once those are addressed we are good to go!

@paaljoachim
Copy link
Contributor

An associated comment.... As the Audio Block: caption field is being worked on.... Perhaps someone in this thread would like to work on or knows someone who might want to work on the Playlist block feature. Here is the issue for it: #805 (It is the second oldest issue here in the Gutenberg Github repo.)
Crossing fingers.... I believe we just need to link the right person with the right issue... Thanks.

@ceyhun
Copy link
Member Author

ceyhun commented Dec 16, 2020

Thanks for testing and reviewing @jd-alexander! I think I have addressed your feedback. Can you please give it another check?

@ceyhun ceyhun requested a review from jd-alexander December 16, 2020 16:05
Copy link
Contributor

@jd-alexander jd-alexander left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @ceyhun for addressing all the feedback! We are good to go here! LGTM 🚢

@ceyhun
Copy link
Member Author

ceyhun commented Dec 17, 2020

An associated comment.... As the Audio Block: caption field is being worked on.... Perhaps someone in this thread would like to work on or knows someone who might want to work on the Playlist block feature. Here is the issue for it: #805 (It is the second oldest issue here in the Gutenberg Github repo.)
Crossing fingers.... I believe we just need to link the right person with the right issue... Thanks.

Hey there @paaljoachim 👋 I'm only working on porting the Audio block to native/mobile, and unfortunately, I'm not the right person 😔 Also the issue you shared still seems to have a [Priority] Low tag 😔

@ceyhun ceyhun merged commit af6cb99 into rnmobile/audio-block-I-b Dec 17, 2020
@ceyhun ceyhun deleted the audio-block-III-caption-field branch December 17, 2020 08:54
jd-alexander added a commit that referenced this pull request Jan 26, 2021
* Basics of Audio block working

* Add audio support to MediaUpload

* Add handling of file uploads and replace

* WPMediaLibrary support for Audio block

* Avoid removing media info on error state

* Linting

* Added an AUDIO file to the test requestMediaPickFromMediaLibrary func

* Fixed typo in ToolbarButton of Audio Block.

* Removed auto help behavior present on web that's not used on mobile.

* [Android] Wired the click of the Audio Media Library button.

* Added Audio media options for choosing audio file locally.

* [RNMobile] Audio Block: Proper caption field (#27689)

Co-authored-by: Joel Dean <[email protected]>
Co-authored-by: Ceyhun Ozugur <[email protected]>
jd-alexander added a commit that referenced this pull request Feb 1, 2021
* Basics of Audio block working

* Add audio support to MediaUpload

* Add handling of file uploads and replace

* WPMediaLibrary support for Audio block

* Avoid removing media info on error state

* Linting

* Added an AUDIO file to the test requestMediaPickFromMediaLibrary func

* Fixed typo in ToolbarButton of Audio Block.

* Removed auto help behavior present on web that's not used on mobile.

* [Android] Wired the click of the Audio Media Library button.

* Added Audio media options for choosing audio file locally.

* [RNMobile] Audio Block: Proper caption field (#27689)

* Audio Player UI for audio block

* Add extension to styles import

* Show file name while loading and retry message on error

* Pass state props to audio player component

* Implement placeholder-ish player UI structure

* added styles for icon, title and subtitle

* added blue-wordpress as link color.

* added sizing based on design specs.

* Fixed object destructuring error.

* added icon styling state for upload in progress or upload failed.

* implemented error style and behavior.

* added styling for upload failed text.

* Override MediaUploadProgress styles

* Update filename extension spseration to handle two dots

* Update UI structure and styles

* Make retry message translateable

* Update snaphots

* Fix lint error

* Set initial file name

* Remove devOnly flag from audio block

* Increase tap target of button

* Add 1px between title and subtitle

* Align title, subtitle and button vertically

* On iOS use VideoPlayer to play audio files in-app

* Revert "On iOS use VideoPlayer to play audio files in-app"

This reverts commit b1eb8dd.

* [RNMobile] Audio Block -  Cancel and Retry Dialog (#28540)

Co-authored-by: Ceyhun Ozugur <[email protected]>

* Rename button title

* Add pill-shaped background to button

* Add padding to title

* Fix file title being empty when selecting from media library

* Use safeDecodeURI

* On iOS use VideoPlayer to play audio files in-app

* Decrease button font size

Co-authored-by: Joel Dean <[email protected]>

* Revert "Remove devOnly flag from audio block"

This reverts commit e6b5b6d.

* Add right padding to title container to fix error state

Co-authored-by: Joel Dean <[email protected]>
Co-authored-by: Ceyhun Ozugur <[email protected]>
fluiddot pushed a commit that referenced this pull request Feb 2, 2021
* Basics of Audio block working

* Add audio support to MediaUpload

* Add handling of file uploads and replace

* WPMediaLibrary support for Audio block

* Avoid removing media info on error state

* Linting

* Added an AUDIO file to the test requestMediaPickFromMediaLibrary func

* Fixed typo in ToolbarButton of Audio Block.

* Removed auto help behavior present on web that's not used on mobile.

* [Android] Wired the click of the Audio Media Library button.

* Added Audio media options for choosing audio file locally.

* [RNMobile] Audio Block: Proper caption field (#27689)

* Audio Player UI for audio block

* Add extension to styles import

* Show file name while loading and retry message on error

* Pass state props to audio player component

* Implement placeholder-ish player UI structure

* added styles for icon, title and subtitle

* added blue-wordpress as link color.

* added sizing based on design specs.

* Fixed object destructuring error.

* added icon styling state for upload in progress or upload failed.

* implemented error style and behavior.

* added styling for upload failed text.

* Override MediaUploadProgress styles

* Update filename extension spseration to handle two dots

* Update UI structure and styles

* Make retry message translateable

* Update snaphots

* Fix lint error

* Set initial file name

* Remove devOnly flag from audio block

* Increase tap target of button

* Add 1px between title and subtitle

* Align title, subtitle and button vertically

* On iOS use VideoPlayer to play audio files in-app

* Revert "On iOS use VideoPlayer to play audio files in-app"

This reverts commit b1eb8dd.

* [RNMobile] Audio Block -  Cancel and Retry Dialog (#28540)

Co-authored-by: Ceyhun Ozugur <[email protected]>

* Rename button title

* Add pill-shaped background to button

* Add padding to title

* Fix file title being empty when selecting from media library

* Use safeDecodeURI

* On iOS use VideoPlayer to play audio files in-app

* Decrease button font size

Co-authored-by: Joel Dean <[email protected]>

* Revert "Remove devOnly flag from audio block"

This reverts commit e6b5b6d.

* Add right padding to title container to fix error state

Co-authored-by: Joel Dean <[email protected]>
Co-authored-by: Ceyhun Ozugur <[email protected]>
fluiddot added a commit that referenced this pull request Feb 5, 2021
* Release script: Update react-native-editor version to 1.46.0

* Release script: Update with changes from 'npm run core preios'

* [RNMobile] Correct condition in setting blockWidth (#28635)

* [RNMobile] Fix height of the bottom-sheet after using back button (#28632)

* remove unused param and setHeight even if it is the same

* [RNMobile] Audio Player UI for audio block (#27467)

* Basics of Audio block working

* Add audio support to MediaUpload

* Add handling of file uploads and replace

* WPMediaLibrary support for Audio block

* Avoid removing media info on error state

* Linting

* Added an AUDIO file to the test requestMediaPickFromMediaLibrary func

* Fixed typo in ToolbarButton of Audio Block.

* Removed auto help behavior present on web that's not used on mobile.

* [Android] Wired the click of the Audio Media Library button.

* Added Audio media options for choosing audio file locally.

* [RNMobile] Audio Block: Proper caption field (#27689)

* Audio Player UI for audio block

* Add extension to styles import

* Show file name while loading and retry message on error

* Pass state props to audio player component

* Implement placeholder-ish player UI structure

* added styles for icon, title and subtitle

* added blue-wordpress as link color.

* added sizing based on design specs.

* Fixed object destructuring error.

* added icon styling state for upload in progress or upload failed.

* implemented error style and behavior.

* added styling for upload failed text.

* Override MediaUploadProgress styles

* Update filename extension spseration to handle two dots

* Update UI structure and styles

* Make retry message translateable

* Update snaphots

* Fix lint error

* Set initial file name

* Remove devOnly flag from audio block

* Increase tap target of button

* Add 1px between title and subtitle

* Align title, subtitle and button vertically

* On iOS use VideoPlayer to play audio files in-app

* Revert "On iOS use VideoPlayer to play audio files in-app"

This reverts commit b1eb8dd.

* [RNMobile] Audio Block -  Cancel and Retry Dialog (#28540)

Co-authored-by: Ceyhun Ozugur <[email protected]>

* Rename button title

* Add pill-shaped background to button

* Add padding to title

* Fix file title being empty when selecting from media library

* Use safeDecodeURI

* On iOS use VideoPlayer to play audio files in-app

* Decrease button font size

Co-authored-by: Joel Dean <[email protected]>

* Revert "Remove devOnly flag from audio block"

This reverts commit e6b5b6d.

* Add right padding to title container to fix error state

Co-authored-by: Joel Dean <[email protected]>
Co-authored-by: Ceyhun Ozugur <[email protected]>

* [RNMobile] Enable Audio Block (#28594)

Co-authored-by: Joel Dean <[email protected]>

* Update react-native-editor CHANGELOG

* Update unsupported block test data for UI tests (#28649)

The unsupported block now used is jetpack/gif since Audio block is now supported.

* Revert indentation of modified package.json files

* Update react-native-editor CHANGELOG

* [RNMobile] Move custom indicator to be rendered above the colors (#28698)

* [RNMobile] Move back disabled style for button in File block (#28704)

Co-authored-by: Luke Walczak <[email protected]>
Co-authored-by: Drapich Piotr <[email protected]>
Co-authored-by: etoledom <[email protected]>
Co-authored-by: Joel Dean <[email protected]>
Co-authored-by: Ceyhun Ozugur <[email protected]>
jd-alexander added a commit that referenced this pull request May 21, 2021
* Basics of Audio block working

* Add audio support to MediaUpload

* Add handling of file uploads and replace

* WPMediaLibrary support for Audio block

* Avoid removing media info on error state

* Linting

* Added an AUDIO file to the test requestMediaPickFromMediaLibrary func

* Fixed typo in ToolbarButton of Audio Block.

* Removed auto help behavior present on web that's not used on mobile.

* [Android] Wired the click of the Audio Media Library button.

* Added Audio media options for choosing audio file locally.

* [RNMobile] Audio Block: Proper caption field (#27689)

* Add alert prompt to insert from URL

* Set entered URL in audio block attributes

* initial integration with react native prompt.

* updated prompt lib.

* updated commit hash of prompt lib.

* Updated package-lock.json.

* Added RNPromptPackage to Glue Code.

* fixed merge conflicts between the edit.native.js files of the branches

* added onSelectURL to the media-upload component

* added onSelectURL to the media-placeholder

* updated onSelectURL support with notice and URL validation

* sync package-lock.json

* updated package-lock.json

* updated package-lock.json

* updated react-native-prompt-android setup due to binary dep changes.

* sync package-lock.json

* Integrated RNPromptPackage with the glue code.

* sync package-lock.json

* package-lock.json fix

* sync package-lock.json

* Added the globe icon to the Insert from URL source.Only shown on Android

* Extract filename from all URL types and optimized extension logic.

* Reduced onPress -> onSelectURL logic since the parameters match.

* Added entry to CHANGELOG.md

* Fixed release notes entry.

Co-authored-by: eToledo <[email protected]>
Co-authored-by: Joel Dean <[email protected]>
jd-alexander added a commit that referenced this pull request May 21, 2021
* Basics of Audio block working

* Add audio support to MediaUpload

* Add handling of file uploads and replace

* WPMediaLibrary support for Audio block

* Avoid removing media info on error state

* Linting

* Added an AUDIO file to the test requestMediaPickFromMediaLibrary func

* Fixed typo in ToolbarButton of Audio Block.

* Removed auto help behavior present on web that's not used on mobile.

* [Android] Wired the click of the Audio Media Library button.

* Added Audio media options for choosing audio file locally.

* [RNMobile] Audio Block: Proper caption field (#27689)

* Add alert prompt to insert from URL

* Set entered URL in audio block attributes

* initial integration with react native prompt.

* updated prompt lib.

* updated commit hash of prompt lib.

* Updated package-lock.json.

* Added RNPromptPackage to Glue Code.

* fixed merge conflicts between the edit.native.js files of the branches

* added onSelectURL to the media-upload component

* added onSelectURL to the media-placeholder

* updated onSelectURL support with notice and URL validation

* sync package-lock.json

* updated package-lock.json

* updated package-lock.json

* updated react-native-prompt-android setup due to binary dep changes.

* sync package-lock.json

* Integrated RNPromptPackage with the glue code.

* sync package-lock.json

* package-lock.json fix

* sync package-lock.json

* Added the globe icon to the Insert from URL source.Only shown on Android

* Extract filename from all URL types and optimized extension logic.

* Extracted the url parsing logic to a file so it can be tested.

* integrated parseAudioUrl function with the Audio block.

* Created tests for the audio url parsing.

* Made the component and its respective tests native.

* Reduced onPress -> onSelectURL logic since the parameters match.

* Added entry to CHANGELOG.md

* Utilized getPath from the `wordpress/url` package to simplify logic.

* Added URL with folder to the tests for audio urls with an extension.

* Enhanced tests to verify the title and extension values.

* Trimmed the extension since a space exists in the string for the UI.

* Removed trim and put the space in the string.

* Removed duplicate entry.

Co-authored-by: eToledo <[email protected]>
Co-authored-by: Ceyhun Ozugur <[email protected]>
fluiddot added a commit that referenced this pull request Jun 3, 2021
… media sources (#31966)

* Basics of Audio block working

* Add audio support to MediaUpload

* Add handling of file uploads and replace

* WPMediaLibrary support for Audio block

* Avoid removing media info on error state

* Linting

* Added an AUDIO file to the test requestMediaPickFromMediaLibrary func

* Fixed typo in ToolbarButton of Audio Block.

* Removed auto help behavior present on web that's not used on mobile.

* [Android] Wired the click of the Audio Media Library button.

* Added Audio media options for choosing audio file locally.

* [RNMobile] Audio Block: Proper caption field (#27689)

* Add alert prompt to insert from URL

* Set entered URL in audio block attributes

* initial integration with react native prompt.

* updated prompt lib.

* updated commit hash of prompt lib.

* Updated package-lock.json.

* Added RNPromptPackage to Glue Code.

* fixed merge conflicts between the edit.native.js files of the branches

* added onSelectURL to the media-upload component

* added onSelectURL to the media-placeholder

* updated onSelectURL support with notice and URL validation

* sync package-lock.json

* updated package-lock.json

* updated package-lock.json

* updated react-native-prompt-android setup due to binary dep changes.

* sync package-lock.json

* Integrated RNPromptPackage with the glue code.

* sync package-lock.json

* package-lock.json fix

* sync package-lock.json

* Added the globe icon to the Insert from URL source.Only shown on Android

* Extract filename from all URL types and optimized extension logic.

* Removed hook that would show/hide the audio block. It is not needed.

* Only show the Insert from URL option when the audio block cap is false

* Added changelog entry for the Audio block URL prompt on free sites

* Removed exclamation mark.

* Reduced onPress -> onSelectURL logic since the parameters match.

* Added entry to CHANGELOG.md

* simplified isAudioBlockEnabled's usage of getSettings.

* exported the Insert from URL option so that the test can be utilize it.

* Added test that verifies the Insert From URL option with the audio type

* isAudioBlockMediaUploadEnabled now represents the Audio block capability

* placed the audio block capability in a single filter callback function

* Added release notes entry under unreleased.

* added logic that verifies that the source being enabled supports audio

* formatted code changes.

* Changed the order of the props to match the order throughout the file.

* Fixed order of ios capabilities

* Fix indent issues on Gutenberg props

Co-authored-by: eToledo <[email protected]>
Co-authored-by: Ceyhun Ozugur <[email protected]>
Co-authored-by: Carlos Garcia <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Mobile App - i.e. Android or iOS Native mobile impl of the block editor. (Note: used in scripts, ping mobile folks to change)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants