[wp-hackers] No filter of code on switch from html to visual editor, how?

Braydon ronin at braydon.com
Tue Jan 31 04:12:31 UTC 2012


Another solution could be to have another post type that uses an 
alternative editor instead of TinyMCE, such as ACE. That way the visual 
editor works as usual, and html can be better written with the other, 
such as posts that are mostly about code.

On 01/25/2012 03:50 AM, Frank Bueltge wrote:
> Hello at all,
> if I include code inside the html-tab and I switch to the visual mode
> of the Editor on post/page, then format WP the code to a block, remove
> all breaks and leave lines, see the screenshots at this post on WPSE.
> I think this easier to understand as my bad english.
> http://wordpress.stackexchange.com/questions/39843/no-filter-of-code-on-switch-from-html-to-visual-editor-how
>
> My tests for an solution.
> I have test this to stop WP for this with the follow test plugin, also
> readable in this https://gist.github.com/1663554
>
> add_filter( 'tiny_mce_before_init', 'fb_tinymce', 9 );
>
> function fb_tinymce( $init ) {
>
>      $init['fix_list_elements'] = FALSE;
>      $init['wpautop'] = FALSE;
>      $init['remove_linebreaks'] = FALSE;
>      $init['apply_source_formatting'] = TRUE;
>      $init['extended_valid_elements'] .= ',pre[*],code[*]';
>
>      return $init;
> }
>
> Alternative is it maybe possible to change the process viua jquery, an
> script which add a process on the tab change of the editor, but not
> very fine. Basically an add on for editor.js
>
> Maybe an other reader has an solution for this topic.
> THANKS for replies.
> Frank
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>
> !DSPAM:4f1feca2113881410093335!
>


-- 
Braydon Fuller
http://braydon.com/



More information about the wp-hackers mailing list