Results 1 to 8 of 8

Thread: attach empty text to an html editor

  1. #1

    Default attach empty text to an html editor

    Hi folks. I am using extjs 4.. I am trying to add empty text to an html editor.. how do i do this ?
    this is just some friendly explanation about the field..

  2. #2

    Default

    hello!! any help here ?

  3. #3
    Sencha User
    Join Date
    Nov 2014
    Posts
    3,120
    Answers
    446

    Default

    Quote Originally Posted by bvasudevan View Post
    Hi folks. I am using extjs 4.. I am trying to add empty text to an html editor.. how do i do this ?
    this is just some friendly explanation about the field..
    Hi bvasudevan--

    Out of the box, there's no configuration for this. However, you could accomplish this by first setting the value to some predictable pattern, perhaps like this:

    Code:
    '<span style="color:#ccc;">I am empty text</span>'
    You could then add an event listener for "initialize", within which callback you could then attach a mousedown listener on the document of the editor's iframe. In this final listener, you could check the current value of the editor; if it matches some regex for the "empty" value, you could remove it. If it's not that value, just ignore and move along.

    I've included an example below.

    Thanks!
    Joel


  4. #4

    Default

    thanks joel.. how can I remove default focus in the editor ? so I can start with a clean state. if it is in focus , I can start typing right away and then the empty text concept won work well

  5. #5

    Default

    You can see the issue i am talking about the fiddle.. when the interface loads , start typing right away

  6. #6

    Default

    joel , I have another question around this editor.. how do i trim leading/trailing whitespaces and newlines in the editor content ..?

  7. #7
    Sencha Premium Member
    Join Date
    Feb 2015
    Location
    Israel
    Posts
    114
    Answers
    3

    Default View this example

    http://dev.sencha.com/deploy/ext-4.0...p/desktop.html

    and try to get the code of it.

    It provides a notepad that turns text into HTML text

  8. #8
    Sencha User
    Join Date
    Nov 2014
    Posts
    3,120
    Answers
    446

    Default

    Quote Originally Posted by bvasudevan View Post
    thanks joel.. how can I remove default focus in the editor ? so I can start with a clean state. if it is in focus , I can start typing right away and then the empty text concept won work well
    Just add another event for keydown. See the Fiddle, I've updated it.

    Thanks
    Joel

Tags for this Thread

Posting Permissions

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