fix "resend" function when editor is disabled
This commit is contained in:
parent
096ecba883
commit
5c9eb19767
1 changed files with 77 additions and 69 deletions
|
@ -4,75 +4,78 @@
|
||||||
var editor=false;
|
var editor=false;
|
||||||
var textlen = 0;
|
var textlen = 0;
|
||||||
|
|
||||||
function initEditor(){
|
function initEditor(cb){
|
||||||
$("#profile-jot-text-loading").show();
|
if (editor==false){
|
||||||
tinyMCE.init({
|
$("#profile-jot-text-loading").show();
|
||||||
theme : "advanced",
|
tinyMCE.init({
|
||||||
mode : "specific_textareas",
|
theme : "advanced",
|
||||||
editor_selector: /(profile-jot-text|prvmail-text)/,
|
mode : "specific_textareas",
|
||||||
plugins : "bbcode,paste,autoresize",
|
editor_selector: /(profile-jot-text|prvmail-text)/,
|
||||||
theme_advanced_buttons1 : "bold,italic,underline,undo,redo,link,unlink,image,forecolor,formatselect,code",
|
plugins : "bbcode,paste,autoresize",
|
||||||
theme_advanced_buttons2 : "",
|
theme_advanced_buttons1 : "bold,italic,underline,undo,redo,link,unlink,image,forecolor,formatselect,code",
|
||||||
theme_advanced_buttons3 : "",
|
theme_advanced_buttons2 : "",
|
||||||
theme_advanced_toolbar_location : "top",
|
theme_advanced_buttons3 : "",
|
||||||
theme_advanced_toolbar_align : "center",
|
theme_advanced_toolbar_location : "top",
|
||||||
theme_advanced_blockformats : "blockquote,code",
|
theme_advanced_toolbar_align : "center",
|
||||||
paste_text_sticky : true,
|
theme_advanced_blockformats : "blockquote,code",
|
||||||
entity_encoding : "raw",
|
paste_text_sticky : true,
|
||||||
add_unload_trigger : false,
|
entity_encoding : "raw",
|
||||||
remove_linebreaks : false,
|
add_unload_trigger : false,
|
||||||
force_p_newlines : false,
|
remove_linebreaks : false,
|
||||||
force_br_newlines : true,
|
force_p_newlines : false,
|
||||||
forced_root_block : '',
|
force_br_newlines : true,
|
||||||
convert_urls: false,
|
forced_root_block : '',
|
||||||
content_css: "$baseurl/view/custom_tinymce.css",
|
convert_urls: false,
|
||||||
theme_advanced_path : false,
|
content_css: "$baseurl/view/custom_tinymce.css",
|
||||||
setup : function(ed) {
|
theme_advanced_path : false,
|
||||||
//Character count
|
setup : function(ed) {
|
||||||
ed.onKeyUp.add(function(ed, e) {
|
//Character count
|
||||||
var txt = tinyMCE.activeEditor.getContent();
|
ed.onKeyUp.add(function(ed, e) {
|
||||||
textlen = txt.length;
|
var txt = tinyMCE.activeEditor.getContent();
|
||||||
if(textlen != 0 && $('#jot-perms-icon').is('.unlock')) {
|
textlen = txt.length;
|
||||||
$('#profile-jot-desc').html(ispublic);
|
if(textlen != 0 && $('#jot-perms-icon').is('.unlock')) {
|
||||||
}
|
$('#profile-jot-desc').html(ispublic);
|
||||||
else {
|
}
|
||||||
$('#profile-jot-desc').html(' ');
|
else {
|
||||||
}
|
$('#profile-jot-desc').html(' ');
|
||||||
|
}
|
||||||
|
|
||||||
if(textlen <= 140) {
|
if(textlen <= 140) {
|
||||||
$('#character-counter').removeClass('red');
|
$('#character-counter').removeClass('red');
|
||||||
$('#character-counter').removeClass('orange');
|
$('#character-counter').removeClass('orange');
|
||||||
$('#character-counter').addClass('grey');
|
$('#character-counter').addClass('grey');
|
||||||
}
|
}
|
||||||
if((textlen > 140) && (textlen <= 420)) {
|
if((textlen > 140) && (textlen <= 420)) {
|
||||||
$('#character-counter').removeClass('grey');
|
$('#character-counter').removeClass('grey');
|
||||||
$('#character-counter').removeClass('red');
|
$('#character-counter').removeClass('red');
|
||||||
$('#character-counter').addClass('orange');
|
$('#character-counter').addClass('orange');
|
||||||
}
|
}
|
||||||
if(textlen > 420) {
|
if(textlen > 420) {
|
||||||
$('#character-counter').removeClass('grey');
|
$('#character-counter').removeClass('grey');
|
||||||
$('#character-counter').removeClass('orange');
|
$('#character-counter').removeClass('orange');
|
||||||
$('#character-counter').addClass('red');
|
$('#character-counter').addClass('red');
|
||||||
}
|
}
|
||||||
$('#character-counter').text(textlen);
|
$('#character-counter').text(textlen);
|
||||||
});
|
});
|
||||||
|
|
||||||
ed.onInit.add(function(ed) {
|
ed.onInit.add(function(ed) {
|
||||||
ed.pasteAsPlainText = true;
|
ed.pasteAsPlainText = true;
|
||||||
$("#profile-jot-text-loading").hide();
|
$("#profile-jot-text-loading").hide();
|
||||||
$("#profile-jot-submit-wrapper").show();
|
$("#profile-jot-submit-wrapper").show();
|
||||||
});
|
if (typeof cb!="undefined") cb();
|
||||||
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
editor = true;
|
editor = true;
|
||||||
|
// setup acl popup
|
||||||
// setup acl popup
|
$("a#jot-perms-icon").fancybox({
|
||||||
$("#profile-jot-acl-wrapper").hide();
|
'transitionIn' : 'none',
|
||||||
$("a#jot-perms-icon").fancybox({
|
'transitionOut' : 'none'
|
||||||
'transitionIn' : 'none',
|
});
|
||||||
'transitionOut' : 'none'
|
} else {
|
||||||
});
|
if (typeof cb!="undefined") cb();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
@ -181,12 +184,17 @@ function initEditor(){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function jotShare(id) {
|
function jotShare(id) {
|
||||||
$('#like-rotator-' + id).show();
|
$('#like-rotator-' + id).show();
|
||||||
|
|
||||||
$.get('share/' + id, function(data) {
|
$.get('share/' + id, function(data) {
|
||||||
tinyMCE.execCommand('mceInsertRawHTML',false,data);
|
initEditor(function(){
|
||||||
$('#like-rotator-' + id).hide();
|
tinyMCE.execCommand('mceInsertRawHTML',false,data);
|
||||||
$(window).scrollTop(0);
|
$('#like-rotator-' + id).hide();
|
||||||
|
$(window).scrollTop(0);
|
||||||
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue