MathtoolsItems.js 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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. var __importDefault = (this && this.__importDefault) || function (mod) {
  18. return (mod && mod.__esModule) ? mod : { "default": mod };
  19. };
  20. Object.defineProperty(exports, "__esModule", { value: true });
  21. exports.MultlinedItem = void 0;
  22. var AmsItems_js_1 = require("../ams/AmsItems.js");
  23. var NodeUtil_js_1 = __importDefault(require("../NodeUtil.js"));
  24. var TexConstants_js_1 = require("../TexConstants.js");
  25. var MultlinedItem = (function (_super) {
  26. __extends(MultlinedItem, _super);
  27. function MultlinedItem() {
  28. return _super !== null && _super.apply(this, arguments) || this;
  29. }
  30. Object.defineProperty(MultlinedItem.prototype, "kind", {
  31. get: function () {
  32. return 'multlined';
  33. },
  34. enumerable: false,
  35. configurable: true
  36. });
  37. MultlinedItem.prototype.EndTable = function () {
  38. if (this.Size() || this.row.length) {
  39. this.EndEntry();
  40. this.EndRow();
  41. }
  42. if (this.table.length > 1) {
  43. var options = this.factory.configuration.options.mathtools;
  44. var gap = options.multlinegap;
  45. var firstskip = options['firstline-afterskip'] || gap;
  46. var lastskip = options['lastline-preskip'] || gap;
  47. var first = NodeUtil_js_1.default.getChildren(this.table[0])[0];
  48. if (NodeUtil_js_1.default.getAttribute(first, 'columnalign') !== TexConstants_js_1.TexConstant.Align.RIGHT) {
  49. first.appendChild(this.create('node', 'mspace', [], { width: firstskip }));
  50. }
  51. var last = NodeUtil_js_1.default.getChildren(this.table[this.table.length - 1])[0];
  52. if (NodeUtil_js_1.default.getAttribute(last, 'columnalign') !== TexConstants_js_1.TexConstant.Align.LEFT) {
  53. var top_1 = NodeUtil_js_1.default.getChildren(last)[0];
  54. top_1.childNodes.unshift(null);
  55. var space = this.create('node', 'mspace', [], { width: lastskip });
  56. NodeUtil_js_1.default.setChild(top_1, 0, space);
  57. }
  58. }
  59. _super.prototype.EndTable.call(this);
  60. };
  61. return MultlinedItem;
  62. }(AmsItems_js_1.MultlineItem));
  63. exports.MultlinedItem = MultlinedItem;
  64. //# sourceMappingURL=MathtoolsItems.js.map