Forum closed. New forum available at http://community.wymeditor.org/

<div> as a container type

Discuss features, code, contributions, ideas, suggestions, ...
For bugs, patches and feature requests, please post on the Trac:
http://trac.wymeditor.org/

<div> as a container type

Postby evildmp on Sat Jun 13, 2009 5:37 pm

I understand that it is not a simple matter to add a <div> container type to WYMEditor. I don't understand why it's so difficult though.

For our purposes, it would be extremely useful functionality. We have developed a plugin system for Django CMS http://github.com/digi604/django-cms-2.0/ (and a presentation system using WYMEditor http://bitbucket.org/spookylukey/semanticeditor).

The plugin system allows us to place database objects (which could be an image, a link, some content, some HTML, some Django template tags - anything) into the editor.

Sometimes, it's OK to place them as inline items (say an image in a paragraph).

But sometimes, it's not. The object might itself contain a <div>, or a <ul>, or a <p> - and the only container it can safely be inserted in is a <div>.

I know that others have also wanted to be able to insert <div>s, possibly for different reasons (they want <div>s with classes for presentation reasons - we don't need that, because the presentation system makes that unnecessary).

Could someone explain why it is so far from a simple matter to extent the list of containers to include <div>s?

Thanks!
evildmp
 
Posts: 3
Joined: Tue Jan 06, 2009 12:13 pm

Re: <div> as a container type

Postby stebbi on Thu Aug 13, 2009 2:49 pm

I am quite interested in hearing about this, too.
stebbi
 
Posts: 3
Joined: Mon Aug 10, 2009 1:37 pm

Re: <div> as a container type

Postby mr_lundis on Thu Jan 07, 2010 3:46 pm

Hello, and sorry for the much late reply...
Technically WYMeditor already allows divs as containers, but they will however completely break most of the editing functionality... :?

The issue lies in editors handling of pretty much all block elements besides paragraphs and lists. There are several issues in this area, most of them concern how line breaks and enter-key presses should be handled which differs between browsers. For example, when the users inside a paragraph which in turn is inside a div; how should the user move outside that div to create a new paragraph or any other block element? Hitting enter will currently just create a new paragraph inside the current div.

What could possibly solve this would be some kind of inline controls allowing the user to insert a new element below the div. But this brings a whole new set of issues dealing with selections and so forth, as you most likely would need to insert some form of markup inside the editor. Another area that would need some work is the presentation of nested elements.

This list just keeps going, but I think you get the picture? In 0.6 we'll most likely implement a placeholder system, as mentioned before. This would remove the need to use divs as containers in most situations and will most likely provide a cleaner way of inserting external content. Any thoughts, ideas or alternative solutions are as always welcome!

Cheers! ;)
Jonatan Lundin - designer, developer and forum moderator. You should follow me on Twitter!
mr_lundis
 
Posts: 335
Joined: Sun Dec 02, 2007 10:59 am
Location: Sweden


Return to Developers

Who is online

Users browsing this forum: No registered users and 1 guest