ckeditor в drupal: тонкая настройка и кастомизация - osman seferov

23
25 -27 April, 2014 http:// camp2014.drupal.dn.ua CKEditor in Drupal: detailed setting and customization Osman Seferov skype: osmanseferov e-mail: [email protected]

Upload: drupalcampdn

Post on 08-May-2015

651 views

Category:

Internet


0 download

DESCRIPTION

Среди большого количества WYSIWYG редакторов, начинающему разработчику достаточно сложно выделить действительно мощный и удовлетворяющий всем требованиям инструмент. В своём докладе я расскажу о CKEditor и поделюсь собственным опытом использования, настройки и кастомизации под определённые нужды.

TRANSCRIPT

Page 1: CKEditor в Drupal: тонкая настройка и кастомизация - Osman Seferov

25 -27 April, 2014

http://camp2014.drupal.dn.ua

CKEditor in Drupal: detailed setting and

customizationOsman Seferovskype: osmanseferove-mail: [email protected]

Page 2: CKEditor в Drupal: тонкая настройка и кастомизация - Osman Seferov

CKEditor - the best web text editor for everyone

● Very Flexibility● All is constructed on plug-ins and features● Fast and easy● Many add-ons● CKBuilder● Support content inline editing ● Active Open Source community

Page 3: CKEditor в Drupal: тонкая настройка и кастомизация - Osman Seferov

Wysiwyg vs CKEditor

Wysiwyg CKEditor

WYSIWYG support integration of multiple different client-side editorsAbility to assign different ones to different input formatsIt’s possible to determine your custom css onlyYou can not change the order of buttons on the page of settings

CKEditor offers more granular control over some of the editor configuration settings on the module settings pageManagement of visibility settings for each roleYou can choose a theme for editorOpportunity to choose your own styles for editor and file manager settingsAdvanced option section for change config options

Page 4: CKEditor в Drupal: тонкая настройка и кастомизация - Osman Seferov

25 -27 April, 2014

http://camp2014.drupal.dn.ua

CKEditor Customization

Page 5: CKEditor в Drupal: тонкая настройка и кастомизация - Osman Seferov

CKEditor toolbar settings

You can add new buttons or delete unnecessary ones using drug&drop

Page 6: CKEditor в Drupal: тонкая настройка и кастомизация - Osman Seferov

Definition of enter mode elements

Page 7: CKEditor в Drupal: тонкая настройка и кастомизация - Osman Seferov

Useful options

More information : http://docs.ckeditor.com/#!/api/CKEDITOR.config

Page 8: CKEditor в Drupal: тонкая настройка и кастомизация - Osman Seferov

Advanced options

CKEditor module provides convenient interface for configuration editing

Page 9: CKEditor в Drupal: тонкая настройка и кастомизация - Osman Seferov

Advanced Content Filter

ACF is a highly configurable CKEditor core feature

● Limit and adapt of input data● It may also deactivate features which generate HTML code that is not

allowed by the configuration

ACF works in two modes

automaticthe filter is configured by editor features (like plugins, buttons and commands)

customthe filter is configured by the CKEDITOR.config.allowedContent option and only features that match this setting are activated.

CKEDITOR.config.allowedContent = TRUE;

Page 10: CKEditor в Drupal: тонкая настройка и кастомизация - Osman Seferov

How to add own styles

ckeditor.styles.js file

ckeditor.styles.css file

Page 11: CKEditor в Drupal: тонкая настройка и кастомизация - Osman Seferov

Setting up the toolbar

config.stylesCombo_stylesSet =

'drupal:/sites/all/theme/theme_name/ckeditor.styles.js';

Add a style control

Remove “Format”, ”Font” and “Size controls”

Page 12: CKEditor в Drupal: тонкая настройка и кастомизация - Osman Seferov

Drop down of custom styles

You can easily add a new style options for different

CKEditor text formats

Drop down includes only styles we have approved for site

Page 13: CKEditor в Drupal: тонкая настройка и кастомизация - Osman Seferov

Definition of custom styles for editor

Page 14: CKEditor в Drupal: тонкая настройка и кастомизация - Osman Seferov

25 -27 April, 2014

http://camp2014.drupal.dn.ua

How to create CKEditor plugin

Page 15: CKEditor в Drupal: тонкая настройка и кастомизация - Osman Seferov

Structure of custom plugin files

You can add your plugin into CKEditor library or into your module that implements hook_ckeditor_plugin()

File that will contain the plugin logic

This file will contain the definition for the dialog that we are

going to use in our plugin

Page 16: CKEditor в Drupal: тонкая настройка и кастомизация - Osman Seferov

Task formulation

Page 17: CKEditor в Drupal: тонкая настройка и кастомизация - Osman Seferov

Our plugin registration

OR SET

CKEDITOR.config.allowedContent = TRUE;

Page 18: CKEditor в Drupal: тонкая настройка и кастомизация - Osman Seferov

Dialog adding

Page 19: CKEditor в Drupal: тонкая настройка и кастомизация - Osman Seferov

Our new button and dialog window

Page 20: CKEditor в Drupal: тонкая настройка и кастомизация - Osman Seferov

“Ok” button function

Page 21: CKEditor в Drupal: тонкая настройка и кастомизация - Osman Seferov

When we press footnote button we should show selected footnote data

Page 22: CKEditor в Drupal: тонкая настройка и кастомизация - Osman Seferov

Useful links

➢https://drupal.org/project/ckeditor➢https://drupal.org/project/wysiwyg➢http://docs.ckeditor.com/#!/api/CKEDITOR.config➢http://ckeditor.com/addons/plugins/all➢http://docs.ckeditor.com/#!/guide/plugin_sdk_intro➢http://drupalwoo.com/content/how-customize-

ckeditor-drupal-7-site➢https://drupal.org/node/1793710

Page 23: CKEditor в Drupal: тонкая настройка и кастомизация - Osman Seferov

THANK YOU!