From fff3458d7b4e02b291a026dd9f09a89e68850d27 Mon Sep 17 00:00:00 2001 From: nfmohit-wpmudev Date: Mon, 18 Mar 2019 23:42:25 +0600 Subject: [PATCH 1/6] Added the 'playsinline' attribute to the block --- packages/block-library/src/video/index.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/packages/block-library/src/video/index.js b/packages/block-library/src/video/index.js index 46592062ea41e..37bd8a32cd437 100644 --- a/packages/block-library/src/video/index.js +++ b/packages/block-library/src/video/index.js @@ -78,6 +78,12 @@ export const settings = { selector: 'video', attribute: 'src', }, + playsinline: { + type: 'boolean', + source: 'attribute', + selector: 'video', + attribute: 'playsinline', + }, }, transforms: { From 6ffdbf49867a03dce06042483566dccce55e2382 Mon Sep 17 00:00:00 2001 From: nfmohit-wpmudev Date: Mon, 18 Mar 2019 23:44:13 +0600 Subject: [PATCH 2/6] Added output of the 'playsinline' attribute in the front-end --- packages/block-library/src/video/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/block-library/src/video/index.js b/packages/block-library/src/video/index.js index 37bd8a32cd437..75590dd322ef8 100644 --- a/packages/block-library/src/video/index.js +++ b/packages/block-library/src/video/index.js @@ -150,7 +150,7 @@ export const settings = { edit, save( { attributes } ) { - const { autoplay, caption, controls, loop, muted, poster, preload, src } = attributes; + const { autoplay, caption, controls, loop, muted, poster, preload, src, playsinline } = attributes; return (
{ src && ( @@ -162,6 +162,7 @@ export const settings = { poster={ poster } preload={ preload !== 'metadata' ? preload : undefined } src={ src } + playsInline={ playsinline } /> ) } { ! RichText.isEmpty( caption ) && ( From 4b20369255cfd9a330318b45756317528c7d5640 Mon Sep 17 00:00:00 2001 From: nfmohit-wpmudev Date: Mon, 18 Mar 2019 23:46:40 +0600 Subject: [PATCH 3/6] Added the 'playsinline' attribute in InspectorControls --- packages/block-library/src/video/edit.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/packages/block-library/src/video/edit.js b/packages/block-library/src/video/edit.js index 6661db034b75c..1e1a82e338d7f 100644 --- a/packages/block-library/src/video/edit.js +++ b/packages/block-library/src/video/edit.js @@ -129,6 +129,7 @@ class VideoEdit extends Component { poster, preload, src, + playsinline, } = this.props.attributes; const { setAttributes, isSelected, className, noticeOperations, noticeUI } = this.props; const { editing } = this.state; @@ -200,6 +201,11 @@ class VideoEdit extends Component { onChange={ this.toggleAttribute( 'controls' ) } checked={ controls } /> + Date: Tue, 19 Mar 2019 00:50:00 +0600 Subject: [PATCH 4/6] Change label 'Playsinline' to 'Plays inline' --- packages/block-library/src/video/edit.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/block-library/src/video/edit.js b/packages/block-library/src/video/edit.js index 1e1a82e338d7f..a28961922b197 100644 --- a/packages/block-library/src/video/edit.js +++ b/packages/block-library/src/video/edit.js @@ -202,7 +202,7 @@ class VideoEdit extends Component { checked={ controls } /> From 758275687e07c41cb156a35eaca04609f1cfcc76 Mon Sep 17 00:00:00 2001 From: nfmohit-wpmudev Date: Tue, 19 Mar 2019 00:54:18 +0600 Subject: [PATCH 5/6] Fix failing e2e test issue --- packages/e2e-tests/fixtures/blocks/core__video.json | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/e2e-tests/fixtures/blocks/core__video.json b/packages/e2e-tests/fixtures/blocks/core__video.json index e91fd20c5bd8b..0bbf5170d68e0 100644 --- a/packages/e2e-tests/fixtures/blocks/core__video.json +++ b/packages/e2e-tests/fixtures/blocks/core__video.json @@ -9,6 +9,7 @@ "controls": true, "loop": false, "muted": false, + "playsinline": false, "preload": "metadata", "src": "https://awesome-fake.video/file.mp4" }, From 23cf5beb2b074fb6daa9de96f0de38f86c5a857a Mon Sep 17 00:00:00 2001 From: nfmohit-wpmudev Date: Tue, 19 Mar 2019 23:55:15 +0600 Subject: [PATCH 6/6] Replace variable name to --- packages/block-library/src/video/edit.js | 6 +++--- packages/block-library/src/video/index.js | 6 +++--- packages/e2e-tests/fixtures/blocks/core__video.json | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/packages/block-library/src/video/edit.js b/packages/block-library/src/video/edit.js index a28961922b197..5b54e8ae0f0a4 100644 --- a/packages/block-library/src/video/edit.js +++ b/packages/block-library/src/video/edit.js @@ -129,7 +129,7 @@ class VideoEdit extends Component { poster, preload, src, - playsinline, + playsInline, } = this.props.attributes; const { setAttributes, isSelected, className, noticeOperations, noticeUI } = this.props; const { editing } = this.state; @@ -203,8 +203,8 @@ class VideoEdit extends Component { /> { src && ( @@ -162,7 +162,7 @@ export const settings = { poster={ poster } preload={ preload !== 'metadata' ? preload : undefined } src={ src } - playsInline={ playsinline } + playsInline={ playsInline } /> ) } { ! RichText.isEmpty( caption ) && ( diff --git a/packages/e2e-tests/fixtures/blocks/core__video.json b/packages/e2e-tests/fixtures/blocks/core__video.json index 0bbf5170d68e0..cb19827f7ad7b 100644 --- a/packages/e2e-tests/fixtures/blocks/core__video.json +++ b/packages/e2e-tests/fixtures/blocks/core__video.json @@ -9,7 +9,7 @@ "controls": true, "loop": false, "muted": false, - "playsinline": false, + "playsInline": false, "preload": "metadata", "src": "https://awesome-fake.video/file.mp4" },