@uiw/react-md-editor 3.19.0 → 3.19.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 (137) hide show
  1. package/dist/mdeditor.js +1559 -1578
  2. package/dist/mdeditor.min.js +1 -1
  3. package/esm/Context.js.map +1 -1
  4. package/esm/Editor.js +43 -67
  5. package/esm/Editor.js.map +1 -1
  6. package/esm/commands/bold.js +4 -4
  7. package/esm/commands/bold.js.map +1 -1
  8. package/esm/commands/code.js +4 -6
  9. package/esm/commands/code.js.map +1 -1
  10. package/esm/commands/comment.js +4 -4
  11. package/esm/commands/comment.js.map +1 -1
  12. package/esm/commands/divider.js.map +1 -1
  13. package/esm/commands/fullscreen.js +3 -4
  14. package/esm/commands/fullscreen.js.map +2 -2
  15. package/esm/commands/group.js +2 -4
  16. package/esm/commands/group.js.map +1 -1
  17. package/esm/commands/hr.js.map +1 -1
  18. package/esm/commands/image.js +4 -4
  19. package/esm/commands/image.js.map +1 -1
  20. package/esm/commands/index.d.ts +2 -2
  21. package/esm/commands/index.js +6 -17
  22. package/esm/commands/index.js.map +3 -2
  23. package/esm/commands/italic.js +4 -4
  24. package/esm/commands/italic.js.map +1 -1
  25. package/esm/commands/link.js +4 -4
  26. package/esm/commands/link.js.map +1 -1
  27. package/esm/commands/list.js +4 -4
  28. package/esm/commands/list.js.map +1 -1
  29. package/esm/commands/preview.js +21 -3
  30. package/esm/commands/preview.js.map +7 -2
  31. package/esm/commands/quote.js +2 -1
  32. package/esm/commands/quote.js.map +1 -1
  33. package/esm/commands/strikeThrough.js +4 -4
  34. package/esm/commands/strikeThrough.js.map +1 -1
  35. package/esm/commands/title.js.map +1 -1
  36. package/esm/commands/title1.js.map +1 -1
  37. package/esm/commands/title2.js.map +1 -1
  38. package/esm/commands/title3.js.map +1 -1
  39. package/esm/commands/title4.js.map +1 -1
  40. package/esm/commands/title5.js.map +1 -1
  41. package/esm/commands/title6.js.map +1 -1
  42. package/esm/components/DragBar/index.js +2 -9
  43. package/esm/components/DragBar/index.js.map +1 -1
  44. package/esm/components/TextArea/Markdown.js +2 -7
  45. package/esm/components/TextArea/Markdown.js.map +1 -1
  46. package/esm/components/TextArea/Textarea.js +8 -11
  47. package/esm/components/TextArea/Textarea.js.map +1 -1
  48. package/esm/components/TextArea/handleKeyDown.js +2 -16
  49. package/esm/components/TextArea/handleKeyDown.js.map +1 -1
  50. package/esm/components/TextArea/index.js +11 -15
  51. package/esm/components/TextArea/index.js.map +1 -1
  52. package/esm/components/TextArea/shortcuts.js +1 -17
  53. package/esm/components/TextArea/shortcuts.js.map +2 -2
  54. package/esm/components/Toolbar/Child.js +2 -1
  55. package/esm/components/Toolbar/Child.js.map +1 -1
  56. package/esm/components/Toolbar/index.js +2 -12
  57. package/esm/components/Toolbar/index.js.map +1 -1
  58. package/esm/index.js.map +1 -1
  59. package/esm/utils/InsertTextAtPosition.js +28 -34
  60. package/esm/utils/InsertTextAtPosition.js.map +1 -1
  61. package/esm/utils/markdownUtils.js +14 -23
  62. package/esm/utils/markdownUtils.js.map +1 -1
  63. package/lib/Context.js +0 -6
  64. package/lib/Context.js.map +1 -1
  65. package/lib/Editor.js +74 -114
  66. package/lib/Editor.js.map +1 -1
  67. package/lib/commands/bold.js +4 -9
  68. package/lib/commands/bold.js.map +1 -1
  69. package/lib/commands/code.js +4 -11
  70. package/lib/commands/code.js.map +1 -1
  71. package/lib/commands/comment.js +4 -7
  72. package/lib/commands/comment.js.map +1 -1
  73. package/lib/commands/divider.js.map +1 -1
  74. package/lib/commands/fullscreen.js +3 -8
  75. package/lib/commands/fullscreen.js.map +2 -2
  76. package/lib/commands/group.js +2 -10
  77. package/lib/commands/group.js.map +1 -1
  78. package/lib/commands/hr.js +0 -4
  79. package/lib/commands/hr.js.map +1 -1
  80. package/lib/commands/image.js +4 -9
  81. package/lib/commands/image.js.map +1 -1
  82. package/lib/commands/index.d.ts +2 -2
  83. package/lib/commands/index.js +4 -41
  84. package/lib/commands/index.js.map +3 -2
  85. package/lib/commands/italic.js +4 -9
  86. package/lib/commands/italic.js.map +1 -1
  87. package/lib/commands/link.js +4 -9
  88. package/lib/commands/link.js.map +1 -1
  89. package/lib/commands/list.js +4 -10
  90. package/lib/commands/list.js.map +1 -1
  91. package/lib/commands/preview.js +21 -7
  92. package/lib/commands/preview.js.map +7 -2
  93. package/lib/commands/quote.js +2 -6
  94. package/lib/commands/quote.js.map +1 -1
  95. package/lib/commands/strikeThrough.js +4 -9
  96. package/lib/commands/strikeThrough.js.map +1 -1
  97. package/lib/commands/title.js +0 -6
  98. package/lib/commands/title.js.map +1 -1
  99. package/lib/commands/title1.js +0 -5
  100. package/lib/commands/title1.js.map +1 -1
  101. package/lib/commands/title2.js +0 -5
  102. package/lib/commands/title2.js.map +1 -1
  103. package/lib/commands/title3.js +0 -5
  104. package/lib/commands/title3.js.map +1 -1
  105. package/lib/commands/title4.js +0 -5
  106. package/lib/commands/title4.js.map +1 -1
  107. package/lib/commands/title5.js +0 -5
  108. package/lib/commands/title5.js.map +1 -1
  109. package/lib/commands/title6.js +0 -5
  110. package/lib/commands/title6.js.map +1 -1
  111. package/lib/components/DragBar/index.js +4 -15
  112. package/lib/components/DragBar/index.js.map +1 -1
  113. package/lib/components/TextArea/Markdown.js +6 -22
  114. package/lib/components/TextArea/Markdown.js.map +1 -1
  115. package/lib/components/TextArea/Textarea.js +15 -36
  116. package/lib/components/TextArea/Textarea.js.map +1 -1
  117. package/lib/components/TextArea/handleKeyDown.js +1 -18
  118. package/lib/components/TextArea/handleKeyDown.js.map +1 -1
  119. package/lib/components/TextArea/index.js +15 -37
  120. package/lib/components/TextArea/index.js.map +1 -1
  121. package/lib/components/TextArea/shortcuts.js +1 -17
  122. package/lib/components/TextArea/shortcuts.js.map +2 -2
  123. package/lib/components/Toolbar/Child.js +8 -18
  124. package/lib/components/Toolbar/Child.js.map +1 -1
  125. package/lib/components/Toolbar/index.js +14 -36
  126. package/lib/components/Toolbar/index.js.map +1 -1
  127. package/lib/index.js +0 -9
  128. package/lib/index.js.map +1 -1
  129. package/lib/utils/InsertTextAtPosition.js +28 -37
  130. package/lib/utils/InsertTextAtPosition.js.map +1 -1
  131. package/lib/utils/markdownUtils.js +17 -28
  132. package/lib/utils/markdownUtils.js.map +1 -1
  133. package/package.json +1 -1
  134. package/src/commands/fullscreen.tsx +3 -2
  135. package/src/commands/index.ts +3 -1
  136. package/src/commands/preview.tsx +35 -4
  137. package/src/components/TextArea/shortcuts.ts +2 -2
@@ -4,11 +4,8 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.comment = void 0;
7
-
8
7
  var _markdownUtils = require("../utils/markdownUtils");
9
-
10
8
  var _jsxRuntime = require("react/jsx-runtime");
11
-
12
9
  var comment = {
13
10
  name: 'comment',
14
11
  keyCommand: 'comment',
@@ -24,10 +21,10 @@ var comment = {
24
21
  text: state.text,
25
22
  selection: state.selection
26
23
  });
27
- var state1 = api.setSelectionRange(newSelectionRange); // Replaces the current selection with the bold mark up
28
-
29
- var state2 = api.replaceSelection("<!-- ".concat(state1.selectedText, " -->")); // Adjust the selection to not contain the **
30
-
24
+ var state1 = api.setSelectionRange(newSelectionRange);
25
+ // Replaces the current selection with the bold mark up
26
+ var state2 = api.replaceSelection("<!-- ".concat(state1.selectedText, " -->"));
27
+ // Adjust the selection to not contain the **
31
28
  api.setSelectionRange({
32
29
  start: state2.selection.end - 4 - state1.selectedText.length,
33
30
  end: state2.selection.end - 4
@@ -31,5 +31,5 @@
31
31
  "sourcesContent": [
32
32
  "import { ICommand, TextState, TextAreaTextApi } from './';\nimport { selectWord } from '../utils/markdownUtils';\n\nexport const comment: ICommand = {\n name: 'comment',\n keyCommand: 'comment',\n shortcuts: 'ctrlcmd+/',\n value: '<!-- -->',\n buttonProps: { 'aria-label': 'Insert comment (ctrl + /)', title: 'Insert comment (ctrl + /)' },\n execute: (state: TextState, api: TextAreaTextApi) => {\n // Adjust the selection to encompass the whole word if the caret is inside one\n const newSelectionRange = selectWord({ text: state.text, selection: state.selection });\n const state1 = api.setSelectionRange(newSelectionRange);\n // Replaces the current selection with the bold mark up\n const state2 = api.replaceSelection(`<!-- ${state1.selectedText} -->`);\n // Adjust the selection to not contain the **\n api.setSelectionRange({\n start: state2.selection.end - 4 - state1.selectedText.length,\n end: state2.selection.end - 4,\n });\n },\n icon: (\n <svg height=\"1em\" width=\"1em\" viewBox=\"0 0 25 25\">\n <g fill=\"none\" fillRule=\"evenodd\">\n <polygon points=\".769 .727 24.981 .727 24.981 24.727 .769 24.727\" />\n <path\n stroke=\"currentColor\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n strokeWidth=\"3\"\n d=\"M12.625,23.8787879 L8.125,19.6969697 L5.125,19.6969697 C2.63971863,19.6969697 0.625,17.8247059 0.625,15.5151515 L0.625,7.15151515 C0.625,4.84196074 2.63971863,2.96969697 5.125,2.96969697 L20.125,2.96969697 C22.6102814,2.96969697 24.625,4.84196074 24.625,7.15151515 L24.625,15.5151515 C24.625,17.8247059 22.6102814,19.6969697 20.125,19.6969697 L17.125,19.6969697 L12.625,23.8787879\"\n />\n <path\n stroke=\"currentColor\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n strokeWidth=\"3\"\n d=\"M10.625,8.54545455 L7.25,11.3333333 L10.625,14.1212121 M15.6875,8.54545455 L19.0625,11.3333333 L15.6875,14.1212121\"\n />\n </g>\n </svg>\n ),\n};\n"
33
33
  ],
34
- "mappings": ";;;;;;;AACA;;;;AAEO,IAAMA,OAAiB,GAAG;EAC/BC,IAAI,EAAE,SADyB;EAE/BC,UAAU,EAAE,SAFmB;EAG/BC,SAAS,EAAE,WAHoB;EAI/BC,KAAK,EAAE,UAJwB;EAK/BC,WAAW,EAAE;IAAE,cAAc,2BAAhB;IAA6CC,KAAK,EAAE;EAApD,CALkB;EAM/BC,OAAO,EAAE,iBAACC,KAAD,EAAmBC,GAAnB,EAA4C;IACnD;IACA,IAAMC,iBAAiB,GAAG,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AAK,EAAE;EAA4B,CAAC;EAC9FC,OAAO,EAAE,iBAACC,KAAgB,EAAEC,GAAoB,EAAK;IACnD;IACA,IAAMC,iBAAiB,GAAG,IAAAC,yBAAU,EAAC;MAAEC,IAAI,EAAEJ,KAAK,CAACI,IAAI;MAAEC,SAAS,EAAEL,KAAK,CAACK;IAAU,CAAC,CAAC;IACtF,IAAMC,MAAM,GAAGL,GAAG,CAACM,iBAAiB,CAACL,iBAAiB,CAAC;IACvD;IACA,IAAMM,MAAM,GAAGP,GAAG,CAACQ,gBAAgB,gBAASH,MAAM,CAACI,YAAY,UAAO;IACtE;IACAT,GAAG,CAACM,iBAAiB,CAAC;MACpBI,KAAK,EAAEH,MAAM,CAACH,SAAS,CAACO,GAAG,GAAG,CAAC,GAAGN,MAAM,CAACI,YAAY,CAACG,MAAM;MAC5DD,GAAG,EAAEJ,MAAM,CAACH,SAAS,CAACO,GAAG,GAAG;IAC9B,CAAC,CAAC;EACJ,CAAC;EACDE,IAAI,eACF;IAAK,MAAM,EAAC,KAAK;IAAC,KAAK,EAAC,KAAK;IAAC,OAAO,EAAC,WAAW;IAAA,uBAC/C;MAAG,IAAI,EAAC,MAAM;MAAC,QAAQ,EAAC,SAAS;MAAA,wBAC/B;QAAS,MAAM,EAAC;MAAiD,EAAG,eACpE;QACE,MAAM,EAAC,cAAc;QACrB,aAAa,EAAC,OAAO;QACrB,cAAc,EAAC,OAAO;QACtB,WAAW,EAAC,GAAG;QACf,CAAC,EAAC;MAA8X,EAChY,eACF;QACE,MAAM,EAAC,cAAc;QACrB,aAAa,EAAC,OAAO;QACrB,cAAc,EAAC,OAAO;QACtB,WAAW,EAAC,GAAG;QACf,CAAC,EAAC;MAAoH,EACtH;IAAA;EACA;AAGV,CAAC;AAAC"
35
35
  }
@@ -10,5 +10,5 @@
10
10
  "sourcesContent": [
11
11
  "import { ICommand } from './';\n\nexport const divider: ICommand = {\n keyCommand: 'divider',\n};\n"
12
12
  ],
13
- "mappings": ";;;;;;AAEO,IAAMA,OAAiB,GAAG;EAC/BC,UAAU,EAAE;AADmB,CAA1B"
13
+ "mappings": ";;;;;;AAEO,IAAMA,OAAiB,GAAG;EAC/BC,UAAU,EAAE;AACd,CAAC;AAAC"
14
14
  }
@@ -1,16 +1,12 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard")["default"];
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.fullscreen = void 0;
9
-
10
8
  var React = _interopRequireWildcard(require("react"));
11
-
12
9
  var _jsxRuntime = require("react/jsx-runtime");
13
-
14
10
  var fullscreen = {
15
11
  name: 'fullscreen',
16
12
  keyCommand: 'fullscreen',
@@ -29,12 +25,11 @@ var fullscreen = {
29
25
  d: "M118 171.133334L118 342.200271C118 353.766938 126.675 365.333605 141.133333 365.333605L382.634614 365.333605C394.201281 365.333605 405.767948 356.658605 405.767948 342.200271L405.767948 171.133334C405.767948 159.566667 397.092948 148 382.634614 148L141.133333 148C126.674999 148 117.999999 156.675 118 171.133334zM465.353591 413.444444L370 413.444444 370 471.222222 474.0221 471.222222C500.027624 471.222222 520.254143 451 520.254143 425L520.254143 321 462.464089 321 462.464089 413.444444 465.353591 413.444444zM471.0221 43L367 43 367 100.777778 462.353591 100.777778 462.353591 196.111111 520.143647 196.111111 520.143647 89.2222219C517.254144 63.2222219 497.027624 43 471.0221 43zM57.7900547 100.777778L153.143646 100.777778 153.143646 43 46.2320439 43C20.2265191 43 0 63.2222219 0 89.2222219L0 193.222222 57.7900547 193.222222 57.7900547 100.777778zM57.7900547 321L0 321 0 425C0 451 20.2265191 471.222222 46.2320439 471.222223L150.254143 471.222223 150.254143 413.444445 57.7900547 413.444445 57.7900547 321z"
30
26
  })
31
27
  }),
