jodit
Version:
Jodit is awesome and usefully wysiwyg editor with filebrowser
20 lines (18 loc) • 595 B
text/typescript
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2020 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
/**
* Detect if string is HTML from MS Word or Excel
*
* @param {string} data
* @return {boolean}
*/
export function isHtmlFromWord(data: string): boolean {
return (
data.search(/<meta.*?Microsoft Excel\s[\d].*?>/) !== -1 ||
data.search(/<meta.*?Microsoft Word\s[\d].*?>/) !== -1 ||
(data.search(/style="[^"]*mso-/) !== -1 && data.search(/<font/) !== -1)
);
}