summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/jetpack/modules/after-the-deadline/atd-nonvis-editor-plugin.js')
-rw-r--r--plugins/jetpack/modules/after-the-deadline/atd-nonvis-editor-plugin.js20
1 files changed, 18 insertions, 2 deletions
diff --git a/plugins/jetpack/modules/after-the-deadline/atd-nonvis-editor-plugin.js b/plugins/jetpack/modules/after-the-deadline/atd-nonvis-editor-plugin.js
index 1e33a0c8..9ca642a6 100644
--- a/plugins/jetpack/modules/after-the-deadline/atd-nonvis-editor-plugin.js
+++ b/plugins/jetpack/modules/after-the-deadline/atd-nonvis-editor-plugin.js
@@ -4,9 +4,9 @@
var AtD_qtbutton, autosave;
/* convienence method to restore the text area from the preview div */
-function AtD_restore_text_area()
-{
+function AtD_restore_text_area() {
var content;
+
/* swap the preview div for the textarea, notice how I have to restore the appropriate class/id/style attributes */
if( jQuery('#atd-content').get(0) ) {
AtD.remove('atd-content');
@@ -20,6 +20,22 @@ function AtD_restore_text_area()
content = content.replace(/<BR.*?class.*?atd_remove_me.*?>/gi, '\n');
}
+ // Remove emoji replacement images
+ if ( typeof window.twemoji !== 'undefined' ) {
+ content = content.replace( /<img [^>]+>/g, function( img ) {
+ // The images should have class containing 'emoji'
+ if ( img.indexOf( 'emoji' ) !== -1 ) {
+ var alt = img.match( /alt="([^"]+)"/ );
+
+ if ( alt && alt[1] && window.twemoji.test( alt[1] ) ) {
+ return alt[1];
+ }
+ }
+
+ return img;
+ });
+ }
+
// jQuery('#content').replaceWith( AtD.content_canvas );
jQuery('#content').val( content.replace(/\&lt\;/g, '<').replace(/\&gt\;/g, '>').replace(/\&amp;/g, '&') )
.height(AtD.height)