Skip to content

Instantly share code, notes, and snippets.

@hideki-a
Created August 3, 2011 05:45
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save hideki-a/1121987 to your computer and use it in GitHub Desktop.
Save hideki-a/1121987 to your computer and use it in GitHub Desktop.
CKEditor for Movable Type向けの設定ファイル
CKEDITOR.editorConfig = function (config) {
// 実体参照に変換する文字
config.entities_additional = '#9312,#9313,#9314,#9315,#9316,#9317,#9318,' +
'#9319,#9320,#9321,#9322,#9323,#9324,#9325,' +
'#9326,#9327,#9328,#9329,#9330,#9331';
// MTタグのエンティティ化を抑止
config.protectedSource.push(/<[\$\/]?mt[\s\S]*?>\n?/g);
// href,srcを相対パス化
config.rewrite_urls = true;
// ツールバーボタンの設定
// See Also: http://docs.cksource.com/CKEditor_3.x/Developers_Guide/Toolbar
config.toolbar_Standard1 = [
['Source','-','Templates','ShowBlocks'],
['Cut','Copy','Paste','PasteFromWord'],
['Link','Unlink','Anchor'],
['mt_insert_image', 'mt_insert_file','Table','HorizontalRule'],
['Maximize'],
'/',
['Styles','Format','FontSize'],
'/',
['Bold','Italic','Underline','Strike'],
['NumberedList','BulletedList'],
['TextColor'],
['JustifyLeft','JustifyCenter','JustifyRight'],
['Outdent','Indent','Blockquote'],
['Subscript','Superscript']
];
config.toolbar = 'Standard1';
// フォーマットタグ
config.format_tags = 'p;h2;h3;h4;h5;h6;pre;div';
// フォントサイズ
// Default: 13px
config.fontSize_sizes = '10px/77%;11px/84.7%;12px/92.4%;標準/100%;14px/107.7%;15px/115.4;16px/123.1%;17px/130.8%;18px/138.5%;' +
'19px/146.2%;20px/153.9%;21px/161.6%;22px/169.3%;23px/177%;24px/184.7%;25px/192.4%;26px/197%;';
// Default: 14px
//config.fontSize_sizes = '10px/71.5%;11px/78.6%;12px/85.8%;13px/92.9%;標準/100%;15px/107.2;16px/114.3%;17px/121.5%;18px/128.6%;' +
// '19px/135.8%;20px/142.9%;21px/150%;22px/157.2%;23px/164.3%;24px/171.5%;25px/178.6%;26px/185.8%;';
};
CKEDITOR.on('instanceReady', function (ev) {
// ソースコードインデント文字
// タブ: '\t'
// 任意の数のスペース: ' '
ev.editor.dataProcessor.writer.indentationChars = '';
// 空要素のタグ(br,img,etc...)の閉じ方
// XHTML,XHTML5: ' />'
// HTML4,HTML5: '>'
ev.editor.dataProcessor.writer.selfClosingEnd = '>';
// ソースコードフォーマット
// (開始タグ直後の改行を無効化)
// See Also: http://cksource.com/forums/viewtopic.php?t=14493#p40127
// 処理対象タグ
var tags = ['div',
'h1','h2','h3','h4','h5','h6',
'p',
'ul','ol','li','dl','dt','dd',
'table','thead','tbody','tfoot','tr','th','td',
'pre', 'address'];
for (var key in tags) {
ev.editor.dataProcessor.writer.setRules(tags[key], {
breakAfterOpen : false
});
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment