hlink-click-xform.js 837 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. const BaseXform = require('../base-xform');
  2. class HLinkClickXform extends BaseXform {
  3. get tag() {
  4. return 'a:hlinkClick';
  5. }
  6. render(xmlStream, model) {
  7. if (!(model.hyperlinks && model.hyperlinks.rId)) {
  8. return;
  9. }
  10. xmlStream.leafNode(this.tag, {
  11. 'xmlns:r': 'http://schemas.openxmlformats.org/officeDocument/2006/relationships',
  12. 'r:id': model.hyperlinks.rId,
  13. tooltip: model.hyperlinks.tooltip,
  14. });
  15. }
  16. parseOpen(node) {
  17. switch (node.name) {
  18. case this.tag:
  19. this.model = {
  20. hyperlinks: {
  21. rId: node.attributes['r:id'],
  22. tooltip: node.attributes.tooltip,
  23. },
  24. };
  25. return true;
  26. default:
  27. return true;
  28. }
  29. }
  30. parseText() {}
  31. parseClose() {
  32. return false;
  33. }
  34. }
  35. module.exports = HLinkClickXform;