@atlaskit/adf-schema
Version:
Shared package that contains the ADF-schema (json) and ProseMirror node/mark specs
36 lines (33 loc) • 1.07 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.breakout = void 0;
var _markTypes = require("../../next-schema/generated/markTypes");
var allowedTypes = ['wide', 'full-width'];
/**
* @name breakout_mark
*/
var breakout = exports.breakout = (0, _markTypes.breakout)({
parseDOM: [{
tag: 'div.fabric-editor-breakout-mark',
getAttrs: function getAttrs(dom) {
// eslint-disable-next-line @atlaskit/editor/no-as-casting
var mode = dom.getAttribute('data-mode');
// eslint-disable-next-line @atlaskit/editor/no-as-casting
var width = dom.getAttribute('data-width');
return {
mode: allowedTypes.indexOf(mode || '') === -1 ? 'wide' : mode,
width: width ? parseInt(width) : null
};
}
}],
toDOM: function toDOM(mark) {
var _mark$attrs;
return ['div', {
class: 'fabric-editor-breakout-mark',
'data-mode': mark.attrs.mode,
'data-width': (_mark$attrs = mark.attrs) === null || _mark$attrs === void 0 ? void 0 : _mark$attrs.width
}, 0];
}
});