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

Frank Bueltge frank at bueltge.de
Tue Jan 31 13:06:05 UTC 2012


Hi Bradon,
no, the users will use this on default post type post and page, no CPT.
I thinked, WordPress must have filter and hooks for this, on the
standard TinyMCe works fine, is an problem of the JS for the editor
and this js has no filter; only deactivate and rewrite is possible.
Best wishes
Frank


On Tue, Jan 31, 2012 at 5:12 AM, Braydon <ronin at braydon.com> wrote:
> 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/
>
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers


More information about the wp-hackers mailing list