1 | /** |
---|
2 | * $Id: editor_plugin_src.js 42 2006-08-08 14:32:24Z spocke $ |
---|
3 | * |
---|
4 | * @author Moxiecode - based on work by Andrew Tetlaw |
---|
5 | * @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved. |
---|
6 | */ |
---|
7 | |
---|
8 | function init() { |
---|
9 | SXE.initElementDialog('ins'); |
---|
10 | if (SXE.currentAction == "update") { |
---|
11 | setFormValue('datetime', tinyMCEPopup.editor.dom.getAttrib(SXE.updateElement, 'datetime')); |
---|
12 | setFormValue('cite', tinyMCEPopup.editor.dom.getAttrib(SXE.updateElement, 'cite')); |
---|
13 | SXE.showRemoveButton(); |
---|
14 | } |
---|
15 | } |
---|
16 | |
---|
17 | function setElementAttribs(elm) { |
---|
18 | setAllCommonAttribs(elm); |
---|
19 | setAttrib(elm, 'datetime'); |
---|
20 | setAttrib(elm, 'cite'); |
---|
21 | } |
---|
22 | |
---|
23 | function insertIns() { |
---|
24 | var elm = tinyMCEPopup.editor.dom.getParent(SXE.focusElement, 'INS'); |
---|
25 | tinyMCEPopup.execCommand('mceBeginUndoLevel'); |
---|
26 | if (elm == null) { |
---|
27 | var s = SXE.inst.selection.getContent(); |
---|
28 | if(s.length > 0) { |
---|
29 | tinyMCEPopup.execCommand('mceInsertContent', false, '<ins id="#sxe_temp_ins#">' + s + '</ins>'); |
---|
30 | var elementArray = tinymce.grep(SXE.inst.dom.select('ins'), function(n) {return n.id == '#sxe_temp_ins#';}); |
---|
31 | for (var i=0; i<elementArray.length; i++) { |
---|
32 | var elm = elementArray[i]; |
---|
33 | setElementAttribs(elm); |
---|
34 | } |
---|
35 | } |
---|
36 | } else { |
---|
37 | setElementAttribs(elm); |
---|
38 | } |
---|
39 | tinyMCEPopup.editor.nodeChanged(); |
---|
40 | tinyMCEPopup.execCommand('mceEndUndoLevel'); |
---|
41 | tinyMCEPopup.close(); |
---|
42 | } |
---|
43 | |
---|
44 | function removeIns() { |
---|
45 | SXE.removeElement('ins'); |
---|
46 | tinyMCEPopup.close(); |
---|
47 | } |
---|
48 | |
---|
49 | tinyMCEPopup.onInit.add(init); |
---|