ProcessWire - Editor: Unterschied zwischen den Versionen

Aus Wikizone
Wechseln zu: Navigation, Suche
Zeile 34: Zeile 34:
  
 
==== Eigene Styles ====
 
==== Eigene Styles ====
You can also add your personal styles in
+
Eigene Stile zur Auswahl im Styles Dropdown
 
  site->modules->InputfieldCKEditor->mystyle.js
 
  site->modules->InputfieldCKEditor->mystyle.js
 
 
Example:
 
Example:
 
<pre>
 
<pre>
CKEDITOR.stylesSet.add( 'mystyles', [
+
/**
{ name: 'Credit Card Icon', element: 'i', attributes: {'class': 'uk-icon-credit-card-alt'} },
+
  * mystyles.js
{ name: 'Panel Title', element: 'h4', attributes: {'class': 'uk-panel-title'} },
+
  *
]);
+
  * This file may be used when you have "Styles" as one of the items in your toolbar.
</pre>
+
  * add mystyles:/site/modules/InputfieldCKEditor/mystyles.js in
 +
  * Field Settings > CKEditor Settings > Custom Editor JS Styles Set
 +
  *
 +
  * For a more comprehensive example, see the file ./ckeditor-[version]/styles.js
 +
  *
 +
  */
 +
  CKEDITOR.stylesSet.add( 'mystyles', [
 +
  { name: 'Home Icon', element: 'i', attributes: {'class': 'fa fa-home fa-2x'} },
 +
  { name: 'Panel Title', element: 'h4', attributes: {'class': 'panel-title'} },
 +
  ]);</pre>
 
You could now select on-demand which <i> and <h4> you want to apply those styles.
 
You could now select on-demand which <i> and <h4> you want to apply those styles.
  

Version vom 29. April 2017, 11:37 Uhr

Links

https://processwire.com/talk/topic/3023-module-ckeditor/

CKEditor

Ist der Standard Editor in PW

Konfiguration CKEditor

CKEditor für einzelne Felder konfigurieren

Siehe z.B. Alb-Massage.de

Wenn man ein Textarea Feld definiert, kann man auch für dieses Feld den CKEditor anpassen. Das geht unter dem Reiter Eingabe.

Beispiel: Hier werden Buttons für die Textausrichtung hinzugefügt.

Format, Styles, -, Bold, Italic,Superscript, -,JustifyLeft,JustifyCenter,JustifyRight,-, RemoveFormat
NumberedList, BulletedList, -, Blockquote
PWLink, Unlink, Anchor

PWImage, Table, HorizontalRule, SpecialChar
PasteText, PasteFromWord,-,Undo,Redo
Scayt, -, Sourcedialog

Default Einstellungen

Kann man im Modulverzeichnis hinterlegen. Vorsicht bei Updates des Moduls. Zumindest früher wurde die Datei dann überschrieben.

/site/modules/InputfieldCKEditor/config.js -> überschreibt oder ergänzt die Default Einstellung
/site/modules/InputfieldCKEditor/config.body.js -> überschreibt oder ergänzt das body Feld

Beispiele:

config.startupOutlineBlocks = true;

CKEDITOR.editorConfig = function( config ) {
	config.justifyClasses = [ 'left', 'center', 'right', 'justify' ];
};

Eigene Styles

Eigene Stile zur Auswahl im Styles Dropdown

site->modules->InputfieldCKEditor->mystyle.js

Example:

/**
  * mystyles.js
  *
  * This file may be used when you have "Styles" as one of the items in your toolbar.
  * add mystyles:/site/modules/InputfieldCKEditor/mystyles.js in
  * Field Settings > CKEditor Settings > Custom Editor JS Styles Set
  *
  * For a more comprehensive example, see the file ./ckeditor-[version]/styles.js
  *
  */
  CKEDITOR.stylesSet.add( 'mystyles', [
   { name: 'Home Icon', element: 'i', attributes: {'class': 'fa fa-home fa-2x'} },
   { name: 'Panel Title', element: 'h4', attributes: {'class': 'panel-title'} },
  ]);

You could now select on-demand which and

you want to apply those styles. http://docs.ckeditor.com/#!/api/CKEDITOR.stylesSet

Plugins hinzufügen

CKEditor allgemeines Wissen

Ein paar Infos zu CKEditor ohne PW. Viele Dinge sind ähnlich

Plugins

Werden normalerweise mit einem Builder implementiert. Das geht bei PW nicht. Aber es gelten zum Teil die Regeln für Manuelle Installation. Manche Schritte z.B. aktivieren der Plugins macht man in PW aber wahlweise über die Feldkonfiguration.

Beispiel Widget Plugin:

If you want to add the plugin manually, you will need to:

  • Extract the downloaded plugin .zip into the plugins folder of your CKEditor installation. Example:
http://example.com/ckeditor/plugins/widget
  • Enable the plugin by using the extraPlugins configuration setting. Example:
config.extraPlugins = 'widget'; 
  • Download and configure all its dependencies, too.

In PW