UNPKG

@atlaskit/editor-plugin-media

Version:

Media plugin for @atlaskit/editor-core

11 lines (10 loc) • 619 B
// `remix` or `remix:<type>:<subtype>`, as written by Rovo Remix when it inserts an image. const REMIX_SOURCE_PATTERN = /^remix(?::|$)/u; /** * Whether a media node was inserted by Rovo Remix, based on the `dataConsumer` mark sources. */ export const isRemixGeneratedMedia = node => { var _node$marks$find; const sources = (_node$marks$find = node.marks.find(mark => mark.type.name === 'dataConsumer')) === null || _node$marks$find === void 0 ? void 0 : _node$marks$find.attrs.sources; return Array.isArray(sources) && sources.some(source => typeof source === 'string' && REMIX_SOURCE_PATTERN.test(source)); };