Created
April 18, 2011 15:57
-
-
Save thurloat/925599 to your computer and use it in GitHub Desktop.
Control Freak script to replace the default ZenDesk tinyMCE loaded on a page with a more better / full featured one.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* advanced toolbar tinyMCE replacer for ZenDesk. | |
*/ | |
// remove all existing editors from the page. | |
var editor_types = ['entry_body', 'post_body']; | |
for (var i=0; i < editor_types.length; i++) { | |
if (tinyMCE.editors[editor_types[i]] !== undefined){ | |
tinyMCE.editors[editor_types[i]].remove(); | |
} | |
}; | |
// boot up our new editor in it's place. | |
tinyMCE.init( | |
{ | |
convert_urls : false, | |
mode : "exact", | |
elements : editor_types.join(','), | |
theme : "advanced", | |
entities : "160,nbsp,34,quot,162,cent,8364,euro,163,pound,165,yen,169,copy,174,reg,8482,trade,8240,permil,60,lt,62,gt,8804,le,8805,ge,176,deg,8722,minus", | |
button_tile_map : true, | |
plugins : "safari,zd_advimage,fullscreen,visualchars,table,paste,media", | |
theme_advanced_buttons1 : "undo,redo,removeformat,|,formatselect,|,bold,italic,underline,strikethrough,sub,sup,|,outdent,indent,bullist,numlist,hr|,link,unlink,charmap,image", | |
theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,separator,tablecontrols,separator,cleanup,code,fullscreen,media", | |
theme_advanced_buttons3 : "", | |
theme_advanced_toolbar_location : "top", | |
theme_advanced_toolbar_align : "left", | |
theme_advanced_path_location : "bottom", | |
theme_advanced_blockformats : "p,h1,h2,h3,h4,blockquote,pre", | |
paste_auto_cleanup_on_paste : false, | |
gecko_spellcheck : true, | |
extended_valid_elements : "s,a[name|href|target|title|onclick|class|rel],img[class|src|style|border=0|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name],hr[class|width|size|noshade],span[class|align|style],font[color|size],iframe[src|style|width|height],script[charset|defer|language|src|type],div[id|class|style],form[name|id|action|method|enctype|accept-charset|onsubmit|onreset|target|class|style],input[id|name|type|value|size|maxlength|checked|accept|src|width|height|disabled|readonly|tabindex|accesskey|onfocus|onblur|onchange|onselect|class|style|autocomplete],textarea[id|name|rows|cols|disabled|readonly|tabindex|accesskey|onfocus|onblur|onchange|onselect|class|style],option[name|id|value|class|style],select[id|name|type|value|size|maxlength|checked|accept|src|width|height|disabled|readonly|tabindex|accesskey|onfocus|onblur|onchange|onselect|length|options|selectedIndex|class|style],object[width|height|classid|codebase|style|type|data|title],param[name|value],embed[src|type|width|height|flashvars|wmode|allowscriptaccess|allowfullscreen]", | |
theme_advanced_resizing : true, | |
theme_advanced_resize_horizontal : false, | |
body_class : "user_formatted entry content", | |
setupcontent_callback : function (editor_id, body, doc) { | |
body.style.background = 'white'; | |
if (typeof(doc.importNode) === 'function') { | |
$$('style').each(function(style){ | |
doc.getElementsByTagName('head')[0].appendChild(doc.importNode(style, true)); | |
}); | |
} | |
if (typeof(doc.addEventListener) === 'function') { | |
doc.addEventListener('keydown', function(event){ | |
InputTracking.trackElement.call(body, event); | |
}, false); | |
} | |
}, | |
content_css : "https://xobni.zendesk.com/stylesheets/zd_all_users.css?version=128" | |
} | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment