HTML Editor - "content initialized" callback (add content to messages when edited)

Have a great idea for extending Zimbra? Share ideas, ask questions, contribute, and get feedback.
Post Reply
roby.tea
Posts: 31
Joined: Sat Sep 13, 2014 3:18 am

HTML Editor - "content initialized" callback (add content to messages when edited)

Post by roby.tea »

Hello Gents
we're developing a Zimlet that needs to do some stuff on the email message body when a draft is loaded into the HTML editor.
What we would need is some kind of callbak that is called when the editor has just finished to load... somewhat like the "ZmHtmlEditor.prototype._onContentInitialized" function.
We saw there's a callback here, "_onContentInitializeCallback", but seems that this function is used internally for other purposes.
We also tried to accomplish our needings overriding the "ZmComposeController.prototype._setView" function, adding some code at the end of this.

This is working fine with Chrome and IE, but seems there's a problem with Firefox related to the "enableDesignMode" function.
In the end, what's the best way to add some content (in our case, the default signature of the logged user) to a draft, when this is opened for editing by the user?
We are using Zimbra 7.2.2.
Thanks in advance for any help.

Roberto
12140kapplebaum
Posts: 27
Joined: Sat Sep 13, 2014 3:13 am

HTML Editor - "content initialized" callback (add content to messages when edited)

Post by 12140kapplebaum »

Have you tried

ZmHtmlEditor.prototype.onShowView = function(view) {

if (appCtxt.getCurrentViewType() == ZmId.VIEW_COMPOSE) {

// do some stuff here

}

}?
Does this fire too early for you?
Kathy A.
roby.tea
Posts: 31
Joined: Sat Sep 13, 2014 3:18 am

HTML Editor - "content initialized" callback (add content to messages when edited)

Post by roby.tea »

Hello Kathy, that worked for me, thanks! :-)
roby.tea
Posts: 31
Joined: Sat Sep 13, 2014 3:18 am

HTML Editor - "content initialized" callback (add content to messages when edited)

Post by roby.tea »

For completeness:
[QUOTE]appCtxt.getCurrentViewType()ZmHtmlEditor.prototype.onShowView = function(view) {

if (appCtxt.getCurrentViewType() == ZmId.VIEW_COMPOSE) {

// do some stuff here

}

}[/QUOTE]

is not working for me (appCtxt.getCurrentViewType() is not defined), but I managed to do what I want in this way:
MyZimlet.prototype.onShowView = function(viewId) {
viewId = viewId || appCtxt.getCurrentViewId();



// if we're not in a COMPOSE view, do nothing

if (!viewId.substring(0, ZmId.VIEW_COMPOSE.length) == ZmId.VIEW_COMPOSE) {

return;

}
// do my stuff

}
12140kapplebaum
Posts: 27
Joined: Sat Sep 13, 2014 3:13 am

HTML Editor - "content initialized" callback (add content to messages when edited)

Post by 12140kapplebaum »

Keep appCtxt.getCurrentViewType() in mind for when you switch to Zimbra 8.
Glad">http://www.zimbra.com/forums/zimlets/59 ... mlets.html
Glad it worked for you.

Kathy A.
Post Reply