[wp-trac] [WordPress Trac] #32555: TinyMCE should have a lang attribute

WordPress Trac noreply at wordpress.org
Tue Jun 2 19:20:02 UTC 2015


#32555: TinyMCE should have a lang attribute
----------------------------+-----------------------------
 Reporter:  GregLone        |      Owner:
     Type:  enhancement     |     Status:  new
 Priority:  normal          |  Milestone:  Awaiting Review
Component:  TinyMCE         |    Version:  4.2.2
 Severity:  normal          |   Keywords:
  Focuses:  administration  |
----------------------------+-----------------------------
 Hello.

 When we use `add_editor_style()`, we try to reproduce front styles in the
 editor. But there's at least one CSS property that can't be reproduced
 right now, it's `hyphens`.
 To work, this property needs a lang attribute on a wrapping tag somewhere.

 So far I managed to add it by creating a TinyMCE plugin:

 {{{
 tinymce.PluginManager.add( "langattribute", function( editor ) {
         editor.on( "init", function() {
                 if ( window.mejsL10n && window.mejsL10n.language ) {
                         editor.getBody().setAttribute( "lang",
 window.mejsL10n.language );
                 }
         } );
 } );
 }}}

 It's a bit hacky because I use a MediaElement.js var but it works. I'm
 sure there's a better way though.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/32555>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list