Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 7th, 2012  |  syntax: None  |  size: 2.81 KB  |  hits: 79  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. CKEDITOR.editorConfig = function(config) {
  2.     // 実体参照に変換する文字
  3.     config.entities_additional = '#9312,#9313,#9314,#9315,#9316,#9317,#9318,' +
  4.                                  '#9319,#9320,#9321,#9322,#9323,#9324,#9325,' +
  5.                                  '#9326,#9327,#9328,#9329,#9330,#9331';
  6.  
  7.     // MTタグのエンティティ化を抑止
  8.     config.protectedSource.push(/<[\$\/]?mt[\s\S]*?>\n?/g);
  9.  
  10.     // href,srcを相対パス化
  11.     config.rewrite_urls = true;
  12.  
  13.     // ツールバーボタンの設定
  14.     // See Also: http://docs.cksource.com/CKEditor_3.x/Developers_Guide/Toolbar
  15.     config.toolbar_Standard1 = [
  16.         ['Source','-','Templates','ShowBlocks'],
  17.         ['Cut','Copy','Paste','PasteFromWord'],
  18.         ['Link','Unlink','Anchor'],
  19.         ['mt_insert_image', 'mt_insert_file','Table','HorizontalRule'],
  20.         ['Maximize'],
  21.         '/',
  22.         ['Styles','Format','FontSize'],
  23.         '/',
  24.         ['Bold','Italic','Underline','Strike'],
  25.         ['NumberedList','BulletedList'],
  26.         ['TextColor'],
  27.         ['JustifyLeft','JustifyCenter','JustifyRight'],
  28.         ['Outdent','Indent','Blockquote'],
  29.         ['Subscript','Superscript']
  30.     ];
  31.     config.toolbar = 'Standard1';
  32.  
  33.     // フォーマットタグ
  34.     config.format_tags = 'p;h2;h3;h4;h5;h6;pre;div';
  35.  
  36.     // フォントサイズ
  37.     // Default: 13px
  38.     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%;' +
  39.                             '19px/146.2%;20px/153.9%;21px/161.6%;22px/169.3%;23px/177%;24px/184.7%;25px/192.4%;26px/197%;';
  40.     // Default: 14px
  41.     //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%;' +
  42.     //                        '19px/135.8%;20px/142.9%;21px/150%;22px/157.2%;23px/164.3%;24px/171.5%;25px/178.6%;26px/185.8%;';
  43. };
  44.  
  45. CKEDITOR.on('instanceCreated', function(ev) {
  46.     // ソースコードインデント文字
  47.     // タブ: '\t'
  48.     // 任意の数のスペース: '    '
  49.     ev.editor.dataProcessor.writer.indentationChars = '';
  50.  
  51.     // 空要素のタグ(br,img,etc...)の閉じ方
  52.     // XHTML,XHTML5: ' />'
  53.     // HTML4,HTML5: '>'
  54.     ev.editor.dataProcessor.writer.selfClosingEnd = '>';
  55.  
  56.     // ソースコードフォーマット
  57.     // (開始タグ直後の改行を無効化)
  58.     // See Also: http://cksource.com/forums/viewtopic.php?t=14493#p40127
  59.     // 処理対象タグ
  60.     var tags = ['div',
  61.                 'h1','h2','h3','h4','h5','h6',
  62.                 'p',
  63.                 'ul','ol','li','dl','dt','dd',
  64.                 'table','thead','tbody','tfoot','tr','th','td',
  65.                 'pre', 'address'];
  66.    
  67.     for (var key in tags) {
  68.         ev.editor.dataProcessor.writer.setRules(tags[key], {
  69.             breakAfterOpen : false
  70.         });
  71.     }
  72. });