readd the syntaxhightler plugin for the RTE
authorMichael J. Rubinsky <mrubinsk@horde.org>
Sun, 30 Jan 2011 04:14:54 +0000 (23:14 -0500)
committerMichael J. Rubinsky <mrubinsk@horde.org>
Sun, 30 Jan 2011 04:14:54 +0000 (23:14 -0500)
This was removed with the last update of CKEditor...re-add it.

framework/Editor/js/plugins/syntaxhighlight/dialogs/syntaxhighlight.js [new file with mode: 0644]
framework/Editor/js/plugins/syntaxhighlight/images/syntaxhighlight.gif [new file with mode: 0644]
framework/Editor/js/plugins/syntaxhighlight/lang/en.js [new file with mode: 0644]
framework/Editor/js/plugins/syntaxhighlight/plugin.js [new file with mode: 0644]
framework/Editor/package.xml

diff --git a/framework/Editor/js/plugins/syntaxhighlight/dialogs/syntaxhighlight.js b/framework/Editor/js/plugins/syntaxhighlight/dialogs/syntaxhighlight.js
new file mode 100644 (file)
index 0000000..946c4c6
--- /dev/null
@@ -0,0 +1 @@
+CKEDITOR.dialog.add("syntaxhighlight",function(c){var a=function(f){f=f.replace(/<br>/g,"\n");f=f.replace(/&amp;/g,"&");f=f.replace(/&lt;/g,"<");f=f.replace(/&gt;/g,">");f=f.replace(/&quot;/g,'"');return f};var e=function(f){var f=new Object();f.hideGutter=false;f.hideControls=false;f.collapse=false;f.showColumns=false;f.noWrap=false;f.firstLineChecked=false;f.firstLine=0;f.highlightChecked=false;f.highlight=null;f.lang=null;f.code="";return f};var b=function(i){var h=e();if(i){if(i.indexOf("brush")>-1){var g=/brush:[ ]{0,1}(\w*)/.exec(i);if(g!=null&&g.length>0){h.lang=g[1].replace(/^\s+|\s+$/g,"")}}if(i.indexOf("gutter")>-1){h.hideGutter=true}if(i.indexOf("toolbar")>-1){h.hideControls=true}if(i.indexOf("collapse")>-1){h.collapse=true}if(i.indexOf("first-line")>-1){var g=/first-line:[ ]{0,1}([0-9]{1,4})/.exec(i);if(g!=null&&g.length>0&&g[1]>1){h.firstLineChecked=true;h.firstLine=g[1]}}if(i.indexOf("highlight")>-1){if(i.match(/highlight:[ ]{0,1}\[[0-9]+(,[0-9]+)*\]/)){var f=/highlight:[ ]{0,1}\[(.*)\]/.exec(i);if(f!=null&&f.length>0){h.highlightChecked=true;h.highlight=f[1]}}}if(i.indexOf("ruler")>-1){h.showColumns=true}if(i.indexOf("wrap-lines")>-1){h.noWrap=true}}return h};var d=function(g){var f="brush:"+g.lang+";";if(g.hideGutter){f+="gutter:false;"}if(g.hideControls){f+="toolbar:false;"}if(g.collapse){f+="collapse:true;"}if(g.showColumns){f+="ruler:true;"}if(g.noWrap){f+="wrap-lines:false;"}if(g.firstLineChecked&&g.firstLine>1){f+="first-line:"+g.firstLine+";"}if(g.highlightChecked&&g.highlight!=""){f+="highlight: ["+g.highlight.replace(/\s/gi,"")+"];"}return f};return{title:c.lang.syntaxhighlight.title,minWidth:500,minHeight:400,onShow:function(){var i=this.getParentEditor();var h=i.getSelection();var g=h.getStartElement();var k=g&&g.getAscendant("pre",true);var j="";var f=null;if(k){code=a(k.getHtml());f=b(k.getAttribute("class"));f.code=code}else{f=e()}this.setupContent(f)},onOk:function(){var h=this.getParentEditor();var g=h.getSelection();var f=g.getStartElement();var k=f&&f.getAscendant("pre",true);var i=e();this.commitContent(i);var j=d(i);if(k){k.setAttribute("class",j);k.setText(i.code)}else{var l=new CKEDITOR.dom.element("pre");l.setAttribute("class",j);l.setText(i.code);h.insertElement(l)}},contents:[{id:"source",label:c.lang.syntaxhighlight.sourceTab,accessKey:"S",elements:[{type:"vbox",children:[{id:"cmbLang",type:"select",labelLayout:"horizontal",label:c.lang.syntaxhighlight.langLbl,"default":"java",widths:["25%","75%"],items:[["Bash (Shell)","bash"],["C#","csharp"],["C++","cpp"],["CSS","css"],["Delphi","delphi"],["Diff","diff"],["Groovy","groovy"],["Javascript","jscript"],["Java","java"],["Java FX","javafx"],["Perl","perl"],["PHP","php"],["Plain (Text)","plain"],["Python","python"],["Ruby","ruby"],["Scala","scala"],["SQL","sql"],["VB","vb"],["XML/XHTML","xml"]],setup:function(f){if(f.lang){this.setValue(f.lang)}},commit:function(f){f.lang=this.getValue()}}]},{type:"textarea",id:"hl_code",rows:22,style:"width: 100%",setup:function(f){if(f.code){this.setValue(f.code)}},commit:function(f){f.code=this.getValue()}}]},{id:"advanced",label:c.lang.syntaxhighlight.advancedTab,accessKey:"A",elements:[{type:"vbox",children:[{type:"html",html:"<strong>"+c.lang.syntaxhighlight.hideGutter+"</strong>"},{type:"checkbox",id:"hide_gutter",label:c.lang.syntaxhighlight.hideGutterLbl,setup:function(f){this.setValue(f.hideGutter)},commit:function(f){f.hideGutter=this.getValue()}},{type:"html",html:"<strong>"+c.lang.syntaxhighlight.hideControls+"</strong>"},{type:"checkbox",id:"hide_controls",label:c.lang.syntaxhighlight.hideControlsLbl,setup:function(f){this.setValue(f.hideControls)},commit:function(f){f.hideControls=this.getValue()}},{type:"html",html:"<strong>"+c.lang.syntaxhighlight.collapse+"</strong>"},{type:"checkbox",id:"collapse",label:c.lang.syntaxhighlight.collapseLbl,setup:function(f){this.setValue(f.collapse)},commit:function(f){f.collapse=this.getValue()}},{type:"html",html:"<strong>"+c.lang.syntaxhighlight.showColumns+"</strong>"},{type:"checkbox",id:"show_columns",label:c.lang.syntaxhighlight.showColumnsLbl,setup:function(f){this.setValue(f.showColumns)},commit:function(f){f.showColumns=this.getValue()}},{type:"html",html:"<strong>"+c.lang.syntaxhighlight.lineWrap+"</strong>"},{type:"checkbox",id:"line_wrap",label:c.lang.syntaxhighlight.lineWrapLbl,setup:function(f){this.setValue(f.noWrap)},commit:function(f){f.noWrap=this.getValue()}},{type:"html",html:"<strong>"+c.lang.syntaxhighlight.lineCount+"</strong>"},{type:"hbox",widths:["5%","95%"],children:[{type:"checkbox",id:"lc_toggle",label:"",setup:function(f){this.setValue(f.firstLineChecked)},commit:function(f){f.firstLineChecked=this.getValue()}},{type:"text",id:"default_lc",style:"width: 15%;",label:"",setup:function(f){if(f.firstLine>1){this.setValue(f.firstLine)}},commit:function(f){if(this.getValue()&&this.getValue()!=""){f.firstLine=this.getValue()}}}]},{type:"html",html:"<strong>"+c.lang.syntaxhighlight.highlight+"</strong>"},{type:"hbox",widths:["5%","95%"],children:[{type:"checkbox",id:"hl_toggle",label:"",setup:function(f){this.setValue(f.highlightChecked)},commit:function(f){f.highlightChecked=this.getValue()}},{type:"text",id:"default_hl",style:"width: 40%;",label:"",setup:function(f){if(f.highlight!=null){this.setValue(f.highlight)}},commit:function(f){if(this.getValue()&&this.getValue()!=""){f.highlight=this.getValue()}}}]},{type:"hbox",widths:["5%","95%"],children:[{type:"html",html:""},{type:"html",html:"<i>"+c.lang.syntaxhighlight.highlightLbl+"</i>"}]}]}]}]}});
\ No newline at end of file
diff --git a/framework/Editor/js/plugins/syntaxhighlight/images/syntaxhighlight.gif b/framework/Editor/js/plugins/syntaxhighlight/images/syntaxhighlight.gif
new file mode 100644 (file)
index 0000000..dd94ded
Binary files /dev/null and b/framework/Editor/js/plugins/syntaxhighlight/images/syntaxhighlight.gif differ
diff --git a/framework/Editor/js/plugins/syntaxhighlight/lang/en.js b/framework/Editor/js/plugins/syntaxhighlight/lang/en.js
new file mode 100644 (file)
index 0000000..a9fe02d
--- /dev/null
@@ -0,0 +1 @@
+CKEDITOR.plugins.setLang("syntaxhighlight","en",{syntaxhighlight:{title:"Add or update a code snippet",sourceTab:"Source code",langLbl:"Select language",advancedTab:"Advanced",hideGutter:"Hide gutter",hideGutterLbl:"Hide gutter & line numbers.",hideControls:"Hide controls",hideControlsLbl:"Hide code controls at the top of the code block.",collapse:"Collapse",collapseLbl:"Collapse the code block by default. (controls need to be turned on)",showColumns:"Show columns",showColumnsLbl:"Show row columns in the first line.",lineWrap:"Disable line wrapping",lineWrapLbl:"Switch off line wrapping.",lineCount:"Default line count",highlight:"Highlight lines",highlightLbl:"Enter a comma seperated lines of lines you want to highlight, eg <em>3,10,15</em>."}});
\ No newline at end of file
diff --git a/framework/Editor/js/plugins/syntaxhighlight/plugin.js b/framework/Editor/js/plugins/syntaxhighlight/plugin.js
new file mode 100644 (file)
index 0000000..a94864a
--- /dev/null
@@ -0,0 +1 @@
+CKEDITOR.plugins.add("syntaxhighlight",{requires:["dialog"],lang:["en"],init:function(a){var b="syntaxhighlight";var c=a.addCommand(b,new CKEDITOR.dialogCommand(b));c.modes={wysiwyg:1,source:1};c.canUndo=false;a.ui.addButton("Code",{label:a.lang.syntaxhighlight.title,command:b,icon:this.path+"images/syntaxhighlight.gif"});CKEDITOR.dialog.add(b,this.path+"dialogs/syntaxhighlight.js")}});
\ No newline at end of file
index ead9f51..5027582 100644 (file)
@@ -16,8 +16,8 @@
   <email>slusarz@horde.org</email>
   <active>yes</active>
  </lead>
