default 에디터 제거

xpresseditor에 default 에디터의 컬러셋 모두 적용후 default 에디터를 대체하도록 함
xpresseidtor의 텍스트등에서 한글 제외 (바꾸기 부분은 아직 미 적용)


git-svn-id: http://xe-core.googlecode.com/svn/sandbox@6104 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
zero 2009-04-14 11:19:24 +00:00
parent 32c3e86b1b
commit 38ea8b89ae
33 changed files with 646 additions and 1164 deletions

View file

@ -246,4 +246,4 @@ stack.push({tag:m2,state:state});}else{var tags=[],t='';if(!stack.length)return'
if(t.state!='deleted')tags.push('</'+t.tag+'>');}while(stack.length&&t.tag!=m2);return tags.join('');}
return'<'+m1+m2+(m3?' '+m3:'')+'>';});if(stack.length){var t='';do{t=stack.pop();if(t.state!='deleted')sContent+='</'+t.tag+'>';}while(stack.length);}
return sContent;},IR_TO:function(sContent){return sContent;}});})(jQuery);xe.XE_Extension=jQuery.Class({name:"XE_Extension",seq:'',$init:function(elAppContainer,editor_sequence){this.seq=editor_sequence;this._assignHTMLObjects(elAppContainer);},_assignHTMLObjects:function(elAppContainer){this.elDropdownLayer=jQuery('DIV.xpress_xeditor_extension_layer',elAppContainer).get(0);},_removeAttrs:function(sContent){sContent=sContent.replace(/<img([^>]*?) xe_handled\s*=\s*".+?"([^>]*?)>/i,'<img$1 $2>');return sContent;},_addEvent:function(){if(this.oApp.getEditingMode()!='WYSIWYG')return;var doc=this.oApp.getWYSIWYGDocument();var seq=this.seq;var fn=function(){var img=jQuery(this);var comp=img.attr('editor_component');if(comp&&jQuery.isFunction(openComponent)){editorPrevNode=img.get(0);openComponent(comp,seq);}};jQuery('img[editor_component]',doc).each(function(){var img=jQuery(this);if(!img.attr('xe_handled')){img.attr('xe_handled','yes').dblclick(fn);}});},$ON_MSG_APP_READY:function(){this.oApp.exec('REGISTER_UI_EVENT',['extension','click','TOGGLE_EXTENSION_LAYER']);this.oApp.addConverter("WYSIWYG_TO_IR",this._removeAttrs);},$ON_TOGGLE_EXTENSION_LAYER:function(){this.oApp.exec('TOGGLE_TOOLBAR_ACTIVE_LAYER',[this.elDropdownLayer]);},$ON_CHANGE_EDITING_MODE:function(mode){this._addEvent();},$ON_PASTE_HTML:function(){this._addEvent();},$ON_LOAD_IR_FIELD:function(){this._addEvent();},$ON_SET_IR:function(){this._addEvent();}});xe.XE_AutoSave=jQuery.Class({name:"XE_AutoSave",form:null,textarea:null,$init:function(oIRTextarea,elAppContainer){this.form=oIRTextarea.form;this.textarea=oIRTextarea;this._assignHTMLObjects(elAppContainer);},_assignHTMLObjects:function(elAppContainer){this.welMessageBox=jQuery('autosave_message');},$ON_MSG_APP_READY:function(){var elTitle=jQuery(this.form._saved_doc_title);var elContent=jQuery(this.form._saved_doc_content);var title=jQuery.trim(elTitle.val());var content=jQuery.trim(elContent.val());if(title||content){if(confirm(this.form._saved_doc_message.value)){jQuery(this.form.title).val(title);this.oApp.setIR(content);}else{editorRemoveSavedDoc();}}
editorEnableAutoSave(this.form,jQuery(this.form).attr("editor_sequence"));this.oApp.exec('REGISTER_HOTKEY',['ctrl+shift+s','AUTO_SAVE']);},$ON_AUTO_SAVE:function(){_editorAutoSave();}});xe.XE_FormatWithSelectUI=jQuery.Class({name:"XE_FormatWithSelectUI",$init:function(elAppContainer){this._assignHTMLObjects(elAppContainer);},_assignHTMLObjects:function(elAppContainer){this.elFormatSelect=jQuery("SELECT.xpress_xeditor_ui_format_select",elAppContainer).get(0);},$ON_MSG_APP_READY:function(){this.oApp.registerBrowserEvent(this.elFormatSelect,"change","SET_FORMAT_FROM_SELECT_UI");this.elFormatSelect.selectedIndex=0;},$ON_MSG_STYLE_CHANGED:function(sAttributeName,sAttributeValue){var blockName=this.oApp.getWYSIWYGDocument().queryCommandValue("FormatBlock");if(!blockName)return(this.elFormatSelect.selectedIndex=0);this.elFormatSelect.value=blockName.toLowerCase();if(this.elFormatSelect.selectedIndex<0)this.elFormatSelect.selectedIndex=0;},$ON_SET_FORMAT_FROM_SELECT_UI:function(){var sFormat=this.elFormatSelect.value;if(!sFormat)return;this.oApp.exec("EXECCOMMAND",["FormatBlock",false,sFormat]);this.oApp.exec("CHECK_STYLE_CHANGE",[]);}});
editorEnableAutoSave(this.form,jQuery(this.form).attr("editor_sequence"));this.oApp.exec('REGISTER_HOTKEY',['ctrl+shift+s','AUTO_SAVE']);},$ON_AUTO_SAVE:function(){_editorAutoSave();}});xe.XE_FormatWithSelectUI=jQuery.Class({name:"XE_FormatWithSelectUI",$init:function(elAppContainer){this._assignHTMLObjects(elAppContainer);},_assignHTMLObjects:function(elAppContainer){this.elFormatSelect=jQuery("SELECT.xpress_xeditor_ui_format_select",elAppContainer).get(0);},$ON_MSG_APP_READY:function(){this.oApp.registerBrowserEvent(this.elFormatSelect,"change","SET_FORMAT_FROM_SELECT_UI");this.elFormatSelect.selectedIndex=0;},$ON_MSG_STYLE_CHANGED:function(sAttributeName,sAttributeValue){var blockName=this.oApp.getWYSIWYGDocument().queryCommandValue("FormatBlock");if(!blockName)return(this.elFormatSelect.selectedIndex=0);this.elFormatSelect.value=blockName.toLowerCase();if(this.elFormatSelect.selectedIndex<0)this.elFormatSelect.selectedIndex=0;},$ON_SET_FORMAT_FROM_SELECT_UI:function(){var sFormat=this.elFormatSelect.value;if(!sFormat)return;this.oApp.exec("EXECCOMMAND",["FormatBlock",false,sFormat]);this.oApp.exec("CHECK_STYLE_CHANGE",[]);}});

