@uiw/react-md-editor 3.18.2 → 3.18.3

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.
@@ -1,4 +1,6 @@
1
1
  import { selectWord } from '../utils/markdownUtils';
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import { jsxs as _jsxs } from "react/jsx-runtime";
2
4
  export var comment = {
3
5
  name: 'comment',
4
6
  keyCommand: 'comment',
@@ -22,6 +24,19 @@ export var comment = {
22
24
  start: state2.selection.end - 4 - state1.selectedText.length,
23
25
  end: state2.selection.end - 4
24
26
  });
25
- }
27
+ },
28
+ icon: /*#__PURE__*/_jsxs("svg", {
29
+ role: "img",
30
+ viewBox: "0 0 512 512",
31
+ width: "12",
32
+ height: "12",
33
+ children: [/*#__PURE__*/_jsx("path", {
34
+ fill: "currentColor",
35
+ d: "M281 72H231oLuLFozwYpLrBi5VTa8sg7fDqKkeyD81V172H281V72Z"
36
+ }), /*#__PURE__*/_jsx("path", {
37
+ fill: "currentColor",
38
+ d: "M287.817 501H213.333L298.667 334H438.857C438.857 334 438.857 333.021 438.857 308.308V187.875V74.6028C438.857 64.3818 438.857 67.2814 438.857 62.625C438.857 61.7594 439.31 62.625 426.667 62.625H256H73.1429C73.1429 65.4903 73.1429 77.3378 73.1429 79.8845V187.875V308.308C73.1429 311.005 73.1429 334 73.1429 334C73.1429 334 113.826 334 106.667 334H149.333H237.714V385.385H73.1429C53.7442 385.385 35.14 377.264 21.423 362.809C7.7061 348.355 0 328.75 0 308.308V77.0769C0 56.6349 7.7061 37.03 21.423 22.5753C35.14 8.12058 53.7442 0 73.1429 0H438.857C458.256 0 476.86 8.12058 490.577 22.5753C504.294 37.03 512 56.6349 512 77.0769V308.308C512 328.75 504.294 348.355 490.577 362.809C476.86 377.264 458.256 385.385 438.857 385.385H350.354L287.817 501Z"
39
+ })]
40
+ })
26
41
  };
27
42
  //# sourceMappingURL=comment.js.map
@@ -22,13 +22,14 @@
22
22
  "selectedText",
23
23
  "start",
24
24
  "end",
25
- "length"
25
+ "length",
26
+ "icon"
26
27
  ],
27
28
  "sources": [
28
29
  "../../src/commands/comment.tsx"
29
30
  ],
30
31
  "sourcesContent": [
31
- "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};\n"
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 role=\"img\" viewBox=\"0 0 512 512\" width=\"12\" height=\"12\">\n <path fill=\"currentColor\" d=\"M281 72H231oLuLFozwYpLrBi5VTa8sg7fDqKkeyD81V172H281V72Z\" />\n <path fill=\"currentColor\" d=\"M287.817 501H213.333L298.667 334H438.857C438.857 334 438.857 333.021 438.857 308.308V187.875V74.6028C438.857 64.3818 438.857 67.2814 438.857 62.625C438.857 61.7594 439.31 62.625 426.667 62.625H256H73.1429C73.1429 65.4903 73.1429 77.3378 73.1429 79.8845V187.875V308.308C73.1429 311.005 73.1429 334 73.1429 334C73.1429 334 113.826 334 106.667 334H149.333H237.714V385.385H73.1429C53.7442 385.385 35.14 377.264 21.423 362.809C7.7061 348.355 0 328.75 0 308.308V77.0769C0 56.6349 7.7061 37.03 21.423 22.5753C35.14 8.12058 53.7442 0 73.1429 0H438.857C458.256 0 476.86 8.12058 490.577 22.5753C504.294 37.03 512 56.6349 512 77.0769V308.308C512 328.75 504.294 348.355 490.577 362.809C476.86 377.264 458.256 385.385 438.857 385.385H350.354L287.817 501Z\" />\n </svg>\n )\n};\n"
32
33
  ],
33
- "mappings": "AACA,SAASA,UAAT,QAA2B,wBAA3B;AAEA,OAAO,IAAMC,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,CAACC,KAAD,EAAmBC,GAAnB,KAA4C;IACnD;IACA,IAAMC,iBAAiB,GAAGX,UAAU,CAAC;MAAEY,IAAI,EAAEH,KAAK,CAACG,IAAd;MAAoBC,SAAS,EAAEJ,KAAK,CAACI;IAArC,CAAD,CAApC;IACA,IAAMC,MAAM,GAAGJ,GAAG,CAACK,iBAAJ,CAAsBJ,iBAAtB,CAAf,CAHmD,CAInD;;IACA,IAAMK,MAAM,GAAGN,GAAG,CAACO,gBAAJ,WAA6BH,MAAM,CAACI,YAApC,UAAf,CALmD,CAMnD;;IACAR,GAAG,C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AAM,IAAI,EAAC,cAAX;MAA0B,CAAC,EAAC;IAA5B,EADF,eAEE;MAAM,IAAI,EAAC,cAAX;MAA0B,CAAC,EAAC;IAA5B,EAFF;EAAA;AAnB6B,CAA1B"
34
35
  }
@@ -1,11 +1,18 @@
1
1
  import React from 'react';
2
+ import { ContextStore, ExecuteCommandState } from '../Context';
2
3
  import { bold } from './bold';
3
4
  import { code, codeBlock } from './code';
5
+ import { divider } from './divider';
6
+ import { fullscreen } from './fullscreen';
7
+ import { group } from './group';
8
+ import { hr } from './hr';
9
+ import { image } from './image';
4
10
  import { italic } from './italic';
5
11
  import { link } from './link';
6
- import { unorderedListCommand, orderedListCommand, checkedListCommand } from './list';
12
+ import { checkedListCommand, orderedListCommand, unorderedListCommand } from './list';
13
+ import { codeEdit, codeLive, codePreview } from './preview';
7
14
  import { quote } from './quote';
8
- import { hr } from './hr';
15
+ import { strikethrough } from './strikeThrough';
9
16
  import { title } from './title';
10
17
  import { title1 } from './title1';
11
18
  import { title2 } from './title2';
@@ -13,13 +20,6 @@ import { title3 } from './title3';
13
20
  import { title4 } from './title4';
14
21
  import { title5 } from './title5';
15
22
  import { title6 } from './title6';
16
- import { group } from './group';
17
- import { divider } from './divider';
18
- import { codePreview, codeEdit, codeLive } from './preview';
19
- import { fullscreen } from './fullscreen';
20
- import { image } from './image';
21
- import { strikethrough } from './strikeThrough';
22
- import { ContextStore, ExecuteCommandState } from '../Context';
23
23
  export interface CommandOrchestrator {
24
24
  executeCommand(command: ICommand): void;
25
25
  }
@@ -1,10 +1,18 @@
1
+ import { insertTextAtPosition } from '../utils/InsertTextAtPosition';
1
2
  import { bold } from './bold';
2
3
  import { code, codeBlock } from './code';
4
+ import { comment } from './comment';
5
+ import { divider } from './divider';
6
+ import { fullscreen } from './fullscreen';
7
+ import { group } from './group';
8
+ import { hr } from './hr';
9
+ import { image } from './image';
3
10
  import { italic } from './italic';
4
11
  import { link } from './link';
5
- import { unorderedListCommand, orderedListCommand, checkedListCommand } from './list';
12
+ import { checkedListCommand, orderedListCommand, unorderedListCommand } from './list';
13
+ import { codeEdit, codeLive, codePreview } from './preview';
6
14
  import { quote } from './quote';
7
- import { hr } from './hr';
15
+ import { strikethrough } from './strikeThrough';
8
16
  import { title } from './title';
9
17
  import { title1 } from './title1';
10
18
  import { title2 } from './title2';
@@ -12,16 +20,15 @@ import { title3 } from './title3';
12
20
  import { title4 } from './title4';
13
21
  import { title5 } from './title5';
14
22
  import { title6 } from './title6';
15
- import { comment } from './comment';
16
- import { group } from './group';
17
- import { divider } from './divider';
18
- import { codePreview, codeEdit, codeLive } from './preview';
19
- import { fullscreen } from './fullscreen';
20
- import { image } from './image';
21
- import { strikethrough } from './strikeThrough';
22
- import { insertTextAtPosition } from '../utils/InsertTextAtPosition';
23
23
 
24
- var getCommands = () => [comment, bold, italic, strikethrough, hr, title, divider, link, quote, code, codeBlock, image, divider, unorderedListCommand, orderedListCommand, checkedListCommand];
24
+ var getCommands = () => [comment, bold, italic, strikethrough, hr, group([title1, title2, title3, title4, title5, title6], {
25
+ name: "title",
26
+ groupName: "title",
27
+ buttonProps: {
28
+ "aria-label": "Insert title",
29
+ title: "Insert title"
30
+ }
31
+ }), divider, link, quote, code, codeBlock, image, divider, unorderedListCommand, orderedListCommand, checkedListCommand];
25
32
 
26
33
  var getExtraCommands = () => [codeEdit, codeLive, codePreview, divider, fullscreen];
27
34
 
@@ -86,7 +93,6 @@ class TextAreaCommandOrchestrator {
86
93
 
87
94
  }
88
95
 
89
- export { // Toolbars.
90
- 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, // Tool method.
96
+ 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, // Tool method.
91
97
  getCommands, getExtraCommands, getStateFromTextArea, TextAreaCommandOrchestrator, TextAreaTextApi };
92
98
  //# sourceMappingURL=index.js.map
@@ -1,16 +1,26 @@
1
1
  {
2
2
  "version": 3,
3
3
  "names": [
4
+ "insertTextAtPosition",
4
5
  "bold",
5
6
  "code",
6
7
  "codeBlock",
8
+ "comment",
9
+ "divider",
10
+ "fullscreen",
11
+ "group",
12
+ "hr",
13
+ "image",
7
14
  "italic",
8
15
  "link",
9
- "unorderedListCommand",
10
- "orderedListCommand",
11
16
  "checkedListCommand",
17
+ "orderedListCommand",
18
+ "unorderedListCommand",
19
+ "codeEdit",
20
+ "codeLive",
21
+ "codePreview",
12
22
  "quote",
13
- "hr",
23
+ "strikethrough",
14
24
  "title",
15
25
  "title1",
16
26
  "title2",
@@ -18,17 +28,10 @@
18
28
  "title4",
19
29
  "title5",
20
30
  "title6",
21
- "comment",
22
- "group",
23
- "divider",
24
- "codePreview",
25
- "codeEdit",
26
- "codeLive",
27
- "fullscreen",
28
- "image",
29
- "strikethrough",
30
- "insertTextAtPosition",
31
31
  "getCommands",
32
+ "name",
33
+ "groupName",
34
+ "buttonProps",
32
35
  "getExtraCommands",
33
36
  "getStateFromTextArea",
34
37
  "textArea",
@@ -59,7 +62,7 @@
59
62
  "../../src/commands/index.ts"
60
63
  ],
61
64
  "sourcesContent": [
62
- "import React from 'react';\nimport { bold } from './bold';\nimport { code, codeBlock } from './code';\nimport { italic } from './italic';\nimport { link } from './link';\nimport { unorderedListCommand, orderedListCommand, checkedListCommand } from './list';\nimport { quote } from './quote';\nimport { hr } from './hr';\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';\nimport { comment } from './comment';\nimport { group } from './group';\nimport { divider } from './divider';\nimport { codePreview, codeEdit, codeLive } from './preview';\nimport { fullscreen } from './fullscreen';\nimport { image } from './image';\nimport { strikethrough } from './strikeThrough';\nimport { insertTextAtPosition } from '../utils/InsertTextAtPosition';\nimport { ContextStore, ExecuteCommandState } from '../Context';\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 comment,\n bold,\n italic,\n strikethrough,\n hr,\n title,\n divider,\n link,\n quote,\n code,\n codeBlock,\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 // Toolbars.\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"
65
+ "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 comment,\n bold,\n italic,\n strikethrough,\n hr,\n group([title1, title2, title3, title4, title5, title6], {\n\t\t\tname: \"title\",\n\t\t\tgroupName: \"title\",\n\t\t\tbuttonProps: { \"aria-label\": \"Insert title\", title: \"Insert title\" },\n\t\t}),\n divider,\n link,\n quote,\n code,\n codeBlock,\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\n"
63
66
  ],
64
- "mappings": "AACA,SAASA,IAAT,QAAqB,QAArB;AACA,SAASC,IAAT,EAAeC,SAAf,QAAgC,QAAhC;AACA,SAASC,MAAT,QAAuB,UAAvB;AACA,SAASC,IAAT,QAAqB,QAArB;AACA,SAASC,oBAAT,EAA+BC,kBAA/B,EAAmDC,kBAAnD,QAA6E,QAA7E;AACA,SAASC,KAAT,QAAsB,SAAtB;AACA,SAASC,EAAT,QAAmB,MAAnB;AACA,SAASC,KAAT,QAAsB,SAAtB;AACA,SAASC,MAAT,QAAuB,UAAvB;AACA,SAASC,MAAT,QAAuB,UAAvB;AACA,SAASC,MAAT,QAAuB,UAAvB;AACA,SAASC,MAAT,QAAuB,UAAvB;AACA,SAASC,MAAT,QAAuB,UAAvB;AACA,SAASC,MAAT,QAAuB,UAAvB;AACA,SAASC,OAAT,QAAwB,WAAxB;AACA,SAASC,KAAT,QAAsB,SAAtB;AACA,SAASC,OAAT,QAAwB,WAAxB;AACA,SAASC,WAAT,EAAsBC,QAAtB,EAAgCC,QAAhC,QAAgD,WAAhD;AACA,SAASC,UAAT,QAA2B,cAA3B;AACA,SAASC,KAAT,QAAsB,SAAtB;AACA,SAASC,aAAT,QAA8B,iBAA9B;AACA,SAASC,oBAAT,QAAqC,+BAArC;;AA0DA,IAAMC,WAA6B,GAAG,MAAM,CAC1CV,OAD0C,EAE1CjB,IAF0C,EAG1CG,MAH0C,EAI1CsB,aAJ0C,EAK1ChB,EAL0C,EAM1CC,KAN0C,EAO1CS,OAP0C,EAQ1Cf,IAR0C,EAS1CI,KAT0C,EAU1CP,IAV0C,EAW1CC,SAX0C,EAY1CsB,KAZ0C,EAa1CL,OAb0C,EAc1Cd,oBAd0C,EAe1CC,kBAf0C,EAgB1CC,kBAhB0C,CAA5C;;AAmBA,IAAMqB,gBAAkC,GAAG,MAAM,CA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C,MAHF,EAIEC,MAJF,EAKEC,MALF,EAMEC,MANF,EAOEC,MAPF,EAQEzB,IARF,EASEE,SATF,EAUEO,MAVF,EAWES,aAXF,EAYEX,EAZF,EAaED,KAbF,EAcEF,OAdF,EAeEM,IAfF,EAgBEO,KAhBF,EAiBEhB,IAjBF,EAkBEO,KAlBF,EAmBEK,oBAnBF,EAoBED,kBApBF,EAqBED,kBArBF,EAsBEG,QAtBF,EAuBEC,QAvBF,EAwBEC,WAxBF,EAyBEX,UAzBF,EA0BE;AACAqB,WA3BF,EA4BEI,gBA5BF,EA6BEC,oBA7BF,EA8BEgB,2BA9BF,EA+BEL,eA/BF"
65
68
  }
@@ -7,6 +7,8 @@ exports.comment = void 0;
7
7
 
8
8
  var _markdownUtils = require("../utils/markdownUtils");
9
9
 
10
+ var _jsxRuntime = require("react/jsx-runtime");
11
+
10
12
  var comment = {
11
13
  name: 'comment',
12
14
  keyCommand: 'comment',
@@ -30,7 +32,20 @@ var comment = {
30
32
  start: state2.selection.end - 4 - state1.selectedText.length,
31
33
  end: state2.selection.end - 4
32
34
  });
33
- }
35
+ },
36
+ icon: /*#__PURE__*/(0, _jsxRuntime.jsxs)("svg", {
37
+ role: "img",
38
+ viewBox: "0 0 512 512",
39
+ width: "12",
40
+ height: "12",
41
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("path", {
42
+ fill: "currentColor",
43
+ d: "M281 72H231oLuLFozwYpLrBi5VTa8sg7fDqKkeyD81V172H281V72Z"
44
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("path", {
45
+ fill: "currentColor",
46
+ d: "M287.817 501H213.333L298.667 334H438.857C438.857 334 438.857 333.021 438.857 308.308V187.875V74.6028C438.857 64.3818 438.857 67.2814 438.857 62.625C438.857 61.7594 439.31 62.625 426.667 62.625H256H73.1429C73.1429 65.4903 73.1429 77.3378 73.1429 79.8845V187.875V308.308C73.1429 311.005 73.1429 334 73.1429 334C73.1429 334 113.826 334 106.667 334H149.333H237.714V385.385H73.1429C53.7442 385.385 35.14 377.264 21.423 362.809C7.7061 348.355 0 328.75 0 308.308V77.0769C0 56.6349 7.7061 37.03 21.423 22.5753C35.14 8.12058 53.7442 0 73.1429 0H438.857C458.256 0 476.86 8.12058 490.577 22.5753C504.294 37.03 512 56.6349 512 77.0769V308.308C512 328.75 504.294 348.355 490.577 362.809C476.86 377.264 458.256 385.385 438.857 385.385H350.354L287.817 501Z"
47
+ })]
48
+ })
34
49
  };
35
50
  exports.comment = comment;
36
51
  //# sourceMappingURL=comment.js.map
@@ -22,13 +22,14 @@
22
22
  "selectedText",
23
23
  "start",
24
24
  "end",
25
- "length"
25
+ "length",
26
+ "icon"
26
27
  ],
27
28
  "sources": [
28
29
  "../../src/commands/comment.tsx"
29
30
  ],
30
31
  "sourcesContent": [
31
- "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};\n"
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 role=\"img\" viewBox=\"0 0 512 512\" width=\"12\" height=\"12\">\n <path fill=\"currentColor\" d=\"M281 72H231oLuLFozwYpLrBi5VTa8sg7fDqKkeyD81V172H281V72Z\" />\n <path fill=\"currentColor\" d=\"M287.817 501H213.333L298.667 334H438.857C438.857 334 438.857 333.021 438.857 308.308V187.875V74.6028C438.857 64.3818 438.857 67.2814 438.857 62.625C438.857 61.7594 439.31 62.625 426.667 62.625H256H73.1429C73.1429 65.4903 73.1429 77.3378 73.1429 79.8845V187.875V308.308C73.1429 311.005 73.1429 334 73.1429 334C73.1429 334 113.826 334 106.667 334H149.333H237.714V385.385H73.1429C53.7442 385.385 35.14 377.264 21.423 362.809C7.7061 348.355 0 328.75 0 308.308V77.0769C0 56.6349 7.7061 37.03 21.423 22.5753C35.14 8.12058 53.7442 0 73.1429 0H438.857C458.256 0 476.86 8.12058 490.577 22.5753C504.294 37.03 512 56.6349 512 77.0769V308.308C512 328.75 504.294 348.355 490.577 362.809C476.86 377.264 458.256 385.385 438.857 385.385H350.354L287.817 501Z\" />\n </svg>\n )\n};\n"
32
33
  ],
33
- "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,E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AAK,EAAEH,MAAM,CAACH,SAAP,CAAiBO,GAAjB,GAAuB,CAAvB,GAA2BN,MAAM,CAACI,YAAP,CAAoBG,MADlC;MAEpBD,GAAG,EAAEJ,MAAM,CAACH,SAAP,CAAiBO,GAAjB,GAAuB;IAFR,CAAtB;EAID,CAjB8B;EAkB/BE,IAAI,eACF;IAAK,IAAI,EAAC,KAAV;IAAgB,OAAO,EAAC,aAAxB;IAAsC,KAAK,EAAC,IAA5C;IAAiD,MAAM,EAAC,IAAxD;IAAA,wBACE;MAAM,IAAI,EAAC,cAAX;MAA0B,CAAC,EAAC;IAA5B,EADF,eAEE;MAAM,IAAI,EAAC,cAAX;MAA0B,CAAC,EAAC;IAA5B,EAFF;EAAA;AAnB6B,CAA1B"
34
35
  }
@@ -1,11 +1,18 @@
1
1
  import React from 'react';
2
+ import { ContextStore, ExecuteCommandState } from '../Context';
2
3
  import { bold } from './bold';
3
4
  import { code, codeBlock } from './code';
5
+ import { divider } from './divider';
6
+ import { fullscreen } from './fullscreen';
7
+ import { group } from './group';
8
+ import { hr } from './hr';
9
+ import { image } from './image';
4
10
  import { italic } from './italic';
5
11
  import { link } from './link';
6
- import { unorderedListCommand, orderedListCommand, checkedListCommand } from './list';
12
+ import { checkedListCommand, orderedListCommand, unorderedListCommand } from './list';
13
+ import { codeEdit, codeLive, codePreview } from './preview';
7
14
  import { quote } from './quote';
8
- import { hr } from './hr';
15
+ import { strikethrough } from './strikeThrough';
9
16
  import { title } from './title';
10
17
  import { title1 } from './title1';
11
18
  import { title2 } from './title2';
@@ -13,13 +20,6 @@ import { title3 } from './title3';
13
20
  import { title4 } from './title4';
14
21
  import { title5 } from './title5';
15
22
  import { title6 } from './title6';
16
- import { group } from './group';
17
- import { divider } from './divider';
18
- import { codePreview, codeEdit, codeLive } from './preview';
19
- import { fullscreen } from './fullscreen';
20
- import { image } from './image';
21
- import { strikethrough } from './strikeThrough';
22
- import { ContextStore, ExecuteCommandState } from '../Context';
23
23
  export interface CommandOrchestrator {
24
24
  executeCommand(command: ICommand): void;
25
25
  }
@@ -165,19 +165,35 @@ var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/creat
165
165
 
166
166
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
167
167
 
168
+ var _InsertTextAtPosition = require("../utils/InsertTextAtPosition");
169
+
168
170
  var _bold = require("./bold");
169
171
 
170
172
  var _code = require("./code");
171
173
 
174
+ var _comment = require("./comment");
175
+
176
+ var _divider = require("./divider");
177
+
178
+ var _fullscreen = require("./fullscreen");
179
+
180
+ var _group = require("./group");
181
+
182
+ var _hr = require("./hr");
183
+
184
+ var _image = require("./image");
185
+
172
186
  var _italic = require("./italic");
173
187
 
174
188
  var _link = require("./link");
175
189
 
176
190
  var _list = require("./list");
177
191
 
192
+ var _preview = require("./preview");
193
+
178
194
  var _quote = require("./quote");
179
195
 
180
- var _hr = require("./hr");
196
+ var _strikeThrough = require("./strikeThrough");
181
197
 
182
198
  var _title = require("./title");
183
199
 
@@ -193,24 +209,15 @@ var _title6 = require("./title5");
193
209
 
194
210
  var _title7 = require("./title6");
195
211
 
196
- var _comment = require("./comment");
197
-
198
- var _group = require("./group");
199
-
200
- var _divider = require("./divider");
201
-
202
- var _preview = require("./preview");
203
-
204
- var _fullscreen = require("./fullscreen");
205
-
206
- var _image = require("./image");
207
-
208
- var _strikeThrough = require("./strikeThrough");
209
-
210
- var _InsertTextAtPosition = require("../utils/InsertTextAtPosition");
211
-
212
212
  var getCommands = function getCommands() {
213
- return [_comment.comment, _bold.bold, _italic.italic, _strikeThrough.strikethrough, _hr.hr, _title.title, _divider.divider, _link.link, _quote.quote, _code.code, _code.codeBlock, _image.image, _divider.divider, _list.unorderedListCommand, _list.orderedListCommand, _list.checkedListCommand];
213
+ return [_comment.comment, _bold.bold, _italic.italic, _strikeThrough.strikethrough, _hr.hr, (0, _group.group)([_title2.title1, _title3.title2, _title4.title3, _title5.title4, _title6.title5, _title7.title6], {
214
+ name: "title",
215
+ groupName: "title",
216
+ buttonProps: {
217
+ "aria-label": "Insert title",
218
+ title: "Insert title"
219
+ }
220
+ }), _divider.divider, _link.link, _quote.quote, _code.code, _code.codeBlock, _image.image, _divider.divider, _list.unorderedListCommand, _list.orderedListCommand, _list.checkedListCommand];
214
221
  };
215
222
 
216
223
  exports.getCommands = getCommands;
@@ -7,6 +7,16 @@
7
7
  "italic",
8
8
  "strikethrough",
9
9
  "hr",
10
+ "group",
11
+ "title1",
12
+ "title2",
13
+ "title3",
14
+ "title4",
15
+ "title5",
16
+ "title6",
17
+ "name",
18
+ "groupName",
19
+ "buttonProps",
10
20
  "title",
11
21
  "divider",
12
22
  "link",
@@ -47,7 +57,7 @@
47
57
  "../../src/commands/index.ts"
48
58
  ],
49
59
  "sourcesContent": [
50
- "import React from 'react';\nimport { bold } from './bold';\nimport { code, codeBlock } from './code';\nimport { italic } from './italic';\nimport { link } from './link';\nimport { unorderedListCommand, orderedListCommand, checkedListCommand } from './list';\nimport { quote } from './quote';\nimport { hr } from './hr';\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';\nimport { comment } from './comment';\nimport { group } from './group';\nimport { divider } from './divider';\nimport { codePreview, codeEdit, codeLive } from './preview';\nimport { fullscreen } from './fullscreen';\nimport { image } from './image';\nimport { strikethrough } from './strikeThrough';\nimport { insertTextAtPosition } from '../utils/InsertTextAtPosition';\nimport { ContextStore, ExecuteCommandState } from '../Context';\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 comment,\n bold,\n italic,\n strikethrough,\n hr,\n title,\n divider,\n link,\n quote,\n code,\n codeBlock,\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 // Toolbars.\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"
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 comment,\n bold,\n italic,\n strikethrough,\n hr,\n group([title1, title2, title3, title4, title5, title6], {\n\t\t\tname: \"title\",\n\t\t\tgroupName: \"title\",\n\t\t\tbuttonProps: { \"aria-label\": \"Insert title\", title: \"Insert title\" },\n\t\t}),\n divider,\n link,\n quote,\n code,\n codeBlock,\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\n"
51
61
  ],
52
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA;;AACA;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,KAAKD,QAAL,CAAcY,KAAd;MACA,KAAKZ,QAAL,CAAcG,cAAd,GAA+BF,SAAS,CAACC,KAAzC;MACA,KAAKF,QAAL,CAAcK,YAAd,GAA6BJ,SAAS,CAACG,GAAvC;MACA,OAAOL,oBAAoB,CAAC,KAAKC,QAAN,CAA3B;IACD;;;;;;;IAGGa,2B;EAIJ,qCAAYb,QAAZ,EAA2C;IAAA;IAAA;IAAA;IACzC,KAAKA,QAAL,GAAgBA,QAAhB;IACA,KAAKc,OAAL,GAAe,IAAIJ,eAAJ,CAAoBV,QAApB,CAAf;EACD;;;;WAED,oBAAW;MACT,IAAI,CAAC,KAAKA,QAAV,EAAoB,OAAO,KAAP;MACpB,OAAOD,oBAAoB,CAAC,KAAKC,QAAN,CAA3B;IACD;;;WAED,wBACEe,OADF,EAEEC,QAFF,EAGEC,KAHF,EAIQ;MACNF,OAAO,CAACG,OAAR,IAAmBH,OAAO,CAACG,OAAR,CAAgBnB,oBAAoB,CAAC,KAAKC,QAAN,CAApC,EAAqD,KAAKc,OAA1D,EAAmEE,QAAnE,EAA6EC,KAA7E,CAAnB;IACD"
53
63
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uiw/react-md-editor",
3
- "version": "3.18.2",
3
+ "version": "3.18.3",
4
4
  "description": "A markdown editor with preview, implemented with React.js and TypeScript.",
5
5
  "homepage": "https://uiwjs.github.io/react-md-editor/",
6
6
  "author": "kenny wang <wowohoo@qq.com>",
@@ -19,4 +19,10 @@ export const comment: ICommand = {
19
19
  end: state2.selection.end - 4,
20
20
  });
21
21
  },
