Инструменты пользователя

Инструменты сайта


software:development:web:docs:web:wysiwyg:sceditor_doc_custom_formats

Пользовательские форматы

Структура

В настоящее время SCEditor поддерживает форматы BBCode и XHTML, а также пользовательские форматы.

:&9: Важно:При создании пользовательского формата это необходимо сделать до создания экземпляра редактора, например, до вызова метода sceditor.create().

Структура пользовательского формата должна быть следующей:

script.js
sceditor.formats['youformatname'] = function () {
    /**
     * Called when the editor is created.
     *
     * This is called before the editor is fully initialised 
     */
    this.init = function () {
        // this is set to the editor
    };
 
    /**
     * Called when the WYSIWYG editor document is ready
     */
    this.onReady = function () {
        // this is set to the editor
    };
 
    /**
     * Called to convert the whole HTML document to this format
     */
    this.toSource = function (html, context) {
        // this is set to this object
    };
 
    /**
     * Called to convert the whole source into HTML
     */
    this.toHtml = function (source) {
        // this is set to this object
    };
 
    /**
     * Called to convert a fragment HTML into this format
     *
     * Parent is set to the current node
     */
    this.fragmentToSource = function (html, context, parent) {
        // this is set to this object
    };
 
    /**
     * Called to convert a fragment of source into HTML
     */
    this.fragmentToHtml = function (source) {
        // this is set to this object
    };
};

Если какой-либо метод отсутствует, ошибки не возникнет, он просто не будет вызван.

Дополнения и Файлы

Только авторизованные участники могут оставлять комментарии.
software/development/web/docs/web/wysiwyg/sceditor_doc_custom_formats.txt · Последнее изменение: VladPolskiy

Если не указано иное, содержимое этой вики предоставляется на условиях следующей лицензии: Public Domain
Public Domain Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki