Problem/Motivation
CKE5 is the new default Wysiwyg since Drupal 10. But Video Embed Wysiwyg does not work with it and has been removed from 3.0.x.
Proposed resolution
See merge request.
Remaining tasks
- Fix the problems reported by CI
- Manually review the code and the resulting behavior of the merge request (dynamic patch available at https://git.drupalcode.org/project/video_embed_field/-/merge_requests/74...) to find any remaining problems
| Comment | File | Size | Author |
|---|---|---|---|
| #90 | video_embed_field-D10-ckeditor5-fix-3311063-90.patch | 198.09 KB | jschref |
| #56 | 3311063-56.patch | 173 KB | dylan donkersgoed |
| #47 | Screenshot 2023-11-20 at 01.40.47.png | 117.76 KB | danielzigo |
| #47 | Screenshot 2023-11-20 at 01.39.19.png | 60.95 KB | danielzigo |
| #46 | Screenshot from 2023-11-10 13-26-01.png | 34.26 KB | gwvoigt |
Issue fork video_embed_field-3311063
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #5
saidatomComment #6
selinav commentedIs the 8.x.2.5 release is compatible with ckeditor 5 ?
Comment #7
vegardjo commenteddid a quick test with a patch downloaded from the MR above, but get this:
Comment #8
gaëlgIt seems to me that for this module to be CKE5-compatible, the video_embed_wysiwyg submodule should declare a CKE5 plugin, which it does not.
Comment #9
gaëlgSee https://www.drupal.org/docs/core-modules-and-themes/core-modules/ckedito...
Comment #10
gaëlgI'm on it.
Comment #11
gaëlgI'm done for today, will continue later if no one does in the meanwhile.
Comment #12
gaëlgComment #13
gaëlgComment #14
gaëlgComment #15
gaëlgComment #16
gaëlgComment #17
vuilCan not be applied on 8.x-2.5 version.
Comment #18
gaëlgHi vuil and thank you for your feedback.
Yes, the patch is against 8.x-2.x-dev. Feel free to submit a patch for the last stable version for composer use, but if I'm right, to be accepted/committed/merged, a patch has to be against the dev version.
Comment #19
taran2lTested patch and, unfortunately, it gives an JS error when switching between filter formats and/or when CKEditor enabled field is added via AJAX
Setting it to NW
Comment #21
bbombachiniWhile testing this patch, I could not add the video_embed_wysiwyg to the text editor, it would error out saying height and weight were required fields so I've added a default value to the patch.
Please review.
Comment #23
bbombachiniTested and patch is working. Moving to needs review.
Comment #24
loopy1492 commentedWhen I check "Autoplay", or "Responsive Video", then go back to the content item, click the video, then click to edit the existing field, those elements are not checked.
Comment #25
loopy1492 commentedComment #26
loopy1492 commentedWhen testing this, do note that Autoplay is disabled by default for Administrators.
Comment #27
loopy1492 commentedHmm. This appears to be a thing that happens with all of the embedded elements, not just the video. Very well. This seems to be working within that particular constraint of the editor in general.
Comment #28
thomwilhelm commented+1 to this MR. Allowed me to upgrade to ckeditor5.
Would love to see this get committed as technically if you are using the video_embed_wysiwyg module, you can't migrate to ckeditor5 due to the dependency on ckeditor.
Comment #29
loopy1492 commentedCorrect @ThomWilhelm. The only way is to use the issue fork which is a bit of a security risk.
https://www.drupal.org/docs/develop/git/using-gitlab-to-contribute-to-dr...
Comment #30
jacqui1811 commentedHi.
Sorry but just wanted to ask, as I am in need of this fix as I need to upgrade my website to CKEditor5 and can't as we use this module.
Can I ask what the next step here is please ?
BTW you guys rock and I appreciate all you do here.
I have been following this issue for about 4 months in the hope.
Comment #31
loopy1492 commented@jacqui1811 you can use this version for video_embed_field in composer.json:
"drupal/video_embed_field": "dev-3311063-add-support-for",But you need to do this in your repositories section:
Just know that there are some inherent security risks when using WIP dev branches.
Comment #32
jacqui1811 commentedThanks for that,
Will try that tomorrow and report back by editing this comment.
Comment #33
loopy1492 commentedMy latest commit removes the composer requirement for drupal/ckeditor and adds drupal:ckeditor5 as a dependency on the wysiwyg module.
Do note that if you are using blt drupal:sync:default:db during your remote ci run, you will actually need to keep drupal/ckeditor required in the codebase until the next release. I recommend just doing one release with the dependency, then a quck bugfix release with the dependency removed after that is deployed. Ref: https://github.com/acquia/blt/issues/4687
Comment #34
loopy1492 commentedI have switched this from RBTC to in progress.
We have noticed that, if you have multiple video embeds in a WYSIWYG, it does not render the videos; it just displays the CK5 markdown instead.
One video:
Two videos:
I was hoping this issue would solve the problem, but I applied the patch and it does not: https://www.drupal.org/project/video_embed_field/issues/3371353
NOTE
This happens on a field-by-field basis. If you have two WYSIWYG fields on the same content item, and each field only has one embedded video, they render just fine. But when you try to embed more than one video per field, they stop rendering.
Comment #35
nicolash commentedJust a note that the other issue mentioned above (https://www.drupal.org/project/video_embed_field/issues/3371353) actually does fix the rendering of multiple videos in one field, at least for me. I did not apply the patch, I just manually replaced that one line after applying the work in this issue.
Comment #36
tgoeg commentedFor those that prefer a patch for the time being: 3311063-35.patch
Applies against current stable version 2.0.
Might enable easier test feedback.
Works for me.
Comment #37
mrdalesmith commentedApplied patch and it allows me to move to CK Editor five and embed videos into the WYSIWYG.
Comment #38
danielzigo commentedPatch #36 also worked for me. Drupal 9.5.11, CKEditor 5, PHP 8.1, Video Embed Field 8.x-2.5.
Test video embed also worked.
Comment #39
tgoeg commentedRegarding #3311063-34: Add support for Ckeditor 5 (get Video Embed Wysiwyg back): I created a patch over at #3371353-5: VideoEmbedWysiwyg::getValidMatches() does not detect two videos next to each other.
@loopy1492: Can you please try to apply both patches and report whether that fixes it for you? It's not really related to this issue at hand, but I'd like to get rid of this negative feedback here so we can push this (and the other ticket) to RTBC.
Comment #40
podarok#38 confirmed patch from #36 does work
Let's push it to release
Comment #41
podarok+1 RTBC
Tested in Drupal 10.0, YMCA Website Services Distribution https://github.com/YCloudYUSA/yusaopeny/pull/127
Let's merge and release
Comment #43
jeroen_vreuls commentedI get the following error when switching from CKEditor 4 to 5:
This is because
video_embed_wysiwyg.schema.ymlhas incorrect indenting for the CKEditor 5 plugin part. I fixed this in the MR.Comment #44
t_d_d commentedI can confirm that 8.x-2.5 patched (by composer) with patch made from #42 allowed me to switch to CKEditor 5 smoothly without any problems (Drupal 9.5.11).
Patch for #42 attached if anyone needs it before this got release.
Comment #45
dave kopecekI can also confirm that 3311063-42.patch worked.
Comment #46
gwvoigtI'm using patch 42, but something is off:
In /admin/config/content/formats/manage/full_html I have the Autoplay - Autoplay the videos for users without the "never autoplay videos" permission. Roles with this permission will bypass this setting. set to Off.
When I edit a ndoe and add a video it has Autoplay marked as On, ant it should be off:
Comment #47
danielzigo commentedI can confirm @gwvoigt's observation in comment #46. I tested patch 42 on a vanilla Drupal 9.5.11 site (PHP 8.1). I observed the same, the difference in the text format config versus when you edit a node and attempt to add a video.
Comment #48
shobhit_juyal commentedI believe the issue raised by @gwvoigt is not actually related with the CKEDITOR5 compatibility, rather it should be open in a separate issue queue for the logical issue.
Please share the issue link if it has opened already.
Thanks
Comment #49
nick hope commented#44 (i.e. the patch made from #42) works for me in 8.x-2.5 in D10.2.1.
Re #46 & #47, in the setting Autoplay the videos for users without the "never autoplay videos" permission. Roles with this permission will bypass this setting, I think users refers to users viewing the page, and not to users creating or editing the page. As I understand it, it is not a setting that does something like Allow permitted users to enable Autoplay on videos they embed. So I don't see a problem.
Comment #51
dylan donkersgoed commentedLooking at the code it does appear to be intended that the autoplay setting from the WYSIWYG settings should be applied in the modal. It's trying to load default settings from there but they always turn out blank because it has the wrong plugin key ("video_embed", probably corresponding to the CKE4 plugin, instead of "video_embed_wysiwyg_video_embed"):
I've updated VideoEmbedDialog.php to check for both in the MR and attached the corresponding patch.
Comment #52
nick hope commentedComment #53
parkh commented@dylan-donkersgoed Re #51, please update "$this->render" to "$this->renderer" in modules/video_embed_wysiwyg/src/Form/VideoEmbedDialog.php.
This is error what I got:
Deprecated function: Creation of dynamic property Drupal\video_embed_wysiwyg\Form\VideoEmbedDialog::$render is deprecated in Drupal\video_embed_wysiwyg\Form\VideoEmbedDialog->__construct() (line 51 of /var/www/html/docroot/modules/contrib/video_embed_field/modules/video_embed_wysiwyg/src/Form/VideoEmbedDialog.php)
Comment #54
mxr576❯ interdiff 6.diff 3311063-50.patch
❯ echo $?
0
Patch 6 is indeed equivalent with the current state of the MR, hiding the patch as (IMO) it creates additional noise in the issue.
Comment #55
mxr576Fixed in MR#6 by using the WebIDE, however my eyes and CTRL+F did not find any usage of
$this->renderer... maybe that is a dad code?Comment #56
dylan donkersgoed commentedI've noticed an issue related to the one described in https://www.drupal.org/project/video_embed_field/issues/3311063#comment-... where videos will render raw JSON. This is also related to the regex, but in this case seems to happen when there is an earlier { character before the preview_thumbnail property. In my case this was due to
data-entity-embed-display-settings="{in a<drupal-entity>tag but it probably could happen in other situations as well. Could be the cause of the issues a couple other users reported.To fix this I pushed up a small change to the regex to make the opening
tag required. From what I can tell in the code for both the CKE4 and CKE5 plugins videos should always be wrapped in a paragraph so I believe this should be safe, but it would be nice to have some additional review/confirmation.
Updated patch is attached.
Comment #57
caspervoogt commentedI tested 3311063-56.patch on 10.2.4 - working for me.
Comment #58
paintingguy commentedI need this! Please add this to the next version. Thank you!
Comment #59
kiwad commentedAlso tested patch #56 and works well with ckeditor5
Comment #60
mxr576Why a new patch was uploaded instead of contributing changes to the already open MR#6? It is one click requesting access and adding changes to it...
Comment #61
fotispanpatch #56 works fine with ckeditor5 (D10.2.6)
Comment #63
mxr576Well, I would have rather incorporated new changes to MR that makes code reviews and rebasing much easier then a patch... but maybe that is only my opinion.
Comment #64
krug commentedDrupal: 10.2.6
PHP: 8.2.2
MariaDB: 10.5.18
Web Server: nginx
ckeditor5: 10.2.6
video_embed_wysiwyg: 8.x-2.5
@dylan-donkersgoed thank you very much.
Patch #56 works fine.
Comment #65
zepner commentedThis patch worked to relieve the ajax error when switching the dropdown selection to ckeditor5.
But upon saving, there is a set of save-blocking errors, ie, 'image_style_large' is not a supported key.
(Related: https://www.drupal.org/project/inline_responsive_images/issues/3460644)
Comment #66
rajeshreeputraCan we get this merged as #3465381: Drupal 11 compatibility for Video Embed Field is blocked by this. For Drupla 11 support this is critical.
Comment #67
rajeshreeputraTests also needs to be updated as per CKEditor5, will leave it up to maintainers.
Comment #68
rajeshreeputrawill work on test failure with CKE5.
Comment #70
rajeshreeputraCan we get this merged, as it's blocker for #3465381: Drupal 11 compatibility for Video Embed Field.
Comment #71
rajeshreeputraComment #72
paintingguy commentedHi everyone. Can you please tell me if this is going to be available for D10 / 11 ?
Comment #73
mably commentedHi, could this be rebased on the 3.0.x Drupal 11 compatible branch which is currently missing the
video_embed_wysiwygmodule? Thanks.Comment #74
caspervoogt commentedPatch #56 still applies cleanly to 2.x, but doesn't apply to 3.x.
Comment #75
mably commentedComment #76
alfthecat commentedHi everyone, both the patch from #56 and the latest merge diff fail against 2.xdev on Drupal 10.3.9
Patch from #56:
Latest merge request plain diff:
Comment #77
paintingguy commentedHi all! Please, please, hoping someone can get this working for D10 . / CKEditor 5
Comment #78
prudloff commentedComment #79
mably commentedCode will have to be updated to fix the following security issue before merging: #3503383: Potential XSS vulnerability in colorbox and lazy load formatters.
Comment #81
gaëlgComment #86
gaëlg#3503383: Potential XSS vulnerability in colorbox and lazy load formatters and #3517880: Broken thumbnail access when the default download method is set to "Private local files served by Drupal." have to be handled before this can land.
Comment #87
gaëlgActually #3503383: Potential XSS vulnerability in colorbox and lazy load formatters is unrelated to this issue.
And #3517880: Broken thumbnail access when the default download method is set to "Private local files served by Drupal." is only necessary for this issue to work when default download method is set to private, but it's a separate bug which can be handled separately.
The only thing is making sure the latest one to be merged still works when the previous one has been merged, but it's the case for any issue.
Comment #88
gaëlgComment #89
gaëlgComment #90
jschref commentedConvert MR to a patch .
Comment #92
gaëlgComment #93
mably commentedRebased MR to apply it to the new
3.xdefault branch.Comment #94
mably commentedLocally tested successfully.
Could we have another RTBC before I merge it? Thanks.
Comment #95
christianadamski commentedWorks fine here..
Comment #97
mably commentedIt's merged. Thanks, everyone, for your contribution!
Comment #98
mably commentedNew version released: 3.0.0-beta2.
Comment #99
gaëlgThanks @mably!
Comment #104
alexanderpatricio commentedRebased MR6 for 8.x-2.x version
Comment #105
joelpittetThis is a closed fixed issue, it might be worth opening a new targetted issue for 2.x @alexanderpatricio if you need a backport as sometimes closed fixed get ignored by maintainers.