Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | 1x 1x 1x 1x 1x 96x 32x | import { PastePropertyNames } from './constants'; import type { GetSourceFunction } from './getPasteSource'; const WORD_ATTRIBUTE_NAME = 'xmlns:w'; const WORD_ATTRIBUTE_VALUE = 'urn:schemas-microsoft-com:office:word'; const WORD_PROG_ID = 'Word.Document'; /** * @internal * Checks whether the Array provided contains strings that identify Word Desktop documents * @param props Properties related to the PasteEvent * @returns */ export const isWordDesktopDocument: GetSourceFunction = props => { const { htmlAttributes, clipboardData, environment } = props; return ( htmlAttributes[WORD_ATTRIBUTE_NAME] == WORD_ATTRIBUTE_VALUE || htmlAttributes[PastePropertyNames.PROG_ID_NAME] == WORD_PROG_ID || // Safari removes the metadata from the clipboard html, so we need to do this check. !!( environment.isSafari && clipboardData.rawHtml && clipboardData.rawHtml ?.replace(/ /g, '') .indexOf(`${WORD_ATTRIBUTE_NAME}="${WORD_ATTRIBUTE_VALUE}`) > -1 ) ); }; |