annotate WebContent/jscripts/tiny_mce/plugins/inlinepopups/editor_plugin_src.js @ 5:0be9d53a6967

editor for annotations
author dwinter
date Tue, 13 Dec 2011 17:43:46 +0100
parents
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 * editor_plugin_src.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() {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
12 var DOM = tinymce.DOM, Element = tinymce.dom.Element, Event = tinymce.dom.Event, each = tinymce.each, is = tinymce.is;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
13
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
14 tinymce.create('tinymce.plugins.InlinePopups', {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
15 init : function(ed, url) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
16 // Replace window manager
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
17 ed.onBeforeRenderUI.add(function() {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
18 ed.windowManager = new tinymce.InlineWindowManager(ed);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
19 DOM.loadCSS(url + '/skins/' + (ed.settings.inlinepopups_skin || 'clearlooks2') + "/window.css");
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
20 });
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
21 },
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
22
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
23 getInfo : function() {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
24 return {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
25 longname : 'InlinePopups',
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
26 author : 'Moxiecode Systems AB',
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
27 authorurl : 'http://tinymce.moxiecode.com',
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
28 infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/inlinepopups',
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
29 version : tinymce.majorVersion + "." + tinymce.minorVersion
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
30 };
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
31 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
32 });
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
33
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
34 tinymce.create('tinymce.InlineWindowManager:tinymce.WindowManager', {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
35 InlineWindowManager : function(ed) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
36 var t = this;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
37
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
38 t.parent(ed);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
39 t.zIndex = 300000;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
40 t.count = 0;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
41 t.windows = {};
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
42 },
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
43
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
44 open : function(f, p) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
45 var t = this, id, opt = '', ed = t.editor, dw = 0, dh = 0, vp, po, mdf, clf, we, w, u, parentWindow;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
46
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
47 f = f || {};
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
48 p = p || {};
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
49
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
50 // Run native windows
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
51 if (!f.inline)
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
52 return t.parent(f, p);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
53
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
54 parentWindow = t._frontWindow();
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
55 if (parentWindow && DOM.get(parentWindow.id + '_ifr')) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
56 parentWindow.focussedElement = DOM.get(parentWindow.id + '_ifr').contentWindow.document.activeElement;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
57 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
58
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
59 // Only store selection if the type is a normal window
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
60 if (!f.type)
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
61 t.bookmark = ed.selection.getBookmark(1);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
62
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
63 id = DOM.uniqueId();
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
64 vp = DOM.getViewPort();
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
65 f.width = parseInt(f.width || 320);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
66 f.height = parseInt(f.height || 240) + (tinymce.isIE ? 8 : 0);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
67 f.min_width = parseInt(f.min_width || 150);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
68 f.min_height = parseInt(f.min_height || 100);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
69 f.max_width = parseInt(f.max_width || 2000);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
70 f.max_height = parseInt(f.max_height || 2000);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
71 f.left = f.left || Math.round(Math.max(vp.x, vp.x + (vp.w / 2.0) - (f.width / 2.0)));
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
72 f.top = f.top || Math.round(Math.max(vp.y, vp.y + (vp.h / 2.0) - (f.height / 2.0)));
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
73 f.movable = f.resizable = true;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
74 p.mce_width = f.width;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
75 p.mce_height = f.height;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
76 p.mce_inline = true;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
77 p.mce_window_id = id;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
78 p.mce_auto_focus = f.auto_focus;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
79
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
80 // Transpose
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
81 // po = DOM.getPos(ed.getContainer());
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
82 // f.left -= po.x;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
83 // f.top -= po.y;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
84
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
85 t.features = f;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
86 t.params = p;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
87 t.onOpen.dispatch(t, f, p);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
88
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
89 if (f.type) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
90 opt += ' mceModal';
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
91
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
92 if (f.type)
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
93 opt += ' mce' + f.type.substring(0, 1).toUpperCase() + f.type.substring(1);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
94
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
95 f.resizable = false;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
96 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
97
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
98 if (f.statusbar)
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
99 opt += ' mceStatusbar';
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
100
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
101 if (f.resizable)
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
102 opt += ' mceResizable';
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
103
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
104 if (f.minimizable)
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
105 opt += ' mceMinimizable';
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
106
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
107 if (f.maximizable)
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
108 opt += ' mceMaximizable';
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
109
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
110 if (f.movable)
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
111 opt += ' mceMovable';
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
112
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
113 // Create DOM objects
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
114 t._addAll(DOM.doc.body,
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
115 ['div', {id : id, role : 'dialog', 'aria-labelledby': f.type ? id + '_content' : id + '_title', 'class' : (ed.settings.inlinepopups_skin || 'clearlooks2') + (tinymce.isIE && window.getSelection ? ' ie9' : ''), style : 'width:100px;height:100px'},
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
116 ['div', {id : id + '_wrapper', 'class' : 'mceWrapper' + opt},
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
117 ['div', {id : id + '_top', 'class' : 'mceTop'},
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
118 ['div', {'class' : 'mceLeft'}],
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
119 ['div', {'class' : 'mceCenter'}],
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
120 ['div', {'class' : 'mceRight'}],
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
121 ['span', {id : id + '_title'}, f.title || '']
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
122 ],
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
123
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
124 ['div', {id : id + '_middle', 'class' : 'mceMiddle'},
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
125 ['div', {id : id + '_left', 'class' : 'mceLeft', tabindex : '0'}],
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
126 ['span', {id : id + '_content'}],
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
127 ['div', {id : id + '_right', 'class' : 'mceRight', tabindex : '0'}]
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
128 ],
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
129
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
130 ['div', {id : id + '_bottom', 'class' : 'mceBottom'},
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
131 ['div', {'class' : 'mceLeft'}],
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
132 ['div', {'class' : 'mceCenter'}],
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
133 ['div', {'class' : 'mceRight'}],
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
134 ['span', {id : id + '_status'}, 'Content']
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
135 ],
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
136
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
137 ['a', {'class' : 'mceMove', tabindex : '-1', href : 'javascript:;'}],
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
138 ['a', {'class' : 'mceMin', tabindex : '-1', href : 'javascript:;', onmousedown : 'return false;'}],
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
139 ['a', {'class' : 'mceMax', tabindex : '-1', href : 'javascript:;', onmousedown : 'return false;'}],
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
140 ['a', {'class' : 'mceMed', tabindex : '-1', href : 'javascript:;', onmousedown : 'return false;'}],
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
141 ['a', {'class' : 'mceClose', tabindex : '-1', href : 'javascript:;', onmousedown : 'return false;'}],
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
142 ['a', {id : id + '_resize_n', 'class' : 'mceResize mceResizeN', tabindex : '-1', href : 'javascript:;'}],
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
143 ['a', {id : id + '_resize_s', 'class' : 'mceResize mceResizeS', tabindex : '-1', href : 'javascript:;'}],
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
144 ['a', {id : id + '_resize_w', 'class' : 'mceResize mceResizeW', tabindex : '-1', href : 'javascript:;'}],
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
145 ['a', {id : id + '_resize_e', 'class' : 'mceResize mceResizeE', tabindex : '-1', href : 'javascript:;'}],
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
146 ['a', {id : id + '_resize_nw', 'class' : 'mceResize mceResizeNW', tabindex : '-1', href : 'javascript:;'}],
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
147 ['a', {id : id + '_resize_ne', 'class' : 'mceResize mceResizeNE', tabindex : '-1', href : 'javascript:;'}],
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
148 ['a', {id : id + '_resize_sw', 'class' : 'mceResize mceResizeSW', tabindex : '-1', href : 'javascript:;'}],
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
149 ['a', {id : id + '_resize_se', 'class' : 'mceResize mceResizeSE', tabindex : '-1', href : 'javascript:;'}]
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
150 ]
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
151 ]
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
152 );
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
153
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
154 DOM.setStyles(id, {top : -10000, left : -10000});
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
155
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
156 // Fix gecko rendering bug, where the editors iframe messed with window contents
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
157 if (tinymce.isGecko)
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
158 DOM.setStyle(id, 'overflow', 'auto');
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
159
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
160 // Measure borders
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
161 if (!f.type) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
162 dw += DOM.get(id + '_left').clientWidth;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
163 dw += DOM.get(id + '_right').clientWidth;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
164 dh += DOM.get(id + '_top').clientHeight;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
165 dh += DOM.get(id + '_bottom').clientHeight;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
166 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
167
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
168 // Resize window
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
169 DOM.setStyles(id, {top : f.top, left : f.left, width : f.width + dw, height : f.height + dh});
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
170
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
171 u = f.url || f.file;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
172 if (u) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
173 if (tinymce.relaxedDomain)
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
174 u += (u.indexOf('?') == -1 ? '?' : '&') + 'mce_rdomain=' + tinymce.relaxedDomain;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
175
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
176 u = tinymce._addVer(u);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
177 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
178
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
179 if (!f.type) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
180 DOM.add(id + '_content', 'iframe', {id : id + '_ifr', src : 'javascript:""', frameBorder : 0, style : 'border:0;width:10px;height:10px'});
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
181 DOM.setStyles(id + '_ifr', {width : f.width, height : f.height});
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
182 DOM.setAttrib(id + '_ifr', 'src', u);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
183 } else {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
184 DOM.add(id + '_wrapper', 'a', {id : id + '_ok', 'class' : 'mceButton mceOk', href : 'javascript:;', onmousedown : 'return false;'}, 'Ok');
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
185
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
186 if (f.type == 'confirm')
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
187 DOM.add(id + '_wrapper', 'a', {'class' : 'mceButton mceCancel', href : 'javascript:;', onmousedown : 'return false;'}, 'Cancel');
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
188
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
189 DOM.add(id + '_middle', 'div', {'class' : 'mceIcon'});
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
190 DOM.setHTML(id + '_content', f.content.replace('\n', '<br />'));
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
191
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
192 Event.add(id, 'keyup', function(evt) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
193 var VK_ESCAPE = 27;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
194 if (evt.keyCode === VK_ESCAPE) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
195 f.button_func(false);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
196 return Event.cancel(evt);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
197 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
198 });
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
199
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
200 Event.add(id, 'keydown', function(evt) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
201 var cancelButton, VK_TAB = 9;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
202 if (evt.keyCode === VK_TAB) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
203 cancelButton = DOM.select('a.mceCancel', id + '_wrapper')[0];
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
204 if (cancelButton && cancelButton !== evt.target) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
205 cancelButton.focus();
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
206 } else {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
207 DOM.get(id + '_ok').focus();
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
208 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
209 return Event.cancel(evt);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
210 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
211 });
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
212 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
213
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
214 // Register events
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
215 mdf = Event.add(id, 'mousedown', function(e) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
216 var n = e.target, w, vp;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
217
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
218 w = t.windows[id];
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
219 t.focus(id);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
220
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
221 if (n.nodeName == 'A' || n.nodeName == 'a') {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
222 if (n.className == 'mceClose') {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
223 t.close(null, id);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
224 return Event.cancel(e);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
225 } else if (n.className == 'mceMax') {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
226 w.oldPos = w.element.getXY();
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
227 w.oldSize = w.element.getSize();
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
228
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
229 vp = DOM.getViewPort();
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
230
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
231 // Reduce viewport size to avoid scrollbars
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
232 vp.w -= 2;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
233 vp.h -= 2;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
234
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
235 w.element.moveTo(vp.x, vp.y);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
236 w.element.resizeTo(vp.w, vp.h);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
237 DOM.setStyles(id + '_ifr', {width : vp.w - w.deltaWidth, height : vp.h - w.deltaHeight});
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
238 DOM.addClass(id + '_wrapper', 'mceMaximized');
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
239 } else if (n.className == 'mceMed') {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
240 // Reset to old size
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
241 w.element.moveTo(w.oldPos.x, w.oldPos.y);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
242 w.element.resizeTo(w.oldSize.w, w.oldSize.h);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
243 w.iframeElement.resizeTo(w.oldSize.w - w.deltaWidth, w.oldSize.h - w.deltaHeight);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
244
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
245 DOM.removeClass(id + '_wrapper', 'mceMaximized');
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
246 } else if (n.className == 'mceMove')
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
247 return t._startDrag(id, e, n.className);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
248 else if (DOM.hasClass(n, 'mceResize'))
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
249 return t._startDrag(id, e, n.className.substring(13));
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
250 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
251 });
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
252
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
253 clf = Event.add(id, 'click', function(e) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
254 var n = e.target;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
255
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
256 t.focus(id);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
257
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
258 if (n.nodeName == 'A' || n.nodeName == 'a') {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
259 switch (n.className) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
260 case 'mceClose':
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
261 t.close(null, id);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
262 return Event.cancel(e);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
263
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
264 case 'mceButton mceOk':
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
265 case 'mceButton mceCancel':
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
266 f.button_func(n.className == 'mceButton mceOk');
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
267 return Event.cancel(e);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
268 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
269 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
270 });
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
271
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
272 // Make sure the tab order loops within the dialog.
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
273 Event.add([id + '_left', id + '_right'], 'focus', function(evt) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
274 var iframe = DOM.get(id + '_ifr');
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
275 if (iframe) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
276 var body = iframe.contentWindow.document.body;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
277 var focusable = DOM.select(':input:enabled,*[tabindex=0]', body);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
278 if (evt.target.id === (id + '_left')) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
279 focusable[focusable.length - 1].focus();
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
280 } else {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
281 focusable[0].focus();
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
282 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
283 } else {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
284 DOM.get(id + '_ok').focus();
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
285 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
286 });
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
287
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
288 // Add window
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
289 w = t.windows[id] = {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
290 id : id,
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
291 mousedown_func : mdf,
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
292 click_func : clf,
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
293 element : new Element(id, {blocker : 1, container : ed.getContainer()}),
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
294 iframeElement : new Element(id + '_ifr'),
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
295 features : f,
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
296 deltaWidth : dw,
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
297 deltaHeight : dh
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
298 };
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
299
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
300 w.iframeElement.on('focus', function() {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
301 t.focus(id);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
302 });
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
303
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
304 // Setup blocker
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
305 if (t.count == 0 && t.editor.getParam('dialog_type', 'modal') == 'modal') {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
306 DOM.add(DOM.doc.body, 'div', {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
307 id : 'mceModalBlocker',
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
308 'class' : (t.editor.settings.inlinepopups_skin || 'clearlooks2') + '_modalBlocker',
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
309 style : {zIndex : t.zIndex - 1}
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
310 });
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
311
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
312 DOM.show('mceModalBlocker'); // Reduces flicker in IE
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
313 DOM.setAttrib(DOM.doc.body, 'aria-hidden', 'true');
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
314 } else
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
315 DOM.setStyle('mceModalBlocker', 'z-index', t.zIndex - 1);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
316
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
317 if (tinymce.isIE6 || /Firefox\/2\./.test(navigator.userAgent) || (tinymce.isIE && !DOM.boxModel))
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
318 DOM.setStyles('mceModalBlocker', {position : 'absolute', left : vp.x, top : vp.y, width : vp.w - 2, height : vp.h - 2});
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
319
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
320 DOM.setAttrib(id, 'aria-hidden', 'false');
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
321 t.focus(id);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
322 t._fixIELayout(id, 1);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
323
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
324 // Focus ok button
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
325 if (DOM.get(id + '_ok'))
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
326 DOM.get(id + '_ok').focus();
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
327 t.count++;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
328
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
329 return w;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
330 },
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
331
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
332 focus : function(id) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
333 var t = this, w;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
334
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
335 if (w = t.windows[id]) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
336 w.zIndex = this.zIndex++;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
337 w.element.setStyle('zIndex', w.zIndex);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
338 w.element.update();
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
339
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
340 id = id + '_wrapper';
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
341 DOM.removeClass(t.lastId, 'mceFocus');
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
342 DOM.addClass(id, 'mceFocus');
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
343 t.lastId = id;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
344
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
345 if (w.focussedElement) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
346 w.focussedElement.focus();
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
347 } else if (DOM.get(id + '_ok')) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
348 DOM.get(w.id + '_ok').focus();
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
349 } else if (DOM.get(w.id + '_ifr')) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
350 DOM.get(w.id + '_ifr').focus();
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
351 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
352 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
353 },
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
354
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
355 _addAll : function(te, ne) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
356 var i, n, t = this, dom = tinymce.DOM;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
357
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
358 if (is(ne, 'string'))
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
359 te.appendChild(dom.doc.createTextNode(ne));
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
360 else if (ne.length) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
361 te = te.appendChild(dom.create(ne[0], ne[1]));
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
362
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
363 for (i=2; i<ne.length; i++)
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
364 t._addAll(te, ne[i]);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
365 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
366 },
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
367
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
368 _startDrag : function(id, se, ac) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
369 var t = this, mu, mm, d = DOM.doc, eb, w = t.windows[id], we = w.element, sp = we.getXY(), p, sz, ph, cp, vp, sx, sy, sex, sey, dx, dy, dw, dh;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
370
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
371 // Get positons and sizes
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
372 // cp = DOM.getPos(t.editor.getContainer());
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
373 cp = {x : 0, y : 0};
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
374 vp = DOM.getViewPort();
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
375
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
376 // Reduce viewport size to avoid scrollbars while dragging
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
377 vp.w -= 2;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
378 vp.h -= 2;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
379
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
380 sex = se.screenX;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
381 sey = se.screenY;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
382 dx = dy = dw = dh = 0;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
383
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
384 // Handle mouse up
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
385 mu = Event.add(d, 'mouseup', function(e) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
386 Event.remove(d, 'mouseup', mu);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
387 Event.remove(d, 'mousemove', mm);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
388
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
389 if (eb)
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
390 eb.remove();
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
391
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
392 we.moveBy(dx, dy);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
393 we.resizeBy(dw, dh);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
394 sz = we.getSize();
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
395 DOM.setStyles(id + '_ifr', {width : sz.w - w.deltaWidth, height : sz.h - w.deltaHeight});
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
396 t._fixIELayout(id, 1);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
397
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
398 return Event.cancel(e);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
399 });
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
400
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
401 if (ac != 'Move')
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
402 startMove();
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
403
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
404 function startMove() {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
405 if (eb)
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
406 return;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
407
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
408 t._fixIELayout(id, 0);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
409
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
410 // Setup event blocker
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
411 DOM.add(d.body, 'div', {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
412 id : 'mceEventBlocker',
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
413 'class' : 'mceEventBlocker ' + (t.editor.settings.inlinepopups_skin || 'clearlooks2'),
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
414 style : {zIndex : t.zIndex + 1}
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
415 });
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
416
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
417 if (tinymce.isIE6 || (tinymce.isIE && !DOM.boxModel))
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
418 DOM.setStyles('mceEventBlocker', {position : 'absolute', left : vp.x, top : vp.y, width : vp.w - 2, height : vp.h - 2});
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
419
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
420 eb = new Element('mceEventBlocker');
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
421 eb.update();
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
422
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
423 // Setup placeholder
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
424 p = we.getXY();
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
425 sz = we.getSize();
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
426 sx = cp.x + p.x - vp.x;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
427 sy = cp.y + p.y - vp.y;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
428 DOM.add(eb.get(), 'div', {id : 'mcePlaceHolder', 'class' : 'mcePlaceHolder', style : {left : sx, top : sy, width : sz.w, height : sz.h}});
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
429 ph = new Element('mcePlaceHolder');
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
430 };
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
431
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
432 // Handle mouse move/drag
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
433 mm = Event.add(d, 'mousemove', function(e) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
434 var x, y, v;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
435
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
436 startMove();
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
437
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
438 x = e.screenX - sex;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
439 y = e.screenY - sey;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
440
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
441 switch (ac) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
442 case 'ResizeW':
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
443 dx = x;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
444 dw = 0 - x;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
445 break;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
446
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
447 case 'ResizeE':
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
448 dw = x;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
449 break;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
450
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
451 case 'ResizeN':
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
452 case 'ResizeNW':
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
453 case 'ResizeNE':
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
454 if (ac == "ResizeNW") {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
455 dx = x;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
456 dw = 0 - x;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
457 } else if (ac == "ResizeNE")
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
458 dw = x;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
459
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
460 dy = y;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
461 dh = 0 - y;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
462 break;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
463
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
464 case 'ResizeS':
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
465 case 'ResizeSW':
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
466 case 'ResizeSE':
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
467 if (ac == "ResizeSW") {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
468 dx = x;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
469 dw = 0 - x;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
470 } else if (ac == "ResizeSE")
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
471 dw = x;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
472
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
473 dh = y;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
474 break;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
475
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
476 case 'mceMove':
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
477 dx = x;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
478 dy = y;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
479 break;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
480 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
481
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
482 // Boundary check
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
483 if (dw < (v = w.features.min_width - sz.w)) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
484 if (dx !== 0)
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
485 dx += dw - v;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
486
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
487 dw = v;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
488 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
489
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
490 if (dh < (v = w.features.min_height - sz.h)) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
491 if (dy !== 0)
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
492 dy += dh - v;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
493
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
494 dh = v;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
495 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
496
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
497 dw = Math.min(dw, w.features.max_width - sz.w);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
498 dh = Math.min(dh, w.features.max_height - sz.h);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
499 dx = Math.max(dx, vp.x - (sx + vp.x));
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
500 dy = Math.max(dy, vp.y - (sy + vp.y));
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
501 dx = Math.min(dx, (vp.w + vp.x) - (sx + sz.w + vp.x));
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
502 dy = Math.min(dy, (vp.h + vp.y) - (sy + sz.h + vp.y));
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
503
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
504 // Move if needed
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
505 if (dx + dy !== 0) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
506 if (sx + dx < 0)
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
507 dx = 0;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
508
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
509 if (sy + dy < 0)
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
510 dy = 0;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
511
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
512 ph.moveTo(sx + dx, sy + dy);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
513 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
514
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
515 // Resize if needed
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
516 if (dw + dh !== 0)
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
517 ph.resizeTo(sz.w + dw, sz.h + dh);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
518
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
519 return Event.cancel(e);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
520 });
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
521
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
522 return Event.cancel(se);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
523 },
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
524
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
525 resizeBy : function(dw, dh, id) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
526 var w = this.windows[id];
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
527
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
528 if (w) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
529 w.element.resizeBy(dw, dh);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
530 w.iframeElement.resizeBy(dw, dh);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
531 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
532 },
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
533
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
534 close : function(win, id) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
535 var t = this, w, d = DOM.doc, fw, id;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
536
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
537 id = t._findId(id || win);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
538
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
539 // Probably not inline
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
540 if (!t.windows[id]) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
541 t.parent(win);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
542 return;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
543 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
544
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
545 t.count--;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
546
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
547 if (t.count == 0) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
548 DOM.remove('mceModalBlocker');
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
549 DOM.setAttrib(DOM.doc.body, 'aria-hidden', 'false');
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
550 t.editor.focus();
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
551 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
552
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
553 if (w = t.windows[id]) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
554 t.onClose.dispatch(t);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
555 Event.remove(d, 'mousedown', w.mousedownFunc);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
556 Event.remove(d, 'click', w.clickFunc);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
557 Event.clear(id);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
558 Event.clear(id + '_ifr');
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
559
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
560 DOM.setAttrib(id + '_ifr', 'src', 'javascript:""'); // Prevent leak
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
561 w.element.remove();
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
562 delete t.windows[id];
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
563
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
564 fw = t._frontWindow();
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
565
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
566 if (fw)
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
567 t.focus(fw.id);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
568 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
569 },
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
570
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
571 // Find front most window
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
572 _frontWindow : function() {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
573 var fw, ix = 0;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
574 // Find front most window and focus that
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
575 each (this.windows, function(w) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
576 if (w.zIndex > ix) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
577 fw = w;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
578 ix = w.zIndex;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
579 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
580 });
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
581 return fw;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
582 },
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
583
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
584 setTitle : function(w, ti) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
585 var e;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
586
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
587 w = this._findId(w);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
588
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
589 if (e = DOM.get(w + '_title'))
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
590 e.innerHTML = DOM.encode(ti);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
591 },
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
592
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
593 alert : function(txt, cb, s) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
594 var t = this, w;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
595
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
596 w = t.open({
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
597 title : t,
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
598 type : 'alert',
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
599 button_func : function(s) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
600 if (cb)
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
601 cb.call(s || t, s);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
602
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
603 t.close(null, w.id);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
604 },
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
605 content : DOM.encode(t.editor.getLang(txt, txt)),
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
606 inline : 1,
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
607 width : 400,
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
608 height : 130
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
609 });
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
610 },
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
611
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
612 confirm : function(txt, cb, s) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
613 var t = this, w;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
614
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
615 w = t.open({
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
616 title : t,
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
617 type : 'confirm',
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
618 button_func : function(s) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
619 if (cb)
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
620 cb.call(s || t, s);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
621
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
622 t.close(null, w.id);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
623 },
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
624 content : DOM.encode(t.editor.getLang(txt, txt)),
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
625 inline : 1,
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
626 width : 400,
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
627 height : 130
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
628 });
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
629 },
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
630
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
631 // Internal functions
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
632
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
633 _findId : function(w) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
634 var t = this;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
635
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
636 if (typeof(w) == 'string')
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
637 return w;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
638
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
639 each(t.windows, function(wo) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
640 var ifr = DOM.get(wo.id + '_ifr');
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
641
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
642 if (ifr && w == ifr.contentWindow) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
643 w = wo.id;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
644 return false;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
645 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
646 });
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
647
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
648 return w;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
649 },
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
650
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
651 _fixIELayout : function(id, s) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
652 var w, img;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
653
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
654 if (!tinymce.isIE6)
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
655 return;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
656
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
657 // Fixes the bug where hover flickers and does odd things in IE6
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
658 each(['n','s','w','e','nw','ne','sw','se'], function(v) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
659 var e = DOM.get(id + '_resize_' + v);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
660
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
661 DOM.setStyles(e, {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
662 width : s ? e.clientWidth : '',
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
663 height : s ? e.clientHeight : '',
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
664 cursor : DOM.getStyle(e, 'cursor', 1)
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
665 });
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
666
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
667 DOM.setStyle(id + "_bottom", 'bottom', '-1px');
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
668
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
669 e = 0;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
670 });
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
671
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
672 // Fixes graphics glitch
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
673 if (w = this.windows[id]) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
674 // Fixes rendering bug after resize
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
675 w.element.hide();
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
676 w.element.show();
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
677
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
678 // Forced a repaint of the window
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
679 //DOM.get(id).style.filter = '';
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
680
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
681 // IE has a bug where images used in CSS won't get loaded
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
682 // sometimes when the cache in the browser is disabled
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
683 // This fix tries to solve it by loading the images using the image object
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
684 each(DOM.select('div,a', id), function(e, i) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
685 if (e.currentStyle.backgroundImage != 'none') {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
686 img = new Image();
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
687 img.src = e.currentStyle.backgroundImage.replace(/url\(\"(.+)\"\)/, '$1');
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
688 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
689 });
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
690
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
691 DOM.get(id).style.filter = '';
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
692 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
693 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
694 });
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
695
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
696 // Register plugin
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
697 tinymce.PluginManager.add('inlinepopups', tinymce.plugins.InlinePopups);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
698 })();
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
699