Permalink
Browse files

BUGFIX Removed tinymce-advcode plugin which breaks with new TinyMCE a…

…nd newer browsers. Both the plugin and the underlying 'codepress' engine are unmaintained. Fall back to standard (non-highlighted) TinyMCE <textarea> editing (fixes #6779)
  • Loading branch information...
chillu committed Feb 11, 2012
1 parent 91b0c7b commit 5bf79f8146f84fcb106e084ecb062291ebab6ec3
Showing with 1 addition and 3,113 deletions.
  1. +1 −2 admin/_config.php
  2. +0 −1 forms/HtmlEditorConfig.php
  3. +0 −8 thirdparty/tinymce-advcode/.piston.yml
  4. +0 −11 thirdparty/tinymce-advcode/README
  5. +0 −3 thirdparty/tinymce-advcode/README.txt
  6. +0 −29 thirdparty/tinymce-advcode/dialog.html
  7. +0 −41 thirdparty/tinymce-advcode/editor_plugin.js
  8. +0 −41 thirdparty/tinymce-advcode/editor_plugin_src.js
  9. BIN thirdparty/tinymce-advcode/img/html.png
  10. +0 −21 thirdparty/tinymce-advcode/js/codepress/codepress.css
  11. +0 −35 thirdparty/tinymce-advcode/js/codepress/codepress.html
  12. +0 −138 thirdparty/tinymce-advcode/js/codepress/codepress.js
  13. +0 −293 thirdparty/tinymce-advcode/js/codepress/engines/gecko.js
  14. 0 thirdparty/tinymce-advcode/js/codepress/engines/khtml.js
  15. +0 −304 thirdparty/tinymce-advcode/js/codepress/engines/msie.js
  16. +0 −21 thirdparty/tinymce-advcode/js/codepress/engines/older.js
  17. +0 −260 thirdparty/tinymce-advcode/js/codepress/engines/opera.js
  18. BIN thirdparty/tinymce-advcode/js/codepress/images/line-numbers.png
  19. +0 −443 thirdparty/tinymce-advcode/js/codepress/index.html
  20. +0 −71 thirdparty/tinymce-advcode/js/codepress/languages/asp.css
  21. +0 −117 thirdparty/tinymce-advcode/js/codepress/languages/asp.js
  22. +0 −13 thirdparty/tinymce-advcode/js/codepress/languages/autoit.css
  23. +0 −32 thirdparty/tinymce-advcode/js/codepress/languages/autoit.js
  24. +0 −9 thirdparty/tinymce-advcode/js/codepress/languages/csharp.css
  25. +0 −25 thirdparty/tinymce-advcode/js/codepress/languages/csharp.js
  26. +0 −10 thirdparty/tinymce-advcode/js/codepress/languages/css.css
  27. +0 −23 thirdparty/tinymce-advcode/js/codepress/languages/css.js
  28. +0 −9 thirdparty/tinymce-advcode/js/codepress/languages/generic.css
  29. +0 −25 thirdparty/tinymce-advcode/js/codepress/languages/generic.js
  30. +0 −13 thirdparty/tinymce-advcode/js/codepress/languages/html.css
  31. +0 −59 thirdparty/tinymce-advcode/js/codepress/languages/html.js
  32. +0 −7 thirdparty/tinymce-advcode/js/codepress/languages/java.css
  33. +0 −24 thirdparty/tinymce-advcode/js/codepress/languages/java.js
  34. +0 −8 thirdparty/tinymce-advcode/js/codepress/languages/javascript.css
  35. +0 −30 thirdparty/tinymce-advcode/js/codepress/languages/javascript.js
  36. +0 −11 thirdparty/tinymce-advcode/js/codepress/languages/perl.css
  37. +0 −27 thirdparty/tinymce-advcode/js/codepress/languages/perl.js
  38. +0 −12 thirdparty/tinymce-advcode/js/codepress/languages/php.css
  39. +0 −61 thirdparty/tinymce-advcode/js/codepress/languages/php.js
  40. +0 −10 thirdparty/tinymce-advcode/js/codepress/languages/ruby.css
  41. +0 −26 thirdparty/tinymce-advcode/js/codepress/languages/ruby.js
  42. +0 −10 thirdparty/tinymce-advcode/js/codepress/languages/sql.css
  43. +0 −30 thirdparty/tinymce-advcode/js/codepress/languages/sql.js
  44. +0 −5 thirdparty/tinymce-advcode/js/codepress/languages/text.css
  45. +0 −9 thirdparty/tinymce-advcode/js/codepress/languages/text.js
  46. +0 −71 thirdparty/tinymce-advcode/js/codepress/languages/vbscript.css
  47. +0 −117 thirdparty/tinymce-advcode/js/codepress/languages/vbscript.js
  48. +0 −15 thirdparty/tinymce-advcode/js/codepress/languages/xsl.css
  49. +0 −103 thirdparty/tinymce-advcode/js/codepress/languages/xsl.js
  50. +0 −458 thirdparty/tinymce-advcode/js/codepress/license.txt
  51. +0 −15 thirdparty/tinymce-advcode/js/dialog.js
  52. +0 −3 thirdparty/tinymce-advcode/langs/en.js
  53. +0 −4 thirdparty/tinymce-advcode/langs/en_dlg.js
View
@@ -31,8 +31,7 @@
HtmlEditorConfig::get('cms')->enablePlugins(array('ssbuttons' => '../../../cms/javascript/tinymce_ssbuttons/editor_plugin_src.js'));
HtmlEditorConfig::get('cms')->insertButtonsBefore('formatselect', 'styleselect');
-HtmlEditorConfig::get('cms')->insertButtonsBefore('advcode', 'ssimage', 'ssflash', 'sslink', 'unlink', 'anchor', 'separator' );
-HtmlEditorConfig::get('cms')->insertButtonsAfter ('advcode', 'fullscreen', 'separator');
+HtmlEditorConfig::get('cms')->addButtonsToLine(2, 'ssimage', 'ssflash', 'sslink', 'unlink', 'anchor', 'separator','code', 'fullscreen', 'separator');
HtmlEditorConfig::get('cms')->removeButtons('tablecontrols');
HtmlEditorConfig::get('cms')->addButtonsToLine(3, 'tablecontrols');
@@ -93,7 +93,6 @@ static function get_available_configs_map() {
'table' => null,
'emotions' => null,
'paste' => null,
- 'advcode' => '../../../sapphire/thirdparty/tinymce-advcode/editor_plugin_src.js',
'spellchecker' => null
);
@@ -1,8 +0,0 @@
----
-format: 1
-handler:
- commit: 1af68f76ab6bd5008a06706a3cfa02feb7bd4835
- branch: master
-lock: false
-repository_url: git://github.com/dinsley/tinymce-codepress.git
-repository_class: Piston::Git::Repository
@@ -1,11 +0,0 @@
-tinymce-codepress
----------------------
-
-Provides syntax highlighting in the HTML source editing dialog with Codepress.
-
-Installation:
- * Rename directory to 'advcode' in TinyMCE plugins directory.
- * Add 'advcode' plugin to TinyMCE init configuration.
- * Replace the existing source editing button with 'advcode' in your toolbar configuration.
-
-
@@ -1,3 +0,0 @@
-# SilverStripe Update Instructions
-
-Copy editor_plugin.js to editor_plugin_src.js to adhere to TinyMCE conventions, see http://wiki.moxiecode.com/index.php/TinyMCE:Create_plugin/3.x
@@ -1,29 +0,0 @@
-<html>
- <head>
- <title>{#advcode_dlg.title}</title>
- <script type="text/javascript" src="../../thirdparty/tinymce/tiny_mce_popup.js"></script>
- <script type="text/javascript" src="js/dialog.js"></script>
- <script type="text/javascript" src="js/codepress/codepress.js"></script>
- </head>
-
- <body>
- <form name="source" onsubmit="CodeDialog.insert();return false;">
- <textarea id="codepress" class="codepress html linenumbers-on" cols="100" rows="25"></textarea>
- </form>
-
- <div>
- <input type="checkbox" value="1" checked="checked" onclick="codepress.toggleLineNumbers()"/>
- <label>{#advcode_dlg.number_toggle}</label>
- </div>
-
- <div class="mceActionPanel">
- <div style="float: left">
- <input type="button" id="insert" name="insert" value="{#insert}" onclick="CodeDialog.insert();" />
- </div>
-
- <div style="float: right">
- <input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />
- </div>
- </div>
- </body>
-</html>
@@ -1,41 +0,0 @@
-(function() {
- tinymce.PluginManager.requireLangPack('advcode');
-
- tinymce.create('tinymce.plugins.AdvancedCodePlugin', {
- init : function(ed, url) {
- // Register commands
- ed.addCommand('mceAdvancedCode', function() {
- ed.windowManager.open({
- file : url + '/dialog.html',
- width : 750 + parseInt(ed.getLang('advcode.delta_width', 0)),
- height : 450 + parseInt(ed.getLang('advcode.delta_height', 0)),
- inline : 1
- }, {
- plugin_url : url
- });
- });
-
- // Register buttons
- ed.addButton('advcode', {
- title : ed.getLang('advcode.desc', 0),
- cmd : 'mceAdvancedCode',
- image : url + '/img/html.png'
- });
-
- ed.onNodeChange.add(function(ed, cm, n) {});
- },
-
- getInfo : function() {
- return {
- longname : 'Advanced Code Editor',
- author : 'Daniel Insley',
- authorurl : 'http://www.danielinsley.com',
- infourl : 'http://github.com/dinsley/tinymce-codepress/tree/master',
- version : tinymce.majorVersion + "." + tinymce.minorVersion
- };
- }
- });
-
- // Register plugin
- tinymce.PluginManager.add('advcode', tinymce.plugins.AdvancedCodePlugin);
-})();
@@ -1,41 +0,0 @@
-(function() {
- tinymce.PluginManager.requireLangPack('advcode');
-
- tinymce.create('tinymce.plugins.AdvancedCodePlugin', {
- init : function(ed, url) {
- // Register commands
- ed.addCommand('mceAdvancedCode', function() {
- ed.windowManager.open({
- file : url + '/dialog.html',
- width : 750 + parseInt(ed.getLang('advcode.delta_width', 0)),
- height : 450 + parseInt(ed.getLang('advcode.delta_height', 0)),
- inline : 1
- }, {
- plugin_url : url
- });
- });
-
- // Register buttons
- ed.addButton('advcode', {
- title : ed.getLang('advcode.desc', 0),
- cmd : 'mceAdvancedCode',
- image : url + '/img/html.png'
- });
-
- ed.onNodeChange.add(function(ed, cm, n) {});
- },
-
- getInfo : function() {
- return {
- longname : 'Advanced Code Editor',
- author : 'Daniel Insley',
- authorurl : 'http://www.danielinsley.com',
- infourl : 'http://github.com/dinsley/tinymce-codepress/tree/master',
- version : tinymce.majorVersion + "." + tinymce.minorVersion
- };
- }
- });
-
- // Register plugin
- tinymce.PluginManager.add('advcode', tinymce.plugins.AdvancedCodePlugin);
-})();
Binary file not shown.
@@ -1,21 +0,0 @@
-body {
- margin-top:13px;
- _margin-top:14px;
- background:white;
- margin-left:32px;
- font-family:monospace;
- font-size:13px;
- white-space:pre;
- background-image:url("images/line-numbers.png");
- background-repeat:repeat-y;
- background-position:0 3px;
- line-height:16px;
- height:100%;
-}
-pre {margin:0;}
-html>body{background-position:0 2px;}
-P {margin:0;padding:0;border:0;outline:0;display:block;white-space:pre;}
-b, i, s, u, a, em, tt, ins, big, cite, strong, var, dfn {text-decoration:none;font-weight:normal;font-style:normal;font-size:13px;}
-
-body.hide-line-numbers {background:white;margin-left:16px;}
-body.show-line-numbers {background-image:url("images/line-numbers.png");margin-left:32px;}
@@ -1,35 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html>
-<head>
- <title>CodePress - Real Time Syntax Highlighting Editor written in JavaScript</title>
- <meta name="description" content="CodePress - source code editor window" />
-
- <script type="text/javascript">
- var language = 'generic';
- var engine = 'older';
- var ua = navigator.userAgent;
- var ts = (new Date).getTime(); // timestamp to avoid cache
- var lh = location.href;
-
- if(ua.match('MSIE')) engine = 'msie';
- else if(ua.match('KHTML')) engine = 'khtml';
- else if(ua.match('Opera')) engine = 'opera';
- else if(ua.match('Gecko')) engine = 'gecko';
-
- if(lh.match('language=')) language = lh.replace(/.*language=(.*?)(&.*)?$/,'$1');
-
- document.write('<link type="text/css" href="codepress.css?ts='+ts+'" rel="stylesheet" />');
- document.write('<link type="text/css" href="languages/'+language+'.css?ts='+ts+'" rel="stylesheet" id="cp-lang-style" />');
- document.write('<scr'+'ipt type="text/javascript" src="engines/'+engine+'.js?ts='+ts+'"></scr'+'ipt>');
- document.write('<scr'+'ipt type="text/javascript" src="languages/'+language+'.js?ts='+ts+'"></scr'+'ipt>');
- </script>
-
-</head>
-
-<script type="text/javascript">
-if(engine == "msie" || engine == "gecko") document.write('<body><pre> </pre></body>');
-else if(engine == "opera") document.write('<body></body>');
-// else if(engine == "khtml") document.write('<body> </body>');
-</script>
-
-</html>
@@ -1,138 +0,0 @@
-/*
- * CodePress - Real Time Syntax Highlighting Editor written in JavaScript - http://codepress.org/
- *
- * Copyright (C) 2006 Fernando M.A.d.S. <fermads@gmail.com>
- *
- * This program is free software; you can redistribute it and/or modify it under the terms of the
- * GNU Lesser General Public License as published by the Free Software Foundation.
- *
- * Read the full licence: http://www.opensource.org/licenses/lgpl-license.php
- */
-
-CodePress = function(obj) {
- var self = document.createElement('iframe');
- self.textarea = obj;
- self.textarea.disabled = true;
- self.textarea.style.overflow = 'hidden';
- self.style.height = '85%';
- self.style.width = '100%';
- self.textarea.style.overflow = 'auto';
- //self.style.border = '1px solid gray';
- self.frameBorder = 0; // remove IE internal iframe border
- self.style.visibility = 'hidden';
- self.style.position = 'absolute';
- self.options = self.textarea.className;
-
- self.initialize = function() {
- self.editor = self.contentWindow.CodePress;
- self.editor.body = self.contentWindow.document.getElementsByTagName('body')[0];
- self.editor.setCode(self.textarea.value);
- self.setOptions();
- self.editor.syntaxHighlight('init');
- self.textarea.style.display = 'none';
- self.style.position = 'static';
- self.style.visibility = 'visible';
- self.style.display = 'inline';
- }
-
- // obj can by a textarea id or a string (code)
- self.edit = function(obj,language) {
- if(obj) self.textarea.value = document.getElementById(obj) ? document.getElementById(obj).value : obj;
- if(!self.textarea.disabled) return;
- self.language = language ? language : self.getLanguage();
- self.src = CodePress.path+'codepress.html?language='+self.language+'&ts='+(new Date).getTime();
- if(self.attachEvent) self.attachEvent('onload',self.initialize);
- else self.addEventListener('load',self.initialize,false);
- }
-
- self.getLanguage = function() {
- for (language in CodePress.languages)
- if(self.options.match('\\b'+language+'\\b'))
- return CodePress.languages[language] ? language : 'generic';
- }
-
- self.setOptions = function() {
- if(self.options.match('autocomplete-off')) self.toggleAutoComplete();
- if(self.options.match('readonly-on')) self.toggleReadOnly();
- if(self.options.match('linenumbers-off')) self.toggleLineNumbers();
- }
-
- self.getCode = function() {
- return self.textarea.disabled ? self.editor.getCode() : self.textarea.value;
- }
-
- self.setCode = function(code) {
- self.textarea.disabled ? self.editor.setCode(code) : self.textarea.value = code;
- }
-
- self.toggleAutoComplete = function() {
- self.editor.autocomplete = (self.editor.autocomplete) ? false : true;
- }
-
- self.toggleReadOnly = function() {
- self.textarea.readOnly = (self.textarea.readOnly) ? false : true;
- if(self.style.display != 'none') // prevent exception on FF + iframe with display:none
- self.editor.readOnly(self.textarea.readOnly ? true : false);
- }
-
- self.toggleLineNumbers = function() {
- var cn = self.editor.body.className;
- self.editor.body.className = (cn==''||cn=='show-line-numbers') ? 'hide-line-numbers' : 'show-line-numbers';
- }
-
- self.toggleEditor = function() {
- if(self.textarea.disabled) {
- self.textarea.value = self.getCode();
- self.textarea.disabled = false;
- self.style.display = 'none';
- self.textarea.style.display = 'inline';
- }
- else {
- self.textarea.disabled = true;
- self.setCode(self.textarea.value);
- self.editor.syntaxHighlight('init');
- self.style.display = 'inline';
- self.textarea.style.display = 'none';
- }
- }
-
- self.edit();
- return self;
-}
-
-CodePress.languages = {
- csharp : 'C#',
- css : 'CSS',
- generic : 'Generic',
- html : 'HTML',
- java : 'Java',
- javascript : 'JavaScript',
- perl : 'Perl',
- ruby : 'Ruby',
- php : 'PHP',
- text : 'Text',
- sql : 'SQL',
- vbscript : 'VBScript'
-}
-
-
-CodePress.run = function() {
- s = document.getElementsByTagName('script');
- for(var i=0,n=s.length;i<n;i++) {
- if(s[i].src.match('codepress.js')) {
- CodePress.path = s[i].src.replace('codepress.js','');
- }
- }
- t = document.getElementsByTagName('textarea');
- for(var i=0,n=t.length;i<n;i++) {
- if(t[i].className.match('codepress')) {
- id = t[i].id;
- t[i].id = id+'_cp';
- eval(id+' = new CodePress(t[i])');
- t[i].parentNode.insertBefore(eval(id), t[i]);
- }
- }
-}
-
-if(window.attachEvent) window.attachEvent('onload',CodePress.run);
-else window.addEventListener('DOMContentLoaded',CodePress.run,false);
Oops, something went wrong.

0 comments on commit 5bf79f8

Please sign in to comment.