@atlaskit/adf-schema
Version:
Shared package that contains the ADF-schema (json) and ProseMirror node/mark specs
43 lines (41 loc) • 1.13 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.captionWithLocalId = exports.caption = void 0;
var _nodeTypes = require("../../next-schema/generated/nodeTypes");
var _utils = require("../../utils");
/**
* @name caption_node
*/
var caption = exports.caption = (0, _nodeTypes.caption)({
parseDOM: [{
tag: 'figcaption[data-caption]'
}],
toDOM: function toDOM() {
var attrs = {
'data-caption': 'true'
};
return ['figcaption', attrs, 0];
}
});
var captionWithLocalId = exports.captionWithLocalId = (0, _nodeTypes.caption)({
parseDOM: [{
tag: 'figcaption[data-caption]',
getAttrs: function getAttrs() {
return {
localId: _utils.uuid.generate()
};
}
}],
toDOM: function toDOM(node) {
var _node$attrs;
var attrs = {
'data-caption': 'true'
};
if ((node === null || node === void 0 ? void 0 : (_node$attrs = node.attrs) === null || _node$attrs === void 0 ? void 0 : _node$attrs.localId) !== undefined) {
attrs['data-local-id'] = node.attrs.localId;
}
return ['figcaption', attrs, 0];
}
});