Skip to content

Commit

Permalink
fix: #553 #597 paste MS data
Browse files Browse the repository at this point in the history
  • Loading branch information
JiHong88 committed Jan 21, 2021
1 parent 7fb2f4f commit ad2a878
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/lib/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -6929,8 +6929,9 @@ export default function (context, pluginCallButtons, plugins, lang, options, _re
},

_setClipboardData: function (type, e, plainText, cleanData, data) {
// MS word
if (/class=["']*Mso(Normal|List)/i.test(cleanData) || /content=["']*Word.Document/i.test(cleanData) || /content=["']*OneNote.File/i.test(cleanData)) {
// MS word, OneNode, Excel
const MSData = /class=["']*Mso(Normal|List)/i.test(cleanData) || /content=["']*Word.Document/i.test(cleanData) || /content=["']*OneNote.File/i.test(cleanData) || /content=["']*Excel.Sheet/i.test(cleanData);
if (MSData) {
cleanData = cleanData.replace(/\n/g, ' ');
plainText = plainText.replace(/\n/g, ' ');
} else {
Expand All @@ -6955,7 +6956,7 @@ export default function (context, pluginCallButtons, plugins, lang, options, _re

// files
const files = data.files;
if (files.length > 0) {
if (files.length > 0 && !MSData) {
if (/^image/.test(files[0].type) && core.plugins.image) {
functions.insertImage(files);
}
Expand Down

0 comments on commit ad2a878

Please sign in to comment.