@king-design/vue 3.8.0-beta.0 → 3.8.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. package/__tests__/__snapshots__/Vue Next Demos.md +74 -74
  2. package/components/bubble/bubble.d.ts +1 -0
  3. package/components/bubble/bubble.vdt.js +6 -2
  4. package/components/bubble/index.spec.js +58 -5
  5. package/components/bubble/styles.js +1 -1
  6. package/components/bubble/useBubbleDisplay.d.ts +1 -0
  7. package/components/bubble/useBubbleDisplay.js +8 -0
  8. package/components/bubbleList/bubbleList.vdt.js +3 -1
  9. package/components/bubbleList/index.spec.js +301 -237
  10. package/components/bubbleList/styles.js +2 -2
  11. package/components/bubbleList/useBubbleList.js +7 -0
  12. package/components/fileCard/fileCard.vdt.js +4 -4
  13. package/components/fileCard/index.spec.js +179 -107
  14. package/components/fileCard/list.d.ts +2 -1
  15. package/components/fileCard/list.vdt.js +7 -5
  16. package/components/fileCard/styles.js +10 -8
  17. package/components/fileCard/useFileCard.d.ts +1 -1
  18. package/components/fileCard/useFileCard.js +6 -35
  19. package/components/media/index.spec.js +774 -585
  20. package/components/media/media.vdt.js +17 -6
  21. package/components/media/mediaAssets.d.ts +2 -0
  22. package/components/media/mediaAssets.js +4 -0
  23. package/components/media/styles.js +5 -3
  24. package/components/media/useMedia.d.ts +6 -2
  25. package/components/media/useMedia.js +28 -6
  26. package/components/sender/index.spec.js +1039 -435
  27. package/components/sender/sender.d.ts +27 -4
  28. package/components/sender/sender.js +16 -5
  29. package/components/sender/sender.vdt.js +121 -49
  30. package/components/sender/styles.js +18 -9
  31. package/components/sender/useAutoResize.js +6 -6
  32. package/components/sender/useSenderDrag.js +12 -3
  33. package/components/sender/useSenderInput.d.ts +3 -0
  34. package/components/sender/useSenderInput.js +20 -3
  35. package/components/sender/useSenderPaste.js +1 -1
  36. package/components/sender/useSenderUpload.js +38 -29
  37. package/components/xmarkdown/index.spec.js +370 -239
  38. package/components/xmarkdown/markdown/streaming.js +41 -8
  39. package/components/xmarkdown/styles.js +2 -2
  40. package/components/xmarkdown/useXMarkdownDisplay.d.ts +1 -0
  41. package/components/xmarkdown/useXMarkdownDisplay.js +9 -1
  42. package/components/xmarkdown/xmarkdown.d.ts +1 -0
  43. package/components/xmarkdown/xmarkdown.vdt.js +6 -2
  44. package/dist/i18n/en-US.js +1 -0
  45. package/dist/i18n/en-US.js.map +1 -1
  46. package/dist/i18n/en-US.min.js +1 -1
  47. package/dist/index.js +400 -193
  48. package/dist/index.js.map +1 -1
  49. package/dist/index.min.js +2 -2
  50. package/i18n/en-US.d.ts +1 -0
  51. package/i18n/en-US.js +1 -0
  52. package/index.d.ts +2 -2
  53. package/index.js +2 -2
  54. package/package.json +1 -1
@@ -17,10 +17,10 @@ describe('XMarkdown', function () {
17
17
  return _waitFor.apply(this, arguments);
18
18
  }
19
19
  function _waitFor() {
20
- _waitFor = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee29(check, retries, interval) {
20
+ _waitFor = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee32(check, retries, interval) {
21
21
  var i;
22
- return _regeneratorRuntime.wrap(function _callee29$(_context60) {
23
- while (1) switch (_context60.prev = _context60.next) {
22
+ return _regeneratorRuntime.wrap(function _callee32$(_context66) {
23
+ while (1) switch (_context66.prev = _context66.next) {
24
24
  case 0:
25
25
  if (retries === void 0) {
26
26
  retries = 30;
@@ -31,28 +31,28 @@ describe('XMarkdown', function () {
31
31
  i = 0;
32
32
  case 3:
33
33
  if (!(i < retries)) {
34
- _context60.next = 11;
34
+ _context66.next = 11;
35
35
  break;
36
36
  }
37
37
  if (!check()) {
38
- _context60.next = 6;
38
+ _context66.next = 6;
39
39
  break;
40
40
  }
41
- return _context60.abrupt("return", true);
41
+ return _context66.abrupt("return", true);
42
42
  case 6:
43
- _context60.next = 8;
43
+ _context66.next = 8;
44
44
  return wait(interval);
45
45
  case 8:
46
46
  i++;
47
- _context60.next = 3;
47
+ _context66.next = 3;
48
48
  break;
49
49
  case 11:
50
- return _context60.abrupt("return", check());
50
+ return _context66.abrupt("return", check());
51
51
  case 12:
52
52
  case "end":
53
- return _context60.stop();
53
+ return _context66.stop();
54
54
  }
55
- }, _callee29);
55
+ }, _callee32);
56
56
  }));
57
57
  return _waitFor.apply(this, arguments);
58
58
  }
@@ -886,8 +886,8 @@ describe('XMarkdown', function () {
886
886
  }
887
887
  }, _callee16);
888
888
  })));