- <date>2011-01-04</date>
- <time>15:37:55</time>
+ <date>2011-01-29</date>
+ <time>23:14:33</time>
  <version>
   <release>0.1.0</release>
   <api>0.1.0</api>
        <file name="default.js" role="horde" />
       </dir> <!-- /js/plugins/styles/styles -->
      </dir> <!-- /js/plugins/styles -->
+     <dir name="syntaxhighlight">
+      <dir name="dialogs">
+       <file name="syntaxhighlight.js" role="horde" />
+      </dir> <!-- /js/plugins/syntaxhighlight/dialogs -->
+      <dir name="images">
+       <file name="syntaxhighlight.gif" role="horde" />
+      </dir> <!-- /js/plugins/syntaxhighlight/images -->
+      <dir name="lang">
+       <file name="en.js" role="horde" />
+      </dir> <!-- /js/plugins/syntaxhighlight/lang -->
+      <file name="plugin.js" role="horde" />
+     </dir> <!-- /js/plugins/syntaxhighlight -->
      <dir name="table">
       <dir name="dialogs">
        <file name="table.js" role="horde" />
    <install as="js/plugins/smiley/images/wink_smile.gif" name="js/plugins/smiley/images/wink_smile.gif" />
    <install as="js/plugins/specialchar/dialogs/specialchar.js" name="js/plugins/specialchar/dialogs/specialchar.js" />
    <install as="js/plugins/styles/styles/default.js" name="js/plugins/styles/styles/default.js" />
