Results 1 to 5 of 5

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

  1. #1
    roby.tea is offline Active Member
    Join Date
    Aug 2013
    Posts
    31
    Rep Power
    1

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

    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

  2. #2
    kapplebaum is offline Active Member
    Join Date
    May 2013
    Location
    California
    Posts
    27
    Rep Power
    1

    Default

    Have you tried
    Code:
    ZmHtmlEditor.prototype.onShowView = function(view) {
      if (appCtxt.getCurrentViewType() == ZmId.VIEW_COMPOSE) {
        // do some stuff here
      }
    }
    ?

    Does this fire too early for you?

    Kathy A.

  3. #3
    roby.tea is offline Active Member
    Join Date
    Aug 2013
    Posts
    31
    Rep Power
    1

    Default

    Hello Kathy, that worked for me, thanks! :-)

  4. #4
    roby.tea is offline Active Member
    Join Date
    Aug 2013
    Posts
    31
    Rep Power
    1

    Default

    For completeness:

    Code:
    appCtxt.getCurrentViewType()ZmHtmlEditor.prototype.onShowView = function(view) {
      if (appCtxt.getCurrentViewType() == ZmId.VIEW_COMPOSE) {
        // do some stuff here
      }
    }
    is not working for me (appCtxt.getCurrentViewType() is not defined), but I managed to do what I want in this way:

    Code:
    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
    }

  5. #5
    kapplebaum is offline Active Member
    Join Date
    May 2013
    Location
    California
    Posts
    27
    Rep Power
    1

    Default

    Keep appCtxt.getCurrentViewType() in mind for when you switch to Zimbra 8. Zimbra 8 Changes that may affect Zimlets

    Glad it worked for you.
    Kathy A.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Can't get 'banned content alert' messages to stop.
    By chauvetp in forum Administrators
    Replies: 0
    Last Post: 01-23-2013, 03:08 PM
  2. zimbra does not show mail to them with HTML content
    By mvalenzuela.cl in forum Users
    Replies: 2
    Last Post: 06-27-2008, 10:41 AM
  3. failed to read html content in webmail HTML mode
    By Frederick Cheung in forum Administrators
    Replies: 1
    Last Post: 02-24-2008, 05:32 PM
  4. Replies: 0
    Last Post: 01-20-2008, 01:42 PM
  5. Custom Content Filter Messages
    By cshepherd in forum Administrators
    Replies: 3
    Last Post: 04-15-2007, 10:38 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •