From 7a069c1438eb0c6b84e9e93985722a34b4bca4e1 Mon Sep 17 00:00:00 2001 From: Fabio Comuni Date: Wed, 20 Jul 2011 11:08:42 +0200 Subject: [PATCH] Load tinyMCE on post editor only if needed. --- mod/editpost.php | 8 +- view/jot-header.tpl | 137 ++++++++++++++++-------------- view/jot.tpl | 6 +- view/theme/duepuntozero/style.css | 7 ++ view/theme/loozah/style.css | 7 ++ 5 files changed, 98 insertions(+), 67 deletions(-) diff --git a/mod/editpost.php b/mod/editpost.php index cd0bbf2239..c396ee44b0 100644 --- a/mod/editpost.php +++ b/mod/editpost.php @@ -80,7 +80,9 @@ function editpost_content(&$a) { call_hooks('jot_tool', $jotplugins); call_hooks('jot_networks', $jotnets); - $tpl = replace_macros($tpl,array('$jotplugins' => $jotplugins)); + + //$tpl = replace_macros($tpl,array('$jotplugins' => $jotplugins)); + $o .= replace_macros($tpl,array( '$return_path' => $_SESSION['return_url'], @@ -110,10 +112,10 @@ function editpost_content(&$a) { '$lockstate' => $lockstate, '$acl' => '', // populate_acl((($group) ? $group_acl : $a->user), $celeb), '$bang' => (($group) ? '!' : ''), - '$profile_uid' => $_SESSION['uid'] + '$profile_uid' => $_SESSION['uid'], + '$jotplugins' => $jotplugins, )); - return $o; } diff --git a/view/jot-header.tpl b/view/jot-header.tpl index 7e7e393acd..061f6a71dc 100644 --- a/view/jot-header.tpl +++ b/view/jot-header.tpl @@ -1,68 +1,79 @@ @@ -70,11 +81,13 @@ tinyMCE.init({ var ispublic = '$ispublic'; $(document).ready(function() { - $("#profile-jot-acl-wrapper").hide(); - $("a#jot-perms-icon").fancybox({ - 'transitionIn' : 'none', - 'transitionOut' : 'none' - }); + /* enable tinymce on focus */ + $("#profile-jot-text").focus(function(){ + if (editor) return; + $(this).val(""); + initEditor(); + }); + var uploader = new window.AjaxUpload( 'wall-image-upload', diff --git a/view/jot.tpl b/view/jot.tpl index 43c20b90e1..aa9892cbbb 100644 --- a/view/jot.tpl +++ b/view/jot.tpl @@ -15,10 +15,12 @@ - + + + {{ if $content }}{{ endif }} -
+