+   <install as="js/plugins/syntaxhighlight/plugin.js" name="js/plugins/syntaxhighlight/plugin.js" />
+   <install as="js/plugins/syntaxhighlight/dialogs/syntaxhighlight.js" name="js/plugins/syntaxhighlight/dialogs/syntaxhighlight.js" />
+   <install as="js/plugins/syntaxhighlight/images/syntaxhighlight.gif" name="js/plugins/syntaxhighlight/images/syntaxhighlight.gif" />
+   <install as="js/plugins/syntaxhighlight/lang/en.js" name="js/plugins/syntaxhighlight/lang/en.js" />
    <install as="js/plugins/table/dialogs/table.js" name="js/plugins/table/dialogs/table.js" />
    <install as="js/plugins/tableresize/plugin.js" name="js/plugins/tableresize/plugin.js" />
    <install as="js/plugins/tabletools/dialogs/tableCell.js" name="js/plugins/tabletools/dialogs/tableCell.js" />
@@ -672,7 +688,7 @@ Initial packaging
     <release>beta</release>
     <api>beta</api>
    </stability>
-   <date>2011-01-04</date>
+   <date>2011-01-29</date>
    <license uri="http://www.gnu.org/copyleft/lesser.html">LGPL</license>
    <notes>
 * Removed Xinha driver.