includes/clientside/tinymce/plugins/xhtmlxtras/js/element_common.js
changeset 778 57ce13805b6f
parent 588 20484deb89cd
child 1193 e3b94bd055dc
equal deleted inserted replaced
777:488665d49417 778:57ce13805b6f
   158 			tagName = element_name;
   158 			tagName = element_name;
   159 
   159 
   160 			if (tinymce.isIE && element_name.indexOf('html:') == 0)
   160 			if (tinymce.isIE && element_name.indexOf('html:') == 0)
   161 				element_name = element_name.substring(5).toLowerCase();
   161 				element_name = element_name.substring(5).toLowerCase();
   162 
   162 
   163 			h = '<' + tagName + ' id="#sxe_temp_' + element_name + '#">' + s + '</' + tagName + '>';
   163 			insertInlineElement(element_name);
   164 
   164 			var elementArray = tinymce.grep(SXE.inst.dom.select(element_name));
   165 			tinyMCEPopup.execCommand('mceInsertContent', false, h);
       
   166 
       
   167 			var elementArray = tinymce.grep(SXE.inst.dom.select(element_name), function(n) {return n.id == '#sxe_temp_' + element_name + '#';});
       
   168 			for (var i=0; i<elementArray.length; i++) {
   165 			for (var i=0; i<elementArray.length; i++) {
   169 				var elm = elementArray[i];
   166 				var elm = elementArray[i];
   170 
   167 
   171 				elm.id = '';
   168 				if (SXE.inst.dom.getAttrib(elm, '_mce_new')) {
   172 				elm.setAttribute('id', '');
   169 					elm.id = '';
   173 				elm.removeAttribute('id');
   170 					elm.setAttribute('id', '');
   174 
   171 					elm.removeAttribute('id');
   175 				setAllCommonAttribs(elm);
   172 					elm.removeAttribute('_mce_new');
       
   173 
       
   174 					setAllCommonAttribs(elm);
       
   175 				}
   176 			}
   176 			}
   177 		}
   177 		}
   178 	} else {
   178 	} else {
   179 		setAllCommonAttribs(elm);
   179 		setAllCommonAttribs(elm);
   180 	}
   180 	}
   217 
   217 
   218 SXE.addClass = function(elm,cl) {
   218 SXE.addClass = function(elm,cl) {
   219 	if(!SXE.containsClass(elm,cl)) elm.className ? elm.className += " " + cl : elm.className = cl;
   219 	if(!SXE.containsClass(elm,cl)) elm.className ? elm.className += " " + cl : elm.className = cl;
   220 	return true;
   220 	return true;
   221 }
   221 }
       
   222 
       
   223 function insertInlineElement(en) {
       
   224 	var ed = tinyMCEPopup.editor, dom = ed.dom;
       
   225 
       
   226 	ed.getDoc().execCommand('FontName', false, 'mceinline');
       
   227 	tinymce.each(dom.select(tinymce.isWebKit ? 'span' : 'font'), function(n) {
       
   228 		if (n.style.fontFamily == 'mceinline' || n.face == 'mceinline')
       
   229 			dom.replace(dom.create(en, {_mce_new : 1}), n, 1);
       
   230 	});
       
   231 }