User Tools

Site Tools


ru:how_to:editor_configuration_more_options

This is an old revision of the document!


Дополнительные настройки

Пользователю доступно значительно большее количество настроек редактора, а не только настройка языка интерфейса, высоты окна и отображения панелей инструментов. В этой статье мы обсудим дополнительные возможности по настройкам CKEditor.

Впечатляющий список всех возможных настроек, который постоянно пополняется, можно найти здесь.

Настройки следует добавлять в параметре GSEDITOROPTIONS файла gsconfig.php

# WYSIWYG Editor Options
define('GSEDITOROPTIONS'," 
");

Далее в этом разделе мы обсудим пользующиеся наибольшей популярностью настройки редактора.

Визуальное оформление (тема или скин)

Визуальное оформление окна редактора определяет используемый для него набор графических элементов и стилей, именуемый темой (или скин).

GetSimple применяет свою собственную и единственную тему оформления редактора, которая расположена в папке Корневой_каталог_GetSimple/admin/template/js/ckeditor/skins/getsimple.

Как объясняется на сайте CKEditor, папка skins содержит файлы тем CKEditor вместе с кнопками панели управления и файлами стилей и является обязательной для работы редактора. Тем не менее, пользователь может удалять неиспользуемые темы и их файлы.

Если вы хотите использовать другие темы (например, с большим количеством видимых кнопок или из-за других предпочтений), подключить новую тему несложно. Вам потребуется выполнить три шага:

На приведенном рисунке открыта дополнительная (advanced) панель инструментов и применена тема редактора v2.

  1. В стандартный пакет CKeditor входят три темы: kama, office2003 и v2. GetSimple их не использует, в системе применяется собственная тема getsimple
  2. Если вы еще не сделали этого – скачайте CKEditor с официального сайта и распакуйте его в отдельную папку на своем компьютере.Откройте папку ckeditor/skins и загрузите тему редактора, которую хотите использовать, в папку Корневой_каталог_GetSimple/admin/template/js/ckeditor/skins на сервере.
  3. Отредактируйте конфигурационный файл системы gsconfig.php и перезагрузите его на сервер.
 
  # WYSIWYG Editor Options
  define('GSEDITOROPTIONS',"skin : 'v2'
  ");

Эта настройка подключает тему v2, вы можете подключить kama или office2003, в зависимости от того, какие новые темы вы загрузили.

Поведение клавиши Enter: абзац или перенос строки?

Пользователь редактора имеет возможность переопределять поведение клавиши ENTER.

Документация CKEditor объясняет параметры настройки поведения клавиш следующим образом: Настройка определяет поведение клавиши ENTER. Настройка также устанавливает и другие параметры редактора, например, использование тэга <br> как разделителя абзацев.

Нажатию клавиши ENTER или SHIFT-ENTER возможно сопоставить следующие действия:

  1. P: создание нового абзаца <p>
  2. BR: создание перевода строки тэгом <br>
  3. DIV: создание нового блока <div>

Отредактируйте файл конфигурации gsconfig.php и перезагрузите его на сервер:

  define('GSEDITOROPTIONS',"skin : 'v2', 
  enterMode: CKEDITOR.ENTER_P,
  shiftEnterMode : CKEDITOR.ENTER_BR
  ");

В результате данных настроек по нажатию клавиши ENTER текст будет заключен в тэги <p> </p>, а при нажатии комбинации клавиш SHIFT-ENTER в текст будет вставлен тэг <br />.

Шрифты по умолчанию

Любой визуальный редактор должен предлагать опции выбора шрифтов и их размеров.
Возможность для установки шрифтов и размеров предоставляется пользователю при активации дополнительной (advanced) панели инструментов, на которой выводятся выпадающие списки доступных шрифтов и их размеров.
Вы также имеете возможность сократить или ограничить список доступных шрифтов.

Чтобы занести в выпадающие списки наименования шрифтов и их размеры по умолчанию, используйте следующие настройки:

  # WYSIWYG Editor Options
  define('GSEDITOROPTIONS',"skin : 'v2', 
  enterMode: CKEDITOR.ENTER_P,
  shiftEnterMode : CKEDITOR.ENTER_BR,
  fontSize_defaultLabel : '11px',
  font_defaultLabel : 'Arial',
  font_names : 'Arial;Times New Roman;Verdana'
  ");
  

Скрытие панели инструментов

В readme-файле, включенном в состав CKEditor, интегрированного в GetSimple, написано, что возможность скрытия панели инструментов в этой версии редактора отсутствует. На самом деле эту возможность очень легко активировать.
Возможность скрытия панели инструментов предписывается опцией toolbarCanCollapse, по умолчанию установленной в false. При установке этой опции в true, вы увидите небольшую кнопку со стрелкой у правой границы панели инструментов.

  # WYSIWYG Editor Options
  define('GSEDITOROPTIONS',"skin : 'v2', 
  enterMode: CKEDITOR.ENTER_P,
  shiftEnterMode : CKEDITOR.ENTER_BR,
  fontSize_defaultLabel : '11px',
  font_defaultLabel : 'Verdana',
  font_names : 'Arial;Times New Roman;Verdana',
  toolbarCanCollapse : true
  ");
  

Панели инструментов закрываются при нажатии на эту кнопку. Если такая возможность вам нравится – попробуйте сами. ;=)

Опция палитры More Colors (Другие цвета)

По умолчанию CKEditor предлагает опцию More colors… (Другие цвета). Кнопка выбора расположена внизу цветовой палитры. Если вам эта возможность не требуется, установите опцию colorButton_enableMore в false.

  # WYSIWYG Editor Options
  define('GSEDITOROPTIONS',"skin : 'v2', 
  enterMode: CKEDITOR.ENTER_P,
  shiftEnterMode : CKEDITOR.ENTER_BR,
  fontSize_defaultLabel : '11px',
  font_defaultLabel : 'Verdana',
  font_names : 'Arial;Times New Roman;Verdana',
  toolbarCanCollapse : true,
  colorButton_enableMore : true
  ");

Entities and Special Characters

By default, the editor converts special characters like umlauts (üäö …) to their HTML-equivalents.
This is not needed anymore if you encode your pages in UTF-8. So you can set this option to false.

# WYSIWYG Editor Options
define('GSEDITOROPTIONS',"skin : 'v2', 
enterMode: CKEDITOR.ENTER_P,
shiftEnterMode : CKEDITOR.ENTER_BR,
fontSize_defaultLabel : '11px',
font_defaultLabel : 'Verdana',
font_names : 'Arial;Times New Roman;Verdana',
toolbarCanCollapse : true,
colorButton_enableMore : true,
entities : false
");

Language Direction

In many languages the reading- or write-direction is from left to right. In German, English, French or whatever.
In other languages the reading-direction goes from right to left: in Arabic, Farsi, Hebrew and many others.
Other languages go from Top to Down or from Down to Top.

The editor follows per default the settings of the user interface language direction (f.e. your browser-settings).
If this does not work correctly or you want to force the direction, set the option contentsLangDirection

# WYSIWYG Editor Options
define('GSEDITOROPTIONS',"skin : 'v2', 
enterMode: CKEDITOR.ENTER_P,
shiftEnterMode : CKEDITOR.ENTER_BR,
fontSize_defaultLabel : '11px',
font_defaultLabel : 'Verdana',
font_names : 'Arial;Times New Roman;Verdana',
toolbarCanCollapse : true,
colorButton_enableMore : true,
entities : false,
contentsLangDirection : 'rtl'
");

The editor allows 3 options:

  1. ui = as defined by the user interaction interface (default)
  2. ltr = left to right
  3. rtl = right to left

There is not top-down until now ;=)

Email Protection

sometimes it is necessary to add some email-adresses into a website.
And it is always necessary to protect these adresses from spam-harvesters.

You can enable some kind of email protection in the editor options (emailProtection : 'encode').
See more info here: http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.config.html#.emailProtection

Add to gsconfig.php-editor-options:

# WYSIWYG Editor Options
define('GSEDITOROPTIONS',"skin : 'v2', 
enterMode: CKEDITOR.ENTER_P,
shiftEnterMode : CKEDITOR.ENTER_BR,
fontSize_defaultLabel : '11px',
font_defaultLabel : 'Verdana',
font_names : 'Arial;Times New Roman;Verdana',
toolbarCanCollapse : true,
colorButton_enableMore : true,
entities : false,
contentsLangDirection : 'ltr',
emailProtection : 'encode'
");

now, whenever you create a mail-link in the editor, that mail-adress will be protected in the source-code:

SpellCheck

CKEditor comes with built-in spellchecking feature, which is deactivated by default. When activated, errors will be marked by a red line below the error. When you position the cursor over that marked error, the context menu will pop up and show a list of suggestions

The Spellchecker-feature is named SCAYT, which means: SpellCheckAsYouType

As there are a lot of options for the spell-checker, we will describe the basic configuration here. If you want to use more of the options, find out in the documentation at ckeditor.net,http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.config.html#.scayt_autoStartup

Necessary modifications:

  1. Enable the feature (scayt_autoStartup:true)
  2. Define the language for the spellchecker (scayt_sLang:'de_DE')
    The default language is en_US, so you should define the language when you need another language.
    Possible values for the languages are: en_US, en_GB, pt_BR, da_DK, nl_NL, en_CA, fi_FI, fr_FR, fr_CA, de_DE, el_GR, it_IT, nb_NO, pt_PT, es_ES, sv_SE.
  3. add the spellchecker-symbols to the toolbar
    There are 2 symbols: the symbol Spellchecker opens the text in a dialogue window, allows to choose the language to check with and to correct the text, the second symbol, Scayt opens a pop-up-dialogue to activate / deactivate the spellchecker and to set some options.

So add SCAYT-options to editor-options and 'Scayt' to the toolbar in gsconfig.php

# WYSIWYG Editor Options
define('GSEDITOROPTIONS',"scayt_autoStartup:true, scayt_sLang:'de_DE'");

# WYSIWYG toolbars (advanced, basic or [custom config])
define('GSEDITORTOOL',"['Source','-','Cut','Copy','Paste',
'PasteText','PasteFromWord','-','Undo',
'Redo','Find','Replace','-','SelectAll','RemoveFormat','SpellChecker','Scayt'],'/',
");

Attention:

There is a bug in CKEditor SpellChecker's plugin which you should be aware of:

if spellchecker is enabled and the cursor is placed in a list (whether unordered or ordered list), do not switch to SourceCode mode! When switching back your list will be “destroyed” because the spellchecker plugin adds superfluous list-elements to the source code

It's tested with the newest CKEditor version (3.6.2), the bug is still there this is no GetSimple bug, so we have to wait until that bug is fixed in CKEditor


ru/how_to/editor_configuration_more_options.1382081757.txt.gz · Last modified: 2013/10/18 07:35 by Arkady