backdrop-contrib / video_filter

A Backdrop CMS port of drupal.org/project/video_filter, a highly flexible and easily extendable filter module to embed any type of video in your site using a simple token.
GNU General Public License v2.0
2 stars 2 forks source link

Option to accept simple URLs #24

Open herbdool opened 1 week ago

herbdool commented 1 week ago

Maybe allow an option to accept just simple URLs rather than having people type in [video:https://...]. Could be a setting per filter. Ignore URLs that are already in HTML tags, such as in a link tag.

Could be useful for Ckeditor 5 users which don't have a button yet.

herbdool commented 1 week ago

@indigoxela maybe you're interested in this? Though the tinymce button works well enough I guess.

My aim was to provide a simple alternative to the button, especially for cke5 users, since it's hard to add buttons to it. 😢 But after making the PR I found out that ironically cke5 has an autolink feature which turns them into links as soon as the user hits enter or space. So they'd have to unlink them for it to work.

Oh well, still might be an improvement.

indigoxela commented 1 week ago

maybe you're interested in this?

I had a quick look yesterday. Initially I had some concerns re links and GDPR (loading external stuff, although people try to explicitly only add it as link), but it seems like you take care of that. :+1:

But CKE5 doesn't play nicely, so the workaround gets even more confusing. :grimacing: Not sure, what to recommend, as I'm not using CKE5.

herbdool commented 1 week ago

@indigoxela I've made it opt-in for site builders and it won't convert if it's within a link tag, etc.

I'd still like to figure out how to a button and dialog to CKE5. I had initially thought that this PR was an easier thing to accomplish. Even though it turned out not to be a good alternative to a button with dialog, maybe it's still worth merging.

In my testing it seems to play nice with TinyMCE.

I'm on the fence with switching some clients to TinyMCE simply because it's less work to build any new features. We've actually started adding paragraphs module to a number of sites, but with CKE5. I've partly resisted TinyMCE because it's not in core, and wanted to see what could be accomplished with CKE5, but that's not a deal breaker.

indigoxela commented 1 week ago

I'd still like to figure out how to a button and dialog to CKE5

You're not alone. It seems that finally, with CKE5 40.1 (caution, we don't have that in core, yet) there's some dialog API, but documentation for that is a ... :clown_face: https://ckeditor.com/docs/ckeditor5/latest/api/module_ui_dialog_dialog-Dialog.html

And given, they're not afraid of "minor" breaking changes, it might be a bit risky to dig into that and use it.

But there's a possible alternative: core ajax dialog. I ran into a similar problem with File Entity Embed Filter, btw., so that one might be slightly helpful. I got it tackled with lots of swearing :speak_no_evil: : https://github.com/backdrop-contrib/feef/blob/1.x-1.x/plugins/ckeditor5/feef_select/plugin.js

I'm on the fence with switching some clients to TinyMCE...

Sure, whatever works. :grinning:

herbdool commented 1 week ago

@indigoxela I think feef will be quite helpful example. Thanks!