@atlaskit/adf-schema
Version:
Shared package that contains the ADF-schema (json) and ProseMirror node/mark specs
39 lines (37 loc) • 1.08 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.syncBlock = void 0;
var _nodeTypes = require("../../next-schema/generated/nodeTypes");
var _utils = require("../../utils");
/**
* Represents a block node that is designed to be synchronized
* with an external resource across different products.
* @name syncBlock_node
*/
var syncBlock = exports.syncBlock = (0, _nodeTypes.syncBlockStage0)({
parseDOM: [{
tag: 'div[data-sync-block]',
getAttrs: function getAttrs(domNode) {
var dom = domNode;
var attrs = {
localId: dom.getAttribute('data-local-id') || _utils.uuid.generate(),
resourceId: dom.getAttribute('data-resource-id') || ''
};
return attrs;
}
}],
toDOM: function toDOM(node) {
var _node$attrs = node.attrs,
localId = _node$attrs.localId,
resourceId = _node$attrs.resourceId;
var name = 'div';
var attrs = {
'data-sync-block': '',
'data-local-id': localId,
'data-resource-id': resourceId
};
return [name, attrs];
}
});