How can i do it ?

Comments

jlyon’s picture

That has been outside of my original scope for a couple reasons:
1) The templates require CKEditor's widgets api, so it won't work with any of the other editors that WYSIWYG supports
2) CKEditor support is in D8 core.

That said, I don't think support would be too difficult, and you could probably hack it together with a simple JS file if you're dying for support and need to stick with WYSIWYG (to support multiple editors, for example). I'll try to play around with it a little this afternoon, and post an example support module if I can make it work. I'll also accept patches if you can get it working properly with the WYSIWYG hooks.

jlyon’s picture

Assigned: Unassigned » jlyon
Status: Active » Needs review
StatusFileSize
new2.45 KB

Here's a patch that adds WYSIWYG module support. Just patch the latest -dev version of the module, and check these boxes on your WYSIWYG profile page:

  • Enable widgetcommon
  • Enable widgetbootstrap
  • Insert Template menu

Let me know if you have any issues.

jlyon’s picture

@phildu: have you had a chance to test this?

phildu’s picture

no not yet

rv0’s picture

I've tried it (in a custom module though) and it seems to work.
I'm just wondering how I can control the buttons. I just want to use the quote widget for now actually

skar’s picture

I tried to apply this patch today for WYSIWYG module version "7.x-2.2+70-dev" and CKEditor version "4.5.5.b34ea4d".
The patch failed because CKEditor $version is now a string which isn't > (int)3.
As a quick fix, i just removed "if ($version > 3) {" and it's matching "}" in your patch and i can now display & enable the 3 options in WYSIWYG profile edit page.

Back on my node edit, CKEditor was not loading because the CKEditor plugins "widget" & "lineutils" were missing. I added them in "site/all/libraries/ckeditor/plugins/" folder.

And it's now working smoothly.

Thanks

rv0’s picture

@skar indeed, you need to add those plugins. You can also do that in a custom module using hook_wysiwyg_plugin in similar way as this patch does.

To answer my own question in #5, you can control the buttons with widgettemplatemenuButtons option.
E.g. i only needed 2 col and 3 col templates, so in hook_wysiwyg_editor_settings_alter I added:
$settings['widgettemplatemenuButtons'] = 'widgetbootstrapTwoCol,widgetbootstrapThreeCol';