From 7c7d42b5f1c3c9cea62b4a73a97e07cea25f8d30 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Thu, 11 Mar 2010 10:18:11 -0500 Subject: enable tinymce editor --- plugins/TinyMCE/TinyMCEPlugin.php | 96 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 96 insertions(+) create mode 100644 plugins/TinyMCE/TinyMCEPlugin.php (limited to 'plugins/TinyMCE/TinyMCEPlugin.php') diff --git a/plugins/TinyMCE/TinyMCEPlugin.php b/plugins/TinyMCE/TinyMCEPlugin.php new file mode 100644 index 000000000..1d9d4a288 --- /dev/null +++ b/plugins/TinyMCE/TinyMCEPlugin.php @@ -0,0 +1,96 @@ +. + * + * @category WYSIWYG + * @package StatusNet + * @author Evan Prodromou + * @copyright 2010 StatusNet, Inc. + * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0 + * @link http://status.net/ + */ + +if (!defined('STATUSNET')) { + // This check helps protect against security problems; + // your code file can't be executed directly from the web. + exit(1); +} + +/** + * Use TinyMCE library to allow rich text editing in the browser + * + * Converts the notice form in browser to a rich-text editor. + * + * @category WYSIWYG + * @package StatusNet + * @author Evan Prodromou + * @copyright 2010 StatusNet, Inc. + * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0 + * @link http://status.net/ + */ + +class TinyMCEPlugin extends Plugin +{ + function onEndShowScripts($action) + { + if (common_logged_in()) { + $action->script(common_path('plugins/TinyMCE/js/jquery.tinymce.js')); + $action->inlineScript($this->_inlineScript()); + } + + return true; + } + + function onEndShowStyles($action) + { + $action->style('span#notice_data-text_container { float: left }'); + return true; + } + + function onPluginVersion(&$versions) + { + $versions[] = array('name' => 'TinyMCE', + 'version' => STATUSNET_VERSION, + 'author' => 'Evan Prodromou', + 'homepage' => 'http://status.net/wiki/Plugin:TinyMCE', + 'rawdescription' => + _m('Use TinyMCE library to allow rich text editing in the browser')); + return true; + } + + function _inlineScript() + { + $path = common_path('plugins/TinyMCE/js/tiny_mce.js'); + + $scr = <<