mention.js 460 B

1234567891011121314151617181920
  1. import Embed from '../blots/embed';
  2. class Mention extends Embed {
  3. static create(value) {
  4. const node = super.create(value);
  5. node.setAttribute('data-id', value);
  6. node.setAttribute('href', `/${value}`);
  7. node.textContent = '@quilljs';
  8. return node;
  9. }
  10. static value(domNode) {
  11. return domNode.getAttribute('data-id');
  12. }
  13. }
  14. Mention.blotName = 'mention';
  15. Mention.className = 'ql-mention';
  16. Mention.tagName = 'A';
  17. export default Mention;