@atlaskit/adf-schema
Version:
Shared package that contains the ADF-schema (json) and ProseMirror node/mark specs
31 lines (28 loc) • 813 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.fontSize = void 0;
var _markTypes = require("../../next-schema/generated/markTypes");
var allowedSizes = ['small'];
/**
* @name fontSize_mark
*/
var fontSize = exports.fontSize = (0, _markTypes.fontSize)({
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];
}
});