// :: MarkSpec A link. Has `href` and `title` attributes. `title` // defaults to the empty string. Rendered and parsed as an `` // element. const link = { attrs: { href: {}, title: { default: null }, target: { default: '_blank' }, }, inclusive: false, parseDOM: [ { tag: 'a[href]', getAttrs(dom) { return { href: dom.getAttribute('href'), title: dom.getAttribute('title'), target: dom.getAttribute('target'), }; }, }, ], toDOM(node) { const { href, title, target } = node.attrs; return ['a', { href, title, target }, 0]; }, }; // :: MarkSpec An emphasis mark. Rendered as an `` element. // Has parse rules that also match `` and `font-style: italic`. const em = { parseDOM: [ { tag: 'i' }, { tag: 'em' }, { style: 'font-style=italic' }, ], toDOM() { return ['em', 0]; }, }; // :: MarkSpec A strong mark. Rendered as ``, parse rules // also match `` and `font-weight: bold`. const strong = { parseDOM: [ { tag: 'strong' }, // This works around a Google Docs misbehavior where // pasted content will be inexplicably wrapped in `` // tags with a font-weight normal. { tag: 'b', getAttrs: (dom) => { return dom.style.fontWeight !== 'normal' && null; }, }, { style: 'font-weight', getAttrs: (value) => { return (/^(?:bold(?:er)?|[5-9]\d{2,})$/).test(value) && null; }, }, ], toDOM() { return ['strong', 0]; }, }; // :: MarkSpec Code font mark. Represented as a `` element. const code = { parseDOM: [ { tag: 'code' }, ], toDOM() { return ['code', 0]; }, }; // :: MarkSpec An underline mark. Rendered as an `` element. // Has parse rules that also match `text-decoration: underline`. const u = { parseDOM: [ { tag: 'u' }, { style: 'text-decoration=underline', consuming: false, }, ], toDOM() { return ['u', 0]; }, }; // :: MarkSpec An underline mark. Rendered as an `` element. // Has parse rules that also match `strike`, `del` tag and css property `text-decoration: line-through`. const s = { parseDOM: [ { tag: 's' }, { tag: 'strike' }, { style: 'text-decoration=line-through' }, ], toDOM() { return ['s', 0]; }, }; const textColor = { attrs: { color: { default: null, }, }, parseDOM: [ { style: 'color', getAttrs: (value) => { return { color: value }; }, }, ], toDOM(mark) { const { color } = mark.attrs; return ['span', { style: `color:${color};` }, 0]; }, }; const textBackgroundColor = { attrs: { backgroundColor: { default: null, }, }, parseDOM: [ { style: 'background-color', getAttrs: (value) => { return { backgroundColor: value }; }, }, ], toDOM(mark) { const { backgroundColor } = mark.attrs; return ['span', { style: `background-color:${backgroundColor};` }, 0]; }, }; const marks = { link, em, strong, code, u, s, text_color: textColor, text_background_color: textBackgroundColor, }; export default marks; //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibWFya3MuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi9wcm9qZWN0cy9uZ3gtZWRpdG9yL3NjaGVtYS9tYXJrcy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFFQSxpRUFBaUU7QUFDakUsZ0VBQWdFO0FBQ2hFLFdBQVc7QUFDWCxNQUFNLElBQUksR0FBYTtJQUNyQixLQUFLLEVBQUU7UUFDTCxJQUFJLEVBQUUsRUFBRTtRQUNSLEtBQUssRUFBRSxFQUFFLE9BQU8sRUFBRSxJQUFJLEVBQUU7UUFDeEIsTUFBTSxFQUFFLEVBQUUsT0FBTyxFQUFFLFFBQVEsRUFBRTtLQUM5QjtJQUNELFNBQVMsRUFBRSxLQUFLO0lBQ2hCLFFBQVEsRUFBRTtRQUNSO1lBQ0UsR0FBRyxFQUFFLFNBQVM7WUFDZCxRQUFRLENBQUMsR0FBZ0I7Z0JBQ3ZCLE9BQU87b0JBQ0wsSUFBSSxFQUFFLEdBQUcsQ0FBQyxZQUFZLENBQUMsTUFBTSxDQUFDO29CQUM5QixLQUFLLEVBQUUsR0FBRyxDQUFDLFlBQVksQ0FBQyxPQUFPLENBQUM7b0JBQ2hDLE1BQU0sRUFBRSxHQUFHLENBQUMsWUFBWSxDQUFDLFFBQVEsQ0FBQztpQkFDbkMsQ0FBQztZQUNKLENBQUM7U0FDRjtLQUNGO0lBQ0QsS0FBSyxDQUFDLElBQUk7UUFDUixNQUFNLEVBQUUsSUFBSSxFQUFFLEtBQUssRUFBRSxNQUFNLEVBQUUsR0FBRy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