UNPKG

@atlaskit/editor-plugin-media

Version:

Media plugin for @atlaskit/editor-core

16 lines 588 B
import { currentMediaNodeWithPos } from '@atlaskit/editor-common/media-single'; import { currentMediaInlineNodeWithPos } from '../../pm-plugins/utils/current-media-node'; export function shouldShowImageBorder(editorState) { const border = editorState.schema.marks.border; if (!border) { return false; } const nodeWithPos = currentMediaNodeWithPos(editorState) || currentMediaInlineNodeWithPos(editorState); if (!nodeWithPos) { return false; } const { parent } = editorState.doc.resolve(nodeWithPos.pos); return parent && parent.type.allowsMarkType(border); }