UNPKG

@atlaskit/adf-schema

Version:

Shared package that contains the ADF-schema (json) and ProseMirror node/mark specs

32 lines (31 loc) 606 B
/** * @name placeholder_node */ export const placeholder = { inline: true, group: 'inline', selectable: false, marks: '', attrs: { text: { default: '' } }, 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]; } };