Apply line height and other configuration to XpressEditor, too

This commit is contained in:
Kijin Sung 2016-04-28 13:34:26 +09:00
parent 40ab69f225
commit 5b9d5f8d89
2 changed files with 35 additions and 3 deletions

View file

@ -2,11 +2,14 @@ if (!window.xe) xe = {};
xe.Editors = [];
function editorStart_xe(editor_sequence, primary_key, content_key, editor_height, colorset, content_style, content_font, content_font_size) {
function editorStart_xe(editor_sequence, primary_key, content_key, editor_height, colorset, content_style, content_font, content_font_size, content_line_height, content_paragraph_spacing, content_word_break) {
if(typeof(colorset)=='undefined') colorset = 'white';
if(typeof(content_style)=='undefined') content_style = 'xeStyle';
if(typeof(content_font)=='undefined') content_font= '';
if(typeof(content_font_size)=='undefined') content_font_size= '';
if(typeof(content_line_height)=='undefined') content_line_height= '';
if(typeof(content_paragraph_spacing)=='undefined') content_paragraph_spacing= '';
if(typeof(content_word_break)=='undefined') content_word_break= '';
var target_src = request_uri+'modules/editor/styles/'+content_style+'/editor.html';
@ -132,7 +135,36 @@ function editorStart_xe(editor_sequence, primary_key, content_key, editor_height
if(content_font_size && !doc.body.style.fontSize) {
doc.body.style.fontSize = content_font_size;
}
if(content_line_height && !doc.body.style.lineHeight) {
doc.body.style.lineHeight = content_line_height;
}
if(content_word_break === "none") {
doc.body.style.whiteSpace = "nowrap";
} else {
doc.body.style.wordBreak = content_word_break ? content_word_break : "normal";
doc.body.style.wordWrap = "break-word";
}
var paragraph_css;
if(!content_paragraph_spacing) {
paragraph_css = '.xe_content.editable p { margin: 0; }';
} else {
paragraph_css = '.xe_content.editable p { margin: 0 0 ' + content_paragraph_spacing + ' 0; }';
}
var style = doc.createElement('style');
style.type = 'text/css';
if (style.styleSheet){
style.styleSheet.cssText = paragraph_css;
} else {
style.appendChild(doc.createTextNode(paragraph_css));
}
var head = doc.head || doc.getElementsByTagName('head')[0];
head.appendChild(style);
if(content_style === "ckeditor_light") {
doc.body.style.margin = "0";
}
// run
oEditor.run();
} catch(e) {