Enable the client to add an editable div


Hi Cory,
it would be great, if the client could add an editable div between the editable regions by himself without touching the code. We went from an old and slow typo3 website to your nice, simple and fast cms. He likes it, but he misses the chance to insert an editable block between other content by himself, as he did in the typo3 Backend.


This is really more a feature of a website builder. In Surreal, a content region is a “safe” part of the page to edit, so one should never contain structural elements. In other words, if a user does Select All + Delete, the layout shouldn’t be affected. This is why defining content regions is left to the designer.

If clients were able to create content regions, I guarantee the biggest side effect would be headaches for admins. Inserting new regions from scratch would require us knowing where acceptable places are for this to happen. This would require a lot of extra syntax for designers or we’d have to let clients insert regions arbitrarily.

Some initial thoughts on that:

  • Most clients don’t understand how HTML+CSS works, so they would enable elements things that could compromise the page’s layout or other functionality.
  • The editor has a built-in cleanup process to ensure markup in content regions is well-formed and valid HTML5. It also strips certain things that don’t belong in editable regions. If a client enabled an element that contained, for example, a <script> or <style>, they will be removed.
  • Many sites use jQuery plugins and similar libraries that make content interactive. If a client unknowingly enabled an element containing one of these, they would almost always conflict with the editor and break on publish.
  • Many sites use PHP, ASP, ColdFusion, etc. and clients could inadvertently enable elements that contain this code, which will get stripped and immediately break things.
  • This would also compromise our ability to store drafts and revisions, as content regions would be changing all the time and revisions are stored based on those regions. (This is a design decision that spawned from Surreal being able to publish changes to PHP, ColdFusion, and Server Side Includes. It saves us storage space because we don’t have to save the entire page’s source, but it also ensures we’re not storing sensitive info such as an API key hard-coded in your PHP/CF/ASP source.)

That said, I think this is outside of the scope of Surreal. However, with Blocks and the new cms-disable|cms-enable syntax you’ll be able to do a lot more within the constructs of existing editable regions. Instead of being limited to headings, text, and images, you’ll be able to insert and edit more complex, structured elements with ease.

If you have a specific use case for this feature, I’ll be happy to describe how you could probably implement it using the new features :slight_smile: