2012-09-26 21:13:11 +02:00
|
|
|
|
2012-09-15 17:38:59 +02:00
|
|
|
tinyMCE.init({
|
|
|
|
// General options
|
|
|
|
mode : "textareas",
|
|
|
|
theme : "advanced",
|
2016-01-09 20:10:27 +01:00
|
|
|
plugins : "autolink,lists,spellchecker,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,dynastiecolor,dynastieinclude",
|
2012-09-15 17:38:59 +02:00
|
|
|
editor_selector : "mceAdvanced",
|
|
|
|
encoding : "raw",
|
|
|
|
entities : "",
|
|
|
|
entity_encoding : "raw",
|
2012-11-13 18:33:38 +01:00
|
|
|
valid_elements : '*[*]',
|
|
|
|
preformatted : true,
|
2012-09-15 17:38:59 +02:00
|
|
|
|
|
|
|
// Theme options
|
|
|
|
theme_advanced_buttons1 : "bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,formatselect,fontselect,fontsizeselect",
|
|
|
|
theme_advanced_buttons2 : "bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,insertdate,inserttime,preview,|,forecolor,backcolor",
|
2016-01-09 20:10:27 +01:00
|
|
|
theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,charmap,emotions,iespell,media,advhr,dynastiecolor,dynastieinclude",
|
2012-09-15 17:38:59 +02:00
|
|
|
// theme_advanced_buttons4 : "insertlayer,moveforward,movebackward,absolute,|,styleprops,spellchecker,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,blockquote,pagebreak,|,insertfile,insertimage",
|
|
|
|
theme_advanced_toolbar_location : "top",
|
|
|
|
theme_advanced_toolbar_align : "left",
|
|
|
|
theme_advanced_statusbar_location : "bottom",
|
|
|
|
theme_advanced_resizing : true,
|
2012-09-26 21:13:11 +02:00
|
|
|
width: "60%",
|
|
|
|
height: "400",
|
|
|
|
|
2013-03-24 09:13:41 +01:00
|
|
|
theme_advanced_font_sizes: "14px,16px,18px,20px",
|
|
|
|
font_size_style_values : "14px,16px,18px,20px",
|
|
|
|
content_css : "../../static/js/tinymce/jscripts/tiny_mce/themes/advanced/skins/default/custom_content.css",
|
|
|
|
|
2012-09-26 21:13:11 +02:00
|
|
|
external_image_list_url : external_list,
|
2012-09-15 17:38:59 +02:00
|
|
|
|
|
|
|
});
|
|
|
|
|
2012-11-08 21:23:30 +01:00
|
|
|
function previewPost(blog_id)
|
2012-09-15 17:38:59 +02:00
|
|
|
{
|
|
|
|
var w = (screen.width * 80)/100;
|
|
|
|
var h = (screen.height * 80)/100;
|
|
|
|
var t = (screen.height - h) / 2;
|
|
|
|
var l = (screen.width - w) / 2;
|
|
|
|
var form = document.getElementById("previewForm");
|
|
|
|
var action = form.action;
|
|
|
|
var target = form.target;
|
|
|
|
|
|
|
|
form.action="/preview/" + blog_id;
|
|
|
|
form.target="PreviewPost";
|
|
|
|
|
|
|
|
window.open('/preview', 'PreviewPost', 'width=w, height=h, resizable=yes, scrollbars=yes, location=no, directories=no, status=yes, menubar=no, copyhistory=no, screenX=l, screenY=t');
|
|
|
|
|
|
|
|
form.submit();
|
|
|
|
form.action = action;
|
|
|
|
form.target = target;
|
|
|
|
}
|
2013-11-03 09:17:24 +01:00
|
|
|
|
|
|
|
function addTag()
|
|
|
|
{
|
|
|
|
text_tags = document.getElementById('id_text_tags');
|
|
|
|
avail_tags = document.getElementById('available_tags');
|
|
|
|
|
|
|
|
cur_elem = avail_tags.selectedIndex;
|
|
|
|
|
|
|
|
cur_elem = (cur_elem >= 0) ? avail_tags.options[cur_elem].value : "";
|
|
|
|
|
|
|
|
if(cur_elem != "" && text_tags.value.indexOf(cur_elem) == -1)
|
|
|
|
{
|
|
|
|
if (text_tags.value.length > 0)
|
|
|
|
text_tags.value += ", " + cur_elem;
|
|
|
|
else
|
|
|
|
text_tags.value = cur_elem;
|
|
|
|
}
|
2014-01-04 13:43:38 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
function switchEditor()
|
|
|
|
{
|
|
|
|
options = document.getElementById("editor");
|
|
|
|
help = document.getElementById("markdown_help");
|
|
|
|
|
|
|
|
if (options.selectedIndex == 0) // HTML
|
|
|
|
{
|
|
|
|
tinyMCE.execCommand('mceAddControl', false, 'content');
|
|
|
|
help.style.display="none";
|
|
|
|
// tinymce.execCommand('mceToggleEditor',true,'content');
|
|
|
|
} else // Text
|
|
|
|
{
|
|
|
|
tinyMCE.execCommand('mceRemoveControl', false, 'content');
|
|
|
|
help.style.display="block";
|
|
|
|
// tinymce.execCommand('mceToggleEditor',false,'content');
|
|
|
|
}
|
2016-01-09 20:10:27 +01:00
|
|
|
}
|