v1.2: Überarbeitung WYSIWYG-Admin

Support für Module
Antworten
Benutzeravatar
shadowcat
Administrator
Beiträge: 5283
Registriert: Di 5. Feb 2013, 10:36
Kontaktdaten:

v1.2: Überarbeitung WYSIWYG-Admin

Beitrag von shadowcat »

English version below

Unser WYSIWYG-Admin erlaubt es, zusätzliche Einstellungen für den gewählten WYSIWYG-Editor vorzunehmen. Dazu gehören z.B. auch optionale Plugins.

Mittlerweile erfordern solche Editor-Plugins aber manchmal mehr, als nur aktiviert zu werden. Für einige Plugins waren schon bisher zusätzliche Einstellmöglichkeiten hinterlegt, etwa für CodeMirror (Auswahl des Themes).

Um diese Einstellungen künftig nicht mehr hartcodiert in der Datei c_editor.php (im Modulverzeichnis des Editors, also z.B. in ./modules/ckeditor4) vorhalten zu müssen und somit leichter erweiterbar zu machen, ist eine Überarbeitung der Editor-Addons notwendig. Gleichzeitig überarbeite ich auch den WYSIWYG-Admin.

Da ein Bild ja bekanntlich mehr sagt als 1000 Worte, hier mal ein Screenshot:
2015-07-15 14_40_25-BlackCat CMS » Administration - ADMINTOOLS.png
2015-07-15 14_40_25-BlackCat CMS » Administration - ADMINTOOLS.png (51.15 KiB) 3260 mal betrachtet
  • Der bisherige Text neben den Einstellmöglichkeiten wandert in einen Tooltip, im Bild gelb zu sehen.
  • Die Einstellungen, die zu aktivierten Plugins gehören, werden mit Hilfe einer Überschrift gruppiert.
  • Optionen, die zu bestimmten Plugins gehören, erscheinen sofort, wenn das Plugin angehakt wird, und verschwinden, wenn es wieder deaktiviert wird; bisher mußte hierfür die Seite neu geladen werden.
Änderungen im WYSIWYG-Addon

Die Einstellungen, die ein Plugin erlaubt, können in einer Datei info.php hinterlegt werden. Diese Datei liegt im Unterverzeichnis des Plugins. Hier ein Beispiel für codemirror:

Code: Alles auswählen

// additional requirements for this plugin
$plugin_config = array(
    'opt' => array(
        array( 'name' => 'codemirror', 'label' => 'CodeMirror Plugin', 'type' => 'legend' ),
        array(
            'name'     => 'codemirror_theme',
            'label'    => 'Codemirror Theme',
            'help'     => 'Select a theme from the dropdown. You can preview the themes at <a href="http://codemirror.net/demo/theme.html" target="_blank">http://codemirror.net/demo/theme.html</a>',
            'type'     => 'select',
            'default'  => 'default',
            'options'  => array('default', '3024-day', '3024-night', 'ambiance-mobile', 'ambiance', 'base16-dark', 'base16-light', 'blackboard', 'cobalt', 'eclipse', 'elegant', 'erlang-dark', 'lesser-dark', 'mbo', 'mdn-like', 'midnight', 'monokai', 'neat', 'neo', 'night', 'paraiso-dark', 'paraiso-light', 'pastel-on-dark', 'rubyblue', 'solarized', 'the-matrix', 'tomorrow-night-eighties', 'twilight', 'vibrant-ink', 'xq-dark', 'xq-light',)
        )
    ),
);
Zudem können für jedes Plugin auch Übersetzungen hinterlegt werden; diese liegen im Unterverzeichnis languages des jeweiligen Plugins. Das ist analog zum languages-Verzeichnis des Addons selbst, nur daß die Dateien halt im Plugin-Unterverzeichnis liegen. Beispiel:

Code: Alles auswählen

<CAT_PATH>/modules/ckeditor4/ckeditor/plugins
    |_ codemirror
        info.php
        |_ languages
            |_ DE.php
