Forked from megamattron/jquery.jeditable.tinymce.js
Last active
July 18, 2016 05:45
-
-
Save 3lc0nd3/942148e389ea2b40b030353db18c0ba2 to your computer and use it in GitHub Desktop.
JEditable TinyMCE custom input plugin
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
/* | |
* Wysiwyg input for Jeditable | |
* | |
* Copyright (c) 2008 Mika Tuupola | |
* | |
* Licensed under the MIT license: | |
* http://www.opensource.org/licenses/mit-license.php | |
* | |
* Depends on jWYSIWYG plugin by Juan M Martinez: | |
* http://projects.bundleweb.com.ar/jWYSIWYG/ | |
* | |
* Project home: | |
* http://www.appelsiini.net/projects/jeditable | |
* | |
* Revision: $Id$ | |
* | |
*/ | |
$.editable.addInputType('mce', { | |
element:function (settings, original) { | |
var textarea = $('<textarea id="' + $(original).attr("id") + '_mce"/>'); | |
if (settings.rows) { | |
textarea.attr('rows', settings.rows); | |
} else { | |
textarea.height(settings.height); | |
} | |
if (settings.cols) { | |
textarea.attr('cols', settings.cols); | |
} else { | |
console.log("Text area width: " + settings.width); | |
textarea.width(settings.width); | |
} | |
$(this).append(textarea); | |
return(textarea); | |
}, | |
plugin:function (settings, original) { | |
tinyMCE.execCommand("mceAddEditor", false, $(original).attr("id") + '_mce'); | |
}, | |
submit:function (settings, original) { | |
tinyMCE.triggerSave(); | |
tinyMCE.execCommand("mceRemoveEditor", true, $(original).attr("id") + '_mce'); | |
}, | |
reset:function (settings, original) { | |
tinyMCE.execCommand("mceRemoveEditor", true, $(original).attr("id") + '_mce'); | |
original.reset(this); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
For TinyMCE 4.xxx You should use:
mceAddEditor
mceRemoveEditor instead of:
mceAddControl
mceRemoveControl