@atlaskit/editor-plugin-media
Version:
Media plugin for @atlaskit/editor-core
15 lines • 440 B
JavaScript
import { currentMediaNodeWithPos } from '../utils/current-media-node';
export function shouldShowImageBorder(editorState) {
const border = editorState.schema.marks.border;
if (!border) {
return false;
}
const nodeWithPos = currentMediaNodeWithPos(editorState);
if (!nodeWithPos) {
return false;
}
let {
parent
} = editorState.doc.resolve(nodeWithPos.pos);
return parent && parent.type.allowsMarkType(border);
}