mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-05-04 17:44:38 +09:00
#19518918 단락편집기를 XE Core로 통합
git-svn-id: http://xe-core.googlecode.com/svn/sandbox@8081 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
78b6b26d6c
commit
c63410745a
84 changed files with 11289 additions and 102 deletions
|
|
@ -5519,127 +5519,42 @@ xe.XE_XHTMLFormatter = $.Class({
|
|||
|
||||
// remove all useless tag and enclose tags
|
||||
regex = /<(\/)?([:\w\/-]+)(.*?)>/ig;
|
||||
sContent = sContent.replace(regex, function(m0,m1,m2,m3){
|
||||
sContent = sContent.replace(regex, function(m0,closing,tag,attrs){
|
||||
var m3s = [];
|
||||
var state = '';
|
||||
|
||||
m1 = m1 || '';
|
||||
m2 = m2.toLowerCase();
|
||||
m3 = $.trim(m3 || '');
|
||||
closing = closing || '';
|
||||
tag = tag.toLowerCase();
|
||||
attrs = $.trim(attrs || '');
|
||||
|
||||
if (!m1) {
|
||||
if ($.inArray(m2,lonely_tags) >= 0) {
|
||||
var len = m3.length;
|
||||
if (m2 == 'br') m3 = '';
|
||||
if (!m3 || m3.substring(len-1,len) != '/') m3 += '/';
|
||||
if (!closing) {
|
||||
if ($.inArray(tag,lonely_tags) >= 0) {
|
||||
var len = attrs.length;
|
||||
if (tag == 'br') attrs = '';
|
||||
if (!attrs || attrs.substring(len-1,len) != '/') attrs += '/';
|
||||
|
||||
return '<'+m2+' '+m3+'>';
|
||||
}
|
||||
|
||||
/*
|
||||
if (replace_tags[m2]) {
|
||||
stack.push({tag:m2, state:'deleted'});
|
||||
|
||||
m2 = replace_tags[m2];
|
||||
state = 'inserted';
|
||||
} else if (m2 == 'font') {
|
||||
stack.push({tag:m2, state:'deleted'});
|
||||
|
||||
m2 = 'span';
|
||||
m3s = [];
|
||||
if (regex_font_color.test(m3)) m3s.push('color:'+(RegExp.$1||RegExp.$2||RegExp.$3)+';');
|
||||
if (regex_font_face.test(m3)) m3s.push('font-family:'+(RegExp.$1||RegExp.$2||RegExp.$3)+';');
|
||||
|
||||
m3 = m3s.length?'style="'+m3s.join('')+'"':'';
|
||||
state = 'inserted';
|
||||
} else if (m2 == 'center') {
|
||||
stack.push({tag:m2, state:'deleted'});
|
||||
|
||||
m2 = 'div'
|
||||
m3 = 'style="text-align:center"';
|
||||
|
||||
state = 'inserted';
|
||||
} else if (m2 == 'span') {
|
||||
var style = '';
|
||||
|
||||
if (!m3) {
|
||||
stack.push({tag:m3, state:'deleted'});
|
||||
return '';
|
||||
}
|
||||
|
||||
if (regex_style.test(m3)) {
|
||||
var tmpstack = [];
|
||||
var tmptag = '';
|
||||
|
||||
style = RegExp.$1||RegExp.$2||RegExp.$3;
|
||||
m3 = m3.replace(regex_style, '');
|
||||
|
||||
if (regex_font_weight.test(style)) {
|
||||
if (RegExp.$1 == 'bold' || RegExp.$1 == 'bolder') {
|
||||
style = style.replace(regex_font_weight, '');
|
||||
tmpstack.push({tag:'strong', state:'inserted'});
|
||||
tmptag += '<strong>';
|
||||
}
|
||||
}
|
||||
|
||||
if (regex_font_style.test(style)) {
|
||||
style = style.replace(regex_font_style, '');
|
||||
tmpstack.push({tag:'em', state:'inserted'});
|
||||
tmptag += '<em>';
|
||||
}
|
||||
|
||||
if (regex_font_decoration.test(style)) {
|
||||
var deco_css = ' '+RegExp.$1.toLowerCase()+' ';
|
||||
|
||||
if (deco_css.indexOf('underline ') > 0) {
|
||||
deco_css = deco_css.replace('underline ', '');
|
||||
tmpstack.push({tag:'u', state:'inserted'});
|
||||
tmptag += '<u>';
|
||||
}
|
||||
|
||||
if (deco_css.indexOf('line-through ') > 0) {
|
||||
deco_css = deco_css.replace('line-through ', '');
|
||||
tmpstack.push({tag:'del', state:'inserted'});
|
||||
tmptag += '<del>';
|
||||
}
|
||||
|
||||
deco_css = $.trim(deco_css);
|
||||
style = style.replace(regex_font_decoration, (deco_css?'text-decoration:'+deco_css+';':''));
|
||||
}
|
||||
|
||||
style = $.trim(style);
|
||||
|
||||
stack.push({tag:m2, state:(!m3&&!style?'deleted':'')});
|
||||
stack = stack.concat(tmpstack);
|
||||
|
||||
return (!m3&&!style?'':'<span '+m3+' style="'+style+'">')+tmptag;
|
||||
}
|
||||
return '<'+tag+' '+$.trim(attrs)+'>';
|
||||
} else {
|
||||
state = ($.inArray(m2,allow_tags) < 0)?'deleted':'';
|
||||
if (state == 'deleted') return '';
|
||||
stack[stack.length] = {tag:tag, state:state};
|
||||
}
|
||||
*/
|
||||
|
||||
stack.push({tag:m2, state:state});
|
||||
} else {
|
||||
var tags = [], t = '';
|
||||
|
||||
// remove unnecessary closing tag
|
||||
if (!stack.length) return '';
|
||||
|
||||
do {
|
||||
t = stack.pop();
|
||||
if (t.state != 'inserted' && t.tag != m2) {
|
||||
stack.push(t);
|
||||
return tags.join('');
|
||||
}
|
||||
if (t.tag != tag) continue;
|
||||
if (t.state != 'deleted') tags.push('</'+t.tag+'>');
|
||||
} while(stack.length && t.tag != m2);
|
||||
} while(stack.length && t.tag != tag);
|
||||
|
||||
return tags.join('');
|
||||
}
|
||||
|
||||
return '<'+m1+m2+(m3?' '+m3:'')+'>';
|
||||
return '<'+closing+tag+(attrs?' '+attrs:'')+'>';
|
||||
});
|
||||
/*
|
||||
if (stack.length) {
|
||||
var t = '';
|
||||
|
||||
|
|
@ -5648,6 +5563,7 @@ xe.XE_XHTMLFormatter = $.Class({
|
|||
if (t.state != 'deleted') sContent += '</'+t.tag+'>';
|
||||
} while(stack.length);
|
||||
}
|
||||
*/
|
||||
|
||||
return sContent;
|
||||
},
|
||||
|
|
|
|||
|
|
@ -307,4 +307,4 @@ xe.XE_Preview = jQuery.Class({
|
|||
$ON_EVENT_PREVIEW : function() {
|
||||
// TODO : 버튼이 눌렸을 때의 동작 정의
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue