[ 4 posts ]

Marc

YUI Contributor

  • Offline
  • Profile
Tags:

Problem with line breaks in wysiwyg

Post Posted: Fri Apr 13, 2012 8:46 am
+0-
Hi,

I'm having problems with the Wysiwyg editor. When I start typing text and press ENTER, the source shows DIVs being placed around the paragraph. However, on submit these divs are not replaced by BRs and are therefore filtered out on our server.

Any ideas what is wrong here?

Code:
         Y.all('form textarea.wysiwyg').each(function(node,idx,ctxt){
            var editor = new Y.EditorBase({
               content: node.get("value")
            });
            editor.plug(Y.Plugin.EditorBidi);
            editor.plug(Y.Plugin.EditorBR);
            node.wrap("<div/>");
            node.ancestor("div").addClass("wysiwyg-editor");
            node.ancestor("div").insertBefore("<div></div>");
            node.get("form").on("submit",function(){
               node.set("value",editor.getContent());
            });
            editor.render(node.ancestor("div").one("div"));
         });

Dav Glass

  • Username: davglass
  • Joined: Thu Aug 28, 2008 9:28 am
  • Posts: 2088
  • Location: Marion, IL, US
  • Twitter: davglass
  • GitHub: davglass
  • Gists: davglass
  • IRC: davglass
  • Offline
  • Profile
Tags:

Re: Problem with line breaks in wysiwyg

Post Posted: Fri Apr 13, 2012 10:57 am
+0-
EditorBR does not filter out the DIV's that the brower creates. It attempts to put them in for you. But if you are also plugging the BiDi plugin, you are side stepping the BR plugin since EditorPara is required to have EditorBidi work.

Remove EditorBidi and EditorBR should work as expected.

Marc

YUI Contributor

  • Offline
  • Profile

Re: Problem with line breaks in wysiwyg

Post Posted: Mon Apr 16, 2012 7:40 am
+0-
Thx!

Marc

YUI Contributor

  • Offline
  • Profile
Tags:

Re: Problem with line breaks in wysiwyg

Post Posted: Mon Apr 23, 2012 5:50 am
+0-
I still see problems after removing bidi
This is what I seen after a text like this

Code:
Testterrgdf gdg ddg dg fdg dg df gfdg fdg fdg ddf fd fdg dfg fdg gd d dggd

dgdfgdfgfdgfd
gdgdfgfdg

dfgdgfdgfdg


dfgdgfdgfdgdgdg


Code:
Testterrgdf gdg ddg dg fdg dg df gfdg fdg fdg ddf fd fdg dfg fdg gd d dggd
<div><br></div>
<div>dgdfgdfgfdgfd</div>
<div>gdgdfgfdg</div>
<div><br></div>
<div>dfgdgfdgfdg</div>
<div><br></div>
<div><br></div>
<div>dfgdgfdgfdgdgdg</div>


I see two things:
1. I need to do two enters to retain one enter
2. The BRs are placed in a funny way with the DIV around them

This is my wysiwyg code (3.4.1):
Code:
Y.all('form textarea.wysiwyg').each(function(node,idx,ctxt){
            var editor = new Y.EditorBase({
               content: node.get("value")
            });
            editor.plug(Y.Plugin.EditorBR);
            node.wrap("<div/>");
            node.ancestor("div").addClass("wysiwyg-editor");
            node.ancestor("div").insertBefore("<div></div>");
            node.get("form").on("submit",function(){
               node.set("value",editor.getContent());
            });
            editor.render(node.ancestor("div").one("div"));
         });


Cheers,
Marc
  [ 4 posts ]
Display posts from previous:  Sort by  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum