@uiw/react-md-editor 3.24.0 → 3.24.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.
- package/README.md +3 -3
- package/dist/mdeditor.js +10 -1
- package/dist/mdeditor.min.js +1 -1
- package/esm/commands/index.d.ts +4 -1
- package/esm/commands/index.js +2 -1
- package/esm/components/TextArea/handleKeyDown.js +1 -3
- package/lib/commands/index.d.ts +4 -1
- package/lib/commands/index.js +19 -0
- package/lib/components/TextArea/handleKeyDown.js +1 -3
- package/package.json +1 -1
- package/src/commands/index.ts +4 -0
- package/src/components/TextArea/handleKeyDown.tsx +5 -3
package/README.md
CHANGED
|
@@ -846,6 +846,9 @@ As always, thanks to our amazing contributors!
|
|
|
846
846
|
<a href="https://github.com/alphacoma18" title="Alpha Romer Coma">
|
|
847
847
|
<img src="https://avatars.githubusercontent.com/u/108984668?v=4" width="42;" alt="Alpha Romer Coma"/>
|
|
848
848
|
</a>
|
|
849
|
+
<a href="https://github.com/RARgames" title="RAR">
|
|
850
|
+
<img src="https://avatars.githubusercontent.com/u/13639766?v=4" width="42;" alt="RAR"/>
|
|
851
|
+
</a>
|
|
849
852
|
<a href="https://github.com/Exmirai" title="UniqueUlysees">
|
|
850
853
|
<img src="https://avatars.githubusercontent.com/u/6436703?v=4" width="42;" alt="UniqueUlysees"/>
|
|
851
854
|
</a>
|
|
@@ -882,9 +885,6 @@ As always, thanks to our amazing contributors!
|
|
|
882
885
|
<a href="https://github.com/phillipb" title="Phillip Burch">
|
|
883
886
|
<img src="https://avatars.githubusercontent.com/u/1482089?v=4" width="42;" alt="Phillip Burch"/>
|
|
884
887
|
</a>
|
|
885
|
-
<a href="https://github.com/RARgames" title="RAR">
|
|
886
|
-
<img src="https://avatars.githubusercontent.com/u/13639766?v=4" width="42;" alt="RAR"/>
|
|
887
|
-
</a>
|
|
888
888
|
<a href="https://github.com/toresbe" title="Tore Sinding Bekkedal">
|
|
889
889
|
<img src="https://avatars.githubusercontent.com/u/1761606?v=4" width="42;" alt="Tore Sinding Bekkedal"/>
|
|
890
890
|
</a>
|
package/dist/mdeditor.js
CHANGED
|
@@ -17389,10 +17389,12 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
17389
17389
|
getStateFromTextArea: () => (/* reexport */ getStateFromTextArea),
|
|
17390
17390
|
getSurroundingWord: () => (/* reexport */ getSurroundingWord),
|
|
17391
17391
|
group: () => (/* reexport */ group),
|
|
17392
|
+
help: () => (/* reexport */ help),
|
|
17392
17393
|
hr: () => (/* reexport */ hr),
|
|
17393
17394
|
image: () => (/* reexport */ commands_image_image),
|
|
17394
17395
|
insertBeforeEachLine: () => (/* reexport */ insertBeforeEachLine),
|
|
17395
17396
|
insertTextAtPosition: () => (/* reexport */ insertTextAtPosition),
|
|
17397
|
+
issue: () => (/* reexport */ issue),
|
|
17396
17398
|
italic: () => (/* reexport */ italic),
|
|
17397
17399
|
link: () => (/* reexport */ commands_link_link),
|
|
17398
17400
|
orderedListCommand: () => (/* reexport */ orderedListCommand),
|
|
@@ -17401,6 +17403,7 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
17401
17403
|
selectLine: () => (/* reexport */ selectLine),
|
|
17402
17404
|
selectWord: () => (/* reexport */ selectWord),
|
|
17403
17405
|
strikethrough: () => (/* reexport */ strikeThrough_strikethrough),
|
|
17406
|
+
table: () => (/* reexport */ table_table),
|
|
17404
17407
|
title: () => (/* reexport */ title),
|
|
17405
17408
|
title1: () => (/* reexport */ title1),
|
|
17406
17409
|
title2: () => (/* reexport */ title2),
|
|
@@ -17472,13 +17475,16 @@ __webpack_require__.d(commands_namespaceObject, {
|
|
|
17472
17475
|
getExtraCommands: () => (getExtraCommands),
|
|
17473
17476
|
getStateFromTextArea: () => (getStateFromTextArea),
|
|
17474
17477
|
group: () => (group),
|
|
17478
|
+
help: () => (help),
|
|
17475
17479
|
hr: () => (hr),
|
|
17476
17480
|
image: () => (commands_image_image),
|
|
17481
|
+
issue: () => (issue),
|
|
17477
17482
|
italic: () => (italic),
|
|
17478
17483
|
link: () => (commands_link_link),
|
|
17479
17484
|
orderedListCommand: () => (orderedListCommand),
|
|
17480
17485
|
quote: () => (quote),
|
|
17481
17486
|
strikethrough: () => (strikeThrough_strikethrough),
|
|
17487
|
+
table: () => (table_table),
|
|
17482
17488
|
title: () => (title),
|
|
17483
17489
|
title1: () => (title1),
|
|
17484
17490
|
title2: () => (title2),
|
|
@@ -75989,6 +75995,9 @@ var table_table={name:'table',keyCommand:'table',prefix:'\n| Header | Header |\n
|
|
|
75989
75995
|
})}),execute:function execute(state,api){var newSelectionRange=selectWord({text:state.text,selection:state.selection,prefix:state.command.prefix,suffix:state.command.suffix});var state1=api.setSelectionRange(newSelectionRange);if(state1.selectedText.length>=state.command.prefix.length+state.command.suffix.length&&state1.selectedText.startsWith(state.command.prefix)){// Remove
|
|
75990
75996
|
executeCommand({api:api,selectedText:state1.selectedText,selection:state.selection,prefix:state.command.prefix,suffix:state.command.suffix});}else{// Add
|
|
75991
75997
|
state1=api.setSelectionRange({start:state.selection.start,end:state.selection.start});executeCommand({api:api,selectedText:state1.selectedText,selection:state.selection,prefix:state.command.prefix,suffix:state.command.suffix});}}};
|
|
75998
|
+
;// CONCATENATED MODULE: ./src/commands/issue.tsx
|
|
75999
|
+
var issue={name:'issue',keyCommand:'issue',prefix:'#',suffix:'',buttonProps:{'aria-label':'Add issue',title:'Add issue'},icon:/*#__PURE__*/(0,jsx_runtime.jsx)("svg",{role:"img",width:"12",height:"12",viewBox:"0 0 448 512",children:/*#__PURE__*/(0,jsx_runtime.jsx)("path",{fill:"currentColor",d:"M181.3 32.4c17.4 2.9 29.2 19.4 26.3 36.8L197.8 128h95.1l11.5-69.3c2.9-17.4 19.4-29.2 36.8-26.3s29.2 19.4 26.3 36.8L357.8 128H416c17.7 0 32 14.3 32 32s-14.3 32-32 32H347.1L325.8 320H384c17.7 0 32 14.3 32 32s-14.3 32-32 32H315.1l-11.5 69.3c-2.9 17.4-19.4 29.2-36.826.3s-29.2-19.4-26.3-36.8l9.8-58.7H155.1l-11.5 69.3c-2.9 17.4-19.4 29.2-36.8 26.3s-29.2-19.4-26.3-36.8L90.2 384H32c-17.7 0-32-14.3-32-32s14.3-32 32-32h68.9l21.3-128H64c-17.7 0-32-14.3-32-32s14.3-32 32-32h68.9l11.5-69.3c2.9-17.4 19.4-29.2 36.8-26.3zM187.1 192L165.8320h95.1l21.3-128H187.1z"//Font Awesome Free 6.4.2 by @fontawesome - https://fontawesome.com
|
|
76000
|
+
})}),execute:function execute(state,api){var newSelectionRange=selectWord({text:state.text,selection:state.selection,prefix:state.command.prefix,suffix:state.command.suffix});var state1=api.setSelectionRange(newSelectionRange);executeCommand({api:api,selectedText:state1.selectedText,selection:state.selection,prefix:state.command.prefix,suffix:state.command.suffix});}};
|
|
75992
76001
|
;// CONCATENATED MODULE: ./src/commands/help.tsx
|
|
75993
76002
|
var help={name:'help',keyCommand:'help',buttonProps:{'aria-label':'Open help',title:'Open help'},icon:/*#__PURE__*/(0,jsx_runtime.jsx)("svg",{viewBox:"0 0 16 16",width:"12px",height:"12px",children:/*#__PURE__*/(0,jsx_runtime.jsx)("path",{d:"M8 0C3.6 0 0 3.6 0 8s3.6 8 8 8 8-3.6 8-8-3.6-8-8-8Zm.9 13H7v-1.8h1.9V13Zm-.1-3.6v.5H7.1v-.6c.2-2.1 2-1.9 1.9-3.2.1-.7-.3-1.1-1-1.1-.8 0-1.2.7-1.2 1.6H5c0-1.7 1.2-3 2.9-3 2.3 0 3 1.4 3 2.3.1 2.3-1.9 2-2.1 3.5Z",fill:"currentColor"})}),execute:function execute(){window.open('https://www.markdownguide.org/basic-syntax/','_blank','noreferrer');}};
|
|
75994
76003
|
;// CONCATENATED MODULE: ./src/commands/index.ts
|
|
@@ -76008,7 +76017,7 @@ var commands_getCommands=function getCommands(){return[bold,italic,strikeThrough
|
|
|
76008
76017
|
* `9` - `Tab`
|
|
76009
76018
|
*/if(!defaultTabEnable&&e.code&&e.code.toLowerCase()==='tab'){stopPropagation(e);var space=new Array(tabSize+1).join(' ');if(target.selectionStart!==target.selectionEnd){var _star=target.value.substring(0,target.selectionStart).split('\n');var _end=target.value.substring(0,target.selectionEnd).split('\n');var modifiedTextLine=[];_end.forEach(function(item,idx){if(item!==_star[idx]){modifiedTextLine.push(item);}});var modifiedText=modifiedTextLine.join('\n');var oldSelectText=target.value.substring(target.selectionStart,target.selectionEnd);var newStarNum=target.value.substring(0,target.selectionStart).length;textArea.setSelectionRange({start:target.value.indexOf(modifiedText),end:target.selectionEnd});var modifiedTextObj=insertBeforeEachLine(modifiedText,e.shiftKey?'':space);var text=modifiedTextObj.modifiedText;if(e.shiftKey){text=text.split('\n').map(function(item){return item.replace(new RegExp("^".concat(space)),'');}).join('\n');}textArea.replaceSelection(text);var startTabSize=e.shiftKey?-tabSize:tabSize;var endTabSize=e.shiftKey?-modifiedTextLine.length*tabSize:modifiedTextLine.length*tabSize;textArea.setSelectionRange({start:newStarNum+startTabSize,end:newStarNum+oldSelectText.length+endTabSize});}else{return insertTextAtPosition(target,space);}}else if(e.keyCode===13&&e.code.toLowerCase()==='enter'&&(/^(-|\*)\s/.test(currentLineStr)||/^\d+.\s/.test(currentLineStr))&&!e.shiftKey){/**
|
|
76010
76019
|
* `13` - `Enter`
|
|
76011
|
-
*/stopPropagation(e);var startStr='\n- ';if(currentLineStr.startsWith('*')){startStr='\n* ';}if(currentLineStr.startsWith('- [ ]')
|
|
76020
|
+
*/stopPropagation(e);var startStr='\n- ';if(currentLineStr.startsWith('*')){startStr='\n* ';}if(currentLineStr.startsWith('- [ ]')||currentLineStr.startsWith('- [X]')||currentLineStr.startsWith('- [x]')){startStr='\n- [ ] ';}if(/^\d+.\s/.test(currentLineStr)){startStr="\n".concat(parseInt(currentLineStr)+1,". ");}return insertTextAtPosition(target,startStr);}else if(e.code&&e.code.toLowerCase()==='keyd'&&e.ctrlKey){// Duplicate lines
|
|
76012
76021
|
stopPropagation(e);var selection={start:target.selectionStart,end:target.selectionEnd};var savedSelection=selection;selection=selectLine({text:target.value,selection:selection});var textToDuplicate=target.value.slice(selection.start,selection.end);textArea.setSelectionRange({start:selection.end,end:selection.end});insertTextAtPosition(target,"\n".concat(textToDuplicate));textArea.setSelectionRange({start:savedSelection.start,end:savedSelection.end});}else if(e.code&&e.code.toLowerCase()==='arrowup'&&e.altKey){handleLineMove(e,-1);}else if(e.code&&e.code.toLowerCase()==='arrowdown'&&e.altKey){handleLineMove(e,1);}}
|
|
76013
76022
|
;// CONCATENATED MODULE: ./src/components/TextArea/index.less
|
|
76014
76023
|
// extracted by mini-css-extract-plugin
|