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

Getting out of a blockquote (nested container)

Support forum for WYMeditor.

Getting out of a blockquote (nested container)

Postby TriggerB on Thu Apr 29, 2010 2:29 am

I'm using WYMeditor for all editing across my site, I'm really loving it thus far. I'm having one problem right now. I'm using blockquotes to allow users to quote each other in a forum environment. When a blockquote is created, it nests a p inside of it. That's fine. The problem presents itself when trying to get OUT of the blockquote to continue as normal. I would expect that clicking outside of the container would create a new point to continue from, but that's not how WYM is intended to work anyway as far as I've gathered in my limited experience with it.

The only way to quote something, and then continue outside of the quote is to have an element already waiting below where the blockquote is going to be. There's a few fixes that I can think of:

1. Create an element below the blockquote whenever a blockquote (or probably any container that nests,I've only encountered blockqoute so far) is created. The problem with this is that the user has to break flow by clicking/arrowing into the extra element before they begin typing again.

2. Another solution would be to have the default behavior for <ENTER> when inside of a nested container jump outside of the parent container and create the next element there rather than inside of the parent.

One issue that I see immeadiately with #2 is that if you DO want to type out multiple paragraphs inside of a blockquote...you'd be screwed.

This seems like a pretty sticky situation. I think #1 is probably the only way to go, make it so that the default behavior of inserting a blockquote (or other nested container) is to create an empty p below it IF one doesn't already exist. Has anyone else had this problem or have any ideas?

Thanks for your help!


EDIT: Here's a quick hack that I did to implement solution #1. I don't really know javascript or WYM so it's definitely the wrong way to do it, but it works for testing.

Code: Select all
  //if there is no nextSibling for blockquote, add a p
       if( newNode.nextSibling.nodeName == "#text" ){
              pNode = this._doc.createElement("p");
              newNode.parentNode.insertBefore(pNode,newNode.nextSibling);
       }

on line ~1005 of trunk, directly after:

Code: Select all
container.parentNode.insertBefore(newNode,container);
newNode.appendChild(container);
TriggerB
 
Posts: 1
Joined: Thu Apr 29, 2010 2:11 am

Re: Getting out of a blockquote (nested container)

Postby mr_lundis on Sun May 16, 2010 12:27 pm

I have spent considerable time thinking about how to fix this, and I think the best solution would be to mimic the behaviour of lists. In other words hitting enter once would create a new paragraph inside the blockquote, hitting enter again (or once inside an empty paragraph) would remove the empty paragraph and create a new one below the blockquote. The same would also be applicable on other nested block elements, possibly even tables...

Thoughts?

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 Support

Who is online

Users browsing this forum: No registered users and 2 guests