Permalink
Browse files

Detect meta tag generated by Microsoft Office apps.

  • Loading branch information...
f1ames authored and mlewand committed May 23, 2017
1 parent aa9506c commit 327b6d3699ddcc87d6015380eb9bb3723f6557f3
Showing with 4 additions and 2 deletions.
  1. +4 −2 plugins/pastefromword/plugin.js
@@ -66,9 +66,11 @@
// dataValue should be used.
mswordHtml = dataTransferHtml || data.dataValue,
pfwEvtData = { dataValue: mswordHtml },
wordRegexp = /(class=\"?Mso|style=(?:\"|\')[^\"]*?\bmso\-|w:WordDocument|<o:\w+>|<\/font>)/;
officeMetaRegexp = /<meta\s*name=("|')?generator("|')?\s*content=("|')?microsoft/gi,
wordRegexp = /(class=\"?Mso|style=(?:\"|\')[^\"]*?\bmso\-|w:WordDocument|<o:\w+>|<\/font>)/,
isOfficeContent = officeMetaRegexp.test( mswordHtml ) || wordRegexp.test( mswordHtml );
if ( !mswordHtml || !( forceFromWord || wordRegexp.test( mswordHtml ) ) ) {
if ( !mswordHtml || !( forceFromWord || isOfficeContent ) ) {
return;
}

0 comments on commit 327b6d3

Please sign in to comment.