@atlaskit/editor-plugin-media
Version:
Media plugin for @atlaskit/editor-core
15 lines • 630 B
JavaScript
import { currentMediaNodeWithPos } from '@atlaskit/editor-common/media-single';
import { currentMediaInlineNodeWithPos } from '../../pm-plugins/utils/current-media-node';
export function shouldShowImageBorder(editorState) {
var border = editorState.schema.marks.border;
if (!border) {
return false;
}
var nodeWithPos = currentMediaNodeWithPos(editorState) || currentMediaInlineNodeWithPos(editorState);
if (!nodeWithPos) {
return false;
}
var _editorState$doc$reso = editorState.doc.resolve(nodeWithPos.pos),
parent = _editorState$doc$reso.parent;
return parent && parent.type.allowsMarkType(border);
}