Created
June 1, 2011 18:06
-
-
Save mkuklis/1002898 to your computer and use it in GitHub Desktop.
TINYeditor
This file contains hidden or 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
var editor = new TINY.editor.edit('editor', { | |
id: "editor", | |
width: 400, | |
height:200, | |
cssclass:'te', | |
controlclass:'tecontrol', | |
rowclass:'teheader', | |
dividerclass:'tedivider', | |
controls:['bold','italic','link','unlink','image','orderedlist','unorderedlist','undo','redo'], | |
footer:false, | |
fonts:['Verdana','Arial','Georgia','Trebuchet MS'], | |
xhtml:true, | |
cssfile:'/stylesheets/tinyeditor/tinyeditor.css', | |
bodyid:'editor', | |
footerclass:'tefooter', | |
toggle:{text:'source',activetext:'wysiwyg',cssclass:'toggle'}, | |
resize:{cssclass:'resize'} | |
}); | |
// bind on key up | |
$(editor.i.contentWindow.document).keyup(function(e) { | |
$('#textarea').val($(this).find("#editor").html())); | |
}); | |
// bind to paste event | |
$(editor.i.contentWindow.document).bind('paste', function(e) { | |
setTimeout(function() { | |
$('#textarea').val($(editor).find("#editor").html()); | |
}, 100); | |
}); | |
// bind when buttons are used | |
$(".tecontrol").bind("click", function() { | |
var html = $(editor.i.contentWindow.document.body)[0].innerHTML; | |
$('#textarea').val(html); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment