@atlaskit/adf-schema
Version:
Shared package that contains the ADF-schema (json) and ProseMirror node/mark specs
57 lines (54 loc) • 1.18 kB
JavaScript
/**
* @name nestedExpand_content
* @minItems 1
* @allowUnsupportedBlock true
*/
/**
* @name nestedExpand_node
*/
/**
* @name nestedExpand_with_no_marks_node
*/
export var nestedExpand = {
inline: false,
marks: 'unsupportedMark unsupportedNodeAttribute',
content: '(paragraph | heading | mediaSingle | mediaGroup | unsupportedBlock)+',
isolating: true,
selectable: true,
attrs: {
title: {
default: ''
},
__expanded: {
default: true
}
},
parseDOM: [{
context: 'nestedExpand//',
tag: '[data-node-type="nestedExpand"]',
skip: true
}, {
tag: '[data-node-type="nestedExpand"] button',
ignore: true
}, {
tag: '[data-node-type="expand"] button',
ignore: true
}, {
tag: 'div[data-node-type="nestedExpand"]',
getAttrs: function getAttrs(domNode) {
var dom = domNode;
return {
title: dom.getAttribute('data-title'),
__expanded: true
};
}
}],
toDOM: function toDOM(node) {
var attrs = {
'data-node-type': 'nestedExpand',
'data-title': node.attrs.title,
'data-expanded': node.attrs.__expanded
};
return ['div', attrs, 0];
}
};