22
+ icon: (
23
+ <svg role="img" viewBox="0 0 512 512" width="12" height="12">
24
+ <path fill="currentColor" d="M281 72H231oLuLFozwYpLrBi5VTa8sg7fDqKkeyD81V172H281V72Z" />
25
+ <path fill="currentColor" d="M287.817 501H213.333L298.667 334H438.857C438.857 334 438.857 333.021 438.857 308.308V187.875V74.6028C438.857 64.3818 438.857 67.2814 438.857 62.625C438.857 61.7594 439.31 62.625 426.667 62.625H256H73.1429C73.1429 65.4903 73.1429 77.3378 73.1429 79.8845V187.875V308.308C73.1429 311.005 73.1429 334 73.1429 334C73.1429 334 113.826 334 106.667 334H149.333H237.714V385.385H73.1429C53.7442 385.385 35.14 377.264 21.423 362.809C7.7061 348.355 0 328.75 0 308.308V77.0769C0 56.6349 7.7061 37.03 21.423 22.5753C35.14 8.12058 53.7442 0 73.1429 0H438.857C458.256 0 476.86 8.12058 490.577 22.5753C504.294 37.03 512 56.6349 512 77.0769V308.308C512 328.75 504.294 348.355 490.577 362.809C476.86 377.264 458.256 385.385 438.857 385.385H350.354L287.817 501Z" />
26
+ </svg>
27
+ )
22
28
  };
@@ -1,11 +1,20 @@
1
1
  import React from 'react';
2
+ import { ContextStore, ExecuteCommandState } from '../Context';
3
+ import { insertTextAtPosition } from '../utils/InsertTextAtPosition';
2
4
  import { bold } from './bold';
3
5
  import { code, codeBlock } from './code';
6
+ import { comment } from './comment';
7
+ import { divider } from './divider';
8
+ import { fullscreen } from './fullscreen';
9
+ import { group } from './group';
10
+ import { hr } from './hr';
11
+ import { image } from './image';
4
12
  import { italic } from './italic';
5
13
  import { link } from './link';
6
- import { unorderedListCommand, orderedListCommand, checkedListCommand } from './list';
14
+ import { checkedListCommand, orderedListCommand, unorderedListCommand } from './list';
15
+ import { codeEdit, codeLive, codePreview } from './preview';
7
16
  import { quote } from './quote';
8
- import { hr } from './hr';
17
+ import { strikethrough } from './strikeThrough';
9
18
  import { title } from './title';
10
19
  import { title1 } from './title1';
11
20
  import { title2 } from './title2';
@@ -13,15 +22,6 @@ import { title3 } from './title3';
13
22
  import { title4 } from './title4';
14
23
  import { title5 } from './title5';
15
24
  import { title6 } from './title6';
16
- import { comment } from './comment';
17
- import { group } from './group';
18
- import { divider } from './divider';
19
- import { codePreview, codeEdit, codeLive } from './preview';
20
- import { fullscreen } from './fullscreen';
21
- import { image } from './image';
22
- import { strikethrough } from './strikeThrough';
23
- import { insertTextAtPosition } from '../utils/InsertTextAtPosition';
24
- import { ContextStore, ExecuteCommandState } from '../Context';
25
25
 
26
26
  export interface CommandOrchestrator {
27
27
  executeCommand(command: ICommand): void;
@@ -84,7 +84,11 @@ const getCommands: () => ICommand[] = () => [
84
84
  italic,
85
85
  strikethrough,
86
86
  hr,
87
- title,
87
+ group([title1, title2, title3, title4, title5, title6], {
88
+ name: "title",
89
+ groupName: "title",
90
+ buttonProps: { "aria-label": "Insert title", title: "Insert title" },
91
+ }),
88
92
  divider,
89
93
  link,
90
94
  quote,
@@ -163,7 +167,6 @@ class TextAreaCommandOrchestrator implements CommandOrchestrator {
163
167
  }
164
168
 
165
169
  export {
166
- // Toolbars.
167
170
  title,
168
171
  title1,
169
172
  title2,
@@ -196,3 +199,4 @@ export {
196
199
  TextAreaCommandOrchestrator,
197
200
  TextAreaTextApi,
198
201
  };
202
+