TinyMCE: fix emoji parsing in IE. See #31242.

git-svn-id: https://develop.svn.wordpress.org/trunk@31761 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Ozz 2015-03-12 22:59:41 +00:00
parent a6d4f5e679
commit 29cca14491
1 changed files with 15 additions and 3 deletions

View File

@ -1,6 +1,7 @@
( function( tinymce, wp ) {
tinymce.PluginManager.add( 'wpemoji', function( editor, url ) {
var typing;
var typing
isMacWebKit = tinymce.Env.mac && tinymce.Env.webkit;
if ( ! wp.emoji.parseEmoji ) {
return;
@ -30,7 +31,10 @@
selection = editor.selection;
node = selection.getNode();
bookmark = selection.getBookmark();
if ( isMacWebKit ) {
bookmark = selection.getBookmark();
}
wp.emoji.parse( node );
@ -44,7 +48,15 @@
}
} );
selection.moveToBookmark( bookmark );
// In IE all content in the editor is left selected aftrer wp.emoji.parse()...
// Collapse the selection to the beginning.
if ( tinymce.Env.ie && node && node.nodeName === 'BODY' ) {
selection.collapse( true );
}
if ( isMacWebKit ) {
selection.moveToBookmark( bookmark );
}
} );
editor.on( 'postprocess', function( event ) {