|
36 | 36 | xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
37 | 37 | <binding id="exchWebServiceEditor">
|
38 | 38 |
|
39 |
| - <content> |
| 39 | + <!-- CSS needed to correctly display color buttons (font and background) --> |
| 40 | + <resources> |
| 41 | + <stylesheet src="chrome://messenger/skin/messengercompose/messengercompose.css" /> |
| 42 | + </resources> |
| 43 | + |
| 44 | + <content> |
40 | 45 |
|
41 | 46 | <xul:vbox flex="1">
|
42 | 47 | <xul:toolbox anonid="FormatToolbox" mode="icons">
|
|
105 | 110 | state="state_all"/>
|
106 | 111 | <xul:toolbarseparator class="toolbarseparator-standard"/>
|
107 | 112 | <xul:toolbaritem class="formatting-button">
|
108 |
| - <xul:stack align="enter" state="rgb(102,102,102)"> |
| 113 | + <xul:stack align="center" state="rgb(102,102,102)"> |
109 | 114 | <xul:box style="background-color:#FFFFFF"
|
110 | 115 | anonid="cmd_backgroundColor"
|
111 | 116 | class="color-button"
|
|
192 | 197 | flex="1"/>
|
193 | 198 | </xul:vbox>
|
194 | 199 |
|
195 |
| - </content> |
| 200 | + </content> |
196 | 201 | <implementation>
|
197 | 202 | <constructor><![CDATA[
|
198 |
| - this.editorElement = document.getAnonymousElementByAttribute(this, "anonid", "editor"); |
199 | 203 | var self=this;
|
| 204 | +
|
| 205 | + // To be able to set correct HTML content |
| 206 | + this.globalFunctions = Components.classes["@1st-setup.nl/global/functions;1"] |
| 207 | + .getService(Components.interfaces.mivFunctions); |
| 208 | +
|
| 209 | + this.editorElement = document.getAnonymousElementByAttribute(this, "anonid", "editor"); |
200 | 210 | if (this.editorElement) {
|
201 | 211 | this.commandManager = this.editorElement.commandManager;
|
202 | 212 | this.editorClickFunction = function(aEvent) { self.onClickEditor(aEvent);};
|
203 |
| - this.editorElement.addEventListener("click", this.editorClickFunction, true); |
| 213 | + this.editorElement.addEventListener("click", this.editorClickFunction, false); |
204 | 214 |
|
205 | 215 | this.editorDblClickFunction = function(aEvent) { self.onDblClickEditor(aEvent);};
|
206 |
| - this.editorElement.addEventListener("dblclick", this.editorDblClickFunction, true); |
| 216 | + this.editorElement.addEventListener("dblclick", this.editorDblClickFunction, false); |
207 | 217 |
|
208 | 218 | this.editorKeyPressFunction = function(aEvent) { self.onKeyPressEditor(aEvent);};
|
209 |
| - this.editorElement.addEventListener("keyup", this.editorKeyPressFunction, true); |
| 219 | + this.editorElement.addEventListener("keyup", this.editorKeyPressFunction, false); |
210 | 220 |
|
211 | 221 | this.editorMouseOver = function(aEvent) { self.onMouseOver(aEvent);};
|
212 |
| - this.editorMouseOut = function(aEvent) { self.onMouseOut(aEvent);}; |
213 |
| -
|
214 | 222 | this.editorElement.addEventListener("mouseover", this.editorMouseOver , false);
|
| 223 | +
|
| 224 | + this.editorMouseOut = function(aEvent) { self.onMouseOut(aEvent);}; |
215 | 225 | this.editorElement.addEventListener("mouseout", this.editorMouseOut, false);
|
216 | 226 |
|
| 227 | + // Set default document to empty HTML content |
| 228 | + this.editorElement.contentDocument.documentElement.innerHTML = this.globalFunctions.fromText2HTML(null); |
217 | 229 | }
|
218 | 230 |
|
219 | 231 | this.atomService = Components.classes["@mozilla.org/atom-service;1"]
|
220 | 232 | .getService(Components.interfaces.nsIAtomService);
|
221 | 233 |
|
222 |
| - // Set initial content to empty HTML body |
223 |
| - this.globalFunctions = Components.classes["@1st-setup.nl/global/functions;1"] |
224 |
| - .getService(Components.interfaces.mivFunctions); |
225 |
| - this.editorElement.contentDocument.documentElement.innerHTML = this.globalFunctions.fromText2HTML(null); |
| 234 | + this.connectAllCommandListenerToolbar("FormatToolbar"); |
226 | 235 |
|
227 |
| - this.connectButtons("FormatToolbar"); |
228 | 236 | // Connect color button
|
229 | 237 | this.bgColorFunction = function(){ self.selectColor("cmd_backgroundColor");};
|
230 | 238 | var bgColorElement = document.getAnonymousElementByAttribute(this, "anonid", "cmd_backgroundColor")
|
231 |
| - bgColorElement.addEventListener("click", this.bgColorFunction, true); |
| 239 | + bgColorElement.addEventListener("click", this.bgColorFunction, false); |
232 | 240 |
|
233 | 241 | this.fontColorFunction = function(){ self.selectColor("cmd_fontColor");};
|
234 | 242 | var fontColorElement = document.getAnonymousElementByAttribute(this, "anonid", "cmd_fontColor")
|
235 |
| - fontColorElement.addEventListener("click", this.fontColorFunction, true); |
| 243 | + fontColorElement.addEventListener("click", this.fontColorFunction, false); |
236 | 244 |
|
237 | 245 | this.highlightColor = "#FFFFFF";
|
238 | 246 | this.fontColor = "#000000";
|
239 | 247 |
|
240 |
| - // Fill fontfac popup menu |
| 248 | + // Connect FontFace popup menu |
241 | 249 | this.menuPopupFunction = function(event){ self.selectFont("cmd_fontFace", event.target.value);};
|
242 | 250 | this.menuPopup = document.getAnonymousElementByAttribute(this, "anonid", "fontFaceSelect");
|
243 |
| - this.menuPopup.addEventListener("command", this.menuPopupFunction, true); |
| 251 | + this.menuPopup.addEventListener("command", this.menuPopupFunction, false); |
244 | 252 | this.fillFontFace();
|
245 | 253 |
|
| 254 | + // Connect HyperLink buttons |
246 | 255 | this.addLinkFunction = function(){ self.addLink();};
|
247 | 256 | var addLinkElement = document.getAnonymousElementByAttribute(this, "anonid", "cmd_add_link")
|
248 |
| - addLinkElement.addEventListener("click", this.addLinkFunction, true); |
| 257 | + addLinkElement.addEventListener("click", this.addLinkFunction, false); |
249 | 258 |
|
250 | 259 | this.removeLinkFunction = function(){ self.removeLink();};
|
251 | 260 | var removeLinkElement = document.getAnonymousElementByAttribute(this, "anonid", "cmd_remove_link")
|
252 |
| - removeLinkElement.addEventListener("click", this.removeLinkFunction, true); |
| 261 | + removeLinkElement.addEventListener("click", this.removeLinkFunction, false); |
253 | 262 |
|
254 | 263 | this.editLinkFunction = function(){ self.editLink();};
|
255 | 264 | var editLinkElement = document.getAnonymousElementByAttribute(this, "anonid", "cmd_edit_link")
|
256 |
| - editLinkElement.addEventListener("click", this.editLinkFunction, true); |
| 265 | + editLinkElement.addEventListener("click", this.editLinkFunction, false); |
257 | 266 | ]]></constructor>
|
258 | 267 |
|
259 | 268 | <destructor><![CDATA[
|
260 | 269 | if (this.editorElement) {
|
261 | 270 | this.editorElement.removeEventListener("click", this.editorClickFunction, false);
|
262 | 271 | this.editorElement.removeEventListener("keyup", this.editorKeyPressFunction, false);
|
263 | 272 |
|
264 |
| - this.editorElement.removeEventListener("dblclick", this.editorDblClickFunction, true); |
| 273 | + this.editorElement.removeEventListener("dblclick", this.editorDblClickFunction, false); |
265 | 274 |
|
266 | 275 | this.editorElement.removeEventListener("mouseover", this.editorMouseOver , false);
|
267 | 276 | this.editorElement.removeEventListener("mouseout", this.editorMouseOut, false);
|
268 | 277 | }
|
269 |
| - this.disconnectButtons("FormatToolbar"); |
270 |
| - document.getAnonymousElementByAttribute(this, "anonid", "cmd_backgroundColor").removeEventListener("click", this.bgColorFunction, false); |
271 |
| - document.getAnonymousElementByAttribute(this, "anonid", "cmd_fontColor").removeEventListener("click", this.fontColorFunction, false); |
| 278 | +
|
| 279 | + this.removeAllCommandListenerToolbar("FormatToolbar"); |
| 280 | +
|
| 281 | + // Disconnect color button |
| 282 | + document.getAnonymousElementByAttribute(this, "anonid", "cmd_backgroundColor") |
| 283 | + .removeEventListener("click", this.bgColorFunction, false); |
| 284 | + document.getAnonymousElementByAttribute(this, "anonid", "cmd_fontColor") |
| 285 | + .removeEventListener("click", this.fontColorFunction, false); |
| 286 | +
|
| 287 | + // Disconnect Font face button |
272 | 288 | if (this.menuPopupFunction) {
|
273 | 289 | this.menuPopup.removeEventListener("command", this.menuPopupFunction, false);
|
274 | 290 | }
|
275 |
| - document.getAnonymousElementByAttribute(this, "anonid", "cmd_add_link").removeEventListener("click", this.addLinkFunction, true); |
276 |
| - document.getAnonymousElementByAttribute(this, "anonid", "cmd_remove_link").removeEventListener("click", this.removeLinkFunction, true); |
277 |
| - document.getAnonymousElementByAttribute(this, "anonid", "cmd_edit_link").removeEventListener("click", this.editLinkFunction, true); |
| 291 | +
|
| 292 | + // Disconnect HyperLink buttons |
| 293 | + document.getAnonymousElementByAttribute(this, "anonid", "cmd_add_link") |
| 294 | + .removeEventListener("click", this.addLinkFunction, false); |
| 295 | + document.getAnonymousElementByAttribute(this, "anonid", "cmd_remove_link") |
| 296 | + .removeEventListener("click", this.removeLinkFunction, false); |
| 297 | + document.getAnonymousElementByAttribute(this, "anonid", "cmd_edit_link") |
| 298 | + .removeEventListener("click", this.editLinkFunction, false); |
278 | 299 | ]]></destructor>
|
279 | 300 |
|
280 | 301 | <property name="content">
|
|
328 | 349 | ]]></body>
|
329 | 350 | </method>
|
330 | 351 |
|
331 |
| - <method name="connectButtons"> |
| 352 | + <method name="connectAllCommandListenerToolbar"> |
332 | 353 | <parameter name="aAnonId" />
|
333 | 354 | <body><![CDATA[
|
334 | 355 | var toolbar = document.getAnonymousElementByAttribute(this, "anonid", aAnonId);
|
|
341 | 362 | var toolbarButtons = toolbar.getElementsByTagName("xul:toolbarbutton");
|
342 | 363 | for (var i=0; i<toolbarButtons.length;i++) {
|
343 | 364 | if ((toolbarButtons[i].hasAttribute("connect")) && (toolbarButtons[i].getAttribute("connect") === "true")) {
|
344 |
| - this.connectButton(toolbarButtons[i].getAttribute("anonid"), aAnonId); |
| 365 | + this.addCommandListener(toolbarButtons[i].getAttribute("anonid"), aAnonId); |
345 | 366 | }
|
346 | 367 | }
|
347 | 368 | }
|
348 | 369 | ]]></body>
|
349 | 370 | </method>
|
350 | 371 |
|
351 |
| - <method name="connectButton"> |
| 372 | + <method name="addCommandListener"> |
352 | 373 | <parameter name="aAnonId" />
|
353 | 374 | <parameter name="aStore" />
|
354 | 375 | <body><![CDATA[
|
|
358 | 379 | this.functions[aStore] = {};
|
359 | 380 | }
|
360 | 381 | this.functions[aStore][aAnonId] = function() { self.toggleButton(aAnonId);};
|
361 |
| - document.getAnonymousElementByAttribute(this, "anonid", aAnonId).addEventListener("command", this.functions[aStore][aAnonId], true); |
| 382 | + document.getAnonymousElementByAttribute(this, "anonid", aAnonId).addEventListener("command", this.functions[aStore][aAnonId], false); |
362 | 383 | ]]></body>
|
363 | 384 | </method>
|
364 | 385 |
|
365 |
| - <method name="disconnectButtons"> |
| 386 | + <method name="removeAllCommandListenerToolbar"> |
366 | 387 | <parameter name="aAnonId" />
|
367 | 388 | <body><![CDATA[
|
368 | 389 | if ((this.functions) && (this.functions[aAnonId])) {
|
369 | 390 | for (var name in this.functions[aAnonId]) {
|
370 |
| - this.disconnectButton(name, aAnonId); |
| 391 | + this.removeCommandListener(name, aAnonId); |
371 | 392 | }
|
372 | 393 | }
|
373 | 394 | ]]></body>
|
374 | 395 | </method>
|
375 | 396 |
|
376 |
| - <method name="disconnectButton"> |
| 397 | + <method name="removeCommandListener"> |
377 | 398 | <parameter name="aAnonId" />
|
378 | 399 | <parameter name="aStore" />
|
379 | 400 | <body><![CDATA[
|
|
0 commit comments