Add editor: BUEditor
| Project: | Wysiwyg |
| Version: | 6.x-2.x-dev |
| Component: | Editor - BUeditor |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | needs work |
I've built a very rough but functional BUEditor integration module. So far I've tested it with 3 input formats and 3 different editors. I'd like to contribute this after some cleanup, but I'm not sure how it fits into wysiwyg or BUEditor.
I've built it as an additional module rather than a wysiwyg contrib because it required a hook_form_alter function to achieve the settings I was after. Also, the BUEditor is packaged as a standalone Drupal module, and it didn't make sense to drop it right into the wysiwyg folder. And, BUEditor provides a complex UI for creating and importing multiple button sets that I didn't want to duplicate.
BUEditor can provide multiple button set presets. The hook adds an additional fieldset with a select control to choose the BUEditor preset to use for the selected input format. For example, if you click "edit" on the BBCode input format wysiwyg profile, you can select from the editor presets created on BUEditor's admin pages and choose the "BBCode" editor.
The hook_form_alter is too specific to dump into wysiwyg's codebase, but at this point I think it's necessary. I couldn't find any other way to add a simple "select" control to the settings page. The settings and plugins interface for wysiwyg is (so far) not very well documented and seems quite convoluted. Please tell me there's a way to add more than checkboxes in a way that somehow resembles the Form API!
Should I:
Stay with the standalone "bridge" module route?
Try to merge with the BUEditor project?
Find a solution to the settings problem and eliminate the hook_form_alter and produce a patch for wysiwyg?
Thanks!

#1
First of all, thanks for trying.
- Any code for BUeditor support should go into Wysiwyg API at this point in time, because major parts of the API can still change without notice.
- Based on what you described here, I think you would need #313497: Allow to configure advanced editor settings to do it properly, but that issue still needs a lot of work. Currently, we can only do a half-baked implementation like the (very similar) one for markItUp.
- This BUeditor integration must work without BUeditor module. Editor libraries have to be considered as plain JavaScript libraries.
#2
Thanks. I feel like I've not only tried, but I have a functional solution that could be useful to others. I'm using my work at http://www.montanakitesports.com, combined with better_formats and tinymce for admin users. It works with multiple instances per page, and multiple BUEditor presets. I've also been able to integrate g2image pretty painlessly. I wrote my own JS detach code for BUEditor, since there was none before.
My experiences mostly agree with points 1 and 2. Point 3 is difficult, because BUEditor appears to be designed primarily as a Drupal module. I've written the author of BUEditor, asking for his thoughts. But... I'm not personally prepared to invest the time coding, coordinating, and negotiating to make a standalone BUEditor without the module. And from what I've read, I'm not sure the author is either... Someone please prove me wrong.
So it looks like at this point there may be an impasse between these two modules. Hopefully what I've built will be helpful to someone until this passes. I'll most likely clean this up and release it as a standalone module rather than debate with two maintainers about where it belongs.
As for editor settings... After looking under the hood of wysiwyg's settings and plugins form for a few hours and still having only a basic understanding of what's going on, I wonder why a hook_form_alter or hook_settings style hook using Form API has not been implemented? Can you provide some insight into the current implementation, and maybe I can invest some time in helping with a solution?
#3
Ok, I've read the entire "advanced editor settings" thread, and see that this is a work in progress. That still doesn't solve the BUEditor as a module question. I've joined the Wywiwyg group on GDO and will watch this issue. Please let me know if there's anything I can do moving forward.
#4
I'm attaching my current work if you're curious... To use it, download and enable the stable release of BUEditor 6.x-1.2. At this point, it must be the packaged version for version detection to work properly. Set all of it's role presets to "none" to avoid conflicts. Then you can configure BUEditor inside of the Wysiwyg admin UI. Click the "edit" link to select which BUEditor preset is used. I'm not currently checking for deleted profiles, input formats, etc, so use it with caution.
#5
Releasing your code as a separate module will be a pain for users, because that module will end up in compatibility nightmares. So far, Wysiwyg API works, but during the past months, we identified a lot of major issues that still need to be changed. Those mostly apply to editors, which is why I'm discouraging anyone from putting editor support code into a 3rd party module.
Well, when you posted this issue, I googled for "bueditor" and quickly found http://ufku.com/drupal/bueditor/non-drupal - which looks very similar to markItUp
The best way to get the ball rolling is to attach your code to this issue.
#6
#7
Yes, #5 is how I invoke the editor, but I'm relying on the admin interface from the module rather than trying to re-create it inside of wysiwyg.
#8
I'll have a look at this asap.
#9
This would be great - there are a few things about BUEditor that make it worth using IMO (like not adding unnecessary
and
tags, integration with Linodef etc). Would be happy to test this whenever that'd be helpful :)
#10
The advantage of the BUEditor module for Drupal is the possibility to add custom buttons through an admin settings page. Like you would add/write a WYSIWYG plugin at an admin settings page.
To provide this functionality a separate module like posted in #4 is required (this feature separates the BUEditor Drupal module from most of the other editor modules). WYSIWYG API doesn't provide the required functionality yet.
In process of writing a WYSIWYG plugin for my filter module I'm also in need to add buttons with the help of an admin settings page. Though these buttons are specialized for my needs the functions *could* be useful as button creation tools also in WYSIWYG API core. When i open the respective WIP issue I'll update this post with a link.
#11
@Roi Danton: Hmm. We recently opened the 3.x branch for Wysiwyg, in which we will solve #313497: Allow to configure advanced editor settings and related issues. That means that each editor will get its own, custom configuration settings (full-blown cockpit) in the long run. I'm not sure - if BUeditor would be supported by Wysiwyg module and this implementation would include support for Wysiwyg's "Drupal plugins" - whether a) one would still need the ability to configure custom buttons at all and b) if a) would be required, whether the editor configuration form could not provide the possibility.
#12
If in case (b) the editor configuration form provides the possibility to execute php functions with a button this would be sufficient (this is what I appreciate on BUEditors Drupal module). To create buttons for my filter module (lists of nodes, fields etc) I'm using the views module and own queries where the site admin sets arguments for each button (certain node types, views etc). These functions are called by clicking on a button and they return Javascript with the required data. The short function in linodef_buttons_bueditor.module makes it clear.
#13
BUEditor FTW... Subscribing.
#14
I did it with one popup window (WYSIWYG plugin) which incorporates buttons which admins can create on a Linodef settings page. However this hasn't much to do with BUEditor itself so I used the WYSIWYG drupal group for further discussions about WYSIWYG plugins.
#15
subscribing
#16
Subscribing, and to throw another curve at this request my ideal use for BUEditor would be for the same input format that works for another WYSIWYG-- that is, I would be able to switch from using TinyMCE to edit a post to using BUEditor, and the input format should not change. Any hope?