UNPKG

@atlaskit/adf-schema

Version:

Shared package that contains the ADF-schema (json) and ProseMirror node/mark specs

36 lines (34 loc) 824 B
import { FONT_STYLE } from '../groups'; /** * @name strong_mark */ const strongDOM = ['strong']; export const strong = { inclusive: true, group: FONT_STYLE, parseDOM: [{ tag: 'strong' }, // This works around a Google Docs misbehavior where // pasted content will be inexplicably wrapped in `<b>` // tags with a font-weight normal. { tag: 'b', getAttrs(node) { const element = node; return element.style.fontWeight !== 'normal' && null; } }, { tag: 'span', getAttrs(node) { const element = node; const { fontWeight } = element.style; return typeof fontWeight === 'string' && (fontWeight === 'bold' || fontWeight === 'bolder' || /^(bold(er)?|[5-9]\d{2,})$/.test(fontWeight)) && null; } }], toDOM() { return strongDOM; } };