YUILibrary - Open source JavaScript and CSS for building richly interactive software.
Fork YUI on GitHub
  [ 3 posts ]

paulie

  • Username: paulie
  • Joined: Tue Apr 21, 2009 3:56 pm
  • Posts: 6
  • Offline
  • Profile

Rich Text Editor dropping close div in safari

Post Posted: Tue Feb 09, 2010 3:37 pm
+1-
I'm using the 2.8.0 RTE and have run into a strange formatting problem in safari only. I stepped through the code and may have found a bug, but I don't understand what it is doing. In editor.js I see the following Safari only code:

Code:
filter_safari: function(html) {
    if (this.browser.webkit) {ht: normal;"/gi, '');
        ...
        } else {
            //html = html.replace(/<div>/gi, '<br>');
            html = html.replace(/<div([^>]*)>([ tnr]*)<\/div>/gi, '<br>');
          html = html.replace(/<\/div>/gi, '');
        }


I see that the last two code lines are removing div tags. I put a button on the toolbar that inserts:

Code:
<div class="drop_cap">...</div>


but the close div is getting deleted by the above code. It seems like the intent was to remove the same number of start and end divs. Is there any work around?

Dav Glass

YUI Developer

  • Username: davglass
  • Joined: Thu Aug 28, 2008 9:28 am
  • Posts: 1156
  • Location: Cupertino, CA
  • Twitter: davglass
  • GitHub: davglass
  • Gists: davglass
  • IRC: davglass
  • YUI Developer
  • Offline
  • Profile

Re: Rich Text Editor dropping close div in safari

Post Posted: Tue Feb 09, 2010 3:40 pm
+0-
Safari is tricky since they don't put <br> or <p> tags in when editing, so the Editor strips all <div>'s to change them to <br>'s or <p>'s when needed.

If you need this, then you can simply noop the filter_safari method or extend it and replace the code you want to remove.

You can also file a bug & I'll get to it when we start on 2.9.

will.bailey

  • Joined: Wed Mar 10, 2010 12:12 pm
  • Posts: 1
  • Offline
  • Profile

Re: Rich Text Editor dropping close div in safari

Post Posted: Wed Mar 10, 2010 12:14 pm
+0-
I'm experiencing this problem also. I took your advice and overrode the filter_safari method in my implementation. I'll file a ticket as well.
  [ 3 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