Single line of WYSIWYG does not add HTML tags

ces55739's Avatar

ces55739

30 Jun, 2014 02:30 PM

Hello,

I am using a WYSIWYG, but am running into some weird issues. If there is only 1 line of text in the WYSIWYG, it doesn't output HTML tags at all. But if there are multiple lines or you add specific tags (bold, heading, etc) it adds the correct tags. Is this a format issue in velocity? Any help is appreciated. here are 2 quick examples.
Thanks!

Example text entered into a WYSIWYG
1)

"This is some example text."

2)

"This is some example text.
Here is another line of text."

First Output:

This is some example text.

Second Output:

<p>This is some example text.</p>
<p>Here is another line of text.</p>
  1. 1 Posted by Ryan Griffith on 30 Jun, 2014 02:44 PM

    Ryan Griffith's Avatar

    Hi,

    The behavior you are encountering is functionality coming from the WYSIWYG library (TinyMCE), where hitting enter will automatically add a <p> tag for you. If you are hitting enter after adding initial content, it will surround the first line with a <p> for you as well.

    If you would like to add the two lines without adding the <p> tags, you can hold the SHIFT key when hitting enter. This will create a <br/> to break the two lines.

    If you would like to add the <p> without hitting enter to add multiple lines, you can use the Format dropdown within the first row of the WYSIWYG's toolbar to surround the content with a <p>.

    Please let me know if you have any questions.

    Thanks!

  2. 2 Posted by ces55739 on 30 Jun, 2014 02:49 PM

    ces55739's Avatar

    Thank you for the prompt response!

    Do you know if there is a way to force a single line to have <p> tags around it?

  3. 3 Posted by Ryan Griffith on 30 Jun, 2014 02:58 PM

    Ryan Griffith's Avatar

    Not a problem at all.

    Because this is relating to the way TinyMCE is being initialized, I believe the only ways to accomplish this would be to either:

    • Use the Format dropdown as I mentioned previously.
    • Add default content to your WYSIWYG field that includes a <p> tag in it. When your user replaces the default content, the <p> tag should remain

    Please let me know if you have any questions.

    Thanks!

  4. 4 Posted by ces55739 on 30 Jun, 2014 03:01 PM

    ces55739's Avatar

    Perfect. Thanks for the help.

  5. 5 Posted by Ryan Griffith on 30 Jun, 2014 03:13 PM

    Ryan Griffith's Avatar

    Not a problem at all. I'm going to go ahead and close this discussion, please feel free to comment or reply to re-open if you have any additional questions.

    Have a great day!

  6. Ryan Griffith closed this discussion on 30 Jun, 2014 03:13 PM.

  7. ces55739 re-opened this discussion on 30 Jun, 2014 04:49 PM

  8. 6 Posted by ces55739 on 30 Jun, 2014 04:49 PM

    ces55739's Avatar

    Sorry to reopen this, but I would like to pursue the "add default content" option you mentioned. How would I go about doing that?

    Is there a way to add it to the base-asset's WYSIWYG to apply to all?
    Or maybe the Data Definition?

  9. 7 Posted by Ryan Griffith on 30 Jun, 2014 05:35 PM

    Ryan Griffith's Avatar

    Not a problem at all.

    Unfortunately, there is no way to add default content to the WYSIWYG that is automatically applied to pages without a Data Definition (ie the DEFAULT WYSIWYG), unless you use a base asset for your Asset Factory.

    That being said, what you would do is create a Page or Structured Data Block (generally tucked away in a hidden base assets folder) that has the desired setup (ie Content Type, Data Definition, etc) and you would add some default content to the WYSIWYG. Then, you create a Page Asset Factory and point the Base Asset field at that new page. When the new Asset Factory is used, the resulting new page will be pre-filled with that content and any other data you filled in.

    For more information regarding Asset Factories and creating new ones, please feel free to view this page on our Knowledge Base.

    Please let me know if you have any questions.

    Thanks!

  10. 8 Posted by ces55739 on 30 Jun, 2014 05:49 PM

    ces55739's Avatar

    I understand that you can add text/formatting to the base asset and then it works just like you said.

    However, is there a way to cause the WYSIWYG to be a paragraph type by default? or heading 1? etc.

  11. 9 Posted by Ryan Griffith on 30 Jun, 2014 06:06 PM

    Ryan Griffith's Avatar

    Sorry for the confusion, are you referring to customizing the WYSIWYG so the initial text is wrapped in a <p> tag rather than nothing at all? If so, it is not currently possible to customize the WYSIWYG's configuration.

    There is an related suggestion on our Idea Exchange for such a feature; however. I highly recommend voting the idea up if you would like to see this functionality added to a future release of Cascade Server. Let me know if you need access to the Idea Exchange and I will send over an invitation.

    Please let me know if you have any questions.

    Thanks!

  12. 10 Posted by ces55739 on 30 Jun, 2014 06:11 PM

    ces55739's Avatar

    Thats what I was looking for. Thank you! And as always I appreciate your prompt responses.

  13. 11 Posted by Ryan Griffith on 30 Jun, 2014 06:22 PM

    Ryan Griffith's Avatar

    Not a problem at all. My apologies for not being able to provide you with a simple solution, but definitely feel free to vote up the idea on our Idea Exchange.

    I'm going to go ahead and close this discussion, please feel free to comment or reply to re-open if you have any additional questions.

    Have a great day!

  14. Ryan Griffith closed this discussion on 30 Jun, 2014 06:22 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac