Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
We would like to use BUEditor with this. We've created a submodule that integrates with a patch we made for bueditor.
See https://www.drupal.org/project/bueditor/issues/3065729.
I'll attach this submodule as a patch here.
Comment | File | Size | Author |
---|---|---|---|
#9 | insert_view_adv--bueditor-support--3065733--9--D8.patch | 6.42 KB | damontgomery |
Comments
Comment #2
damontgomery CreditAttribution: damontgomery at Palantir.net for Tableau commentedHere is the submodule.
Comment #3
damontgomery CreditAttribution: damontgomery at Palantir.net for Tableau commentedComment #4
kbentham CreditAttribution: kbentham at Palantir.net for Tableau commentedThanks for creating this patch Dan!
Comment #5
a.dmitriiev CreditAttribution: a.dmitriiev as a volunteer and at 1xINTERNET commentedThanks, very useful submodule.
I will review it tomorrow.
Comment #6
a.dmitriiev CreditAttribution: a.dmitriiev as a volunteer commentedWhat are the chances that the patch from the issue in description will go in?
Comment #7
damontgomery CreditAttribution: damontgomery at Palantir.net for Tableau commentedThanks, a.dmitriiev.
I think it makes sense to move all the code into this submodule. I've described some of the reasoning in https://www.drupal.org/project/bueditor/issues/3065729#comment-13176005.
I should have some time later this week to try this.
Thanks again.
Comment #8
damontgomery CreditAttribution: damontgomery at Palantir.net for Tableau commentedI've attached a patch which moves all of this functionality into this sub module. This should make maintenance hopefully easier. As discussed, the token pattern is a little specific to this module, so I think the sub module makes sense.
I've used the general structure of the BUEditor functions, particularly those with the HTML Tag support, but removed a lot of the extra parts that were unused. I've also renamed some of the functions and tried to adhere to Drupal JS coding standards.
The structure of the JS is as follows:
A `tokenDialog` is created using the `createTokenDialog` function. This is then opened.
The `tokenDialog` contains a token form which is created with `createTokenForm`. The fields defined in `createTokenDialog` are processed into the form fields with `processTokenField`.
A submit function is created, `submitTokenForm` which converts the form to a string which is inserted into the editor. This uses `getTokenObjectFromTokenForm` and `getTokenStringFromTokenObject`.
We could probably combine a few of these steps, but this maintains most of the pattern from BUEditor.
Comment #9
damontgomery CreditAttribution: damontgomery at Palantir.net for Tableau commentedHere is a new patch with clearer variable names and some of the weird for loop logic stated more explicitly.
Comment #11
a.dmitriiev CreditAttribution: a.dmitriiev as a volunteer and at 1xINTERNET commentedThe patch was applied to latest dev branch. I would also like to know if it is possible to have the list of views in the dialog selectable? Because the filter supports restriction of the views that are allowed, would be nice to make the dialog more user friendly. Also, could you please find the icon for the button in the toolbar? Maybe use the same that is in the main module?
I also moved the module to modules/bueditor folder, to have the structure more clean.
Thank you very much for your contribution, I hope the changes described above would be also implemented.
Comment #12
a.dmitriiev CreditAttribution: a.dmitriiev as a volunteer commentedComment #13
damontgomery CreditAttribution: damontgomery at Palantir.net for Tableau commentedThanks, a.dmitriiev!
We're working on BUEditor for a bit and I'll keep those suggestions in mind. They are very helpful. We are currently trying to figure out how to implement autocomplete for nodes and blocks in BUEditor and I may be able to use something similar to provide dropdowns for the views.
Comment #14
a.dmitriiev CreditAttribution: a.dmitriiev as a volunteer and at 1xINTERNET commenteddamontgomery, maybe before this is implemented, you can do a simple dropdown that will be populated with the values from drupalSettings object (the object itself will be populated from the module from filter settings)? I am willing to help to provide the data in drupalSettings, so you can take care of bueditor part. How does this sound to you?
Comment #15
damontgomery CreditAttribution: damontgomery at Palantir.net for Tableau commentedThanks. I'm working on this for the rest of the week and can provide an update on what I find. If you want to try a drupalSettings approach, that might work for this. That won't work for the autocomplete solution which might need a custom route. A custom route might be a good approach for this as well, essentially provide a public route that the JS can access that is safe enough and provides a list of views, etc to construct a dropdown.
Comment #16
damontgomery CreditAttribution: damontgomery at Palantir.net for Tableau commentedTLDR: I have made progress on related work and may be able to revisit this next week.
I have been able to create a BUEditor plugin that uses Drupal fields.
The approach is to use a custom route / controller to generate a JSON response of the field markup. This JSON is pulled in with the BUEditor plugin JS and the fields are then prepended to the form element before it is added to the popup.
By including the libraries needed in the BUEditor plugin, I can use features like autocomplete.
In this situation, I can generate a select box with the various views and view modes and then use those results to generate the string. The submit handler has access to the form, so by adding classes, it's easy enough to process the form using JS / jQuery.
Comment #18
damontgomery CreditAttribution: damontgomery commentedI apologize for the long delay without any updates. I don't think I'll be able to update the approach in this module.
Comment #19
a.dmitriiev CreditAttribution: a.dmitriiev as a volunteer and at 1xINTERNET commentedNo problem, I will try to use maybe drupalSettings and get the dropdowns as a start. I will create another issue.