@uiw/react-md-editor 3.20.4 → 3.20.5

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 (40) hide show
  1. package/dist/mdeditor.js +19 -20
  2. package/dist/mdeditor.min.js +1 -1
  3. package/esm/commands/bold.js +7 -5
  4. package/esm/commands/bold.js.map +7 -5
  5. package/esm/commands/hr.js +1 -1
  6. package/esm/commands/hr.js.map +4 -3
  7. package/esm/commands/image.js +10 -5
  8. package/esm/commands/image.js.map +6 -2
  9. package/esm/commands/index.d.ts +4 -1
  10. package/esm/commands/index.js +4 -1
  11. package/esm/commands/index.js.map +2 -2
  12. package/esm/commands/italic.js +9 -6
  13. package/esm/commands/italic.js.map +7 -5
  14. package/esm/commands/link.js +7 -4
  15. package/esm/commands/link.js.map +7 -5
  16. package/esm/commands/strikeThrough.js +9 -6
  17. package/esm/commands/strikeThrough.js.map +7 -5
  18. package/lib/commands/bold.js +7 -5
  19. package/lib/commands/bold.js.map +7 -5
  20. package/lib/commands/hr.js +1 -1
  21. package/lib/commands/hr.js.map +4 -3
  22. package/lib/commands/image.js +10 -5
  23. package/lib/commands/image.js.map +6 -2
  24. package/lib/commands/index.d.ts +4 -1
  25. package/lib/commands/index.js +4 -1
  26. package/lib/commands/index.js.map +2 -2
  27. package/lib/commands/italic.js +9 -6
  28. package/lib/commands/italic.js.map +7 -5
  29. package/lib/commands/link.js +7 -4
  30. package/lib/commands/link.js.map +7 -5
  31. package/lib/commands/strikeThrough.js +9 -6
  32. package/lib/commands/strikeThrough.js.map +7 -5
  33. package/package.json +1 -1
  34. package/src/commands/bold.tsx +9 -8
  35. package/src/commands/hr.tsx +3 -3
  36. package/src/commands/image.tsx +12 -9
  37. package/src/commands/index.ts +5 -2
  38. package/src/commands/italic.tsx +11 -10
  39. package/src/commands/link.tsx +8 -8
  40. package/src/commands/strikeThrough.tsx +11 -10
package/dist/mdeditor.js CHANGED
@@ -64535,10 +64535,10 @@ var end=text.length;// iterate to the left
64535
64535
  for(var i=position;i-1>-1;i--){if(isWordDelimiter(text[i-1])){start=i;break;}}// iterate to the right
64536
64536
  for(var _i=position;_i<text.length;_i++){if(isWordDelimiter(text[_i])){end=_i;break;}}return{start:start,end:end};}
64537
64537
  ;// CONCATENATED MODULE: ./src/commands/bold.tsx
64538
- var bold={name:'bold',keyCommand:'bold',shortcuts:'ctrlcmd+b',value:'**',buttonProps:{'aria-label':'Add bold text (ctrl + b)',title:'Add bold text (ctrl + b)'},icon:/*#__PURE__*/(0,jsx_runtime.jsx)("svg",{role:"img",width:"12",height:"12",viewBox:"0 0 384 512",children:/*#__PURE__*/(0,jsx_runtime.jsx)("path",{fill:"currentColor",d:"M304.793 243.891c33.639-18.537 53.657-54.16 53.657-95.693 0-48.236-26.25-87.626-68.626-104.179C265.138 34.01 240.849 32 209.661 32H24c-8.837 0-16 7.163-16 16v33.049c0 8.837 7.163 16 16 16h33.113v318.53H24c-8.837 0-16 7.163-16 16V464c0 8.837 7.163 16 16 16h195.69c24.203 0 44.834-1.289 66.866-7.584C337.52 457.193 376 410.647 376 350.014c0-52.168-26.573-91.684-71.207-106.123zM142.217 100.809h67.444c16.294 0 27.536 2.019 37.525 6.717 15.828 8.479 24.906 26.502 24.906 49.446 0 35.029-20.32 56.79-53.029 56.79h-76.846V100.809zm112.642 305.475c-10.14 4.056-22.677 4.907-31.409 4.907h-81.233V281.943h84.367c39.645 0 63.057 25.38 63.057 63.057.001 28.425-13.66 52.483-34.782 61.284z"})}),execute:function execute(state,api){var _state1$selectedText;// Adjust the selection to encompass the whole word if the caret is inside one
64538
+ var bold={name:'bold',keyCommand:'bold',shortcuts:'ctrlcmd+b',value:'**{{text}}**',buttonProps:{'aria-label':'Add bold text (ctrl + b)',title:'Add bold text (ctrl + b)'},icon:/*#__PURE__*/(0,jsx_runtime.jsx)("svg",{role:"img",width:"12",height:"12",viewBox:"0 0 384 512",children:/*#__PURE__*/(0,jsx_runtime.jsx)("path",{fill:"currentColor",d:"M304.793 243.891c33.639-18.537 53.657-54.16 53.657-95.693 0-48.236-26.25-87.626-68.626-104.179C265.138 34.01 240.849 32 209.661 32H24c-8.837 0-16 7.163-16 16v33.049c0 8.837 7.163 16 16 16h33.113v318.53H24c-8.837 0-16 7.163-16 16V464c0 8.837 7.163 16 16 16h195.69c24.203 0 44.834-1.289 66.866-7.584C337.52 457.193 376 410.647 376 350.014c0-52.168-26.573-91.684-71.207-106.123zM142.217 100.809h67.444c16.294 0 27.536 2.019 37.525 6.717 15.828 8.479 24.906 26.502 24.906 49.446 0 35.029-20.32 56.79-53.029 56.79h-76.846V100.809zm112.642 305.475c-10.14 4.056-22.677 4.907-31.409 4.907h-81.233V281.943h84.367c39.645 0 63.057 25.38 63.057 63.057.001 28.425-13.66 52.483-34.782 61.284z"})}),execute:function execute(state,api){// Adjust the selection to encompass the whole word if the caret is inside one
64539
64539
  var newSelectionRange=selectWord({text:state.text,selection:state.selection});var state1=api.setSelectionRange(newSelectionRange);// Replaces the current selection with the bold mark up
64540
- var state2=api.replaceSelection("**".concat(state1.selectedText,"**"));// Adjust the selection to not contain the **
64541
- api.setSelectionRange({start:state2.selection.end-2-((_state1$selectedText=state1.selectedText)===null||_state1$selectedText===void 0?void 0:_state1$selectedText.length),end:state2.selection.end-2});}};
64540
+ var val=state.command.value||'';api.replaceSelection(val.replace(/({{text}})/gi,state1.selectedText));var start=state1.selection.start+val.indexOf('{{text}}');var end=state1.selection.start+val.indexOf('{{text}}')+(state1.selection.end-state1.selection.start);// Adjust the selection to not contain the **
64541
+ api.setSelectionRange({start:start,end:end});}};
64542
64542
  ;// CONCATENATED MODULE: ./src/commands/code.tsx
64543
64543
  var code_code={name:'code',keyCommand:'code',shortcuts:'ctrlcmd+j',value:'``',buttonProps:{'aria-label':'Insert code (ctrl + j)',title:'Insert code (ctrl + j)'},icon:/*#__PURE__*/(0,jsx_runtime.jsx)("svg",{width:"14",height:"14",role:"img",viewBox:"0 0 640 512",children:/*#__PURE__*/(0,jsx_runtime.jsx)("path",{fill:"currentColor",d:"M278.9 511.5l-61-17.7c-6.4-1.8-10-8.5-8.2-14.9L346.2 8.7c1.8-6.4 8.5-10 14.9-8.2l61 17.7c6.4 1.8 10 8.5 8.2 14.9L293.8 503.3c-1.9 6.4-8.5 10.1-14.9 8.2zm-114-112.2l43.5-46.4c4.6-4.9 4.3-12.7-.8-17.2L117 256l90.6-79.7c5.1-4.5 5.5-12.3.8-17.2l-43.5-46.4c-4.5-4.8-12.1-5.1-17-.5L3.8 247.2c-5.1 4.7-5.1 12.8 0 17.5l144.1 135.1c4.9 4.6 12.5 4.4 17-.5zm327.2.6l144.1-135.1c5.1-4.7 5.1-12.8 0-17.5L492.1 112.1c-4.8-4.5-12.4-4.3-17 .5L431.6 159c-4.6 4.9-4.3 12.7.8 17.2L523 256l-90.6 79.7c-5.1 4.5-5.5 12.3-.8 17.2l43.5 46.4c4.5 4.9 12.1 5.1 17 .6z"})}),execute:function execute(tate,api){// Adjust the selection to encompass the whole word if the caret is inside one
64544
64544
  var newSelectionRange=selectWord({text:tate.text,selection:tate.selection});var state1=api.setSelectionRange(newSelectionRange);// when there's no breaking line
@@ -64561,22 +64561,21 @@ function _objectDestructuringEmpty(obj) {
64561
64561
  ;// CONCATENATED MODULE: ./src/commands/group.tsx
64562
64562
  var group=function group(arr,options){var data=_objectSpread2(_objectSpread2({children:arr,icon:/*#__PURE__*/(0,jsx_runtime.jsx)("svg",{width:"12",height:"12",viewBox:"0 0 520 520",children:/*#__PURE__*/(0,jsx_runtime.jsx)("path",{fill:"currentColor",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"})}),execute:function execute(){}},options),{},{keyCommand:'group'});if(Array.isArray(data.children)){data.children=data.children.map(function(_ref){var item=Object.assign({},(_objectDestructuringEmpty(_ref),_ref));item.parent=data;return _objectSpread2({},item);});}return data;};
64563
64563
  ;// CONCATENATED MODULE: ./src/commands/hr.tsx
64564
- var hr={name:'hr',keyCommand:'hr',shortcuts:'ctrlcmd+h',value:'----------',buttonProps:{'aria-label':'Insert HR (ctrl + h)',title:'Insert HR (ctrl + h)'},icon:/*#__PURE__*/(0,jsx_runtime.jsx)("svg",{width:"12",height:"12",viewBox:"0 0 175 175",children:/*#__PURE__*/(0,jsx_runtime.jsx)("path",{fill:"currentColor",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",transform:"translate(0 9)"})}),execute:function execute(state,api){api.replaceSelection("".concat(state.selectedText,"\n\n----------\n\n"));}};
64564
+ var hr={name:'hr',keyCommand:'hr',shortcuts:'ctrlcmd+h',value:'----------',buttonProps:{'aria-label':'Insert HR (ctrl + h)',title:'Insert HR (ctrl + h)'},icon:/*#__PURE__*/(0,jsx_runtime.jsx)("svg",{width:"12",height:"12",viewBox:"0 0 175 175",children:/*#__PURE__*/(0,jsx_runtime.jsx)("path",{fill:"currentColor",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",transform:"translate(0 9)"})}),execute:function execute(state,api){api.replaceSelection("".concat(state.selectedText,"\n\n").concat(state.command.value||'',"-\n\n"));}};
64565
64565
  ;// CONCATENATED MODULE: ./src/commands/image.tsx
64566
- var commands_image_image={name:'image',keyCommand:'image',shortcuts:'ctrlcmd+k',value:'![image]()',buttonProps:{'aria-label':'Add image (ctrl + k)',title:'Add image (ctrl + k)'},icon:/*#__PURE__*/(0,jsx_runtime.jsx)("svg",{width:"13",height:"13",viewBox:"0 0 20 20",children:/*#__PURE__*/(0,jsx_runtime.jsx)("path",{fill:"currentColor",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"})}),execute:function execute(state,api){// Select everything
64566
+ var commands_image_image={name:'image',keyCommand:'image',shortcuts:'ctrlcmd+k',value:'![image]({{text}})',buttonProps:{'aria-label':'Add image (ctrl + k)',title:'Add image (ctrl + k)'},icon:/*#__PURE__*/(0,jsx_runtime.jsx)("svg",{width:"13",height:"13",viewBox:"0 0 20 20",children:/*#__PURE__*/(0,jsx_runtime.jsx)("path",{fill:"currentColor",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"})}),execute:function execute(state,api){// Select everything
64567
64567
  var newSelectionRange=selectWord({text:state.text,selection:state.selection});var state1=api.setSelectionRange(newSelectionRange);// Replaces the current selection with the image
64568
- var imageTemplate=state1.selectedText||'https://example.com/your-image.png';api.replaceSelection("![](".concat(imageTemplate,")"));// Adjust the selection to not contain the **
64569
- api.setSelectionRange({start:4+state1.selection.start,end:4+state1.selection.start+imageTemplate.length});}};
64568
+ var imageTemplate=state1.selectedText||'https://example.com/your-image.png';var val=state.command.value||'';api.replaceSelection(val.replace(/({{text}})/gi,imageTemplate));var start=state1.selection.start+val.indexOf('{{text}}');var end=state1.selection.start+val.indexOf('{{text}}')+(state1.selection.end-state1.selection.start);if(!state1.selectedText){end=end+imageTemplate.length;}api.setSelectionRange({start:start,end:end});}};
64570
64569
  ;// CONCATENATED MODULE: ./src/commands/italic.tsx
64571
- var italic={name:'italic',keyCommand:'italic',shortcuts:'ctrlcmd+i',value:'* *',buttonProps:{'aria-label':'Add italic text (ctrl + i)',title:'Add italic text (ctrl + i)'},icon:/*#__PURE__*/(0,jsx_runtime.jsx)("svg",{"data-name":"italic",width:"12",height:"12",role:"img",viewBox:"0 0 320 512",children:/*#__PURE__*/(0,jsx_runtime.jsx)("path",{fill:"currentColor",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"})}),execute:function execute(state,api){// Adjust the selection to encompass the whole word if the caret is inside one
64572
- var newSelectionRange=selectWord({text:state.text,selection:state.selection});var state1=api.setSelectionRange(newSelectionRange);// Replaces the current selection with the italic mark up
64573
- var state2=api.replaceSelection("*".concat(state1.selectedText,"*"));// Adjust the selection to not contain the *
64574
- api.setSelectionRange({start:state2.selection.end-1-state1.selectedText.length,end:state2.selection.end-1});}};
64575
- ;// CONCATENATED MODULE: ./src/commands/link.tsx
64576
- var commands_link_link={name:'link',keyCommand:'link',shortcuts:'ctrlcmd+l',value:'[](url)',buttonProps:{'aria-label':'Add a link (ctrl + l)',title:'Add a link (ctrl + l)'},icon:/*#__PURE__*/(0,jsx_runtime.jsx)("svg",{"data-name":"italic",width:"12",height:"12",role:"img",viewBox:"0 0 520 520",children:/*#__PURE__*/(0,jsx_runtime.jsx)("path",{fill:"currentColor",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"})}),execute:function execute(state,api){// Adjust the selection to encompass the whole word if the caret is inside one
64570
+ var italic={name:'italic',keyCommand:'italic',shortcuts:'ctrlcmd+i',value:'*{{text}}*',buttonProps:{'aria-label':'Add italic text (ctrl + i)',title:'Add italic text (ctrl + i)'},icon:/*#__PURE__*/(0,jsx_runtime.jsx)("svg",{"data-name":"italic",width:"12",height:"12",role:"img",viewBox:"0 0 320 512",children:/*#__PURE__*/(0,jsx_runtime.jsx)("path",{fill:"currentColor",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"})}),execute:function execute(state,api){// Adjust the selection to encompass the whole word if the caret is inside one
64577
64571
  var newSelectionRange=selectWord({text:state.text,selection:state.selection});var state1=api.setSelectionRange(newSelectionRange);// Replaces the current selection with the bold mark up
64578
- var state2=api.replaceSelection("[".concat(state1.selectedText,"](url)"));// Adjust the selection to not contain the **
64579
- api.setSelectionRange({start:state2.selection.end-6-state1.selectedText.length,end:state2.selection.end-6});}};
64572
+ var val=state.command.value||'';api.replaceSelection(val.replace(/({{text}})/gi,state1.selectedText));var start=state1.selection.start+val.indexOf('{{text}}');var end=state1.selection.start+val.indexOf('{{text}}')+(state1.selection.end-state1.selection.start);// Adjust the selection to not contain the **
64573
+ api.setSelectionRange({start:start,end:end});}};
64574
+ ;// CONCATENATED MODULE: ./src/commands/link.tsx
64575
+ var commands_link_link={name:'link',keyCommand:'link',shortcuts:'ctrlcmd+l',value:'[{{text}}](URL Here)',buttonProps:{'aria-label':'Add a link (ctrl + l)',title:'Add a link (ctrl + l)'},icon:/*#__PURE__*/(0,jsx_runtime.jsx)("svg",{"data-name":"italic",width:"12",height:"12",role:"img",viewBox:"0 0 520 520",children:/*#__PURE__*/(0,jsx_runtime.jsx)("path",{fill:"currentColor",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"})}),execute:function execute(state,api){// Adjust the selection to encompass the whole word if the caret is inside one
64576
+ var newSelectionRange=selectWord({text:state.text,selection:state.selection});var state1=api.setSelectionRange(newSelectionRange);var val=state.command.value||'';// Replaces the current selection with the bold mark up
64577
+ api.replaceSelection(val.replace(/({{text}})/gi,state1.selectedText));var start=state1.selection.start+val.indexOf('{{text}}');var end=state1.selection.start+val.indexOf('{{text}}')+(state1.selection.end-state1.selection.start);// Adjust the selection to not contain the **
64578
+ api.setSelectionRange({start:start,end:end});}};
64580
64579
  ;// CONCATENATED MODULE: ./src/commands/list.tsx
64581
64580
  /**
64582
64581
  * Inserts insertionString before each line
@@ -64591,10 +64590,10 @@ var quote={name:'quote',keyCommand:'quote',shortcuts:'ctrlcmd+q',buttonProps:{'a
64591
64590
  var newSelectionRange=selectWord({text:state.text,selection:state.selection});var state1=api.setSelectionRange(newSelectionRange);var breaksBeforeCount=getBreaksNeededForEmptyLineBefore(state1.text,state1.selection.start);var breaksBefore=Array(breaksBeforeCount+1).join('\n');var breaksAfterCount=getBreaksNeededForEmptyLineAfter(state1.text,state1.selection.end);var breaksAfter=Array(breaksAfterCount+1).join('\n');// Replaces the current selection with the quote mark up
64592
64591
  api.replaceSelection("".concat(breaksBefore,"> ").concat(state1.selectedText).concat(breaksAfter));var selectionStart=state1.selection.start+breaksBeforeCount+2;var selectionEnd=selectionStart+state1.selectedText.length;api.setSelectionRange({start:selectionStart,end:selectionEnd});}};
64593
64592
  ;// CONCATENATED MODULE: ./src/commands/strikeThrough.tsx
64594
- var strikeThrough_strikethrough={name:'strikethrough',keyCommand:'strikethrough',shortcuts:'ctrl+shift+x',buttonProps:{'aria-label':'Add strikethrough text (ctrl + shift + x)',title:'Add strikethrough text (ctrl + shift + x)'},value:'~~',icon:/*#__PURE__*/(0,jsx_runtime.jsx)("svg",{"data-name":"strikethrough",width:"12",height:"12",role:"img",viewBox:"0 0 512 512",children:/*#__PURE__*/(0,jsx_runtime.jsx)("path",{fill:"currentColor",d:"M496 288H16c-8.837 0-16-7.163-16-16v-32c0-8.837 7.163-16 16-16h480c8.837 0 16 7.163 16 16v32c0 8.837-7.163 16-16 16zm-214.666 16c27.258 12.937 46.524 28.683 46.524 56.243 0 33.108-28.977 53.676-75.621 53.676-32.325 0-76.874-12.08-76.874-44.271V368c0-8.837-7.164-16-16-16H113.75c-8.836 0-16 7.163-16 16v19.204c0 66.845 77.717 101.82 154.487 101.82 88.578 0 162.013-45.438 162.013-134.424 0-19.815-3.618-36.417-10.143-50.6H281.334zm-30.952-96c-32.422-13.505-56.836-28.946-56.836-59.683 0-33.92 30.901-47.406 64.962-47.406 42.647 0 64.962 16.593 64.962 32.985V136c0 8.837 7.164 16 16 16h45.613c8.836 0 16-7.163 16-16v-30.318c0-52.438-71.725-79.875-142.575-79.875-85.203 0-150.726 40.972-150.726 125.646 0 22.71 4.665 41.176 12.777 56.547h129.823z"})}),execute:function execute(state,api){// Adjust the selection to encompass the whole word if the caret is inside one
64595
- var newSelectionRange=selectWord({text:state.text,selection:state.selection});var state1=api.setSelectionRange(newSelectionRange);// Replaces the current selection with the strikethrough mark up
64596
- var state2=api.replaceSelection("~~".concat(state1.selectedText,"~~"));// Adjust the selection to not contain the ~~
64597
- api.setSelectionRange({start:state2.selection.end-2-state1.selectedText.length,end:state2.selection.end-2});}};
64593
+ var strikeThrough_strikethrough={name:'strikethrough',keyCommand:'strikethrough',shortcuts:'ctrl+shift+x',buttonProps:{'aria-label':'Add strikethrough text (ctrl + shift + x)',title:'Add strikethrough text (ctrl + shift + x)'},value:'~~{{text}}~~',icon:/*#__PURE__*/(0,jsx_runtime.jsx)("svg",{"data-name":"strikethrough",width:"12",height:"12",role:"img",viewBox:"0 0 512 512",children:/*#__PURE__*/(0,jsx_runtime.jsx)("path",{fill:"currentColor",d:"M496 288H16c-8.837 0-16-7.163-16-16v-32c0-8.837 7.163-16 16-16h480c8.837 0 16 7.163 16 16v32c0 8.837-7.163 16-16 16zm-214.666 16c27.258 12.937 46.524 28.683 46.524 56.243 0 33.108-28.977 53.676-75.621 53.676-32.325 0-76.874-12.08-76.874-44.271V368c0-8.837-7.164-16-16-16H113.75c-8.836 0-16 7.163-16 16v19.204c0 66.845 77.717 101.82 154.487 101.82 88.578 0 162.013-45.438 162.013-134.424 0-19.815-3.618-36.417-10.143-50.6H281.334zm-30.952-96c-32.422-13.505-56.836-28.946-56.836-59.683 0-33.92 30.901-47.406 64.962-47.406 42.647 0 64.962 16.593 64.962 32.985V136c0 8.837 7.164 16 16 16h45.613c8.836 0 16-7.163 16-16v-30.318c0-52.438-71.725-79.875-142.575-79.875-85.203 0-150.726 40.972-150.726 125.646 0 22.71 4.665 41.176 12.777 56.547h129.823z"})}),execute:function execute(state,api){// Adjust the selection to encompass the whole word if the caret is inside one
64594
+ var newSelectionRange=selectWord({text:state.text,selection:state.selection});var state1=api.setSelectionRange(newSelectionRange);// Replaces the current selection with the bold mark up
64595
+ var val=state.command.value||'';api.replaceSelection(val.replace(/({{text}})/gi,state1.selectedText));var start=state1.selection.start+val.indexOf('{{text}}');var end=state1.selection.start+val.indexOf('{{text}}')+(state1.selection.end-state1.selection.start);// Adjust the selection to not contain the **
64596
+ api.setSelectionRange({start:start,end:end});}};
64598
64597
  ;// CONCATENATED MODULE: ./src/commands/title1.tsx
64599
64598
  var title1={name:'title1',keyCommand:'title1',shortcuts:'ctrlcmd+1',value:'title1',buttonProps:{'aria-label':'Insert title1 (ctrl + 1)',title:'Insert title1 (ctrl + 1)'},icon:/*#__PURE__*/(0,jsx_runtime.jsx)("div",{style:{fontSize:18,textAlign:'left'},children:"Title 1"}),execute:function execute(state,api){if(state.selection.start===0||/\n$/.test(state.text)){api.replaceSelection('# ');}else{insertAtLineStart('# ',state.selection.start,api.textArea);}}};
64600
64599
  ;// CONCATENATED MODULE: ./src/commands/title.tsx
@@ -64617,7 +64616,7 @@ var commands_getCommands=function getCommands(){return[bold,italic,strikeThrough
64617
64616
  */_createClass(TextAreaTextApi,[{key:"replaceSelection",value:function replaceSelection(text){insertTextAtPosition(this.textArea,text);return getStateFromTextArea(this.textArea);}/**
64618
64617
  * Selects the specified text range
64619
64618
  * @param selection
64620
- */},{key:"setSelectionRange",value:function setSelectionRange(selection){this.textArea.focus();this.textArea.selectionStart=selection.start;this.textArea.selectionEnd=selection.end;return getStateFromTextArea(this.textArea);}}]);return TextAreaTextApi;}();var TextAreaCommandOrchestrator=/*#__PURE__*/function(){function TextAreaCommandOrchestrator(textArea){_classCallCheck(this,TextAreaCommandOrchestrator);this.textArea=void 0;this.textApi=void 0;this.textArea=textArea;this.textApi=new TextAreaTextApi(textArea);}_createClass(TextAreaCommandOrchestrator,[{key:"getState",value:function getState(){if(!this.textArea)return false;return getStateFromTextArea(this.textArea);}},{key:"executeCommand",value:function executeCommand(command,dispatch,state,shortcuts){command.execute&&command.execute(getStateFromTextArea(this.textArea),this.textApi,dispatch,state,shortcuts);}}]);return TextAreaCommandOrchestrator;}();
64619
+ */},{key:"setSelectionRange",value:function setSelectionRange(selection){this.textArea.focus();this.textArea.selectionStart=selection.start;this.textArea.selectionEnd=selection.end;return getStateFromTextArea(this.textArea);}}]);return TextAreaTextApi;}();var TextAreaCommandOrchestrator=/*#__PURE__*/function(){function TextAreaCommandOrchestrator(textArea){_classCallCheck(this,TextAreaCommandOrchestrator);this.textArea=void 0;this.textApi=void 0;this.textArea=textArea;this.textApi=new TextAreaTextApi(textArea);}_createClass(TextAreaCommandOrchestrator,[{key:"getState",value:function getState(){if(!this.textArea)return false;return getStateFromTextArea(this.textArea);}},{key:"executeCommand",value:function executeCommand(command,dispatch,state,shortcuts){command.execute&&command.execute(_objectSpread2({command:command},getStateFromTextArea(this.textArea)),this.textApi,dispatch,state,shortcuts);}}]);return TextAreaCommandOrchestrator;}();
64621
64620
  ;// CONCATENATED MODULE: ./src/components/TextArea/handleKeyDown.tsx
64622
64621
  /**
64623
64622
  * - `13` - `Enter`