[wp-trac] [WordPress Trac] #36636: allow add_editor_style() to include inline style

WordPress Trac noreply at wordpress.org
Sat Apr 23 10:42:03 UTC 2016


#36636: allow add_editor_style() to include inline style
-------------------------+----------------------
 Reporter:  selnomeria   |       Owner:
     Type:  enhancement  |      Status:  closed
 Priority:  normal       |   Milestone:
Component:  Editor       |     Version:  3.0
 Severity:  normal       |  Resolution:  wontfix
 Keywords:               |     Focuses:
-------------------------+----------------------

Comment (by swissspidy):

 Replying to [comment:5 selnomeria]:
 > a while ago, i posted in FB support that "almost every time I come
 accross a problem or find out a good suggesion, it doesnt matter if i tell
 that to support, because it wont ever be taken into account, they will
 always say opposite".
 > this is evergreen truth for me, like in this situation. (because as i
 say, that it is problem for me(like one of developers), so it could be
 problematic for many others too... when working in notepad++ ftp
 connections, it is not easy to create a new file "editor_style.css" and
 upload it to site, and then blablabla... so it was a very quick and
 helpful way, to have a function, which will directly inject something
 style into MCE window...  lets people use "add_editor_style", but what if
 you will take into account an ask of a particular person, and make a
 function, which will do that. it will be HELP for me, for many of like
 me...)

 Apart from this not being an ideal workflow, nobody stops you from
 creating such a function yourself. TinyMCE supports it, but it's just not
 something we'd implement in core for the reasons mentioned earlier.

 For example, you could use something like that to achieve what you want:

 {{{#!php
 <?php

 /**
  * Adds inline style to TinyMCE.
  *
  * Please never use this in production.
  *
  * @param array $settings TinyMCE settings
  * @return array
  */
 function wptrac_36636_editor_inline_style( $settings ) {
         $settings['content_style'] = '* {outline: 1px solid red;}';

         return $settings;
 }

 add_filter( 'tiny_mce_before_init', 'wptrac_36636_editor_inline_style' );
 }}}

--
Ticket URL: <https://core.trac.wordpress.org/ticket/36636#comment:6>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list