CKEditor plugin rendering different in WYSIWYG and source mode

I'm starting to develop a plugin for CKEditor that needs to be used to insert some HTML snippets in a web page. This is done. Nonetheless I also need to include some special items when switching to WYSIWYG mode (eg something more or less similar to Show Blocks plugin, but not just using styles since I need some elements included in there). So my question is :

How could I include extra items or styles (eg to hide parts of the contents in WYSIWYG mode) in WYSIWYG view without altering HTML output ?

If someone could provide some information about a working (maybe simple) example, I'd also appreciate your help.

PS: If you need to know further details please ask, but for instance assume inserted raw HTML code is

<div class="xxx">Hello world !</div>

... but in WYSIWYG mode need to display a link on top of it that pops up an alert and toggles dotted border.


About injecting CSS classes in WYSIWYG mode, use addCss function.

About creating fake elements in WYSIWYG mode ... I think I can solve the problem using context menu instead.

链接地址: http://www.djcxy.com/p/89986.html

上一篇: Drupal 7.10所见即所得的语法高亮显示

下一篇: 所见即所得和源模式下的CKEditor插件呈现不同