quill
Version:
Your powerful, rich text editor
23 lines (17 loc) • 476 B
JavaScript
import { InlineEmbed } from '../blots/embed';
class Mention extends InlineEmbed {
static create(value) {
let node = super.create(value);
node.setAttribute('data-id', value);
node.setAttribute('href', '/' + value);
node.textContent = '@quilljs';
return node;
}
static value(domNode) {
return domNode.getAttribute('data-id');
}
}
Mention.blotName = 'mention';
Mention.className = 'ql-mention';
Mention.tagName = 'A';
export default Mention;