annotate WebContent/jscripts/tiny_mce/plugins/xhtmlxtras/js/del.js @ 8:11baadcdd2c8

start of new Annotator API implementation.
author casties
date Mon, 19 Mar 2012 14:50:28 +0100
parents 0be9d53a6967
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
5
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1 /**
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
2 * del.js
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
3 *
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
4 * Copyright 2009, Moxiecode Systems AB
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
5 * Released under LGPL License.
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
6 *
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
7 * License: http://tinymce.moxiecode.com/license
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
8 * Contributing: http://tinymce.moxiecode.com/contributing
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
9 */
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
10
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
11 function init() {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
12 SXE.initElementDialog('del');
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
13 if (SXE.currentAction == "update") {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
14 setFormValue('datetime', tinyMCEPopup.editor.dom.getAttrib(SXE.updateElement, 'datetime'));
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
15 setFormValue('cite', tinyMCEPopup.editor.dom.getAttrib(SXE.updateElement, 'cite'));
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
16 SXE.showRemoveButton();
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
17 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
18 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
19
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
20 function setElementAttribs(elm) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
21 setAllCommonAttribs(elm);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
22 setAttrib(elm, 'datetime');
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
23 setAttrib(elm, 'cite');
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
24 elm.removeAttribute('data-mce-new');
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
25 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
26
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
27 function insertDel() {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
28 var elm = tinyMCEPopup.editor.dom.getParent(SXE.focusElement, 'DEL');
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
29
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
30 if (elm == null) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
31 var s = SXE.inst.selection.getContent();
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
32 if(s.length > 0) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
33 insertInlineElement('del');
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
34 var elementArray = SXE.inst.dom.select('del[data-mce-new]');
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
35 for (var i=0; i<elementArray.length; i++) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
36 var elm = elementArray[i];
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
37 setElementAttribs(elm);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
38 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
39 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
40 } else {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
41 setElementAttribs(elm);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
42 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
43 tinyMCEPopup.editor.nodeChanged();
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
44 tinyMCEPopup.execCommand('mceEndUndoLevel');
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
45 tinyMCEPopup.close();
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
46 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
47
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
48 function removeDel() {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
49 SXE.removeElement('del');
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
50 tinyMCEPopup.close();
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
51 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
52
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
53 tinyMCEPopup.onInit.add(init);