Prinzipiell kann das natürlich jeder, der einen WYSIWYG-Editor paketiert, halten, wie er möchte. Für den CKE4 - ab Version 4.5.1, derzeit als Beta-Modul verfügbar - habe ich es jedenfalls so umgesetzt.
My software never has bugs, it just develops random features.
If it’s not broken, keep fixing it until it is
Benutzeravatar
shadowcat
Administrator
Beiträge: 5283
Registriert: Di 5. Feb 2013, 10:36
Kontaktdaten:

Re: v1.2: Überarbeitung WYSIWYG-Admin

Beitrag von shadowcat »

Our WYSIWYG-Admin allows to set additional options for the WYSIWYG-Editor in use. This includes settings for optional editor plugins.

Some plugins require more than simple activation. For some of them, additional options are already defined, for example for codemirror. (Theme selection.)

To make this additional options easier to maintain, I am extracting them from the file c_editor.php (located in the editor's module folder, for example ./modules/ckeditor4). At the same time, I am doing some reworking of the WYSIWYG-Admin.

Here's a screenshot:
2015-07-15 14_40_25-BlackCat CMS » Administration - ADMINTOOLS.png
2015-07-15 14_40_25-BlackCat CMS » Administration - ADMINTOOLS.png (51.15 KiB) 3259 mal betrachtet
  • The text that was located on the right next to the option is now available via a tooltip, yellow in the screenshot.
  • Options that belong to an activated plugin are grouped by a heading now.
  • Options that belong to an appropriate plugin are shown immediately after the plugin was activated and get hidden when the plugin is deactivated again; this required a page reload until now.
Changes in the Editor-Addon

Options that belong to a plugin can be placed in a file info.php located in the plugins folder. Example content:

Code: Alles auswählen

// additional requirements for this plugin
$plugin_config = array(
    'opt' => array(
        array( 'name' => 'codemirror', 'label' => 'CodeMirror Plugin', 'type' => 'legend' ),
        array(
            'name'     => 'codemirror_theme',
            'label'    => 'Codemirror Theme',
            'help'     => 'Select a theme from the dropdown. You can preview the themes at <a href="http://codemirror.net/demo/theme.html" target="_blank">http://codemirror.net/demo/theme.html</a>',
            'type'     => 'select',
            'default'  => 'default',
            'options'  => array('default', '3024-day', '3024-night', 'ambiance-mobile', 'ambiance', 'base16-dark', 'base16-light', 'blackboard', 'cobalt', 'eclipse', 'elegant', 'erlang-dark', 'lesser-dark', 'mbo', 'mdn-like', 'midnight', 'monokai', 'neat', 'neo', 'night', 'paraiso-dark', 'paraiso-light', 'pastel-on-dark', 'rubyblue', 'solarized', 'the-matrix', 'tomorrow-night-eighties', 'twilight', 'vibrant-ink', 'xq-dark', 'xq-light',)
        )
    ),
);
In addition, each plugin can have a language file, located in the 'languages' subfolder of that plugin. Example:

Code: Alles auswählen

<CAT_PATH>/modules/ckeditor4/ckeditor/plugins
    |_ codemirror
        info.php
        |_ languages
            |_ DE.php
In fact, everyone packaging a WYSIWYG editor can do this his own way, but this is how I did it for CKE4.
My software never has bugs, it just develops random features.
If it’s not broken, keep fixing it until it is
Benutzeravatar
shadowcat
Administrator
Beiträge: 5283
Registriert: Di 5. Feb 2013, 10:36
Kontaktdaten:

Re: v1.2: Überarbeitung WYSIWYG-Admin

Beitrag von shadowcat »

Achja, und ein neues Icon habe ich dem WYSIWYG-Admin auch spendiert. :lol:
2015-07-15 15_05_21-BlackCat CMS » Administration - ADMINTOOLS.png
2015-07-15 15_05_21-BlackCat CMS » Administration - ADMINTOOLS.png (7.51 KiB) 3258 mal betrachtet
My software never has bugs, it just develops random features.
If it’s not broken, keep fixing it until it is
Antworten