标签

2016年12月4日星期日

Drupal 8 CKeditor Extend's plugins install: colorbutton

ColorButton Module in Drupal is used for add two button in CKeditor editing interface, it can contral the content font show in color and both the font back ground color.

Open Source is like nightmare, we thought we can get open mind, but it actually like another human nightmare: democracy. a lot of open source modules in Drupal lake good documents, what you can do is Guess.

If you following the usually way to install a Module in Drupal 8 for Ckeditor's plugin, it doesn't work.
CKeditor in Drupal 8 is default become a core module, now the interface in Drupal 8 called extend, the CKeditor has itself plugins, so you know they use the similar word to express the similar logic, how you can keep understand what they said? :)

The logical is like this

Drupal 8  -->  extend(module) --> Ckeditor --> plugin --> colorbutton

this is just a beginning.

If you install Drupal 8 module: Colorbutton(link), it will ask you install another depend module: Panel Button (link), that's usually Drupal style, after you install both modules and config them in CKeditor, to drag the control button to the running environment, you will get a wrong editor interface when you try edit a article or another thing. it's because the configuration is not finish.

The Drupal Colorbutton module page tell you should install a plugin in this address:
 http://ckeditor.com/addon/colorbutton
that's the same name, but that's CKeditor's plugin, if you read Ckeditor help to want to install this Ckeditor plugin, it doesn't work anymore, the filename are all different, so we continue to guess...


the CKeditor's plugin Colorbutton give the install address: siteaddress/ckeditor/plugin..., in Drupal 8, you can't find the path, the Drupal module Colorbutton said to install in /libaries/, there isn't a path in Drupal site also, but from the error message in Javascript, we have to create a folder libraries in Drupal web site root, and copy the CKeditor's plugin Colorbutton file to there:
Drupal site root/libraries/colorbutton

and this plugin prompt should install another plugin Floating Panel (link), so another ckeditor plugin
Drupal site root/libraries/floatpanel

the Drupal depend module Panel Button is also need a same CKeditor plugin:
Drupal site root/libraries/panelbutton

It doesn't finish, the error still there, because we don't know how to config the 5 plugins each other,  from the Javascript error message, find the file(also from a article) , find the file:
\core\assets\vendor\ckeditor\ckeditor.js, find the item extraplugins:"", modify it like this:
extraPlugins:"colorbutton",extraPlugins:"floatpanel",extraPlugins : "panelbutton",
It works!

conclusion:
to install a Drupal module, you should:

  • install two Drupal Modules following:
    ColorButton, Panel Button in this path
    Drupal root/modules/
  • install three CKeditor plugins following:
    ColorButton, PanelButton, FloatingPanel in this path
    Drupal root/libraries/
  • config enable two Drupal modules, Config Ckeditor interface to use the two buttons
    Drupal admin/manage/extend
    Drupal admin/manage/Configuration/ckeditor ...(according you plan, like Full HTML)
  • config ckeditor plugins here:
    \core\assets\vendor\ckeditor\ckeditor.js
others? maybe something is not needed, who know that?
The logical maybe like this:
The logical is like this

Drupal 8  -->  extend(module) --> Ckeditor --> plugin --> colorbutton
                                                           |
D8-extend->Colorbutton<--PanelButton (D8 module)
                             |                       |
            ColorButton Plugin   PanelButton Plugin (CKeditor Plugin)
                             |
                   FloatingPanel Plugin

没有评论:

发表评论