專注搜索競價代運營

成長之選 ,效果之道!

免費咨詢熱線:17636682598

帝國cms默認編輯器ckeditor代碼高亮插件

今天我們來聊聊帝國cms默認編輯器ckeditor代碼高亮插件,以下2個關(guān)于帝國cms默認編輯器ckeditor代碼高亮插件的觀點希望能幫助到您找到想要的資訊。

帝國cms代碼高亮插件使用說明

1.下載解壓后codeblock復(fù)制到帝國cms后臺:/e/admin/ecmseditor/infoeditor/plugins下(注:admin 為系統(tǒng)默認地址,如果有自定義需要改為自定義文件名)

2.修改帝國cms編輯器配置文件,路徑:/e/admin/ecmseditor/infoeditor/config.js(大概在95行與110行后添加 , 'CodeBlock')

PS:一定要注意大小寫,否則會出現(xiàn)編輯器不顯示或顯示但沒有codeblock模塊的情況,完了刷新緩存,你就可以看到編輯器多了一個圖標。

3.修改后的源碼

  1. function EcmsEditorDoCKhtml(htmlstr){ 
  2.     if(htmlstr.indexOf('"')!=-1) 
  3.     { 
  4.         return ''
  5.     } 
  6.     if(htmlstr.indexOf("'")!=-1) 
  7.     { 
  8.         return ''
  9.     } 
  10.     if(htmlstr.indexOf("/")!=-1) 
  11.     { 
  12.         return ''
  13.     } 
  14.     if(htmlstr.indexOf("\\")!=-1) 
  15.     { 
  16.         return ''
  17.     } 
  18.     if(htmlstr.indexOf("[")!=-1) 
  19.     { 
  20.         return ''
  21.     } 
  22.     if(htmlstr.indexOf("]")!=-1) 
  23.     { 
  24.         return ''
  25.     } 
  26.     if(htmlstr.indexOf(":")!=-1) 
  27.     { 
  28.         return ''
  29.     } 
  30.     if(htmlstr.indexOf("%")!=-1) 
  31.     { 
  32.         return ''
  33.     } 
  34.     if(htmlstr.indexOf("<")!=-1) 
  35.     { 
  36.         return ''
  37.     } 
  38.     if(htmlstr.indexOf(">")!=-1) 
  39.     { 
  40.         return ''
  41.     } 
  42.     return htmlstr; 
  43.  
  44. function EcmsEditorGetCs(){ 
  45.     var js=document.getElementsByTagName("script"); 
  46.     for(var i=0;i<js.length;i++) 
  47.     { 
  48.         if(js[i].src.indexOf("ckeditor.js")>=0) 
  49.         { 
  50.             var arraytemp=new Array(); 
  51.             arraytemp=js[i].src.split('?'); 
  52.             return arraytemp; 
  53.         } 
  54.     } 
  55.  
  56. var arraycs=new Array(); 
  57. arraycs=EcmsEditorGetCs(); 
  58.  
  59. arraycs[0]=arraycs[0].replace('infoeditor/ckeditor.js',''); 
  60.  
  61. arraycs[1]=document.getElementById('doecmseditor_eaddcs').value; 
  62. arraycs[1]=EcmsEditorDoCKhtml(arraycs[1]); 
  63.  
  64.  
  65. CKEDITOR.editorConfig = function( config ) { 
  66.     // Define changes to default configuration here. For example: 
  67.     // config.language = 'fr'; 
  68.     // config.uiColor = '#AADC6E'; 
  69.      
  70.     config.filebrowserImageUploadUrl = ''
  71.     config.filebrowserFlashUploadUrl = arraycs[0]; 
  72.     config.filebrowserImageBrowseUrl = arraycs[1]; 
  73.     config.filebrowserFlashBrowseUrl = arraycs[1]; 
  74.      
  75.     config.enterMode = CKEDITOR.ENTER_BR; 
  76.     config.shiftEnterMode = CKEDITOR.ENTER_P; 
  77.  
  78.     config.allowedContent= true
  79.      
  80.     config.font_names='宋體/宋體;黑體/黑體;仿宋/仿宋_GB2312;楷體/楷體_GB2312;隸書/隸書;幼圓/幼圓;微軟雅黑/微軟雅黑;'+ config.font_names; 
  81.      
  82.     // Toolbar 
  83.     config.toolbar_full = [ 
  84.     { name: 'document', groups: [ 'mode''document''doctools' ], items: [ 'Source''-''Preview''Print' ] }, 
  85.     { name: 'clipboard', groups: [ 'clipboard''undo' ], items: [ 'Cut''Copy''Paste''PasteText''PasteFromWord''-''Undo''Redo' ] }, 
  86.      
  87.     { name: 'paragraph', groups: [ 'list''indent''blocks''align''bidi' ], items: [ 'NumberedList''BulletedList''-''Outdent''Indent''-''Blockquote''CreateDiv''-''JustifyLeft''JustifyCenter''JustifyRight''JustifyBlock''-''BidiLtr''BidiRtl' ] }, 
  88.     '/'
  89.     { name: 'basicstyles', groups: [ 'basicstyles''cleanup' ], items: [ 'Bold''Italic''Underline''Strike''Subscript''Superscript''-''RemoveFormat''ecleanalltext''autoformat' ] }, 
  90.      
  91.     { name: 'links', items: [ 'Link''Unlink''Anchor' ] }, 
  92.     { name: 'insert', items: [ 'Image''etranmore''Flash''etranmedia''etranfile''-''Table''HorizontalRule''SpecialChar''equotetext''einserttime''einsertpage''einsertbr''CodeBlock' ] }, 
  93.     '/'
  94.     { name: 'styles', items: [ 'Styles''Format''Font''FontSize' ] }, 
  95.     { name: 'colors', items: [ 'TextColor''BGColor' ] }, 
  96.     { name: 'tools', items: [ 'ShowBlocks''NewPage''Templates' ] }, 
  97.     { name: 'others', items: [ '-' ] }, 
  98.     { name: 'editing', groups: [ 'find''selection''spellchecker' ], items: [ 'Find''Replace''-''SelectAll''Maximize' ] } 
  99. ]; 
  100.  
  101.  
  102.     // Toolbar 
  103.     config.toolbar_basic = [ 
  104.     { name: 'document', groups: [ 'mode''document''doctools' ], items: [ 'Source' ] }, 
  105.     { name: 'clipboard', groups: [ 'clipboard''undo' ], items: [ 'Cut''Copy''Paste''PasteText''PasteFromWord''-''Undo''Redo' ] }, 
  106.     { name: 'links', items: [ 'Link''Unlink''Anchor' ] }, 
  107.     { name: 'insert', items: [ 'Image''Table''HorizontalRule''SpecialChar''CodeBlock' ] }, 
  108.     { name: 'tools', items: [ 'Maximize' ] }, 
  109.     { name: 'others', items: [ '-' ] }, 
  110.     '/'
  111.     { name: 'basicstyles', groups: [ 'basicstyles''cleanup' ], items: [ 'Bold''Italic''Strike''-''RemoveFormat' ] }, 
  112.     { name: 'paragraph', groups: [ 'list''indent''blocks''align''bidi' ], items: [ 'NumberedList''BulletedList''-''Outdent''Indent''-''Blockquote' ] }, 
  113.     { name: 'styles', items: [ 'Styles''Format' ] } 
  114. ]; 
  115.  
  116.  
  117.     config.extraPlugins = 'etranfile,etranmedia,etranmore,autoformat,ecleanalltext,einsertbr,einsertpage,einserttime,equotetext,codeblock'
  118.      
  119.      
  120.     config.toolbar = 'full'
  121.      
  122.      
  123.      
  124. }; 

4.模板調(diào)用:

壓縮包里contents.css 文件復(fù)制到/skin下你站點的css文件夾里,在內(nèi)容頁引入CSS文件即可(skin為系統(tǒng)默認地址,如果有自定義需要改為自定義文件名)。
 

  1. <link href="[!--news.url--]skin/css/contents.css" rel="stylesheet"> 

帝國cms代碼高亮插件下載

帝國代碼高亮.zip
4f4265ab5bdaf746bccba11a2a1a8577.zip (12.02 KB)

本文分類:營銷學(xué)院

瀏覽次數(shù):98次瀏覽

發(fā)布日期:2022-07-03 10:59:46

本文鏈接:http://www.ozone-depletion.net/edu/2404.html