Forum Discussion

Claudius's avatar
9 years ago

Adding a placeholder text to the rich text editor

In order to provide some guidance for community members on their first post we would like to add a placeholder to the editor field.

I've seen that the HP Community are doing it:

 

I roughly now how it's technically done by defining a string for the placeholder. I just cannot find the string for the lia-mce-placeholder class that sits in the iFrame that the rich text editor sits in.

 

Any tip you can share fuenteso ?

  • lilim's avatar
    lilim
    9 years ago

    You can use the text key form.MessageEditor.field.body.placeholder to change the placeholder text that appears in each text editor.

     

  • Hi Claudius,

     

    We used this text key: form.MessageEditor.field.body.placeholder

     

    Usually, when I need to figure out which text key is used on any part of the community I open studio on a new window, then go to Text Editor > Advanced and click on "Show text keys", then just go to the community page you were checking and refresh it. All the text keys used should be showing, even if they're empty.

     

     

     

    When I'm done I just go back to the Studio tab and click on "Hide text keys". I use two different tabs because navigating through the community or Studio could be a little tricky when the text keys are showing.

     

    Hope that helps!

  • Hi Claudius,

     

    We used this text key: form.MessageEditor.field.body.placeholder

     

    Usually, when I need to figure out which text key is used on any part of the community I open studio on a new window, then go to Text Editor > Advanced and click on "Show text keys", then just go to the community page you were checking and refresh it. All the text keys used should be showing, even if they're empty.

     

     

     

    When I'm done I just go back to the Studio tab and click on "Hide text keys". I use two different tabs because navigating through the community or Studio could be a little tricky when the text keys are showing.

     

    Hope that helps!

    • Claudius's avatar
      Claudius
      Boss
      Thanks for the detailed explanation and the screenshot. That got me convinced that the "show text keys" feature is actually useful :)
      • tyw's avatar
        tyw
        Boss
        Thanks for sharing! Nice lil feature :)
  • OlivierS's avatar
    OlivierS
    Lithium Alumni (Retired)

    Claudius one way to do it would be to use a TinyMCE class. I suppose you could add it somewhere in a script, but you would have to be sure the editor is fully loaded in order to work. It might be best to include this in the TinyMCE init, but would probably require Lithium professional services ...

     

    • lilim's avatar
      lilim
      Boss

      You can use the text key form.MessageEditor.field.body.placeholder to change the placeholder text that appears in each text editor.