889
- it('should keep previous stable DOM across multiple append-only promotions', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee17() {
890
- var Demo, _mount17, instance, element, ready, stableContainer, tailContainer, firstHeading, firstParagraph, firstTailReady, firstPromotionReady, secondHeading, secondParagraph, secondTailReady, secondPromotionReady;
889
+ it('should keep spacing before open code block while streaming', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee17() {
890
+ var Demo, _mount17, element, ready, codeBlock;
891
891
  return _regeneratorRuntime.wrap(function _callee17$(_context35) {
892
892
  while (1) switch (_context35.prev = _context35.next) {
893
893
  case 0:
@@ -905,21 +905,113 @@ describe('XMarkdown', function () {
905
905
  }
906
906
  Demo.defaults = function defaults() {
907
907
  return {
908
- content: '# 标题\n\n第一段稳定内容。\n\n',
908
+ content: '上一段内容。\n\n```ts\nconst a = 1;',
909
909
  streaming: true
910
910
  };
911
911
  };
912
912
  return Demo;
913
913
  }(Component);
914
914
  Demo.template = "\n const { XMarkdown } = this;\n <XMarkdown\n content={this.get('content')}\n streaming={this.get('streaming')}\n />\n ";
915
- _mount17 = mount(Demo), instance = _mount17[0], element = _mount17[1];
915
+ _mount17 = mount(Demo), element = _mount17[1];
916
916
  _context35.next = 5;
917
917
  return waitFor(function () {
918
- return !!element.querySelector('.k-xmarkdown-stable h1');
918
+ return !!element.querySelector('.k-xmarkdown-tail > .k-xmarkdown-code-block');
919
919
  });
920
920
  case 5:
921
921
  ready = _context35.sent;
922
922
  expect(ready).to.be.true;
923
+ codeBlock = element.querySelector('.k-xmarkdown-tail > .k-xmarkdown-code-block');
924
+ expect(getComputedStyle(codeBlock).marginTop).to.eql('12px');
925
+ case 9:
926
+ case "end":
927
+ return _context35.stop();
928
+ }
929
+ }, _callee17);
930
+ })));
931
+ it('should progressively fill table cells while streaming a new row', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee18() {
932
+ var Demo, _mount18, instance, element, ready, filled;
933
+ return _regeneratorRuntime.wrap(function _callee18$(_context37) {
934
+ while (1) switch (_context37.prev = _context37.next) {
935
+ case 0:
936
+ Demo = /*#__PURE__*/function (_Component18) {
937
+ _inheritsLoose(Demo, _Component18);
938
+ function Demo() {
939
+ var _context36;
940
+ var _this18;
941
+ for (var _len18 = arguments.length, args = new Array(_len18), _key18 = 0; _key18 < _len18; _key18++) {
942
+ args[_key18] = arguments[_key18];
943
+ }
944
+ _this18 = _Component18.call.apply(_Component18, _concatInstanceProperty(_context36 = [this]).call(_context36, args)) || this;
945
+ _this18.XMarkdown = XMarkdown;
946
+ return _this18;
947
+ }
948
+ Demo.defaults = function defaults() {
949
+ return {
950
+ content: ['| A | B | C |', '| --- | --- | --- |', '| 1 |'].join('\n'),
951
+ streaming: true
952
+ };
953
+ };
954
+ return Demo;
955
+ }(Component);
956
+ Demo.template = "\n const { XMarkdown } = this;\n <XMarkdown\n content={this.get('content')}\n streaming={this.get('streaming')}\n />\n ";
957
+ _mount18 = mount(Demo), instance = _mount18[0], element = _mount18[1];
958
+ _context37.next = 5;
959
+ return waitFor(function () {
960
+ return element.querySelectorAll('.k-xmarkdown-table-wrap td').length === 3;
961
+ });
962
+ case 5:
963
+ ready = _context37.sent;
964
+ expect(ready).to.be.true;
965
+ instance.set('content', ['| A | B | C |', '| --- | --- | --- |', '| 1 | 2'].join('\n'));
966
+ _context37.next = 10;
967
+ return waitFor(function () {
968
+ var cells = element.querySelectorAll('.k-xmarkdown-table-wrap td');
969
+ return cells.length === 3 && cells[1].textContent === '2';
970
+ });
971
+ case 10:
972
+ filled = _context37.sent;
973
+ expect(filled).to.be.true;
974
+ expect(element.querySelector('.k-xmarkdown-tail [data-kpc-xmarkdown-tail="true"]')).to.eql(null);
975
+ case 13:
976
+ case "end":
977
+ return _context37.stop();
978
+ }
979
+ }, _callee18);
980
+ })));
981
+ it('should keep previous stable DOM across multiple append-only promotions', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee19() {
982
+ var Demo, _mount19, instance, element, ready, stableContainer, tailContainer, firstHeading, firstParagraph, firstTailReady, firstPromotionReady, secondHeading, secondParagraph, secondTailReady, secondPromotionReady;
983
+ return _regeneratorRuntime.wrap(function _callee19$(_context39) {
984
+ while (1) switch (_context39.prev = _context39.next) {
985
+ case 0:
986
+ Demo = /*#__PURE__*/function (_Component19) {
987
+ _inheritsLoose(Demo, _Component19);
988
+ function Demo() {
989
+ var _context38;
990
+ var _this19;
991
+ for (var _len19 = arguments.length, args = new Array(_len19), _key19 = 0; _key19 < _len19; _key19++) {
992
+ args[_key19] = arguments[_key19];
993
+ }
994
+ _this19 = _Component19.call.apply(_Component19, _concatInstanceProperty(_context38 = [this]).call(_context38, args)) || this;
995
+ _this19.XMarkdown = XMarkdown;
996
+ return _this19;
997
+ }
998
+ Demo.defaults = function defaults() {
999
+ return {
1000
+ content: '# 标题\n\n第一段稳定内容。\n\n',
1001
+ streaming: true
1002
+ };
1003
+ };
1004
+ return Demo;
1005
+ }(Component);
1006
+ Demo.template = "\n const { XMarkdown } = this;\n <XMarkdown\n content={this.get('content')}\n streaming={this.get('streaming')}\n />\n ";
1007
+ _mount19 = mount(Demo), instance = _mount19[0], element = _mount19[1];
1008
+ _context39.next = 5;
1009
+ return waitFor(function () {
1010
+ return !!element.querySelector('.k-xmarkdown-stable h1');
1011
+ });
1012
+ case 5:
1013
+ ready = _context39.sent;
1014
+ expect(ready).to.be.true;
923
1015
  stableContainer = element.querySelector('.k-xmarkdown-stable');
924
1016
  tailContainer = element.querySelector('.k-xmarkdown-tail');
925
1017
  firstHeading = stableContainer.querySelector('h1');
@@ -927,20 +1019,20 @@ describe('XMarkdown', function () {
927
1019
  firstHeading.__kpcFirstStableHeading = 'kept';
928
1020
  firstParagraph.__kpcFirstStableParagraph = 'kept';
929
1021
  instance.set('content', '# 标题\n\n第一段稳定内容。\n\n# 第二个标题');
930
- _context35.next = 16;
1022
+ _context39.next = 16;
931
1023
  return waitFor(function () {
932
1024
  return !!tailContainer.querySelector('[data-kpc-xmarkdown-tail="true"]');
933
1025
  }, 30, 20);
934
1026
  case 16:
935
- firstTailReady = _context35.sent;
1027
+ firstTailReady = _context39.sent;
936
1028
  expect(firstTailReady).to.be.true;
937
1029
  instance.set('content', '# 标题\n\n第一段稳定内容。\n\n# 第二个标题\n\n第二段稳定内容。\n\n');
938
- _context35.next = 21;
1030
+ _context39.next = 21;
939
1031
  return waitFor(function () {
940
1032
  return stableContainer.querySelectorAll('h1').length === 2;
941
1033
  }, 30, 20);
942
1034
  case 21:
943
- firstPromotionReady = _context35.sent;
1035
+ firstPromotionReady = _context39.sent;
944
1036
  expect(firstPromotionReady).to.be.true;
945
1037
  expect(stableContainer.querySelector('h1').__kpcFirstStableHeading).to.eql('kept');
946
1038
  expect(stableContainer.querySelector('p').__kpcFirstStableParagraph).to.eql('kept');
@@ -949,20 +1041,20 @@ describe('XMarkdown', function () {
949
1041
  secondHeading.__kpcSecondStableHeading = 'kept';
950
1042
  secondParagraph.__kpcSecondStableParagraph = 'kept';
951
1043
  instance.set('content', '# 标题\n\n第一段稳定内容。\n\n# 第二个标题\n\n第二段稳定内容。\n\n## 第三个标题');
952
- _context35.next = 32;
1044
+ _context39.next = 32;
953
1045
  return waitFor(function () {
954
1046
  return !!tailContainer.querySelector('[data-kpc-xmarkdown-tail="true"]');
955
1047
  }, 30, 20);
956
1048
  case 32:
957
- secondTailReady = _context35.sent;
1049
+ secondTailReady = _context39.sent;
958
1050
  expect(secondTailReady).to.be.true;
959
1051
  instance.set('content', '# 标题\n\n第一段稳定内容。\n\n# 第二个标题\n\n第二段稳定内容。\n\n## 第三个标题\n\n第三段稳定内容。');
960
- _context35.next = 37;
1052
+ _context39.next = 37;
961
1053
  return waitFor(function () {
962
1054
  return stableContainer.querySelectorAll('h1').length === 2 && stableContainer.querySelectorAll('h2').length === 1;
963
1055
  }, 30, 20);
964
1056
  case 37:
965
- secondPromotionReady = _context35.sent;
1057
+ secondPromotionReady = _context39.sent;
966
1058
  expect(secondPromotionReady).to.be.true;
967
1059
  expect(stableContainer.querySelector('h1').__kpcFirstStableHeading).to.eql('kept');
968
1060
  expect(stableContainer.querySelector('p').__kpcFirstStableParagraph).to.eql('kept');
@@ -970,26 +1062,65 @@ describe('XMarkdown', function () {
970
1062
  expect(stableContainer.querySelectorAll('p')[1].__kpcSecondStableParagraph).to.eql('kept');
971
1063
  case 43:
972
1064
  case "end":
973
- return _context35.stop();
1065
+ return _context39.stop();
974
1066
  }
975
- }, _callee17);
1067
+ }, _callee19);
976
1068
  })));
977
- it('should put unclosed block-level formula into tail container during streaming', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee18() {
978
- var Demo, _mount18, instance, element, ready, stableContainer, tailContainer, formulaRendered;
979
- return _regeneratorRuntime.wrap(function _callee18$(_context37) {
980
- while (1) switch (_context37.prev = _context37.next) {
1069
+ it('should render typing suffix only when enabled', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee20() {
1070
+ var Demo, _mount20, element;
1071
+ return _regeneratorRuntime.wrap(function _callee20$(_context41) {
1072
+ while (1) switch (_context41.prev = _context41.next) {
981
1073
  case 0:
982
- Demo = /*#__PURE__*/function (_Component18) {
983
- _inheritsLoose(Demo, _Component18);
1074
+ Demo = /*#__PURE__*/function (_Component20) {
1075
+ _inheritsLoose(Demo, _Component20);
984
1076
  function Demo() {
985
- var _context36;
986
- var _this18;
987
- for (var _len18 = arguments.length, args = new Array(_len18), _key18 = 0; _key18 < _len18; _key18++) {
988
- args[_key18] = arguments[_key18];
1077
+ var _context40;
1078
+ var _this20;
1079
+ for (var _len20 = arguments.length, args = new Array(_len20), _key20 = 0; _key20 < _len20; _key20++) {
1080
+ args[_key20] = arguments[_key20];
989
1081
  }
990
- _this18 = _Component18.call.apply(_Component18, _concatInstanceProperty(_context36 = [this]).call(_context36, args)) || this;
991
- _this18.XMarkdown = XMarkdown;
992
- return _this18;
1082
+ _this20 = _Component20.call.apply(_Component20, _concatInstanceProperty(_context40 = [this]).call(_context40, args)) || this;
1083
+ _this20.XMarkdown = XMarkdown;
1084
+ return _this20;
1085
+ }
1086
+ Demo.defaults = function defaults() {
1087
+ return {
1088
+ content: '# 标题\n\n一段内容'
1089
+ };
1090
+ };
1091
+ return Demo;
1092
+ }(Component);
1093
+ Demo.template = "\n const { XMarkdown } = this;\n <div>\n <XMarkdown\n className=\"suffix-enabled\"\n content={this.get('content')}\n streaming={true}\n typing={{interval: 16, step: 2, suffix: true}}\n />\n <XMarkdown\n className=\"suffix-default\"\n content={this.get('content')}\n streaming={true}\n typing={{interval: 16, step: 2}}\n />\n </div>\n ";
1094
+ _mount20 = mount(Demo), element = _mount20[1];
1095
+ _context41.next = 5;
1096
+ return waitFor(function () {
1097
+ return !!element.querySelector('.suffix-enabled .k-xmarkdown-typing-suffix');
1098
+ });
1099
+ case 5:
1100
+ expect(element.querySelector('.suffix-enabled .k-xmarkdown-typing-suffix').querySelectorAll('span').length).to.eql(3);
1101
+ expect(element.querySelector('.suffix-default .k-xmarkdown-typing-suffix')).to.eql(null);
1102
+ case 7:
1103
+ case "end":
1104
+ return _context41.stop();
1105
+ }
1106
+ }, _callee20);
1107
+ })));
1108
+ it('should put unclosed block-level formula into tail container during streaming', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee21() {
1109
+ var Demo, _mount21, instance, element, ready, stableContainer, tailContainer, formulaRendered;
1110
+ return _regeneratorRuntime.wrap(function _callee21$(_context43) {
1111
+ while (1) switch (_context43.prev = _context43.next) {
1112
+ case 0:
1113
+ Demo = /*#__PURE__*/function (_Component21) {
1114
+ _inheritsLoose(Demo, _Component21);
1115
+ function Demo() {
1116
+ var _context42;
1117
+ var _this21;
1118
+ for (var _len21 = arguments.length, args = new Array(_len21), _key21 = 0; _key21 < _len21; _key21++) {
1119
+ args[_key21] = arguments[_key21];
1120
+ }
1121
+ _this21 = _Component21.call.apply(_Component21, _concatInstanceProperty(_context42 = [this]).call(_context42, args)) || this;
1122
+ _this21.XMarkdown = XMarkdown;
1123
+ return _this21;
993
1124
  }
994
1125
  Demo.defaults = function defaults() {
995
1126
  return {
@@ -1001,13 +1132,13 @@ describe('XMarkdown', function () {
1001
1132
  return Demo;
1002
1133
  }(Component);
1003
1134
  Demo.template = "\n const { XMarkdown } = this;\n <XMarkdown\n content={this.get('content')}\n streaming={this.get('streaming')}\n />\n ";
1004
- _mount18 = mount(Demo), instance = _mount18[0], element = _mount18[1];
1005
- _context37.next = 5;
1135
+ _mount21 = mount(Demo), instance = _mount21[0], element = _mount21[1];
1136
+ _context43.next = 5;
1006
1137
  return waitFor(function () {
1007
1138
  return !!element.querySelector('.k-xmarkdown-stable h1');
1008
1139
  });
1009
1140
  case 5:
1010
- ready = _context37.sent;
1141
+ ready = _context43.sent;
1011
1142
  expect(ready).to.be.true;
1012
1143
  stableContainer = element.querySelector('.k-xmarkdown-stable');
1013
1144
  tailContainer = element.querySelector('.k-xmarkdown-tail'); // 标题应该在 stable 中
@@ -1017,20 +1148,20 @@ describe('XMarkdown', function () {
1017
1148
  expect(tailContainer.querySelector('[data-kpc-xmarkdown-tail="true"]')).not.to.eql(null);
1018
1149
  // 闭合公式后,整个公式应该渲染在 stable 中
1019
1150
  instance.set('content', '# 标题\n\n$$\n\\operatorname{score}(x)=\\sum_{i=1}^{n}\n$$');
1020
- _context37.next = 15;
1151
+ _context43.next = 15;
1021
1152
  return waitFor(function () {
1022
1153
  var _tailContainer$textCo;
1023
1154
  // 公式闭合后,tail 应该为空或没有 $$
1024
1155
  return tailContainer.innerHTML === '' || !((_tailContainer$textCo = tailContainer.textContent) != null && _includesInstanceProperty(_tailContainer$textCo).call(_tailContainer$textCo, '$$'));
1025
1156
  }, 30, 20);
1026
1157
  case 15:
1027
- formulaRendered = _context37.sent;
1158
+ formulaRendered = _context43.sent;
1028
1159
  expect(formulaRendered).to.be.true;
1029
1160
  case 17:
1030
1161
  case "end":
1031
- return _context37.stop();
1162
+ return _context43.stop();
1032
1163
  }
1033
- }, _callee18);
1164
+ }, _callee21);
1034
1165
  })));
1035
1166
  it('should keep incomplete inline tokens in tail cache during streaming', function () {
1036
1167
  var cache = createStreamingTailCache();
@@ -1044,22 +1175,22 @@ describe('XMarkdown', function () {
1044
1175
  expect(result.stableSource).to.eql('请看[文档](https://example.com)\n');
1045
1176
  expect(result.tailText).to.eql('<notice-card tit');
1046
1177
  });
1047
- it('should render raw html when allowHtml and sanitizeOptions are enabled', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee19() {
1048
- var Demo, _mount19, element, ready;
1049
- return _regeneratorRuntime.wrap(function _callee19$(_context39) {
1050
- while (1) switch (_context39.prev = _context39.next) {
1178
+ it('should render raw html when allowHtml and sanitizeOptions are enabled', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee22() {
1179
+ var Demo, _mount22, element, ready;
1180
+ return _regeneratorRuntime.wrap(function _callee22$(_context45) {
1181
+ while (1) switch (_context45.prev = _context45.next) {
1051
1182
  case 0:
1052
- Demo = /*#__PURE__*/function (_Component19) {
1053
- _inheritsLoose(Demo, _Component19);
1183
+ Demo = /*#__PURE__*/function (_Component22) {
1184
+ _inheritsLoose(Demo, _Component22);
1054
1185
  function Demo() {
1055
- var _context38;
1056
- var _this19;
1057
- for (var _len19 = arguments.length, args = new Array(_len19), _key19 = 0; _key19 < _len19; _key19++) {
1058
- args[_key19] = arguments[_key19];
1186
+ var _context44;
1187
+ var _this22;
1188
+ for (var _len22 = arguments.length, args = new Array(_len22), _key22 = 0; _key22 < _len22; _key22++) {
1189
+ args[_key22] = arguments[_key22];
1059
1190
  }
1060
- _this19 = _Component19.call.apply(_Component19, _concatInstanceProperty(_context38 = [this]).call(_context38, args)) || this;
1061
- _this19.XMarkdown = XMarkdown;
1062
- return _this19;
1191
+ _this22 = _Component22.call.apply(_Component22, _concatInstanceProperty(_context44 = [this]).call(_context44, args)) || this;
1192
+ _this22.XMarkdown = XMarkdown;
1193
+ return _this22;
1063
1194
  }
1064
1195
  Demo.defaults = function defaults() {
1065
1196
  return {
@@ -1073,71 +1204,71 @@ describe('XMarkdown', function () {
1073
1204
  return Demo;
1074
1205
  }(Component);
1075
1206
  Demo.template = "\n const { XMarkdown } = this;\n <XMarkdown\n allowHtml\n content={this.get('content')}\n sanitizeOptions={this.get('sanitizeOptions')}\n />\n ";
1076
- _mount19 = mount(Demo), element = _mount19[1];
1077
- _context39.next = 5;
1207
+ _mount22 = mount(Demo), element = _mount22[1];
1208
+ _context45.next = 5;
1078
1209
  return waitFor(function () {
1079
1210
  return !!element.querySelector('notice-card');
1080
1211
  });
1081
1212
  case 5:
1082
- ready = _context39.sent;
1213
+ ready = _context45.sent;
1083
1214
  expect(ready).to.be.true;
1084
1215
  expect(element.querySelector('mark').getAttribute('data-track')).to.eql('demo-mark');
1085
1216
  expect(element.querySelector('notice-card').getAttribute('title')).to.eql('发布建议');
1086
1217
  expect(element.querySelector('notice-card').textContent).to.contain('先补文档,再补单测。');
1087
1218
  case 10:
1088
1219
  case "end":
1089
- return _context39.stop();
1220
+ return _context45.stop();
1090
1221
  }
1091
- }, _callee19);
1222
+ }, _callee22);
1092
1223
  })));
1093
- it('should keep formula text when enableFormula is false', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee20() {
1094
- var Demo, _mount20, element;
1095
- return _regeneratorRuntime.wrap(function _callee20$(_context41) {
1096
- while (1) switch (_context41.prev = _context41.next) {
1224
+ it('should keep formula text when enableFormula is false', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee23() {
1225
+ var Demo, _mount23, element;
1226
+ return _regeneratorRuntime.wrap(function _callee23$(_context47) {
1227
+ while (1) switch (_context47.prev = _context47.next) {
1097
1228
  case 0:
1098
- Demo = /*#__PURE__*/function (_Component20) {
1099
- _inheritsLoose(Demo, _Component20);
1229
+ Demo = /*#__PURE__*/function (_Component23) {
1230
+ _inheritsLoose(Demo, _Component23);
1100
1231
  function Demo() {
1101
- var _context40;
1102
- var _this20;
1103
- for (var _len20 = arguments.length, args = new Array(_len20), _key20 = 0; _key20 < _len20; _key20++) {
1104
- args[_key20] = arguments[_key20];
1232
+ var _context46;
1233
+ var _this23;
1234
+ for (var _len23 = arguments.length, args = new Array(_len23), _key23 = 0; _key23 < _len23; _key23++) {
1235
+ args[_key23] = arguments[_key23];
1105
1236
  }
1106
- _this20 = _Component20.call.apply(_Component20, _concatInstanceProperty(_context40 = [this]).call(_context40, args)) || this;
1107
- _this20.XMarkdown = XMarkdown;
1108
- return _this20;
1237
+ _this23 = _Component23.call.apply(_Component23, _concatInstanceProperty(_context46 = [this]).call(_context46, args)) || this;
1238
+ _this23.XMarkdown = XMarkdown;
1239
+ return _this23;
1109
1240
  }
1110
1241
  return Demo;
1111
1242
  }(Component);
1112
1243
  Demo.template = "\n const { XMarkdown } = this;\n <XMarkdown\n enableFormula={false}\n content={'$E = mc^2$'}\n />\n ";
1113
- _mount20 = mount(Demo), element = _mount20[1];
1114
- _context41.next = 5;
1244
+ _mount23 = mount(Demo), element = _mount23[1];
1245
+ _context47.next = 5;
1115
1246
  return wait(60);
1116
1247
  case 5:
1117
1248
  expect(element.querySelector('.katex')).to.eql(null);
1118
1249
  expect(element.querySelector('.k-xmarkdown-content').textContent).to.contain('$E = mc^2$');
1119
1250
  case 7:
1120
1251
  case "end":
1121
- return _context41.stop();
1252
+ return _context47.stop();
1122
1253
  }
1123
- }, _callee20);
1254
+ }, _callee23);
1124
1255
  })));
1125
- it('should support custom formulaDelimiters and formulaMacros', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee21() {
1126
- var Demo, _mount21, element, ready;
1127
- return _regeneratorRuntime.wrap(function _callee21$(_context43) {
1128
- while (1) switch (_context43.prev = _context43.next) {
1256
+ it('should support custom formulaDelimiters and formulaMacros', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee24() {
1257
+ var Demo, _mount24, element, ready;
1258
+ return _regeneratorRuntime.wrap(function _callee24$(_context49) {
1259
+ while (1) switch (_context49.prev = _context49.next) {
1129
1260
  case 0:
1130
- Demo = /*#__PURE__*/function (_Component21) {
1131
- _inheritsLoose(Demo, _Component21);
1261
+ Demo = /*#__PURE__*/function (_Component24) {
1262
+ _inheritsLoose(Demo, _Component24);
1132
1263
  function Demo() {
1133
- var _context42;
1134
- var _this21;
1135
- for (var _len21 = arguments.length, args = new Array(_len21), _key21 = 0; _key21 < _len21; _key21++) {
1136
- args[_key21] = arguments[_key21];
1264
+ var _context48;
1265
+ var _this24;
1266
+ for (var _len24 = arguments.length, args = new Array(_len24), _key24 = 0; _key24 < _len24; _key24++) {
1267
+ args[_key24] = arguments[_key24];
1137
1268
  }
1138
- _this21 = _Component21.call.apply(_Component21, _concatInstanceProperty(_context42 = [this]).call(_context42, args)) || this;
1139
- _this21.XMarkdown = XMarkdown;
1140
- return _this21;
1269
+ _this24 = _Component24.call.apply(_Component24, _concatInstanceProperty(_context48 = [this]).call(_context48, args)) || this;
1270
+ _this24.XMarkdown = XMarkdown;
1271
+ return _this24;
1141
1272
  }
1142
1273
  Demo.defaults = function defaults() {
1143
1274
  return {
@@ -1149,38 +1280,38 @@ describe('XMarkdown', function () {
1149
1280
  return Demo;
1150
1281
  }(Component);
1151
1282
  Demo.template = "\n const { XMarkdown } = this;\n <XMarkdown\n content={'\\\\[f: \\\\RR \\\\to \\\\RR\\\\]'}\n formulaDelimiters={'brackets'}\n formulaMacros={this.get('formulaMacros')}\n />\n ";
1152
- _mount21 = mount(Demo), element = _mount21[1];
1153
- _context43.next = 5;
1283
+ _mount24 = mount(Demo), element = _mount24[1];
1284
+ _context49.next = 5;
1154
1285
  return waitFor(function () {
1155
1286
  return !!element.querySelector('.katex');
1156
1287
  }, 60, 20);
1157
1288
  case 5:
1158
- ready = _context43.sent;
1289
+ ready = _context49.sent;
1159
1290
  expect(ready).to.be.true;
1160
1291
  expect(element.querySelector('.k-xmarkdown-content').textContent).not.to.contain('\\[');
1161
1292
  case 8:
1162
1293
  case "end":
1163
- return _context43.stop();
1294
+ return _context49.stop();
1164
1295
  }
1165
- }, _callee21);
1296
+ }, _callee24);
1166
1297
  })));
1167
- it('should support tagAttrs and tagRenderers for custom tags', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee22() {
1168
- var _context45;
1169
- var Demo, _mount22, element, ready, link;
1170
- return _regeneratorRuntime.wrap(function _callee22$(_context46) {
1171
- while (1) switch (_context46.prev = _context46.next) {
1298
+ it('should support tagAttrs and tagRenderers for custom tags', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee25() {
1299
+ var _context51;
1300
+ var Demo, _mount25, element, ready, link;
1301
+ return _regeneratorRuntime.wrap(function _callee25$(_context52) {
1302
+ while (1) switch (_context52.prev = _context52.next) {
1172
1303
  case 0:
1173
- Demo = /*#__PURE__*/function (_Component22) {
1174
- _inheritsLoose(Demo, _Component22);
1304
+ Demo = /*#__PURE__*/function (_Component25) {
1305
+ _inheritsLoose(Demo, _Component25);
1175
1306
  function Demo() {
1176
- var _context44;
1177
- var _this22;
1178
- for (var _len22 = arguments.length, args = new Array(_len22), _key22 = 0; _key22 < _len22; _key22++) {
1179
- args[_key22] = arguments[_key22];
1307
+ var _context50;
1308
+ var _this25;
1309
+ for (var _len25 = arguments.length, args = new Array(_len25), _key25 = 0; _key25 < _len25; _key25++) {
1310
+ args[_key25] = arguments[_key25];
1180
1311
  }
1181
- _this22 = _Component22.call.apply(_Component22, _concatInstanceProperty(_context44 = [this]).call(_context44, args)) || this;
1182
- _this22.XMarkdown = XMarkdown;
1183
- _this22.tagAttrs = {
1312
+ _this25 = _Component25.call.apply(_Component25, _concatInstanceProperty(_context50 = [this]).call(_context50, args)) || this;
1313
+ _this25.XMarkdown = XMarkdown;
1314
+ _this25.tagAttrs = {
1184
1315
  a: function a() {
1185
1316
  return {
1186
1317
  className: 'xmarkdown-enhanced-link',
@@ -1188,7 +1319,7 @@ describe('XMarkdown', function () {
1188
1319
  };
1189
1320
  }
1190
1321
  };
1191
- _this22.tagRenderers = {
1322
+ _this25.tagRenderers = {
1192
1323
  'notice-card': function noticeCard(context) {
1193
1324
  return createVNode('section', {
1194
1325
  className: 'xmarkdown-custom-card'
@@ -1204,7 +1335,7 @@ describe('XMarkdown', function () {
1204
1335
  }, 'custom table');
1205
1336
  }
1206
1337
  };
1207
- return _this22;
1338
+ return _this25;
1208
1339
  }
1209
1340
  Demo.defaults = function defaults() {
1210
1341
  return {
@@ -1218,20 +1349,20 @@ describe('XMarkdown', function () {
1218
1349
  return Demo;
1219
1350
  }(Component);
1220
1351
  Demo.template = "\n const { XMarkdown } = this;\n <XMarkdown\n allowHtml\n content={this.get('content')}\n sanitizeOptions={this.get('sanitizeOptions')}\n tagAttrs={this.tagAttrs}\n tagRenderers={this.tagRenderers}\n />\n ";
1221
- _mount22 = mount(Demo), element = _mount22[1];
1222
- _context46.next = 5;
1352
+ _mount25 = mount(Demo), element = _mount25[1];
1353
+ _context52.next = 5;
1223
1354
  return waitFor(function () {
1224
1355
  return !!element.querySelector('.xmarkdown-custom-card');
1225
1356
  });
1226
1357
  case 5:
1227
- ready = _context46.sent;
1358
+ ready = _context52.sent;
1228
1359
  expect(ready).to.be.true;
1229
1360
  expect(element.querySelector('notice-card')).to.eql(null);
1230
1361
  expect(element.querySelector('table')).to.eql(null);
1231
1362
  expect(element.querySelector('.xmarkdown-custom-card-title').textContent).to.eql('发布建议');
1232
1363
  expect(element.querySelector('.xmarkdown-custom-card-body').textContent).to.contain('先补 Demo,再补单测。');
1233
1364
  expect(element.querySelector('.xmarkdown-custom-table').textContent).to.contain('custom table');
1234
- expect(_mapInstanceProperty(_context45 = _Array$from(element.querySelector('.k-xmarkdown-stable').children)).call(_context45, function (item) {
1365
+ expect(_mapInstanceProperty(_context51 = _Array$from(element.querySelector('.k-xmarkdown-stable').children)).call(_context51, function (item) {
1235
1366
  return item.tagName.toLowerCase();
1236
1367
  })).to.eql(['h1', 'section', 'div', 'p']);
1237
1368
  expect(element.querySelector('.k-xmarkdown-stable p:empty')).to.eql(null);
@@ -1241,30 +1372,30 @@ describe('XMarkdown', function () {
1241
1372
  expect(link.getAttribute('rel')).to.eql('noopener noreferrer');
1242
1373
  case 18:
1243
1374
  case "end":
1244
- return _context46.stop();
1375
+ return _context52.stop();
1245
1376
  }
1246
- }, _callee22);
1377
+ }, _callee25);
1247
1378
  })));
1248
- it('should support codeBlockRenderers for code blocks and mermaid blocks', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee23() {
1249
- var initialize, renderAsync, codeContexts, mermaidContexts, Demo, _mount23, element, ready;
1250
- return _regeneratorRuntime.wrap(function _callee23$(_context48) {
1251
- while (1) switch (_context48.prev = _context48.next) {
1379
+ it('should support codeBlockRenderers for code blocks and mermaid blocks', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee26() {
1380
+ var initialize, renderAsync, codeContexts, mermaidContexts, Demo, _mount26, element, ready;
1381
+ return _regeneratorRuntime.wrap(function _callee26$(_context54) {
1382
+ while (1) switch (_context54.prev = _context54.next) {
1252
1383
  case 0:
1253
1384
  initialize = sinon.stub(mermaid, 'initialize');
1254
1385
  renderAsync = sinon.stub(mermaid, 'renderAsync');
1255
1386
  codeContexts = [];
1256
1387
  mermaidContexts = [];
1257
- Demo = /*#__PURE__*/function (_Component23) {
1258
- _inheritsLoose(Demo, _Component23);
1388
+ Demo = /*#__PURE__*/function (_Component26) {
1389
+ _inheritsLoose(Demo, _Component26);
1259
1390
  function Demo() {
1260
- var _context47;
1261
- var _this23;
1262
- for (var _len23 = arguments.length, args = new Array(_len23), _key23 = 0; _key23 < _len23; _key23++) {
1263
- args[_key23] = arguments[_key23];
1391
+ var _context53;
1392
+ var _this26;
1393
+ for (var _len26 = arguments.length, args = new Array(_len26), _key26 = 0; _key26 < _len26; _key26++) {
1394
+ args[_key26] = arguments[_key26];
1264
1395
  }
1265
- _this23 = _Component23.call.apply(_Component23, _concatInstanceProperty(_context47 = [this]).call(_context47, args)) || this;
1266
- _this23.XMarkdown = XMarkdown;
1267
- _this23.codeBlockRenderers = {
1396
+ _this26 = _Component26.call.apply(_Component26, _concatInstanceProperty(_context53 = [this]).call(_context53, args)) || this;
1397
+ _this26.XMarkdown = XMarkdown;
1398
+ _this26.codeBlockRenderers = {
1268
1399
  ts: function ts(context) {
1269
1400
  codeContexts.push(context);
1270
1401
  return createVNode('section', {
@@ -1286,7 +1417,7 @@ describe('XMarkdown', function () {
1286
1417
  }, context.source)]);
1287
1418
  }
1288
1419
  };
1289
- return _this23;
1420
+ return _this26;
1290
1421
  }
1291
1422
  Demo.defaults = function defaults() {
1292
1423
  return {
@@ -1296,13 +1427,13 @@ describe('XMarkdown', function () {
1296
1427
  return Demo;
1297
1428
  }(Component);
1298
1429
  Demo.template = "\n const { XMarkdown } = this;\n <XMarkdown\n content={this.get('content')}\n codeBlockRenderers={this.codeBlockRenderers}\n />\n ";
1299
- _mount23 = mount(Demo), element = _mount23[1];
1300
- _context48.next = 9;
1430
+ _mount26 = mount(Demo), element = _mount26[1];
1431
+ _context54.next = 9;
1301
1432
  return waitFor(function () {
1302
1433
  return !!element.querySelector('.xmarkdown-custom-code-block') && !!element.querySelector('.xmarkdown-custom-mermaid-block');
1303
1434
  });
1304
1435
  case 9:
1305
- ready = _context48.sent;
1436
+ ready = _context54.sent;
1306
1437
  expect(ready).to.be.true;
1307
1438
  expect(initialize.called).to.be.false;
1308
1439
  expect(renderAsync.called).to.be.false;
@@ -1315,26 +1446,26 @@ describe('XMarkdown', function () {
1315
1446
  expect(element.querySelector('.k-xmarkdown-code-toolbar')).to.eql(null);
1316
1447
  case 20:
1317
1448
  case "end":
1318
- return _context48.stop();
1449
+ return _context54.stop();
1319
1450
  }
1320
- }, _callee23);
1451
+ }, _callee26);
1321
1452
  })));
1322
- it('should refresh renderer when codeBlockRenderers change', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee24() {
1323
- var Demo, _mount24, instance, element, initialReady, refreshed;
1324
- return _regeneratorRuntime.wrap(function _callee24$(_context50) {
1325
- while (1) switch (_context50.prev = _context50.next) {
1453
+ it('should refresh renderer when codeBlockRenderers change', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee27() {
1454
+ var Demo, _mount27, instance, element, initialReady, refreshed;
1455
+ return _regeneratorRuntime.wrap(function _callee27$(_context56) {
1456
+ while (1) switch (_context56.prev = _context56.next) {
1326
1457
  case 0:
1327
- Demo = /*#__PURE__*/function (_Component24) {
1328
- _inheritsLoose(Demo, _Component24);
1458
+ Demo = /*#__PURE__*/function (_Component27) {
1459
+ _inheritsLoose(Demo, _Component27);
1329
1460
  function Demo() {
1330
- var _context49;
1331
- var _this24;
1332
- for (var _len24 = arguments.length, args = new Array(_len24), _key24 = 0; _key24 < _len24; _key24++) {
1333
- args[_key24] = arguments[_key24];
1461
+ var _context55;
1462
+ var _this27;
1463
+ for (var _len27 = arguments.length, args = new Array(_len27), _key27 = 0; _key27 < _len27; _key27++) {
1464
+ args[_key27] = arguments[_key27];
1334
1465
  }
1335
- _this24 = _Component24.call.apply(_Component24, _concatInstanceProperty(_context49 = [this]).call(_context49, args)) || this;
1336
- _this24.XMarkdown = XMarkdown;
1337
- return _this24;
1466
+ _this27 = _Component27.call.apply(_Component27, _concatInstanceProperty(_context55 = [this]).call(_context55, args)) || this;
1467
+ _this27.XMarkdown = XMarkdown;
1468
+ return _this27;
1338
1469
  }
1339
1470
  Demo.defaults = function defaults() {
1340
1471
  return {
@@ -1345,13 +1476,13 @@ describe('XMarkdown', function () {
1345
1476
  return Demo;
1346
1477
  }(Component);
1347
1478
  Demo.template = "\n const { XMarkdown } = this;\n <XMarkdown\n content={this.get('content')}\n codeBlockRenderers={this.get('codeBlockRenderers')}\n />\n ";
1348
- _mount24 = mount(Demo), instance = _mount24[0], element = _mount24[1];
1349
- _context50.next = 5;
1479
+ _mount27 = mount(Demo), instance = _mount27[0], element = _mount27[1];
1480
+ _context56.next = 5;
1350
1481
  return waitFor(function () {
1351
1482
  return !!element.querySelector('.k-xmarkdown-code-toolbar');
1352
1483
  });
1353
1484
  case 5:
1354
- initialReady = _context50.sent;
1485
+ initialReady = _context56.sent;
1355
1486
  expect(initialReady).to.be.true;
1356
1487
  expect(element.querySelector('.xmarkdown-refresh-code-block')).to.eql(null);
1357
1488
  instance.set('codeBlockRenderers', {
@@ -1361,36 +1492,36 @@ describe('XMarkdown', function () {
1361
1492
  }, context.source);
1362
1493
  }
1363
1494
  });
1364
- _context50.next = 11;
1495
+ _context56.next = 11;
1365
1496
  return waitFor(function () {
1366
1497
  return !!element.querySelector('.xmarkdown-refresh-code-block');
1367
1498
  });
1368
1499
  case 11:
1369
- refreshed = _context50.sent;
1500
+ refreshed = _context56.sent;
1370
1501
  expect(refreshed).to.be.true;
1371
1502
  expect(element.querySelector('.k-xmarkdown-code-toolbar')).to.eql(null);
1372
1503
  case 14:
1373
1504
  case "end":
1374
- return _context50.stop();
1505
+ return _context56.stop();
1375
1506
  }
1376
- }, _callee24);
1507
+ }, _callee27);
1377
1508
  })));
1378
- it('should support plugins for markdown extension and render tree transform', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee25() {
1379
- var Demo, _mount25, element, ready;
1380
- return _regeneratorRuntime.wrap(function _callee25$(_context52) {
1381
- while (1) switch (_context52.prev = _context52.next) {
1509
+ it('should support plugins for markdown extension and render tree transform', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee28() {
1510
+ var Demo, _mount28, element, ready;
1511
+ return _regeneratorRuntime.wrap(function _callee28$(_context58) {
1512
+ while (1) switch (_context58.prev = _context58.next) {
1382
1513
  case 0:
1383
- Demo = /*#__PURE__*/function (_Component25) {
1384
- _inheritsLoose(Demo, _Component25);
1514
+ Demo = /*#__PURE__*/function (_Component28) {
1515
+ _inheritsLoose(Demo, _Component28);
1385
1516
  function Demo() {
1386
- var _context51;
1387
- var _this25;
1388
- for (var _len25 = arguments.length, args = new Array(_len25), _key25 = 0; _key25 < _len25; _key25++) {
1389
- args[_key25] = arguments[_key25];
1517
+ var _context57;
1518
+ var _this28;
1519
+ for (var _len28 = arguments.length, args = new Array(_len28), _key28 = 0; _key28 < _len28; _key28++) {
1520
+ args[_key28] = arguments[_key28];
1390
1521
  }
1391
- _this25 = _Component25.call.apply(_Component25, _concatInstanceProperty(_context51 = [this]).call(_context51, args)) || this;
1392
- _this25.XMarkdown = XMarkdown;
1393
- _this25.plugins = [{
1522
+ _this28 = _Component28.call.apply(_Component28, _concatInstanceProperty(_context57 = [this]).call(_context57, args)) || this;
1523
+ _this28.XMarkdown = XMarkdown;
1524
+ _this28.plugins = [{
1394
1525
  extendMarkdown: function extendMarkdown(markdown) {
1395
1526
  markdown.core.ruler.push('xmarkdown-heading-plugin', function (state) {
1396
1527
  state.tokens.forEach(function (token) {
@@ -1414,7 +1545,7 @@ describe('XMarkdown', function () {
1414
1545
  });
1415
1546
  }
1416
1547
  }];
1417
- return _this25;
1548
+ return _this28;
1418
1549
  }
1419
1550
  Demo.defaults = function defaults() {
1420
1551
  return {
@@ -1424,38 +1555,38 @@ describe('XMarkdown', function () {
1424
1555
  return Demo;
1425
1556
  }(Component);
1426
1557
  Demo.template = "\n const { XMarkdown } = this;\n <XMarkdown\n content={this.get('content')}\n plugins={this.plugins}\n />\n ";
1427
- _mount25 = mount(Demo), element = _mount25[1];
1428
- _context52.next = 5;
1558
+ _mount28 = mount(Demo), element = _mount28[1];
1559
+ _context58.next = 5;
1429
1560
  return waitFor(function () {
1430
1561
  return !!element.querySelector('.k-xmarkdown-content blockquote');
1431
1562
  });
1432
1563
  case 5:
1433
- ready = _context52.sent;
1564
+ ready = _context58.sent;
1434
1565
  expect(ready).to.be.true;
1435
1566
  expect(element.querySelector('h1').getAttribute('data-plugin-source')).to.eql('markdown-it');
1436
1567
  expect(element.querySelector('blockquote').getAttribute('data-plugin-transform')).to.eql('render-tree');
1437
1568
  case 9:
1438
1569
  case "end":
1439
- return _context52.stop();
1570
+ return _context58.stop();
1440
1571
  }
1441
- }, _callee25);
1572
+ }, _callee28);
1442
1573
  })));
1443
- it('should refresh renderer when plugins change', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee26() {
1444
- var Demo, _mount26, instance, element, initialReady, refreshed;
1445
- return _regeneratorRuntime.wrap(function _callee26$(_context54) {
1446
- while (1) switch (_context54.prev = _context54.next) {
1574
+ it('should refresh renderer when plugins change', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee29() {
1575
+ var Demo, _mount29, instance, element, initialReady, refreshed;
1576
+ return _regeneratorRuntime.wrap(function _callee29$(_context60) {
1577
+ while (1) switch (_context60.prev = _context60.next) {
1447
1578
  case 0:
1448
- Demo = /*#__PURE__*/function (_Component26) {
1449
- _inheritsLoose(Demo, _Component26);
1579
+ Demo = /*#__PURE__*/function (_Component29) {
1580
+ _inheritsLoose(Demo, _Component29);
1450
1581
  function Demo() {
1451
- var _context53;
1452
- var _this26;
1453
- for (var _len26 = arguments.length, args = new Array(_len26), _key26 = 0; _key26 < _len26; _key26++) {
1454
- args[_key26] = arguments[_key26];
1582
+ var _context59;
1583
+ var _this29;
1584
+ for (var _len29 = arguments.length, args = new Array(_len29), _key29 = 0; _key29 < _len29; _key29++) {
1585
+ args[_key29] = arguments[_key29];
1455
1586
  }
1456
- _this26 = _Component26.call.apply(_Component26, _concatInstanceProperty(_context53 = [this]).call(_context53, args)) || this;
1457
- _this26.XMarkdown = XMarkdown;
1458
- return _this26;
1587
+ _this29 = _Component29.call.apply(_Component29, _concatInstanceProperty(_context59 = [this]).call(_context59, args)) || this;
1588
+ _this29.XMarkdown = XMarkdown;
1589
+ return _this29;
1459
1590
  }
1460
1591
  Demo.defaults = function defaults() {
1461
1592
  return {
@@ -1465,13 +1596,13 @@ describe('XMarkdown', function () {
1465
1596
  return Demo;
1466
1597
  }(Component);
1467
1598
  Demo.template = "\n const { XMarkdown } = this;\n <XMarkdown\n content={'# \u63D2\u4EF6\u5237\u65B0'}\n plugins={this.get('plugins')}\n />\n ";
1468
- _mount26 = mount(Demo), instance = _mount26[0], element = _mount26[1];
1469
- _context54.next = 5;
1599
+ _mount29 = mount(Demo), instance = _mount29[0], element = _mount29[1];
1600
+ _context60.next = 5;
1470
1601
  return waitFor(function () {
1471
1602
  return !!element.querySelector('h1');
1472
1603
  });
1473
1604
  case 5:
1474
- initialReady = _context54.sent;
1605
+ initialReady = _context60.sent;
1475
1606
  expect(initialReady).to.be.true;
1476
1607
  expect(element.querySelector('h1').getAttribute('data-refresh-plugin')).to.eql(null);
1477
1608
  instance.set('plugins', [{
@@ -1485,23 +1616,23 @@ describe('XMarkdown', function () {
1485
1616
  });
1486
1617
  }
1487
1618
  }]);
1488
- _context54.next = 11;
1619
+ _context60.next = 11;
1489
1620
  return waitFor(function () {
1490
1621
  return element.querySelector('h1').getAttribute('data-refresh-plugin') === 'updated';
1491
1622
  });
1492
1623
  case 11:
1493
- refreshed = _context54.sent;
1624
+ refreshed = _context60.sent;
1494
1625
  expect(refreshed).to.be.true;
1495
1626
  case 13:
1496
1627
  case "end":
1497
- return _context54.stop();
1628
+ return _context60.stop();
1498
1629
  }
1499
- }, _callee26);
1630
+ }, _callee29);
1500
1631
  })));
1501
- it('should support plugins transforming citation markers from business data', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee27() {
1502
- var citations, Demo, transformCitationNodes, splitCitationText, _mount27, element, ready;
1503
- return _regeneratorRuntime.wrap(function _callee27$(_context57) {
1504
- while (1) switch (_context57.prev = _context57.next) {
1632
+ it('should support plugins transforming citation markers from business data', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee30() {
1633
+ var citations, Demo, transformCitationNodes, splitCitationText, _mount30, element, ready;
1634
+ return _regeneratorRuntime.wrap(function _callee30$(_context63) {
1635
+ while (1) switch (_context63.prev = _context63.next) {
1505
1636
  case 0:
1506
1637
  splitCitationText = function _splitCitationText(text) {
1507
1638
  var nextNodes = [];
@@ -1549,7 +1680,7 @@ describe('XMarkdown', function () {
1549
1680
  return nextNodes;
1550
1681
  };
1551
1682
  transformCitationNodes = function _transformCitationNod(nodes, appendSection) {
1552
- var _context56;
1683
+ var _context62;
1553
1684
  if (appendSection === void 0) {
1554
1685
  appendSection = false;
1555
1686
  }
@@ -1568,7 +1699,7 @@ describe('XMarkdown', function () {
1568
1699
  }));
1569
1700
  });
1570
1701
  if (!appendSection || !citations.length) return nextNodes;
1571
- return _concatInstanceProperty(_context56 = []).call(_context56, nextNodes, [{
1702
+ return _concatInstanceProperty(_context62 = []).call(_context62, nextNodes, [{
1572
1703
  type: 'element',
1573
1704
  tag: 'section',
1574
1705
  attrs: {
@@ -1584,33 +1715,33 @@ describe('XMarkdown', function () {
1584
1715
  title: '引用来源一',
1585
1716
  link: 'https://example.com/source-1'
1586
1717
  }];
1587
- Demo = /*#__PURE__*/function (_Component27) {
1588
- _inheritsLoose(Demo, _Component27);
1718
+ Demo = /*#__PURE__*/function (_Component30) {
1719
+ _inheritsLoose(Demo, _Component30);
1589
1720
  function Demo() {
1590
- var _context55;
1591
- var _this27;
1592
- for (var _len27 = arguments.length, args = new Array(_len27), _key27 = 0; _key27 < _len27; _key27++) {
1593
- args[_key27] = arguments[_key27];
1721
+ var _context61;
1722
+ var _this30;
1723
+ for (var _len30 = arguments.length, args = new Array(_len30), _key30 = 0; _key30 < _len30; _key30++) {
1724
+ args[_key30] = arguments[_key30];
1594
1725
  }
1595
- _this27 = _Component27.call.apply(_Component27, _concatInstanceProperty(_context55 = [this]).call(_context55, args)) || this;
1596
- _this27.XMarkdown = XMarkdown;
1597
- _this27.plugins = [{
1726
+ _this30 = _Component30.call.apply(_Component30, _concatInstanceProperty(_context61 = [this]).call(_context61, args)) || this;
1727
+ _this30.XMarkdown = XMarkdown;
1728
+ _this30.plugins = [{
1598
1729
  transformRenderTree: function transformRenderTree(nodes) {
1599
1730
  return transformCitationNodes(nodes, true);
1600
1731
  }
1601
1732
  }];
1602
- return _this27;
1733
+ return _this30;
1603
1734
  }
1604
1735
  return Demo;
1605
1736
  }(Component);
1606
1737
  Demo.template = "\n const { XMarkdown } = this;\n <XMarkdown\n content={'\u6B63\u6587\u5F15\u7528[1][2]'}\n plugins={this.plugins}\n />\n ";
1607
- _mount27 = mount(Demo), element = _mount27[1];
1608
- _context57.next = 8;
1738
+ _mount30 = mount(Demo), element = _mount30[1];
1739
+ _context63.next = 8;
1609
1740
  return waitFor(function () {
1610
1741
  return !!element.querySelector('[data-citation-index="1"]');
1611
1742
  });
1612
1743
  case 8:
1613
- ready = _context57.sent;
1744
+ ready = _context63.sent;
1614
1745
  expect(ready).to.be.true;
1615
1746
  expect(element.querySelectorAll('[data-citation-index]').length).to.eql(1);
1616
1747
  expect(element.querySelector('[data-citation-index="1"]').getAttribute('href')).to.eql('https://example.com/source-1');
@@ -1618,49 +1749,49 @@ describe('XMarkdown', function () {
1618
1749
  expect(element.querySelector('[data-citation-section="true"]').textContent).to.contain('Sources: 1');
1619
1750
  case 14:
1620
1751
  case "end":
1621
- return _context57.stop();
1752
+ return _context63.stop();
1622
1753
  }
1623
- }, _callee27);
1754
+ }, _callee30);
1624
1755
  })));
1625
- it('should avoid duplicate markdown rendering during initial mount', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee28() {
1626
- var transformRenderTree, Demo, _mount28, element, ready;
1627
- return _regeneratorRuntime.wrap(function _callee28$(_context59) {
1628
- while (1) switch (_context59.prev = _context59.next) {
1756
+ it('should avoid duplicate markdown rendering during initial mount', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee31() {
1757
+ var transformRenderTree, Demo, _mount31, element, ready;
1758
+ return _regeneratorRuntime.wrap(function _callee31$(_context65) {
1759
+ while (1) switch (_context65.prev = _context65.next) {
1629
1760
  case 0:
1630
1761
  transformRenderTree = sinon.spy(function (nodes) {
1631
1762
  return nodes;
1632
1763
  });
1633
- Demo = /*#__PURE__*/function (_Component28) {
1634
- _inheritsLoose(Demo, _Component28);
1764
+ Demo = /*#__PURE__*/function (_Component31) {
1765
+ _inheritsLoose(Demo, _Component31);
1635
1766
  function Demo() {
1636
- var _context58;
1637
- var _this28;
1638
- for (var _len28 = arguments.length, args = new Array(_len28), _key28 = 0; _key28 < _len28; _key28++) {
1639
- args[_key28] = arguments[_key28];
1767
+ var _context64;
1768
+ var _this31;
1769
+ for (var _len31 = arguments.length, args = new Array(_len31), _key31 = 0; _key31 < _len31; _key31++) {
1770
+ args[_key31] = arguments[_key31];
1640
1771
  }
1641
- _this28 = _Component28.call.apply(_Component28, _concatInstanceProperty(_context58 = [this]).call(_context58, args)) || this;
1642
- _this28.XMarkdown = XMarkdown;
1643
- _this28.plugins = [{
1772
+ _this31 = _Component31.call.apply(_Component31, _concatInstanceProperty(_context64 = [this]).call(_context64, args)) || this;
1773
+ _this31.XMarkdown = XMarkdown;
1774
+ _this31.plugins = [{
1644
1775
  transformRenderTree: transformRenderTree
1645
1776
  }];
1646
- return _this28;
1777
+ return _this31;
1647
1778
  }
1648
1779
  return Demo;
1649
1780
  }(Component);
1650
1781
  Demo.template = "\n const { XMarkdown } = this;\n <XMarkdown\n content={'# \u521D\u59CB\u5316\u6E32\u67D3'}\n plugins={this.plugins}\n />\n ";
1651
- _mount28 = mount(Demo), element = _mount28[1];
1652
- _context59.next = 6;
1782
+ _mount31 = mount(Demo), element = _mount31[1];
1783
+ _context65.next = 6;
1653
1784
  return waitFor(function () {
1654
1785
  return !!element.querySelector('h1');
1655
1786
  });
1656
1787
  case 6:
1657
- ready = _context59.sent;
1788
+ ready = _context65.sent;
1658
1789
  expect(ready).to.be.true;
1659
1790
  expect(transformRenderTree.callCount).to.eql(1);
1660
1791
  case 9:
1661
1792
  case "end":
1662
- return _context59.stop();
1793
+ return _context65.stop();
1663
1794
  }
1664
- }, _callee28);
1795
+ }, _callee31);
1665
1796
  })));
1666
1797
  });