mglyph.js 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. "use strict";
  2. var __extends = (this && this.__extends) || (function () {
  3. var extendStatics = function (d, b) {
  4. extendStatics = Object.setPrototypeOf ||
  5. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  6. function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
  7. return extendStatics(d, b);
  8. };
  9. return function (d, b) {
  10. if (typeof b !== "function" && b !== null)
  11. throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
  12. extendStatics(d, b);
  13. function __() { this.constructor = d; }
  14. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  15. };
  16. })();
  17. Object.defineProperty(exports, "__esModule", { value: true });
  18. exports.CHTMLmglyph = void 0;
  19. var Wrapper_js_1 = require("../Wrapper.js");
  20. var mglyph_js_1 = require("../../common/Wrappers/mglyph.js");
  21. var mglyph_js_2 = require("../../../core/MmlTree/MmlNodes/mglyph.js");
  22. var CHTMLmglyph = (function (_super) {
  23. __extends(CHTMLmglyph, _super);
  24. function CHTMLmglyph() {
  25. return _super !== null && _super.apply(this, arguments) || this;
  26. }
  27. CHTMLmglyph.prototype.toCHTML = function (parent) {
  28. var chtml = this.standardCHTMLnode(parent);
  29. if (this.charWrapper) {
  30. this.charWrapper.toCHTML(chtml);
  31. return;
  32. }
  33. var _a = this.node.attributes.getList('src', 'alt'), src = _a.src, alt = _a.alt;
  34. var styles = {
  35. width: this.em(this.width),
  36. height: this.em(this.height)
  37. };
  38. if (this.valign) {
  39. styles.verticalAlign = this.em(this.valign);
  40. }
  41. var img = this.html('img', { src: src, style: styles, alt: alt, title: alt });
  42. this.adaptor.append(chtml, img);
  43. };
  44. CHTMLmglyph.kind = mglyph_js_2.MmlMglyph.prototype.kind;
  45. CHTMLmglyph.styles = {
  46. 'mjx-mglyph > img': {
  47. display: 'inline-block',
  48. border: 0,
  49. padding: 0
  50. }
  51. };
  52. return CHTMLmglyph;
  53. }((0, mglyph_js_1.CommonMglyphMixin)(Wrapper_js_1.CHTMLWrapper)));
  54. exports.CHTMLmglyph = CHTMLmglyph;
  55. //# sourceMappingURL=mglyph.js.map