@atlaskit/adf-schema
Version:
Shared package that contains the ADF-schema (json) and ProseMirror node/mark specs
52 lines (50 loc) • 1.34 kB
JavaScript
/**
* @name paragraph_node
*/
/**
* @name paragraph_with_no_marks_node
*/
/**
* NOTE: Need this because TS is too smart and inline everything.
* So we need to give them separate identity.
* Probably there's a way to solve it but that will need time and exploration.
* // http://bit.ly/2raXFX5
* type T1 = X | Y
* type T2 = A | T1 | B // T2 = A | X | Y | B
*/
/**
* @name paragraph_with_alignment_node
*/
/**
* @name paragraph_with_indentation_node
*/
var isImageNode = function isImageNode(node) {
return Boolean(node && node.nodeName.toLowerCase() === 'img');
};
var hasInlineImage = function hasInlineImage(node) {
if (!node) {
return false;
}
return Array.from(node.childNodes).some(function (child) {
var isImage = isImageNode(child);
if (!isImage && child.childNodes) {
return Array.from(node.childNodes).some(function (node) {
return hasInlineImage(node);
});
}
return isImage;
});
};
var pDOM = ['p', 0];
export var paragraph = {
selectable: false,
content: 'inline*',
group: 'block',
marks: 'strong code em link strike subsup textColor typeAheadQuery underline confluenceInlineComment action annotation unsupportedMark unsupportedNodeAttribute dataConsumer fragment',
parseDOM: [{
tag: 'p'
}],
toDOM: function toDOM() {
return pDOM;
}
};