32
- execute: function execute(state, api, dispatch, executeCommandState) {
28
+ execute: function execute(state, api, dispatch, executeCommandState, shortcuts) {
33
29
  api.textArea.focus();
34
-
35
- if (dispatch && executeCommandState && executeCommandState.fullscreen) {
30
+ if (shortcuts && dispatch && executeCommandState) {
36
31
  dispatch({
37
- fullscreen: false
32
+ fullscreen: !executeCommandState.fullscreen
38
33
  });
39
34
  }
40
35
  }
@@ -21,7 +21,7 @@
21
21
  "../../src/commands/fullscreen.tsx"
22
22
  ],
23
23
  "sourcesContent": [
24
- "import * as React from 'react';\nimport { ICommand, TextState, TextAreaTextApi } from './';\nimport { ContextStore, ExecuteCommandState } from '../Context';\n\nexport const fullscreen: ICommand = {\n name: 'fullscreen',\n keyCommand: 'fullscreen',\n shortcuts: 'ctrlcmd+0',\n value: 'fullscreen',\n buttonProps: { 'aria-label': 'Toggle fullscreen (ctrl + 0)', title: 'Toggle fullscreen (ctrl+ 0)' },\n icon: (\n <svg width=\"12\" height=\"12\" viewBox=\"0 0 520 520\">\n <path\n fill=\"currentColor\"\n d=\"M118 171.133334L118 342.200271C118 353.766938 126.675 365.333605 141.133333 365.333605L382.634614 365.333605C394.201281 365.333605 405.767948 356.658605 405.767948 342.200271L405.767948 171.133334C405.767948 159.566667 397.092948 148 382.634614 148L141.133333 148C126.674999 148 117.999999 156.675 118 171.133334zM465.353591 413.444444L370 413.444444 370 471.222222 474.0221 471.222222C500.027624 471.222222 520.254143 451 520.254143 425L520.254143 321 462.464089 321 462.464089 413.444444 465.353591 413.444444zM471.0221 43L367 43 367 100.777778 462.353591 100.777778 462.353591 196.111111 520.143647 196.111111 520.143647 89.2222219C517.254144 63.2222219 497.027624 43 471.0221 43zM57.7900547 100.777778L153.143646 100.777778 153.143646 43 46.2320439 43C20.2265191 43 0 63.2222219 0 89.2222219L0 193.222222 57.7900547 193.222222 57.7900547 100.777778zM57.7900547 321L0 321 0 425C0 451 20.2265191 471.222222 46.2320439 471.222223L150.254143 471.222223 150.254143 413.444445 57.7900547 413.444445 57.7900547 321z\"\n />\n </svg>\n ),\n execute: (\n state: TextState,\n api: TextAreaTextApi,\n dispatch?: React.Dispatch<ContextStore>,\n executeCommandState?: ExecuteCommandState,\n ) => {\n api.textArea.focus();\n if (dispatch && executeCommandState && executeCommandState.fullscreen) {\n dispatch({ fullscreen: false });\n }\n },\n};\n"
24
+ "import * as React from 'react';\nimport { ICommand, TextState, TextAreaTextApi } from './';\nimport { ContextStore, ExecuteCommandState } from '../Context';\n\nexport const fullscreen: ICommand = {\n name: 'fullscreen',\n keyCommand: 'fullscreen',\n shortcuts: 'ctrlcmd+0',\n value: 'fullscreen',\n buttonProps: { 'aria-label': 'Toggle fullscreen (ctrl + 0)', title: 'Toggle fullscreen (ctrl+ 0)' },\n icon: (\n <svg width=\"12\" height=\"12\" viewBox=\"0 0 520 520\">\n <path\n fill=\"currentColor\"\n d=\"M118 171.133334L118 342.200271C118 353.766938 126.675 365.333605 141.133333 365.333605L382.634614 365.333605C394.201281 365.333605 405.767948 356.658605 405.767948 342.200271L405.767948 171.133334C405.767948 159.566667 397.092948 148 382.634614 148L141.133333 148C126.674999 148 117.999999 156.675 118 171.133334zM465.353591 413.444444L370 413.444444 370 471.222222 474.0221 471.222222C500.027624 471.222222 520.254143 451 520.254143 425L520.254143 321 462.464089 321 462.464089 413.444444 465.353591 413.444444zM471.0221 43L367 43 367 100.777778 462.353591 100.777778 462.353591 196.111111 520.143647 196.111111 520.143647 89.2222219C517.254144 63.2222219 497.027624 43 471.0221 43zM57.7900547 100.777778L153.143646 100.777778 153.143646 43 46.2320439 43C20.2265191 43 0 63.2222219 0 89.2222219L0 193.222222 57.7900547 193.222222 57.7900547 100.777778zM57.7900547 321L0 321 0 425C0 451 20.2265191 471.222222 46.2320439 471.222223L150.254143 471.222223 150.254143 413.444445 57.7900547 413.444445 57.7900547 321z\"\n />\n </svg>\n ),\n execute: (\n state: TextState,\n api: TextAreaTextApi,\n dispatch?: React.Dispatch<ContextStore>,\n executeCommandState?: ExecuteCommandState,\n shortcuts?: string[],\n ) => {\n api.textArea.focus();\n if (shortcuts && dispatch && executeCommandState) {\n dispatch({ fullscreen: !executeCommandState.fullscreen });\n }\n },\n};\n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,KAAK,EAAE;IACpB,IAAIX,SAAS,IAAIQ,QAAQ,IAAIC,mBAAmB,EAAE;MAChDD,QAAQ,CAAC;QAAEX,UAAU,EAAE,CAACY,mBAAmB,CAACZ;MAAW,CAAC,CAAC;IAC3D;EACF;AACF,CAAC;AAAC"
27
27
  }
@@ -1,20 +1,15 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.group = void 0;
9
-
8
+ var _objectDestructuringEmpty2 = _interopRequireDefault(require("@babel/runtime/helpers/objectDestructuringEmpty"));
10
9
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
11
-
12
10
  var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
13
-
14
11
  var _react = _interopRequireDefault(require("react"));
15
-
16
12
  var _jsxRuntime = require("react/jsx-runtime");
17
-
18
13
  var group = function group(arr, options) {
19
14
  var data = (0, _objectSpread2["default"])((0, _objectSpread2["default"])({
20
15
  children: arr,
@@ -31,17 +26,14 @@ var group = function group(arr, options) {
31
26
  }, options), {}, {
32
27
  keyCommand: 'group'
33
28
  });
34
-
35
29
  if (Array.isArray(data.children)) {
36
30
  data.children = data.children.map(function (_ref) {
37
- var item = (0, _extends2["default"])({}, _ref);
31
+ var item = (0, _extends2["default"])({}, ((0, _objectDestructuringEmpty2["default"])(_ref), _ref));
38
32
  item.parent = data;
39
33
  return (0, _objectSpread2["default"])({}, item);
40
34
  });
41
35
  }
42
-
43
36
  return data;
44
37
  };
45
-
46
38
  exports.group = group;
47
39
  //# sourceMappingURL=group.js.map
@@ -21,5 +21,5 @@
21
21
  "sourcesContent": [
22
22
  "import React from 'react';\nimport { ICommand, ICommandChildCommands, ICommandChildHandle } from './';\n\nexport type GroupOptions = Omit<ICommand<string>, 'children'> & {\n children?: ICommandChildHandle['children'];\n};\n\nexport const group = (arr: ICommandChildCommands['children'], options?: GroupOptions): ICommand<string> => {\n let data = {\n children: arr as any,\n icon: (\n <svg width=\"12\" height=\"12\" viewBox=\"0 0 520 520\">\n <path\n fill=\"currentColor\"\n d=\"M15.7083333,468 C7.03242448,468 0,462.030833 0,454.666667 L0,421.333333 C0,413.969167 7.03242448,408 15.7083333,408 L361.291667,408 C369.967576,408 377,413.969167 377,421.333333 L377,454.666667 C377,462.030833 369.967576,468 361.291667,468 L15.7083333,468 Z M21.6666667,366 C9.69989583,366 0,359.831861 0,352.222222 L0,317.777778 C0,310.168139 9.69989583,304 21.6666667,304 L498.333333,304 C510.300104,304 520,310.168139 520,317.777778 L520,352.222222 C520,359.831861 510.300104,366 498.333333,366 L21.6666667,366 Z M136.835938,64 L136.835937,126 L107.25,126 L107.25,251 L40.75,251 L40.75,126 L-5.68434189e-14,126 L-5.68434189e-14,64 L136.835938,64 Z M212,64 L212,251 L161.648438,251 L161.648438,64 L212,64 Z M378,64 L378,126 L343.25,126 L343.25,251 L281.75,251 L281.75,126 L238,126 L238,64 L378,64 Z M449.047619,189.550781 L520,189.550781 L520,251 L405,251 L405,64 L449.047619,64 L449.047619,189.550781 Z\"\n />\n </svg>\n ),\n execute: () => {},\n ...options,\n keyCommand: 'group',\n };\n if (Array.isArray(data.children)) {\n data.children = data.children.map(({ ...item }: ICommand) => {\n item.parent = data;\n return { ...item };\n });\n }\n return data;\n};\n"
23
23
  ],
24
- "mappings": ";;;;;;;;;;;;;AAAA;;;;AAOO,IAAMA,KAAK,GAAG,SAARA,KAAQ,CAACC,GAAD,EAAyCC,OAAzC,EAAsF;EACzG,IAAIC,IAAI;IACNC,QAAQ,EAAEH,GADJ;IAENI,IAAI,eACF;MAAK,KAAK,EAAC,IAAX;MAAgB,MAAM,EAAC,IAAvB;MAA4B,OAAO,EAAC,aAApC;MAAA,uBACE;QACE,IAAI,EAAC,cADP;QAEE,CAAC,EAAC;MAFJ;IADF,EAHI;IAUNC,OAAO,EAAE,mBAAM,CAAE;EAVX,GAWHJ,OAXG;IAYNK,UAAU,EAAE;EAZN,EAAR;;EAcA,IAAIC,KAAK,CAACC,OAAN,CAAcN,IAAI,CAACC,QAAnB,CAAJ,EAAkC;IAChCD,IAAI,CAACC,QAAL,GAAgBD,IAAI,CAACC,QAAL,CAAcM,GAAd,CAAkB,gBAA2B;MAAA,IAArBC,IAAqB;MAC3DA,IAAI,CAACC,MAAL,GAAcT,IAAd;MACA,0CAAYQ,IAAZ;IACD,CAHe,CAAhB;EAID;;EACD,OAAOR,IAAP;AACD,CAtBM"
24
+ "mappings": ";;;;;;;;;;AAAA;AAA0B;AAOnB,IAAMA,KAAK,GAAG,SAARA,KAAK,CAAIC,GAAsC,EAAEC,OAAsB,EAAuB;EACzG,IAAIC,IAAI;IACNC,QAAQ,EAAEH,GAAU;IACpBI,IAAI,eACF;MAAK,KAAK,EAAC,IAAI;MAAC,MAAM,EAAC,IAAI;MAAC,OAAO,EAAC,aAAa;MAAA,uBAC/C;QACE,IAAI,EAAC,cAAc;QACnB,CAAC,EAAC;MAA24B;IAC74B,EAEL;IACDC,OAAO,EAAE,mBAAM,CAAC;EAAC,GACdJ,OAAO;IACVK,UAAU,EAAE;EAAO,EACpB;EACD,IAAIC,KAAK,CAACC,OAAO,CAACN,IAAI,CAACC,QAAQ,CAAC,EAAE;IAChCD,IAAI,CAACC,QAAQ,GAAGD,IAAI,CAACC,QAAQ,CAACM,GAAG,CAAC,gBAA2B;MAAA,IAArBC,IAAI;MAC1CA,IAAI,CAACC,MAAM,GAAGT,IAAI;MAClB,0CAAYQ,IAAI;IAClB,CAAC,CAAC;EACJ;EACA,OAAOR,IAAI;AACb,CAAC;AAAC"
25
25
  }
@@ -1,16 +1,12 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard")["default"];
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.hr = void 0;
9
-
10
8
  var React = _interopRequireWildcard(require("react"));
11
-
12
9
  var _jsxRuntime = require("react/jsx-runtime");
13
-
14
10
  var hr = {
15
11
  name: 'hr',
16
12
  keyCommand: 'hr',
@@ -21,5 +21,5 @@
21
21
  "sourcesContent": [
22
22
  "import * as React from 'react';\nimport { ICommand, TextState, TextAreaTextApi } from './';\n\nexport const hr: ICommand = {\n name: 'hr',\n keyCommand: 'hr',\n shortcuts: 'ctrlcmd+h',\n value: '----------',\n buttonProps: { 'aria-label': 'Insert HR (ctrl + h)', title: 'Insert HR (ctrl + h)' },\n icon: (\n <svg width=\"12\" height=\"12\" viewBox=\"0 0 175 175\">\n <path\n fill=\"currentColor\"\n d=\"M0,129 L175,129 L175,154 L0,154 L0,129 Z M3,9 L28.2158203,9 L28.2158203,47.9824219 L55.7695313,47.9824219 L55.7695313,9 L81.0966797,9 L81.0966797,107.185547 L55.7695313,107.185547 L55.7695313,68.0214844 L28.2158203,68.0214844 L28.2158203,107.185547 L3,107.185547 L3,9 Z M93.1855469,100.603516 L93.1855469,19 L135.211914,19 C143.004922,19 148.960917,19.6679621 153.080078,21.0039063 C157.199239,22.3398504 160.520495,24.8168764 163.043945,28.4350586 C165.567395,32.0532407 166.829102,36.459935 166.829102,41.6552734 C166.829102,46.1826398 165.864267,50.0883625 163.93457,53.3725586 C162.004873,56.6567547 159.351579,59.3193257 155.974609,61.3603516 C153.822255,62.6591862 150.872089,63.7353473 147.124023,64.5888672 C150.129898,65.5908253 152.319329,66.5927684 153.692383,67.5947266 C154.620122,68.2626987 155.965323,69.6913953 157.728027,71.8808594 C159.490731,74.0703234 160.668942,75.7587831 161.262695,76.9462891 L173,100.603516 L144.953125,100.603516 L131.482422,75.6660156 C129.775382,72.4374839 128.253913,70.3408251 126.917969,69.3759766 C125.0996,68.1142515 123.040051,67.4833984 120.739258,67.4833984 L118.512695,67.4833984 L118.512695,100.603516 L93.1855469,100.603516 Z M118.512695,52.0644531 L129.144531,52.0644531 C130.294928,52.0644531 132.521468,51.6933631 135.824219,50.9511719 C137.494149,50.6171858 138.857905,49.7636787 139.915527,48.390625 C140.97315,47.0175713 141.501953,45.4404386 141.501953,43.6591797 C141.501953,41.0244009 140.667001,39.0019602 138.99707,37.5917969 C137.32714,36.1816336 134.191429,35.4765625 129.589844,35.4765625 L117.512695,35.4765625 L118.512695,52.0644531 Z\"\n transform=\"translate(0 9)\"\n />\n </svg>\n ),\n execute: (state: TextState, api: TextAreaTextApi) => {\n api.replaceSelection(`${state.selectedText}\\n\\n----------\\n\\n`);\n },\n};\n"
23
23
  ],
24
- "mappings": ";;;;;;;;;AAAA;;;;AAGO,IAAMA,EAAY,GAAG;EAC1BC,IAAI,EAAE,IADoB;EAE1BC,UAAU,EAAE,IAFc;EAG1BC,SAAS,EAAE,WAHe;EAI1BC,KAAK,EAAE,YAJmB;EAK1BC,WAAW,EAAE;IAAE,cAAc,sBAAhB;IAAwCC,KAAK,EAAE;EAA/C,CALa;EAM1BC,IAAI,eACF;IAAK,KAAK,EAAC,IAAX;IAAgB,MAAM,EAAC,IAAvB;IAA4B,OAAO,EAAC,aAApC;IAAA,uBACE;MACE,IAAI,EAAC,cADP;MAEE,CAAC,EAAC,ukDAFJ;MAGE,SAAS,EAAC;IAHZ;EADF,EAPwB;EAe1BC,OAAO,EAAE,iBAACC,KAAD,EAAmBC,GAAnB,EAA4C;IACnDA,GAAG,CAACC,gBAAJ,WAAwBF,KAAK,CAACG,YAA9B;EACD;AAjByB,CAArB"
24
+ "mappings": ";;;;;;;AAAA;AAA+B;AAGxB,IAAMA,EAAY,GAAG;EAC1BC,IAAI,EAAE,IAAI;EACVC,UAAU,EAAE,IAAI;EAChBC,SAAS,EAAE,WAAW;EACtBC,KAAK,EAAE,YAAY;EACnBC,WAAW,EAAE;IAAE,YAAY,EAAE,sBAAsB;IAAEC,KAAK,EAAE;EAAuB,CAAC;EACpFC,IAAI,eACF;IAAK,KAAK,EAAC,IAAI;IAAC,MAAM,EAAC,IAAI;IAAC,OAAO,EAAC,aAAa;IAAA,uBAC/C;MACE,IAAI,EAAC,cAAc;MACnB,CAAC,EAAC,ukDAAukD;MACzkD,SAAS,EAAC;IAAgB;EAC1B,EAEL;EACDC,OAAO,EAAE,iBAACC,KAAgB,EAAEC,GAAoB,EAAK;IACnDA,GAAG,CAACC,gBAAgB,WAAIF,KAAK,CAACG,YAAY,wBAAqB;EACjE;AACF,CAAC;AAAC"
25
25
  }
@@ -1,18 +1,13 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard")["default"];
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.image = void 0;
9
-
10
8
  var React = _interopRequireWildcard(require("react"));
11
-
12
9
  var _markdownUtils = require("../utils/markdownUtils");
13
-
14
10
  var _jsxRuntime = require("react/jsx-runtime");
15
-
16
11
  var image = {
17
12
  name: 'image',
18
13
  keyCommand: 'image',
@@ -37,11 +32,11 @@ var image = {
37
32
  text: state.text,
38
33
  selection: state.selection
39
34
  });
40
- var state1 = api.setSelectionRange(newSelectionRange); // Replaces the current selection with the image
41
-
35
+ var state1 = api.setSelectionRange(newSelectionRange);
36
+ // Replaces the current selection with the image
42
37
  var imageTemplate = state1.selectedText || 'https://example.com/your-image.png';
43
- api.replaceSelection("![](".concat(imageTemplate, ")")); // Adjust the selection to not contain the **
44
-
38
+ api.replaceSelection("![](".concat(imageTemplate, ")"));
39
+ // Adjust the selection to not contain the **
45
40
  api.setSelectionRange({
46
41
  start: 4 + state1.selection.start,
47
42
  end: 4 + state1.selection.start + imageTemplate.length
@@ -31,5 +31,5 @@
31
31
  "sourcesContent": [
32
32
  "import * as React from 'react';\nimport { ICommand, TextState, TextAreaTextApi } from './';\nimport { selectWord } from '../utils/markdownUtils';\n\nexport const image: ICommand = {\n name: 'image',\n keyCommand: 'image',\n shortcuts: 'ctrlcmd+k',\n value: '![image]()',\n buttonProps: { 'aria-label': 'Add image (ctrl + k)', title: 'Add image (ctrl + k)' },\n icon: (\n <svg width=\"13\" height=\"13\" viewBox=\"0 0 20 20\">\n <path\n fill=\"currentColor\"\n d=\"M15 9c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm4-7H1c-.55 0-1 .45-1 1v14c0 .55.45 1 1 1h18c.55 0 1-.45 1-1V3c0-.55-.45-1-1-1zm-1 13l-6-5-2 2-4-5-4 8V4h16v11z\"\n />\n </svg>\n ),\n execute: (state: TextState, api: TextAreaTextApi) => {\n // Select everything\n const newSelectionRange = selectWord({ text: state.text, selection: state.selection });\n const state1 = api.setSelectionRange(newSelectionRange);\n // Replaces the current selection with the image\n const imageTemplate = state1.selectedText || 'https://example.com/your-image.png';\n api.replaceSelection(`![](${imageTemplate})`);\n // Adjust the selection to not contain the **\n api.setSelectionRange({\n start: 4 + state1.selection.start,\n end: 4 + state1.selection.start + imageTemplate.length,\n });\n },\n};\n"
33
33
  ],
34
- "mappings": ";;;;;;;;;AAAA;;AAEA;;;;AAEO,IAAMA,KAAe,GAAG;EAC7BC,IAAI,EAAE,OADuB;EAE7BC,UAAU,EAAE,OAFiB;EAG7BC,SAAS,EAAE,WAHkB;EAI7BC,KAAK,EAAE,YAJsB;EAK7BC,WAAW,EAAE;IAAE,cAAc,sBAAhB;IAAwCC,KAAK,EAAE;EAA/C,CALgB;EAM7BC,IAAI,eACF;IAAK,KAAK,EAAC,IAAX;IAAgB,MAAM,EAAC,IAAvB;IAA4B,OAAO,EAAC,WAApC;IAAA,uBACE;MACE,IAAI,EAAC,cADP;MAEE,CAAC,EAAC;IAFJ;EADF,EAP2B;EAc7BC,OAAO,EAAE,iBAACC,KAAD,EAAmBC,GAAnB,EAA4C;IACnD;IACA,IAAMC,iBAAiB,GAAG,IAAAC,yBAAA,EAAW;MAAEC,IAAI,EAAEJ,KAAK,CAACI,IAAd;MAAoBC,SAAS,EAAEL,KAAK,CAACK;IAArC,CAAX,CAA1B;IACA,IAAMC,MAAM,GAAGL,GAAG,CAACM,iB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ACD,SAAS,CAACM,KAAK;MACjCC,GAAG,EAAE,CAAC,GAAGN,MAAM,CAACD,SAAS,CAACM,KAAK,GAAGH,aAAa,CAACK;IAClD,CAAC,CAAC;EACJ;AACF,CAAC;AAAC"
35
35
  }
@@ -46,7 +46,7 @@ export interface ICommandBase<T> {
46
46
  liProps?: React.LiHTMLAttributes<HTMLLIElement>;
47
47
  buttonProps?: React.ButtonHTMLAttributes<HTMLButtonElement> | null;
48
48
  render?: (command: ICommand<T>, disabled: boolean, executeCommand: (command: ICommand<T>, name?: string) => void, index: number) => void | undefined | null | React.ReactElement;
49
- execute?: (state: TextState, api: TextAreaTextApi, dispatch?: React.Dispatch<ContextStore>, executeCommandState?: ExecuteCommandState) => void;
49
+ execute?: (state: TextState, api: TextAreaTextApi, dispatch?: React.Dispatch<ContextStore>, executeCommandState?: ExecuteCommandState, shortcuts?: string[]) => void;
50
50
  }
51
51
  export declare type ICommand<T = string> = ICommandChildCommands<T> | ICommandChildHandle<T>;
52
52
  export interface TextRange {
@@ -81,6 +81,6 @@ declare class TextAreaCommandOrchestrator implements CommandOrchestrator {
81
81
  textApi: TextAreaTextApi;
82
82
  constructor(textArea: HTMLTextAreaElement);
83
83
  getState(): false | TextState;
84
- executeCommand(command: ICommand<string>, dispatch?: React.Dispatch<ContextStore>, state?: ExecuteCommandState): void;
84
+ executeCommand(command: ICommand<string>, dispatch?: React.Dispatch<ContextStore>, state?: ExecuteCommandState, shortcuts?: string[]): void;
85
85
  }
86
86
  export { title, title1, title2, title3, title4, title5, title6, bold, codeBlock, italic, strikethrough, hr, group, divider, link, quote, code, image, unorderedListCommand, orderedListCommand, checkedListCommand, codeEdit, codeLive, codePreview, fullscreen, getCommands, getExtraCommands, getStateFromTextArea, TextAreaCommandOrchestrator, TextAreaTextApi, };
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
@@ -158,57 +157,31 @@ Object.defineProperty(exports, "unorderedListCommand", {
158
157
  return _list.unorderedListCommand;
159
158
  }
160
159
  });
161
-
162
160
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
163
-
164
161
  var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
165
-
166
162
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
167
-
168
163
  var _InsertTextAtPosition = require("../utils/InsertTextAtPosition");
169
-
170
164
  var _bold = require("./bold");
171
-
172
165
  var _code = require("./code");
173
-
174
166
  var _comment = require("./comment");
175
-
176
167
  var _divider = require("./divider");
177
-
178
168
  var _fullscreen = require("./fullscreen");
179
-
180
169
  var _group = require("./group");
181
-
182
170
  var _hr = require("./hr");
183
-
184
171
  var _image = require("./image");
185
-
186
172
  var _italic = require("./italic");
187
-
188
173
  var _link = require("./link");
189
-
190
174
  var _list = require("./list");
191
-
192
175
  var _preview = require("./preview");
193
-
194
176
  var _quote = require("./quote");
195
-
196
177
  var _strikeThrough = require("./strikeThrough");
197
-
198
178
  var _title = require("./title");
199
-
200
179
  var _title2 = require("./title1");
201
-
202
180
  var _title3 = require("./title2");
203
-
204
181
  var _title4 = require("./title3");
205
-
206
182
  var _title5 = require("./title4");
207
-
208
183
  var _title6 = require("./title5");
209
-
210
184
  var _title7 = require("./title6");
211
-
212
185
  var getCommands = function getCommands() {
213
186
  return [_bold.bold, _italic.italic, _strikeThrough.strikethrough, _hr.hr, (0, _group.group)([_title2.title1, _title3.title2, _title4.title3, _title5.title4, _title6.title5, _title7.title6], {
214
187
  name: 'title',
@@ -219,15 +192,11 @@ var getCommands = function getCommands() {
219
192
  }
220
193
  }), _divider.divider, _link.link, _quote.quote, _code.code, _code.codeBlock, _comment.comment, _image.image, _divider.divider, _list.unorderedListCommand, _list.orderedListCommand, _list.checkedListCommand];
221
194
  };
222
-
223
195
  exports.getCommands = getCommands;
224
-
225
196
  var getExtraCommands = function getExtraCommands() {
226
197
  return [_preview.codeEdit, _preview.codeLive, _preview.codePreview, _divider.divider, _fullscreen.fullscreen];
227
198
  };
228
-
229
199
  exports.getExtraCommands = getExtraCommands;
230
-
231
200
  function getStateFromTextArea(textArea) {
232
201
  return {
233
202
  selection: {
@@ -238,31 +207,29 @@ function getStateFromTextArea(textArea) {
238
207
  selectedText: textArea.value.slice(textArea.selectionStart, textArea.selectionEnd)
239
208
  };
240
209
  }
241
-
242
210
  var TextAreaTextApi = /*#__PURE__*/function () {
243
211
  function TextAreaTextApi(textArea) {
244
212
  (0, _classCallCheck2["default"])(this, TextAreaTextApi);
245
213
  (0, _defineProperty2["default"])(this, "textArea", void 0);
246
214
  this.textArea = textArea;
247
215
  }
216
+
248
217
  /**
249
218
  * Replaces the current selection with the new text. This will make the new selectedText to be empty, the
250
219
  * selection start and selection end will be the same and will both point to the end
251
220
  * @param text Text that should replace the current selection
252
221
  */
253
-
254
-
255
222
  (0, _createClass2["default"])(TextAreaTextApi, [{
256
223
  key: "replaceSelection",
257
224
  value: function replaceSelection(text) {
258
225
  (0, _InsertTextAtPosition.insertTextAtPosition)(this.textArea, text);
259
226
  return getStateFromTextArea(this.textArea);
260
227
  }
228
+
261
229
  /**
262
230
  * Selects the specified text range
263
231
  * @param selection
264
232
  */
265
-
266
233
  }, {
267
234
  key: "setSelectionRange",
268
235
  value: function setSelectionRange(selection) {
@@ -274,9 +241,7 @@ var TextAreaTextApi = /*#__PURE__*/function () {
274
241
  }]);
275
242
  return TextAreaTextApi;
276
243
  }();
277
-
278
244
  exports.TextAreaTextApi = TextAreaTextApi;
279
-
280
245
  var TextAreaCommandOrchestrator = /*#__PURE__*/function () {
281
246
  function TextAreaCommandOrchestrator(textArea) {
282
247
  (0, _classCallCheck2["default"])(this, TextAreaCommandOrchestrator);
@@ -285,7 +250,6 @@ var TextAreaCommandOrchestrator = /*#__PURE__*/function () {
285
250
  this.textArea = textArea;
286
251
  this.textApi = new TextAreaTextApi(textArea);
287
252
  }
288
-
289
253
  (0, _createClass2["default"])(TextAreaCommandOrchestrator, [{
290
254
  key: "getState",
291
255
  value: function getState() {
@@ -294,12 +258,11 @@ var TextAreaCommandOrchestrator = /*#__PURE__*/function () {
294
258
  }
295
259
  }, {
296
260
  key: "executeCommand",
297
- value: function executeCommand(command, dispatch, state) {
298
- command.execute && command.execute(getStateFromTextArea(this.textArea), this.textApi, dispatch, state);
261
+ value: function executeCommand(command, dispatch, state, shortcuts) {
262
+ command.execute && command.execute(getStateFromTextArea(this.textArea), this.textApi, dispatch, state, shortcuts);
299
263
  }
300
264
  }]);
301
265
  return TextAreaCommandOrchestrator;
302
266
  }();
303
-
304
267
  exports.TextAreaCommandOrchestrator = TextAreaCommandOrchestrator;
305
268
  //# sourceMappingURL=index.js.map
@@ -51,13 +51,14 @@
51
51
  "command",
52
52
  "dispatch",
53
53
  "state",
54
+ "shortcuts",
54
55
  "execute"
55
56
  ],
56
57
  "sources": [
57
58
  "../../src/commands/index.ts"
58
59
  ],
59
60
  "sourcesContent": [
60
- "import React from 'react';\nimport { ContextStore, ExecuteCommandState } from '../Context';\nimport { insertTextAtPosition } from '../utils/InsertTextAtPosition';\nimport { bold } from './bold';\nimport { code, codeBlock } from './code';\nimport { comment } from './comment';\nimport { divider } from './divider';\nimport { fullscreen } from './fullscreen';\nimport { group } from './group';\nimport { hr } from './hr';\nimport { image } from './image';\nimport { italic } from './italic';\nimport { link } from './link';\nimport { checkedListCommand, orderedListCommand, unorderedListCommand } from './list';\nimport { codeEdit, codeLive, codePreview } from './preview';\nimport { quote } from './quote';\nimport { strikethrough } from './strikeThrough';\nimport { title } from './title';\nimport { title1 } from './title1';\nimport { title2 } from './title2';\nimport { title3 } from './title3';\nimport { title4 } from './title4';\nimport { title5 } from './title5';\nimport { title6 } from './title6';\n\nexport interface CommandOrchestrator {\n executeCommand(command: ICommand): void;\n}\n\nexport interface ICommandChildHandle<T = string> extends ICommandBase<T> {\n children?: (handle: {\n close: () => void;\n execute: () => void;\n getState?: TextAreaCommandOrchestrator['getState'];\n textApi?: TextAreaTextApi;\n }) => React.ReactElement;\n}\n\nexport interface ICommandChildCommands<T = string> extends ICommandBase<T> {\n children?: Array<ICommand<T>>;\n}\n\nexport interface ICommandBase<T> {\n parent?: ICommand<any>;\n keyCommand?: string;\n name?: string;\n shortcuts?: string;\n groupName?: string;\n icon?: React.ReactElement;\n value?: T;\n position?: 'right';\n liProps?: React.LiHTMLAttributes<HTMLLIElement>;\n buttonProps?: React.ButtonHTMLAttributes<HTMLButtonElement> | null;\n render?: (\n command: ICommand<T>,\n disabled: boolean,\n executeCommand: (command: ICommand<T>, name?: string) => void,\n index: number,\n ) => void | undefined | null | React.ReactElement;\n execute?: (\n state: TextState,\n api: TextAreaTextApi,\n dispatch?: React.Dispatch<ContextStore>,\n executeCommandState?: ExecuteCommandState,\n ) => void;\n}\n\nexport type ICommand<T = string> = ICommandChildCommands<T> | ICommandChildHandle<T>;\n\nexport interface TextRange {\n start: number;\n end: number;\n}\n\nexport interface TextState {\n text: string;\n selectedText: string;\n selection: TextRange;\n}\n\nconst getCommands: () => ICommand[] = () => [\n bold,\n italic,\n strikethrough,\n hr,\n group([title1, title2, title3, title4, title5, title6], {\n name: 'title',\n groupName: 'title',\n buttonProps: { 'aria-label': 'Insert title', title: 'Insert title' },\n }),\n divider,\n link,\n quote,\n code,\n codeBlock,\n comment,\n image,\n divider,\n unorderedListCommand,\n orderedListCommand,\n checkedListCommand,\n];\n\nconst getExtraCommands: () => ICommand[] = () => [codeEdit, codeLive, codePreview, divider, fullscreen];\n\nfunction getStateFromTextArea(textArea: HTMLTextAreaElement): TextState {\n return {\n selection: {\n start: textArea.selectionStart,\n end: textArea.selectionEnd,\n },\n text: textArea.value,\n selectedText: textArea.value.slice(textArea.selectionStart, textArea.selectionEnd),\n };\n}\n\nclass TextAreaTextApi {\n textArea: HTMLTextAreaElement;\n\n constructor(textArea: HTMLTextAreaElement) {\n this.textArea = textArea;\n }\n\n /**\n * Replaces the current selection with the new text. This will make the new selectedText to be empty, the\n * selection start and selection end will be the same and will both point to the end\n * @param text Text that should replace the current selection\n */\n replaceSelection(text: string): TextState {\n insertTextAtPosition(this.textArea, text);\n return getStateFromTextArea(this.textArea);\n }\n\n /**\n * Selects the specified text range\n * @param selection\n */\n setSelectionRange(selection: TextRange): TextState {\n this.textArea.focus();\n this.textArea.selectionStart = selection.start;\n this.textArea.selectionEnd = selection.end;\n return getStateFromTextArea(this.textArea);\n }\n}\n\nclass TextAreaCommandOrchestrator implements CommandOrchestrator {\n textArea: HTMLTextAreaElement;\n textApi: TextAreaTextApi;\n\n constructor(textArea: HTMLTextAreaElement) {\n this.textArea = textArea;\n this.textApi = new TextAreaTextApi(textArea);\n }\n\n getState() {\n if (!this.textArea) return false;\n return getStateFromTextArea(this.textArea);\n }\n\n executeCommand(\n command: ICommand<string>,\n dispatch?: React.Dispatch<ContextStore>,\n state?: ExecuteCommandState,\n ): void {\n command.execute && command.execute(getStateFromTextArea(this.textArea), this.textApi, dispatch, state);\n }\n}\n\nexport {\n title,\n title1,\n title2,\n title3,\n title4,\n title5,\n title6,\n bold,\n codeBlock,\n italic,\n strikethrough,\n hr,\n group,\n divider,\n link,\n quote,\n code,\n image,\n unorderedListCommand,\n orderedListCommand,\n checkedListCommand,\n codeEdit,\n codeLive,\n codePreview,\n fullscreen,\n // Tool method.\n getCommands,\n getExtraCommands,\n getStateFromTextArea,\n TextAreaCommandOrchestrator,\n TextAreaTextApi,\n};\n"
61
+ "import React from 'react';\nimport { ContextStore, ExecuteCommandState } from '../Context';\nimport { insertTextAtPosition } from '../utils/InsertTextAtPosition';\nimport { bold } from './bold';\nimport { code, codeBlock } from './code';\nimport { comment } from './comment';\nimport { divider } from './divider';\nimport { fullscreen } from './fullscreen';\nimport { group } from './group';\nimport { hr } from './hr';\nimport { image } from './image';\nimport { italic } from './italic';\nimport { link } from './link';\nimport { checkedListCommand, orderedListCommand, unorderedListCommand } from './list';\nimport { codeEdit, codeLive, codePreview } from './preview';\nimport { quote } from './quote';\nimport { strikethrough } from './strikeThrough';\nimport { title } from './title';\nimport { title1 } from './title1';\nimport { title2 } from './title2';\nimport { title3 } from './title3';\nimport { title4 } from './title4';\nimport { title5 } from './title5';\nimport { title6 } from './title6';\n\nexport interface CommandOrchestrator {\n executeCommand(command: ICommand): void;\n}\n\nexport interface ICommandChildHandle<T = string> extends ICommandBase<T> {\n children?: (handle: {\n close: () => void;\n execute: () => void;\n getState?: TextAreaCommandOrchestrator['getState'];\n textApi?: TextAreaTextApi;\n }) => React.ReactElement;\n}\n\nexport interface ICommandChildCommands<T = string> extends ICommandBase<T> {\n children?: Array<ICommand<T>>;\n}\n\nexport interface ICommandBase<T> {\n parent?: ICommand<any>;\n keyCommand?: string;\n name?: string;\n shortcuts?: string;\n groupName?: string;\n icon?: React.ReactElement;\n value?: T;\n position?: 'right';\n liProps?: React.LiHTMLAttributes<HTMLLIElement>;\n buttonProps?: React.ButtonHTMLAttributes<HTMLButtonElement> | null;\n render?: (\n command: ICommand<T>,\n disabled: boolean,\n executeCommand: (command: ICommand<T>, name?: string) => void,\n index: number,\n ) => void | undefined | null | React.ReactElement;\n execute?: (\n state: TextState,\n api: TextAreaTextApi,\n dispatch?: React.Dispatch<ContextStore>,\n executeCommandState?: ExecuteCommandState,\n shortcuts?: string[],\n ) => void;\n}\n\nexport type ICommand<T = string> = ICommandChildCommands<T> | ICommandChildHandle<T>;\n\nexport interface TextRange {\n start: number;\n end: number;\n}\n\nexport interface TextState {\n text: string;\n selectedText: string;\n selection: TextRange;\n}\n\nconst getCommands: () => ICommand[] = () => [\n bold,\n italic,\n strikethrough,\n hr,\n group([title1, title2, title3, title4, title5, title6], {\n name: 'title',\n groupName: 'title',\n buttonProps: { 'aria-label': 'Insert title', title: 'Insert title' },\n }),\n divider,\n link,\n quote,\n code,\n codeBlock,\n comment,\n image,\n divider,\n unorderedListCommand,\n orderedListCommand,\n checkedListCommand,\n];\n\nconst getExtraCommands: () => ICommand[] = () => [codeEdit, codeLive, codePreview, divider, fullscreen];\n\nfunction getStateFromTextArea(textArea: HTMLTextAreaElement): TextState {\n return {\n selection: {\n start: textArea.selectionStart,\n end: textArea.selectionEnd,\n },\n text: textArea.value,\n selectedText: textArea.value.slice(textArea.selectionStart, textArea.selectionEnd),\n };\n}\n\nclass TextAreaTextApi {\n textArea: HTMLTextAreaElement;\n\n constructor(textArea: HTMLTextAreaElement) {\n this.textArea = textArea;\n }\n\n /**\n * Replaces the current selection with the new text. This will make the new selectedText to be empty, the\n * selection start and selection end will be the same and will both point to the end\n * @param text Text that should replace the current selection\n */\n replaceSelection(text: string): TextState {\n insertTextAtPosition(this.textArea, text);\n return getStateFromTextArea(this.textArea);\n }\n\n /**\n * Selects the specified text range\n * @param selection\n */\n setSelectionRange(selection: TextRange): TextState {\n this.textArea.focus();\n this.textArea.selectionStart = selection.start;\n this.textArea.selectionEnd = selection.end;\n return getStateFromTextArea(this.textArea);\n }\n}\n\nclass TextAreaCommandOrchestrator implements CommandOrchestrator {\n textArea: HTMLTextAreaElement;\n textApi: TextAreaTextApi;\n\n constructor(textArea: HTMLTextAreaElement) {\n this.textArea = textArea;\n this.textApi = new TextAreaTextApi(textArea);\n }\n\n getState() {\n if (!this.textArea) return false;\n return getStateFromTextArea(this.textArea);\n }\n\n executeCommand(\n command: ICommand<string>,\n dispatch?: React.Dispatch<ContextStore>,\n state?: ExecuteCommandState,\n shortcuts?: string[],\n ): void {\n command.execute && command.execute(getStateFromTextArea(this.textArea), this.textApi, dispatch, state, shortcuts);\n }\n}\n\nexport {\n title,\n title1,\n title2,\n title3,\n title4,\n title5,\n title6,\n bold,\n codeBlock,\n italic,\n strikethrough,\n hr,\n group,\n divider,\n link,\n quote,\n code,\n image,\n unorderedListCommand,\n orderedListCommand,\n checkedListCommand,\n codeEdit,\n codeLive,\n codePreview,\n fullscreen,\n // Tool method.\n getCommands,\n getExtraCommands,\n getStateFromTextArea,\n TextAreaCommandOrchestrator,\n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AEE,QAAQ,EAAEC,KAAK,EAAEC,SAAS,CAAC;IACnH;EAAC;EAAA;AAAA;AAAA"
63
64
  }
@@ -1,18 +1,13 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard")["default"];
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.italic = void 0;
9
-
10
8
  var React = _interopRequireWildcard(require("react"));
11
-
12
9
  var _markdownUtils = require("../utils/markdownUtils");
13
-
14
10
  var _jsxRuntime = require("react/jsx-runtime");
15
-
16
11
  var italic = {
17
12
  name: 'italic',
18
13
  keyCommand: 'italic',
@@ -39,10 +34,10 @@ var italic = {
39
34
  text: state.text,
40
35
  selection: state.selection
41
36
  });
42
- var state1 = api.setSelectionRange(newSelectionRange); // Replaces the current selection with the italic mark up
43
-
44
- var state2 = api.replaceSelection("*".concat(state1.selectedText, "*")); // Adjust the selection to not contain the *
45
-
37
+ var state1 = api.setSelectionRange(newSelectionRange);
38
+ // Replaces the current selection with the italic mark up
39
+ var state2 = api.replaceSelection("*".concat(state1.selectedText, "*"));
40
+ // Adjust the selection to not contain the *
46
41
  api.setSelectionRange({
47
42
  start: state2.selection.end - 1 - state1.selectedText.length,
48
43
  end: state2.selection.end - 1
@@ -31,5 +31,5 @@
31
31
  "sourcesContent": [
32
32
  "import * as React from 'react';\nimport { ICommand, TextState, TextAreaTextApi } from './';\nimport { selectWord } from '../utils/markdownUtils';\n\nexport const italic: ICommand = {\n name: 'italic',\n keyCommand: 'italic',\n shortcuts: 'ctrlcmd+i',\n value: '* *',\n buttonProps: { 'aria-label': 'Add italic text (ctrl + i)', title: 'Add italic text (ctrl + i)' },\n icon: (\n <svg data-name=\"italic\" width=\"12\" height=\"12\" role=\"img\" viewBox=\"0 0 320 512\">\n <path\n fill=\"currentColor\"\n d=\"M204.758 416h-33.849l62.092-320h40.725a16 16 0 0 0 15.704-12.937l6.242-32C297.599 41.184 290.034 32 279.968 32H120.235a16 16 0 0 0-15.704 12.937l-6.242 32C96.362 86.816 103.927 96 113.993 96h33.846l-62.09 320H46.278a16 16 0 0 0-15.704 12.935l-6.245 32C22.402 470.815 29.967 480 40.034 480h158.479a16 16 0 0 0 15.704-12.935l6.245-32c1.927-9.88-5.638-19.065-15.704-19.065z\"\n />\n </svg>\n ),\n execute: (state: TextState, api: TextAreaTextApi) => {\n // Adjust the selection to encompass the whole word if the caret is inside one\n const newSelectionRange = selectWord({ text: state.text, selection: state.selection });\n const state1 = api.setSelectionRange(newSelectionRange);\n // Replaces the current selection with the italic mark up\n const state2 = api.replaceSelection(`*${state1.selectedText}*`);\n // Adjust the selection to not contain the *\n api.setSelectionRange({\n start: state2.selection.end - 1 - state1.selectedText.length,\n end: state2.selection.end - 1,\n });\n },\n};\n"
33
33
  ],
34
- "mappings": ";;;;;;;;;AAAA;;AAEA;;;;AAEO,IAAMA,MAAgB,GAAG;EAC9BC,IAAI,EAAE,QADwB;EAE9BC,UAAU,EAAE,QAFkB;EAG9BC,SAAS,EAAE,WAHmB;EAI9BC,KAAK,EAAE,KAJuB;EAK9BC,WAAW,EAAE;IAAE,cAAc,4BAAhB;IAA8CC,KAAK,EAAE;EAArD,CALiB;EAM9BC,IAAI,eACF;IAAK,aAAU,QAAf;IAAwB,KAAK,EAAC,IAA9B;IAAmC,MAAM,EAAC,IAA1C;IAA+C,IAAI,EAAC,KAApD;IAA0D,OAAO,EAAC,aAAlE;IAAA,uBACE;MACE,IAAI,EAAC,cADP;MAEE,CAAC,EAAC;IAFJ;EADF,EAP4B;EAc9BC,OAAO,EAAE,iBAACC,KAAD,EAAmBC,GAAnB,EAA4C;IACnD;IACA,IAAMC,iBAAiB,GAAG,IAAAC,yBAAA,EAAW;MAAEC,IAAI,EAAEJ,KAAK,CAACI,IAAd;MAAoBC,SAAS,EAAEL,KAAK,CAACK;IAArC,CAAX,CAA1B;IACA,IAAMC,MAAM,GAAGL,GAAG,CAACM,iBAAJ,CAAsBL,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AM,CAACH,SAAS,CAACO,GAAG,GAAG,CAAC,GAAGN,MAAM,CAACI,YAAY,CAACG,MAAM;MAC5DD,GAAG,EAAEJ,MAAM,CAACH,SAAS,CAACO,GAAG,GAAG;IAC9B,CAAC,CAAC;EACJ;AACF,CAAC;AAAC"
35
35
  }
@@ -1,18 +1,13 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard")["default"];
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.link = void 0;
9
-
10
8
  var React = _interopRequireWildcard(require("react"));
11
-
12
9
  var _markdownUtils = require("../utils/markdownUtils");
13
-
14
10
  var _jsxRuntime = require("react/jsx-runtime");
15
-
16
11
  var link = {
17
12
  name: 'link',
18
13
  keyCommand: 'link',
@@ -39,10 +34,10 @@ var link = {
39
34
  text: state.text,
40
35
  selection: state.selection
41
36
  });
42
- var state1 = api.setSelectionRange(newSelectionRange); // Replaces the current selection with the bold mark up
43
-
44
- var state2 = api.replaceSelection("[".concat(state1.selectedText, "](url)")); // Adjust the selection to not contain the **
45
-
37
+ var state1 = api.setSelectionRange(newSelectionRange);
38
+ // Replaces the current selection with the bold mark up
39
+ var state2 = api.replaceSelection("[".concat(state1.selectedText, "](url)"));
40
+ // Adjust the selection to not contain the **
46
41
  api.setSelectionRange({
47
42
  start: state2.selection.end - 6 - state1.selectedText.length,
48
43
  end: state2.selection.end - 6
@@ -31,5 +31,5 @@
31
31
  "sourcesContent": [
32
32
  "import * as React from 'react';\nimport { ICommand, TextState, TextAreaTextApi } from './';\nimport { selectWord } from '../utils/markdownUtils';\n\nexport const link: ICommand = {\n name: 'link',\n keyCommand: 'link',\n shortcuts: 'ctrlcmd+l',\n value: '[](url)',\n buttonProps: { 'aria-label': 'Add a link (ctrl + l)', title: 'Add a link (ctrl + l)' },\n icon: (\n <svg data-name=\"italic\" width=\"12\" height=\"12\" role=\"img\" viewBox=\"0 0 520 520\">\n <path\n fill=\"currentColor\"\n d=\"M331.751196,182.121107 C392.438214,241.974735 391.605313,337.935283 332.11686,396.871226 C332.005129,396.991316 331.873084,397.121413 331.751196,397.241503 L263.493918,464.491645 C203.291404,523.80587 105.345257,523.797864 45.151885,464.491645 C-15.0506283,405.187427 -15.0506283,308.675467 45.151885,249.371249 L82.8416853,212.237562 C92.836501,202.39022 110.049118,208.9351 110.56511,222.851476 C111.223305,240.5867 114.451306,258.404985 120.407566,275.611815 C122.424812,281.438159 120.983487,287.882964 116.565047,292.23621 L103.272145,305.332975 C74.8052033,333.379887 73.9123737,379.047937 102.098973,407.369054 C130.563883,435.969378 177.350591,436.139505 206.033884,407.879434 L274.291163,340.6393 C302.9257,312.427264 302.805844,266.827265 274.291163,238.733318 C270.531934,235.036561 266.74528,232.16442 263.787465,230.157924 C259.544542,227.2873 256.928256,222.609848 256.731165,217.542518 C256.328935,206.967633 260.13184,196.070508 268.613213,187.714278 L289.998463,166.643567 C295.606326,161.118448 304.403592,160.439942 310.906317,164.911276 C318.353355,170.034591 325.328531,175.793397 331.751196,182.121107 Z M240.704978,55.4828366 L172.447607,122.733236 C172.325719,122.853326 172.193674,122.983423 172.081943,123.103513 C117.703294,179.334654 129.953294,261.569283 185.365841,328.828764 C191.044403,335.721376 198.762988,340.914712 206.209732,346.037661 C212.712465,350.509012 221.510759,349.829503 227.117615,344.305363 L248.502893,323.234572 C256.984277,314.87831 260.787188,303.981143 260.384957,293.406218 C260.187865,288.338869 257.571576,283.661398 253.328648,280.790763 C250.370829,278.78426 246.58417,275.912107 242.824936,272.215337 C214.310216,244.121282 206.209732,204.825874 229.906702,179.334654 L298.164073,112.094263 C326.847404,83.8340838 373.633159,84.0042113 402.099123,112.604645 C430.285761,140.92587 429.393946,186.594095 400.92595,214.641114 L387.63303,227.737929 C383.214584,232.091191 381.773257,238.536021 383.790506,244.362388 C389.746774,261.569283 392.974779,279.387637 393.632975,297.122928 C394.149984,311.039357 411.361608,317.584262 421.356437,307.736882 L459.046288,270.603053 C519.249898,211.29961 519.249898,114.787281 459.047304,55.4828366 C398.853851,-3.82360914 300.907572,-3.83161514 240.704978,55.4828366 Z\"\n />\n </svg>\n ),\n execute: (state: TextState, api: TextAreaTextApi) => {\n // Adjust the selection to encompass the whole word if the caret is inside one\n const newSelectionRange = selectWord({ text: state.text, selection: state.selection });\n const state1 = api.setSelectionRange(newSelectionRange);\n // Replaces the current selection with the bold mark up\n const state2 = api.replaceSelection(`[${state1.selectedText}](url)`);\n // Adjust the selection to not contain the **\n api.setSelectionRange({\n start: state2.selection.end - 6 - state1.selectedText.length,\n end: state2.selection.end - 6,\n });\n },\n};\n"
33
33
  ],
34
- "mappings": ";;;;;;;;;AAAA;;AAEA;;;;AAEO,IAAMA,IAAc,GAAG;EAC5BC,IAAI,EAAE,MADsB;EAE5BC,UAAU,EAAE,MAFgB;EAG5BC,SAAS,EAAE,WAHiB;EAI5BC,KAAK,EAAE,SAJqB;EAK5BC,WAAW,EAAE;IAAE,cAAc,uBAAhB;IAAyCC,KAAK,EAAE;EAAhD,CALe;EAM5BC,IAAI,eACF;IAAK,aAAU,QAAf;IAAwB,KAAK,EAAC,IAA9B;IAAmC,MAAM,EAAC,IAA1C;IAA+C,IAAI,EAAC,KAApD;IAA0D,OAAO,EAAC,aAAlE;IAAA,uBACE;MACE,IAAI,EAAC,cADP;MAEE,CAAC,EAAC;IAFJ;EADF,EAP0B;EAc5BC,OAAO,EAAE,iBAACC,KAAD,EAAmBC,GAAnB,EAA4C;IACnD;IACA,IAAMC,iBAAiB,GAAG,IAAAC,yBAAA,EAAW;MAAEC,IAAI,EAAEJ,KAAK,CAACI,IAAd;MAAoBC,SAAS,EAAEL,KAAK,CAACK;IAArC,CAAX,CAA1B;IACA,IAAMC,MAAM,GAAGL,GAAG,CAACM,iBAAJ,CAAsBL,iBAAtB,CAAf,CAHmD,CAInD;;IACA,IAAMM,MAAM,GAAGP,GAAG,CAACQ,gBAAJ,YAAyBH,MAAM,CAACI,YAAhC,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