1
0
Fork 0

Load tinyMCE on post editor only if needed.

This commit is contained in:
Fabio Comuni 2011-07-20 11:08:42 +02:00
parent 11d1d309c2
commit 7a069c1438
5 changed files with 98 additions and 67 deletions

View file

@ -80,7 +80,9 @@ function editpost_content(&$a) {
call_hooks('jot_tool', $jotplugins); call_hooks('jot_tool', $jotplugins);
call_hooks('jot_networks', $jotnets); call_hooks('jot_networks', $jotnets);
$tpl = replace_macros($tpl,array('$jotplugins' => $jotplugins));
//$tpl = replace_macros($tpl,array('$jotplugins' => $jotplugins));
$o .= replace_macros($tpl,array( $o .= replace_macros($tpl,array(
'$return_path' => $_SESSION['return_url'], '$return_path' => $_SESSION['return_url'],
@ -110,10 +112,10 @@ function editpost_content(&$a) {
'$lockstate' => $lockstate, '$lockstate' => $lockstate,
'$acl' => '', // populate_acl((($group) ? $group_acl : $a->user), $celeb), '$acl' => '', // populate_acl((($group) ? $group_acl : $a->user), $celeb),
'$bang' => (($group) ? '!' : ''), '$bang' => (($group) ? '!' : ''),
'$profile_uid' => $_SESSION['uid'] '$profile_uid' => $_SESSION['uid'],
'$jotplugins' => $jotplugins,
)); ));
return $o; return $o;
} }

View file

@ -1,10 +1,11 @@
<script language="javascript" type="text/javascript"> <script language="javascript" type="text/javascript">
var editor; var editor=false;
var textlen = 0; var textlen = 0;
function initEditor(){
$("#profile-jot-text-loading").show();
tinyMCE.init({ tinyMCE.init({
theme : "advanced", theme : "advanced",
mode : "specific_textareas", mode : "specific_textareas",
@ -58,11 +59,21 @@ tinyMCE.init({
ed.onInit.add(function(ed) { ed.onInit.add(function(ed) {
ed.pasteAsPlainText = true; ed.pasteAsPlainText = true;
$("#profile-jot-text-loading").hide();
$("#profile-jot-submit-wrapper").show();
}); });
} }
}); });
editor = true;
// setup acl popup
$("#profile-jot-acl-wrapper").hide();
$("a#jot-perms-icon").fancybox({
'transitionIn' : 'none',
'transitionOut' : 'none'
});
}
</script> </script>
<script type="text/javascript" src="include/ajaxupload.js" ></script> <script type="text/javascript" src="include/ajaxupload.js" ></script>
@ -70,12 +81,14 @@ tinyMCE.init({
var ispublic = '$ispublic'; var ispublic = '$ispublic';
$(document).ready(function() { $(document).ready(function() {
$("#profile-jot-acl-wrapper").hide(); /* enable tinymce on focus */
$("a#jot-perms-icon").fancybox({ $("#profile-jot-text").focus(function(){
'transitionIn' : 'none', if (editor) return;
'transitionOut' : 'none' $(this).val("");
initEditor();
}); });
var uploader = new window.AjaxUpload( var uploader = new window.AjaxUpload(
'wall-image-upload', 'wall-image-upload',
{ action: 'wall_upload/$nickname', { action: 'wall_upload/$nickname',

View file

@ -15,10 +15,12 @@
<input type="hidden" name="title" id="jot-title" value="" /> <input type="hidden" name="title" id="jot-title" value="" />
<input type="hidden" name="post_id" value="$post_id" /> <input type="hidden" name="post_id" value="$post_id" />
<textarea rows="5" cols="64" class="profile-jot-text" id="profile-jot-text" name="body" >$content</textarea> <img id="profile-jot-text-loading" src="images/rotator.gif" alt="$wait" title="$wait" style="display: none;" />
<textarea rows="5" cols="64" class="profile-jot-text" id="profile-jot-text" name="body" >{{ if $content }}$content{{ else }}$share{{ endif }}</textarea>
{{ if $content }}<script>initEditor();</script>{{ endif }}
<div id="profile-jot-submit-wrapper" > <div id="profile-jot-submit-wrapper" style="display:none">
<input type="submit" id="profile-jot-submit" name="submit" value="$share" /> <input type="submit" id="profile-jot-submit" name="submit" value="$share" />
<div id="profile-upload-wrapper" style="display: $visitor;" > <div id="profile-upload-wrapper" style="display: $visitor;" >
<div id="wall-image-upload-div" ><a href="#" onclick="return false;" id="wall-image-upload" class="icon camera" title="$upload"></a></div> <div id="wall-image-upload-div" ><a href="#" onclick="return false;" id="wall-image-upload" class="icon camera" title="$upload"></a></div>

View file

@ -1483,6 +1483,13 @@ input#dfrn-url {
width: 180px; width: 180px;
} }
#profile-jot-text {
height: 20px;
color:#cccccc;
border: 1px solid #cccccc;
}
/** acl **/ /** acl **/
#profile-jot-acl-wrapper{ #profile-jot-acl-wrapper{

View file

@ -1561,6 +1561,13 @@ padding: 5px 10px 0px;
overflow: auto; overflow: auto;
} }
#profile-jot-text {
height: 20px;
color:#cccccc;
border: 1px solid #cccccc;
}
/** acl **/ /** acl **/
#profile-jot-acl-wrapper{ #profile-jot-acl-wrapper{
display:block!important; display:block!important;