Reputation: 377
I'm using the tinymce WYSIWYG Editor in my site to get user input. I want to define a Structure to be compared to user input, such as:
<div>
<h1></h1>
<h2></h2>
<article>
<div>
</div>
</article>
<h3></h3>
</div>
I need tinymce
to prevent the user from typing any content that does not follow my structure. I don't know how to accomplish that, but I think there must be a way; can you explain how?
Upvotes: 1
Views: 95
Reputation: 338
Note: using the <body>
tag this way is incorrect.
Best option separate editors for the sections of the document.
TextField for H1 (title?)
TextField for H2 (subtitle)
WYSIWYG for the body copy (do not use the <body>
tag)
WYSIWYG for the footer
That's the common way to force content sections, then you would combine the data in your server-side code to display it exactly how you want it: think like a CMS.
If you want to go over-the-top front-end editable, make each editable inline. That would be best-case User Experience.
Upvotes: 1