View file

@ -2,12 +2,18 @@ if (!window.xe) xe = {};
xe.Editors = [];
function editorStart_xe(editor_sequence, primary_key, content_key, editor_height) {
function editorStart_xe(editor_sequence, primary_key, content_key, editor_height, colorset) {
if(typeof(colorset)=='undefined') colorset = 'white';
var target_src = editor_path+'/blank.html';
if(colorset == 'black') target_src = editor_path+'blank_black.html';
var textarea = jQuery("#xpress-editor-"+editor_sequence);
var iframe = jQuery('<iframe id="editor_iframe_'+editor_sequence+'"frameborder="0" src="'+editor_path+'/blank.html" scrolling="yes" style="z-index:1;width:100%;height:'+editor_height+'px">');
var htmlsrc = jQuery('<textarea rows="10" cols="20" class="input_syntax" style="display:none"></textarea>');
var iframe = jQuery('<iframe id="editor_iframe_'+editor_sequence+'" allowTransparency="true" frameborder="0" src="'+target_src+'" scrolling="yes" style="width:100%;height:'+editor_height+'px">');
var htmlsrc = jQuery('<textarea rows="10" cols="20" class="input_syntax '+colorset+'" style="display:none"></textarea>');
var form = textarea.get(0).form;
form.setAttribute('editor_sequence', editor_sequence);
textarea.css("display","none");
var saved_content = '';
if(jQuery("input[name=content]",form).size()>0){

View file

@ -0,0 +1,41 @@
function editorStartTextarea(editor_sequence, content_key, primary_key) {
var obj = xGetElementById('editor_'+editor_sequence);
var use_html = xGetElementById('htm_'+editor_sequence).value;
obj.form.setAttribute('editor_sequence', editor_sequence);
obj.style.width = '99%';
editorRelKeys[editor_sequence] = new Array();
editorRelKeys[editor_sequence]["primary"] = obj.form[primary_key];
editorRelKeys[editor_sequence]["content"] = obj.form[content_key];
editorRelKeys[editor_sequence]["func"] = editorGetContentTextarea;
var content = obj.form[content_key].value;
if(use_html) {
content = content.replace(/<br([^>]*)>/ig,"\n");
if(use_html!='br') {
content = content.replace(/&lt;/g, "<");
content = content.replace(/&gt;/g, ">");
content = content.replace(/&quot;/g, '"');
content = content.replace(/&amp;/g, "&");
}
}
obj.value = content;
}
function editorGetContentTextarea(editor_sequence) {
var obj = xGetElementById('editor_'+editor_sequence);
var use_html = xGetElementById('htm_'+editor_sequence).value;
var content = obj.value.trim();
if(use_html) {
if(use_html!='br') {
content = content.replace(/&/g, "&amp;");
content = content.replace(/</g, "&lt;");
content = content.replace(/>/g, "&gt;");
content = content.replace(/\"/g, "&quot;");
}
content = content.replace(/(\r\n|\n)/g, "<br />");
}
return content;
}