@atlaskit/editor-plugin-media
Version:
Media plugin for @atlaskit/editor-core
15 lines (14 loc) • 693 B
JavaScript
// `remix` or `remix:<type>:<subtype>`, as written by Rovo Remix when it inserts an image.
var REMIX_SOURCE_PATTERN = /^remix(?::|$)/;
/**
* Whether a media node was inserted by Rovo Remix, based on the `dataConsumer` mark sources.
*/
export var isRemixGeneratedMedia = function isRemixGeneratedMedia(node) {
var _node$marks$find;
var sources = (_node$marks$find = node.marks.find(function (mark) {
return mark.type.name === 'dataConsumer';
})) === null || _node$marks$find === void 0 ? void 0 : _node$marks$find.attrs.sources;
return Array.isArray(sources) && sources.some(function (source) {
return typeof source === 'string' && REMIX_SOURCE_PATTERN.test(source);
});
};