| Page 1 of 1 | [ 4 posts ] |
|
Deep in the YUI3 Rich Text Editor, there's a bit of code that seems to force browsers to use styleWithCSS for all built in commands (those that are natively executed in execCommand). See editor/js/exec-command.js:52
For a Wysiwyg component I'm building on top of the Editor, I'd like to have browsers almost never generate CSS styles. This seems at odds with the above code in and there doesn't seem to be support to modify this behavior. So, I'm left wondering, is there a good way to disable this using some parameter or configuration I may have missed? If not, I can create a plugin that overrides ExecCommand._command, but I'd like to hear what the implications for this might be before going forward. Thanks! |
|
styleWithCSS is enforced to make sure that all browsers do the same thing.
For example, without styleWithCSS when executing a "bold" command. One browser will put in a B tag, one will put in a STRONG tag and others will put in style="font-weight: bold" on any element it can (FONT, EM, SPAN, etc). Setting styleWithCSS forces the browsers to put the CSS property on an element which makes it easier for Editor to then filter those things in the end. When Editor is completed, there will be an export plugin (which it sounds like you already need) that will take the existing markup and convert it into: HTML, HTML with CSS, HTML with CSS classnames, Markdown, BBcode, etc.. So all in all, the content that is inside the Editor doesn't matter, what matters is the output and that can be handled post save. Make sense? |
|
Yes, it makes a lot of sense.
However, it seems that some browsers don't respect the styleWithCSS setting. Current Webkit browsers still emit B tags, for example, despite styleWithCSS being set to true. You are right that I need the export plugin. In fact, does it exist currently in any form? Even if its very early, I could perhaps use it to build out what I need. Or if the export plugin doesn't exist, is there some place in the current editor code that it will plug into cleanly? Perhaps I could plug my own filtering code in. |
|
No, it has not been written yet. It's best to build it as a plugin, override the `getContent` method on Editor base and return the filtered content from there.
You can also submit it to the Gallery when it's done: http://yuilibrary.com/gallery/ |
| Page 1 of 1 | [ 4 posts ] |
| 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 |
© 2006-2013 Yahoo! Inc. All rights reserved.
All code on this site is licensed under the BSD License unless stated otherwise.
About This Site · Security Contact Info
Powered by phpBB® Forum Software © phpBB Group