Skip to main content
The New Rich Text Editor
                           2012年8月4日
             Movable Type 開発エンジニア
                                天野卓
リッチテキストエディタ
5.1



5.2
5.1までのエディタ

• 編集機能が少ない
• モダンなHTMLが出力されない
• 生成されるHTMLがブラウザ毎に異なる
• カスタマイズが難しい
5.2のエディタ

• 編集機能が多い
• モダンなHTMLが出力される
• 生成されるHTMLがブラウザ間で同じ
• カスタマイズが簡単
TinyMCE
TinyMCE

• 編集機能が多い
• モダンなHTMLが出力される
• 生成されるHTMLがブラウザ間で同じ
• カスタマイズが簡単
TinyMCE
• ネットブックでも快適に動作する
• 開発が活発である
 • 各ブラウザの最新バージョンへの対応
• 見える形で開発が行われている
 • GitHub で pull request を送信できる
WYSIWYGモード
標準的な編集ボタン
MT由来のボタン
HTMLソースの挿入
HTMLソースの挿入
HTMLソースの挿入
フルスクリーンモード
フルスクリーンモード
投稿設定




編集領域のCSS
編集領域のCSS
1 body.wysiwyg {
2     background: pink;
3 }




   編集領域のCSS
1   body.entry {
2       background: pink;
3   }
4
5   body.page {
6       background: pink;
7   }


     編集領域のCSS
1   ---
 2   id: Content CSS Sample
 3   label: Content CSS Sample
 4   name: Content CSS Sample
 5   version: 1.0
 6   class: blog
 7
 8   elements:
 9     default_prefs:
10       importer: default_prefs
11       data:
12         content_css: content_css.css


      CSSをテーマで指定
ソース編集モード
MT由来のボタン
フルスクリーンモード
標準的な編集ボタン
標準的な編集ボタン
出力される
HTMLに関する設定
HTMLに関する設定
• HTML4と5のどちらの要素も利用できる
• 要素のチェックは基本的には行わない
 • 親子関係のチェックは行う
• 属性値のチェックは行わない
• HTMLの出力を整形する
5.1以前のデータとの
   互換性
5.1までのエディタ
• HTML4と5のどちらの要素も利用できる
• 要素のチェックは基本的には行わない
 • 親子関係のチェックは行わない
• 属性値のチェックは行わない
• HTMLの出力を整形しない
5.2のエディタ
• HTML4と5のどちらの要素も利用できる
• 要素のチェックは基本的には行わない
 • 親子関係のチェックは行う
• 属性値のチェックは行わない
• HTMLの出力を整形する
API
5.1までのAPI

• カスタマイズ方法が用意されていない
• エディタを変更することができる
 • 実装するのが非常に難しい
5.2のAPI

• カスタマイズ方法が用意されている
• エディタを変更することができる
 • 実装するのが簡単
TinyMCEのカスタマイズ
オプションを変更する
http://www.tinymce.com/wiki.php/Configuration
1   id: EnterBrForTinyMCE
 2   name: EnterBrForTinyMCE
 3   version: 1.00
 4
 5   editors:
 6     tinymce:
 7       config:
 8         force_br_newlines: true
 9         force_p_newlines: ~
10         forced_root_block: ''


     Enterキーでbrを挿入
        https://gist.github.com/281e26f60c092714b702
1   id: HTML5ForTinyMCE
 2   name: HTML5ForTinyMCE
 3   version: 1.00
 4
 5   editors:
 6     tinymce:
 7       config:
 8         schema: html5
 9         verify_html: true
10         valid_children: ''


         HTML5モード
        https://gist.github.com/78cf419f9456612e7d84
1   id: RelativeURLForTinyMCE
 2   name: RelativeURLForTinyMCE
 3   version: 1.00
 4
 5   editors:
 6     tinymce:
 7       config:
 8         relative_urls: ~
 9         convert_urls: true
10         remove_script_host: true


リンクを相対パスに変換
        https://gist.github.com/1f234647a582266c5a8b
もう少し本格的に
    カスタマイズをする
https://github.com/movabletype/Documentation/wiki/Movable-Type-5.2-
                      %E3%81%AE%E3%83%AA
            %E3%83%83%E3%83%81%E3%83%86%E3%82%AD
1   id: TableFeatureForTinyMCE
2   name: TableFeatureForTinyMCE
3   version: 1.02
4   author_name: Six Apart, Ltd.
5
6   editors:
7     tinymce:
8       extension: extension.tmpl


TableFeatureForTinyMCE
    https://github.com/movabletype/mt-plugin-table-feature-for-tinymce
TableFeatureForTinyMCE
https://github.com/movabletype/mt-plugin-table-feature-for-tinymce
エディタの変更
CKEditor
CKEditor
https://github.com/movabletype/mt-plugin-ckeditor
オプションを変更する
1   id: MiscSettingsForCKEditor
2   name: MiscSettingsForCKEditor
3   version: 1.00
4
5   editors:
6     ckeditor: テキスト
7       config:
8         enterMode: 2


    Enterキーでbrを挿入
       https://gist.github.com/2b693224295014d96e3a
CodeMirror
CodeMirror
https://github.com/movabletype/mt-plugin-codemirror
オプションを変更する
1   id: MiscSettingsForCodeMirror
2   name: MiscSettingsForCodeMirror
3   version: 1.00
4
5   editors:
6               テキスト
      codemirror:
7       config:
8         lineNumbers: ~


    行番号を表示しない
        https://gist.github.com/dfe6652e982eee34adb8
まとめ


• 新しいリッチテキストエディタ
• 新しいAPI
ご清聴
ありがとうございました