bgneal@45: /** bgneal@45: * $Id: editor_plugin_src.js 42 2006-08-08 14:32:24Z spocke $ bgneal@45: * bgneal@45: * @author Moxiecode - based on work by Andrew Tetlaw bgneal@45: * @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved. bgneal@45: */ bgneal@45: bgneal@45: function init() { bgneal@45: SXE.initElementDialog('ins'); bgneal@45: if (SXE.currentAction == "update") { bgneal@45: setFormValue('datetime', tinyMCEPopup.editor.dom.getAttrib(SXE.updateElement, 'datetime')); bgneal@45: setFormValue('cite', tinyMCEPopup.editor.dom.getAttrib(SXE.updateElement, 'cite')); bgneal@45: SXE.showRemoveButton(); bgneal@45: } bgneal@45: } bgneal@45: bgneal@45: function setElementAttribs(elm) { bgneal@45: setAllCommonAttribs(elm); bgneal@45: setAttrib(elm, 'datetime'); bgneal@45: setAttrib(elm, 'cite'); bgneal@45: } bgneal@45: bgneal@45: function insertIns() { bgneal@45: var elm = tinyMCEPopup.editor.dom.getParent(SXE.focusElement, 'INS'); bgneal@45: tinyMCEPopup.execCommand('mceBeginUndoLevel'); bgneal@45: if (elm == null) { bgneal@45: var s = SXE.inst.selection.getContent(); bgneal@45: if(s.length > 0) { bgneal@45: insertInlineElement('INS'); bgneal@45: var elementArray = tinymce.grep(SXE.inst.dom.select('ins'), function(n) {return n.id == '#sxe_temp_ins#';}); bgneal@45: for (var i=0; i<elementArray.length; i++) { bgneal@45: var elm = elementArray[i]; bgneal@45: setElementAttribs(elm); bgneal@45: } bgneal@45: } bgneal@45: } else { bgneal@45: setElementAttribs(elm); bgneal@45: } bgneal@45: tinyMCEPopup.editor.nodeChanged(); bgneal@45: tinyMCEPopup.execCommand('mceEndUndoLevel'); bgneal@45: tinyMCEPopup.close(); bgneal@45: } bgneal@45: bgneal@45: function removeIns() { bgneal@45: SXE.removeElement('ins'); bgneal@45: tinyMCEPopup.close(); bgneal@45: } bgneal@45: bgneal@45: function insertInlineElement(en) { bgneal@45: var ed = tinyMCEPopup.editor, dom = ed.dom; bgneal@45: bgneal@45: ed.getDoc().execCommand('FontName', false, 'mceinline'); bgneal@45: tinymce.each(dom.select(tinymce.isWebKit ? 'span' : 'font'), function(n) { bgneal@45: if (n.style.fontFamily == 'mceinline' || n.face == 'mceinline') bgneal@45: dom.replace(dom.create(en), n, 1); bgneal@45: }); bgneal@45: } bgneal@45: bgneal@45: tinyMCEPopup.onInit.add(init);