Changeset 31946
- Timestamp:
- 03/31/2015 11:34:23 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/js/tinymce/plugins/wpemoji/plugin.js
r31923 r31946 31 31 } 32 32 33 // Test if the node text contains emoji char(s) and replace. 34 function parseNode( node ) { 35 var selection, bookmark; 36 37 if ( node && twemoji.test( node.textContent || node.innerText ) ) { 38 if ( env.webkit ) { 39 selection = editor.selection; 40 bookmark = selection.getBookmark(); 41 } 42 43 replaceEmoji( node ); 44 45 if ( env.webkit ) { 46 selection.moveToBookmark( bookmark ); 47 } 48 } 49 } 50 33 51 if ( isWin8 ) { 34 52 // Windows 8+ emoji can be "typed" with the onscreen keyboard. … … 36 54 // Thankfully it sets keyCode 231 when the onscreen keyboard inserts any emoji. 37 55 editor.on( 'keyup', function( event ) { 38 var node;39 40 56 if ( event.keyCode === 231 ) { 41 node = editor.selection.getNode(); 42 43 if ( twemoji.test( node.textContent || node.innerText ) ) { 44 replaceEmoji( node ); 45 } 57 parseNode( editor.selection.getNode() ); 46 58 } 47 59 } ); … … 59 71 } 60 72 61 var bookmark, 62 selection = editor.selection, 63 node = selection.getNode(); 64 65 if ( twemoji.test( node.textContent || node.innerText ) ) { 66 if ( env.webkit ) { 67 bookmark = selection.getBookmark(); 68 } 69 70 replaceEmoji( node ); 71 72 if ( env.webkit ) { 73 selection.moveToBookmark( bookmark ); 74 } 75 } 73 parseNode( editor.selection.getNode() ); 76 74 }); 77 75 }
Note: See TracChangeset
for help on using the changeset viewer.