basic support for plaintext editor configuration (disable tinymce), currently only zero themes - and not all the post tools currently work (as some of them emit html).
This commit is contained in:
parent
76308eca67
commit
2b77002471
2 changed files with 114 additions and 88 deletions
|
@ -838,11 +838,16 @@ function status_editor($a,$x, $notes_cid = 0) {
|
||||||
|
|
||||||
$geotag = (($x['allow_location']) ? get_markup_template('jot_geotag.tpl') : '');
|
$geotag = (($x['allow_location']) ? get_markup_template('jot_geotag.tpl') : '');
|
||||||
|
|
||||||
|
$plaintext = false;
|
||||||
|
if(local_user() && intval(get_pconfig(local_user(),'system','plaintext')))
|
||||||
|
$plaintext = true;
|
||||||
|
|
||||||
$tpl = get_markup_template('jot-header.tpl');
|
$tpl = get_markup_template('jot-header.tpl');
|
||||||
|
|
||||||
$a->page['htmlhead'] .= replace_macros($tpl, array(
|
$a->page['htmlhead'] .= replace_macros($tpl, array(
|
||||||
'$newpost' => 'true',
|
'$newpost' => 'true',
|
||||||
'$baseurl' => $a->get_baseurl(),
|
'$baseurl' => $a->get_baseurl(),
|
||||||
|
'$editselect' => (($plaintext) ? 'none' : '/(profile-jot-text|prvmail-text)/'),
|
||||||
'$geotag' => $geotag,
|
'$geotag' => $geotag,
|
||||||
'$nickname' => $x['nickname'],
|
'$nickname' => $x['nickname'],
|
||||||
'$ispublic' => t('Visible to <strong>everybody</strong>'),
|
'$ispublic' => t('Visible to <strong>everybody</strong>'),
|
||||||
|
@ -878,8 +883,7 @@ function status_editor($a,$x, $notes_cid = 0) {
|
||||||
|
|
||||||
if($mail_enabled) {
|
if($mail_enabled) {
|
||||||
$selected = (($pubmail_enabled) ? ' checked="checked" ' : '');
|
$selected = (($pubmail_enabled) ? ' checked="checked" ' : '');
|
||||||
$jotnets .= '<div class="profile-jot-net"><input type="checkbox" name="pubmail_enable"' . $selected . ' value="1" /> '
|
$jotnets .= '<div class="profile-jot-net"><input type="checkbox" name="pubmail_enable"' . $selected . ' value="1" /> ' . t("Post to Email") . '</div>';
|
||||||
. t("Post to Email") . '</div>';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
call_hooks('jot_tool', $jotplugins);
|
call_hooks('jot_tool', $jotplugins);
|
||||||
|
|
|
@ -3,14 +3,27 @@
|
||||||
|
|
||||||
var editor=false;
|
var editor=false;
|
||||||
var textlen = 0;
|
var textlen = 0;
|
||||||
|
var plaintext = '$editselect';
|
||||||
|
|
||||||
function initEditor(cb){
|
function initEditor(cb){
|
||||||
if (editor==false){
|
if (editor==false){
|
||||||
$("#profile-jot-text-loading").show();
|
$("#profile-jot-text-loading").show();
|
||||||
|
if(plaintext == 'none') {
|
||||||
|
$("#profile-jot-text-loading").hide();
|
||||||
|
$("#profile-jot-text").css({ 'height': 200, 'color': '#000' });
|
||||||
|
$(".jothidden").show();
|
||||||
|
editor = true;
|
||||||
|
$("a#jot-perms-icon").fancybox({
|
||||||
|
'transitionIn' : 'elastic',
|
||||||
|
'transitionOut' : 'elastic'
|
||||||
|
});
|
||||||
|
if (typeof cb!="undefined") cb();
|
||||||
|
return;
|
||||||
|
}
|
||||||
tinyMCE.init({
|
tinyMCE.init({
|
||||||
theme : "advanced",
|
theme : "advanced",
|
||||||
mode : "specific_textareas",
|
mode : "specific_textareas",
|
||||||
editor_selector: /(profile-jot-text|prvmail-text)/,
|
editor_selector: $editselect,
|
||||||
auto_focus: "profile-jot-text",
|
auto_focus: "profile-jot-text",
|
||||||
plugins : "bbcode,paste,autoresize",
|
plugins : "bbcode,paste,autoresize",
|
||||||
theme_advanced_buttons1 : "bold,italic,underline,undo,redo,link,unlink,image,forecolor,formatselect,code",
|
theme_advanced_buttons1 : "bold,italic,underline,undo,redo,link,unlink,image,forecolor,formatselect,code",
|
||||||
|
@ -123,7 +136,7 @@ function enableOnUser(){
|
||||||
name: 'userfile',
|
name: 'userfile',
|
||||||
onSubmit: function(file,ext) { $('#profile-rotator').show(); },
|
onSubmit: function(file,ext) { $('#profile-rotator').show(); },
|
||||||
onComplete: function(file,response) {
|
onComplete: function(file,response) {
|
||||||
tinyMCE.execCommand('mceInsertRawHTML',false,response);
|
addeditortext(response);
|
||||||
$('#profile-rotator').hide();
|
$('#profile-rotator').hide();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -134,7 +147,7 @@ function enableOnUser(){
|
||||||
name: 'userfile',
|
name: 'userfile',
|
||||||
onSubmit: function(file,ext) { $('#profile-rotator').show(); },
|
onSubmit: function(file,ext) { $('#profile-rotator').show(); },
|
||||||
onComplete: function(file,response) {
|
onComplete: function(file,response) {
|
||||||
tinyMCE.execCommand('mceInsertRawHTML',false,response);
|
addeditortext(response);
|
||||||
$('#profile-rotator').hide();
|
$('#profile-rotator').hide();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -167,7 +180,7 @@ function enableOnUser(){
|
||||||
reply = bin2hex(reply);
|
reply = bin2hex(reply);
|
||||||
$('#profile-rotator').show();
|
$('#profile-rotator').show();
|
||||||
$.get('parse_url?binurl=' + reply, function(data) {
|
$.get('parse_url?binurl=' + reply, function(data) {
|
||||||
tinyMCE.execCommand('mceInsertRawHTML',false,data);
|
addeditortext(data);
|
||||||
$('#profile-rotator').hide();
|
$('#profile-rotator').hide();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -176,14 +189,14 @@ function enableOnUser(){
|
||||||
function jotVideoURL() {
|
function jotVideoURL() {
|
||||||
reply = prompt("$vidurl");
|
reply = prompt("$vidurl");
|
||||||
if(reply && reply.length) {
|
if(reply && reply.length) {
|
||||||
tinyMCE.execCommand('mceInsertRawHTML',false,'[video]' + reply + '[/video]');
|
addeditortext('[video]' + reply + '[/video]');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function jotAudioURL() {
|
function jotAudioURL() {
|
||||||
reply = prompt("$audurl");
|
reply = prompt("$audurl");
|
||||||
if(reply && reply.length) {
|
if(reply && reply.length) {
|
||||||
tinyMCE.execCommand('mceInsertRawHTML',false,'[audio]' + reply + '[/audio]');
|
addeditortext('[audio]' + reply + '[/audio]');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -200,7 +213,7 @@ function enableOnUser(){
|
||||||
$.get('share/' + id, function(data) {
|
$.get('share/' + id, function(data) {
|
||||||
if (!editor) $("#profile-jot-text").val("");
|
if (!editor) $("#profile-jot-text").val("");
|
||||||
initEditor(function(){
|
initEditor(function(){
|
||||||
tinyMCE.execCommand('mceInsertRawHTML',false,data);
|
addeditortext(data);
|
||||||
$('#like-rotator-' + id).hide();
|
$('#like-rotator-' + id).hide();
|
||||||
$(window).scrollTop(0);
|
$(window).scrollTop(0);
|
||||||
});
|
});
|
||||||
|
@ -224,7 +237,7 @@ function enableOnUser(){
|
||||||
$.get('parse_url?binurl=' + reply, function(data) {
|
$.get('parse_url?binurl=' + reply, function(data) {
|
||||||
if (!editor) $("#profile-jot-text").val("");
|
if (!editor) $("#profile-jot-text").val("");
|
||||||
initEditor(function(){
|
initEditor(function(){
|
||||||
tinyMCE.execCommand('mceInsertRawHTML',false,data);
|
addeditortext(data);
|
||||||
$('#profile-rotator').hide();
|
$('#profile-rotator').hide();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -253,6 +266,15 @@ function enableOnUser(){
|
||||||
$('#profile-nolocation-wrapper').hide();
|
$('#profile-nolocation-wrapper').hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function addeditortext(data) {
|
||||||
|
if(plaintext == 'none') {
|
||||||
|
var currentText = $("#profile-jot-text").val();
|
||||||
|
$("#profile-jot-text").val(currentText + data);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
tinyMCE.execCommand('mceInsertRawHTML',false,data);
|
||||||
|
}
|
||||||
|
|
||||||
$geotag
|
$geotag
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
Loading…
Reference in a new issue