Jump to content

Columns in editor (TinyMCE)


mel47
 Share

Recommended Posts

Hi,

I know this subject has already been discussed, but I was wondering if TinyMCE will simplify things.

I want to do a editable text by users in a 3-columns layout for a specific page, in the middle of some content. The content of the page is a simple body field with CKeditor/TinyMCeditor (not decided yet). Columns are managed by CSS, something like :

	<div class='columns'>
		<div class='column is-4'>
			<div>Text/image to edit</div>
		</div>
		<div class='column is-4'>
			<div>Text/image to edit</div>
		</div>
	</div>

What is the best way to achieve this inside the editor? Or it's better to create own field for each column, so code will be in template?

Thanks

Link to comment
Share on other sites

  • 2 weeks later...

Hi,
I advanced a little bit but I'm still stuck... 🙃
I used templates to add this code, works fine! However, whatever I do, when I save the page, the class disappear from code. I tried to add those classes in "extra_css" in TinyMCE options, but didn't help.

In CKeditor, it have an option to allow some classes to be not striped from code. Does is have this option for TinyMCE?

Thanks

Mel

Link to comment
Share on other sites

  • 3 weeks later...
On 12/27/2022 at 3:27 PM, mel47 said:

Or it's better to create own field for each column, so code will be in template?

I think most of us here would answer this question as opposed to your others, and answer that, yes, it's more advantageous to use inputfields for this purpose. Since in your example your columns are similarly sized, you could use a repeater of a textarea field to handle this, and base the width of the columns you apply in the template code based on the number of repeated fields created (or if you only want to allow a fixed number of fields, you can design it that way too).

The benefits are:

  1. If the primarily suggested rich text field handling changes with ProcessWire (ex: TinyMCE changed to CKEditor, then is about to go back to TinyMCE), you don't have to deal with recreating code to handle solutions you thought were already solved.
  2. The more HTML you allow in the back-end, the more control of layout you give to users that have access to the system. Although there are definite exceptions, typically that's not how most developers want to control the websites they develop for others to use.
  3. Separation of concerns. Just like we want to separate styling (CSS), and semantics (HTML), storage (database / filesystem), and interactivity (JS) all from one another, we usually want the CMS simply to be there to handle management of the content so we are able to, more often, know where to find things when something needs to change (benefits for maintenance of the system).

What you're doing is definitely possible, but honestly, it's so opposed to how I normally work that I'd have to setup a new installation just to try to work through it with you (which if you really do need the help, I'd give it a shot). For a more thorough system to handle visually creating content, you might have better luck looking at @jploch's new visual builder for ProcessWire, PAGEGRID.

  • Like 1
  • Thanks 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...