aboutsummaryrefslogtreecommitdiff
path: root/mod/tinymce/views/default/js
diff options
context:
space:
mode:
authorcash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>2011-03-08 03:30:37 +0000
committercash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>2011-03-08 03:30:37 +0000
commit1c35c42c67846f9656b0ef01fcda6dcddd1b2eda (patch)
tree72af774dae318e86bf571c514a74ea6590799795 /mod/tinymce/views/default/js
parent9e0791dd9af93ee65ff8069dd34e423da7691fc0 (diff)
downloadelgg-1c35c42c67846f9656b0ef01fcda6dcddd1b2eda.tar.gz
elgg-1c35c42c67846f9656b0ef01fcda6dcddd1b2eda.tar.bz2
fixed tinymce toggle
git-svn-id: http://code.elgg.org/elgg/trunk@8628 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'mod/tinymce/views/default/js')
-rw-r--r--mod/tinymce/views/default/js/tinymce.php28
1 files changed, 20 insertions, 8 deletions
diff --git a/mod/tinymce/views/default/js/tinymce.php b/mod/tinymce/views/default/js/tinymce.php
index 09fbee2ad..4697e33a7 100644
--- a/mod/tinymce/views/default/js/tinymce.php
+++ b/mod/tinymce/views/default/js/tinymce.php
@@ -1,13 +1,22 @@
elgg.provide('elgg.tinymce');
-elgg.tinymce.toggleEditor = function(id) {
+/**
+ * Toggles the tinymce editor
+ *
+ * @param {Object} event
+ * @return void
+ */
+elgg.tinymce.toggleEditor = function(event) {
+ event.preventDefault();
+
+ var target = $(this).attr('href');
+ var id = $(target).attr('id');
if (!tinyMCE.get(id)) {
tinyMCE.execCommand('mceAddControl', false, id);
- <?php //FIXME This changes all controls on the page!! ?>
- $("a.tinymce-toggle-editor").html(elgg.echo('tinymce:remove'));
+ $(this).html(elgg.echo('tinymce:remove'));
} else {
tinyMCE.execCommand('mceRemoveControl', false, id);
- $("a.tinymce-toggle-editor").html(elgg.echo('tinymce:add'));
+ $(this).html(elgg.echo('tinymce:add'));
}
}
@@ -18,6 +27,13 @@ elgg.tinymce.toggleEditor = function(id) {
* http://tinymce.moxiecode.com/wiki.php/Configuration
*/
elgg.tinymce.init = function() {
+
+ $('.tinymce-toggle-editor').live('click', elgg.tinymce.toggleEditor);
+
+ $('.elgg-input-longtext').parents('form').submit(function() {
+ tinyMCE.triggerSave();
+ });
+
tinyMCE.init({
mode : "specific_textareas",
editor_selector : "elgg-input-longtext",
@@ -52,10 +68,6 @@ elgg.tinymce.init = function() {
content_css: elgg.config.wwwroot + 'mod/tinymce/tinymce_content.css'
});
- $('.elgg-input-longtext').parents('form').submit(function() {
- tinyMCE.triggerSave();
- });
-
}
elgg.register_event_handler('init', 'system', elgg.tinymce.init); \ No newline at end of file