@atlaskit/adf-schema
Version:
Shared package that contains the ADF-schema (json) and ProseMirror node/mark specs
25 lines (23 loc) • 703 B
JavaScript
import { fontSize as fontSizeFactory } from '../../next-schema/generated/markTypes';
var allowedSizes = ['small'];
/**
* @name fontSize_mark
*/
export var fontSize = fontSizeFactory({
parseDOM: [{
tag: 'div.fabric-editor-font-size',
getAttrs: function getAttrs(dom) {
// eslint-disable-next-line @atlaskit/editor/no-as-casting
var fontSize = dom.getAttribute('data-font-size');
return {
fontSize: allowedSizes.indexOf(fontSize || '') === -1 ? 'small' : fontSize
};
}
}],
toDOM: function toDOM(mark) {
return ['div', {
class: 'fabric-editor-block-mark fabric-editor-font-size',
'data-font-size': mark.attrs.fontSize
}, 0];
}
});