@atlaskit/adf-schema
Version:
Shared package that contains the ADF-schema (json) and ProseMirror node/mark specs
25 lines (23 loc) • 597 B
JavaScript
import { placeholder as placeholderFactory } from '../../next-schema/generated/nodeTypes';
/**
* @name placeholder_node
*/
export const placeholder = placeholderFactory({
parseDOM: [{
tag: 'span[data-placeholder]',
getAttrs: dom => ({
text: dom.getAttribute('data-placeholder') || placeholder.attrs.text.default
})
}],
toDOM(node) {
const {
text
} = node.attrs;
const attrs = {
'data-placeholder': text,
// Needs to be edtiable for mobile to not close keyboard
contenteditable: 'true'
};
return ['span', attrs, text];
}
});