@uiw/react-md-editor 3.18.3 → 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.
- package/dist/mdeditor.js +1564 -1583
- package/dist/mdeditor.min.js +1 -1
- package/esm/Context.js.map +1 -1
- package/esm/Editor.js +43 -67
- package/esm/Editor.js.map +1 -1
- package/esm/commands/bold.js +4 -4
- package/esm/commands/bold.js.map +1 -1
- package/esm/commands/code.js +8 -10
- package/esm/commands/code.js.map +2 -2
- package/esm/commands/comment.js +27 -16
- package/esm/commands/comment.js.map +2 -2
- package/esm/commands/divider.js.map +1 -1
- package/esm/commands/fullscreen.js +3 -4
- package/esm/commands/fullscreen.js.map +2 -2
- package/esm/commands/group.js +2 -4
- package/esm/commands/group.js.map +1 -1
- package/esm/commands/hr.js.map +1 -1
- package/esm/commands/image.js +6 -6
- package/esm/commands/image.js.map +2 -2
- package/esm/commands/index.d.ts +2 -2
- package/esm/commands/index.js +12 -23
- package/esm/commands/index.js.map +3 -2
- package/esm/commands/italic.js +4 -4
- package/esm/commands/italic.js.map +1 -1
- package/esm/commands/link.js +4 -4
- package/esm/commands/link.js.map +1 -1
- package/esm/commands/list.js +4 -4
- package/esm/commands/list.js.map +1 -1
- package/esm/commands/preview.js +21 -3
- package/esm/commands/preview.js.map +7 -2
- package/esm/commands/quote.js +2 -1
- package/esm/commands/quote.js.map +1 -1
- package/esm/commands/strikeThrough.js +4 -4
- package/esm/commands/strikeThrough.js.map +1 -1
- package/esm/commands/title.js.map +1 -1
- package/esm/commands/title1.js.map +1 -1
- package/esm/commands/title2.js.map +1 -1
- package/esm/commands/title3.js.map +1 -1
- package/esm/commands/title4.js.map +1 -1
- package/esm/commands/title5.js.map +1 -1
- package/esm/commands/title6.js.map +1 -1
- package/esm/components/DragBar/index.js +2 -9
- package/esm/components/DragBar/index.js.map +1 -1
- package/esm/components/TextArea/Markdown.js +2 -7
- package/esm/components/TextArea/Markdown.js.map +1 -1
- package/esm/components/TextArea/Textarea.js +8 -11
- package/esm/components/TextArea/Textarea.js.map +1 -1
- package/esm/components/TextArea/handleKeyDown.js +2 -16
- package/esm/components/TextArea/handleKeyDown.js.map +1 -1
- package/esm/components/TextArea/index.js +11 -15
- package/esm/components/TextArea/index.js.map +1 -1
- package/esm/components/TextArea/shortcuts.js +1 -17
- package/esm/components/TextArea/shortcuts.js.map +2 -2
- package/esm/components/Toolbar/Child.js +2 -1
- package/esm/components/Toolbar/Child.js.map +1 -1
- package/esm/components/Toolbar/index.js +2 -12
- package/esm/components/Toolbar/index.js.map +1 -1
- package/esm/index.js.map +1 -1
- package/esm/utils/InsertTextAtPosition.js +28 -34
- package/esm/utils/InsertTextAtPosition.js.map +1 -1
- package/esm/utils/markdownUtils.js +14 -23
- package/esm/utils/markdownUtils.js.map +1 -1
- package/lib/Context.js +0 -6
- package/lib/Context.js.map +1 -1
- package/lib/Editor.js +74 -114
- package/lib/Editor.js.map +1 -1
- package/lib/commands/bold.js +4 -9
- package/lib/commands/bold.js.map +1 -1
- package/lib/commands/code.js +8 -15
- package/lib/commands/code.js.map +2 -2
- package/lib/commands/comment.js +27 -19
- package/lib/commands/comment.js.map +2 -2
- package/lib/commands/divider.js.map +1 -1
- package/lib/commands/fullscreen.js +3 -8
- package/lib/commands/fullscreen.js.map +2 -2
- package/lib/commands/group.js +2 -10
- package/lib/commands/group.js.map +1 -1
- package/lib/commands/hr.js +0 -4
- package/lib/commands/hr.js.map +1 -1
- package/lib/commands/image.js +6 -11
- package/lib/commands/image.js.map +2 -2
- package/lib/commands/index.d.ts +2 -2
- package/lib/commands/index.js +10 -47
- package/lib/commands/index.js.map +4 -3
- package/lib/commands/italic.js +4 -9
- package/lib/commands/italic.js.map +1 -1
- package/lib/commands/link.js +4 -9
- package/lib/commands/link.js.map +1 -1
- package/lib/commands/list.js +4 -10
- package/lib/commands/list.js.map +1 -1
- package/lib/commands/preview.js +21 -7
- package/lib/commands/preview.js.map +7 -2
- package/lib/commands/quote.js +2 -6
- package/lib/commands/quote.js.map +1 -1
- package/lib/commands/strikeThrough.js +4 -9
- package/lib/commands/strikeThrough.js.map +1 -1
- package/lib/commands/title.js +0 -6
- package/lib/commands/title.js.map +1 -1
- package/lib/commands/title1.js +0 -5
- package/lib/commands/title1.js.map +1 -1
- package/lib/commands/title2.js +0 -5
- package/lib/commands/title2.js.map +1 -1
- package/lib/commands/title3.js +0 -5
- package/lib/commands/title3.js.map +1 -1
- package/lib/commands/title4.js +0 -5
- package/lib/commands/title4.js.map +1 -1
- package/lib/commands/title5.js +0 -5
- package/lib/commands/title5.js.map +1 -1
- package/lib/commands/title6.js +0 -5
- package/lib/commands/title6.js.map +1 -1
- package/lib/components/DragBar/index.js +4 -15
- package/lib/components/DragBar/index.js.map +1 -1
- package/lib/components/TextArea/Markdown.js +6 -22
- package/lib/components/TextArea/Markdown.js.map +1 -1
- package/lib/components/TextArea/Textarea.js +15 -36
- package/lib/components/TextArea/Textarea.js.map +1 -1
- package/lib/components/TextArea/handleKeyDown.js +1 -18
- package/lib/components/TextArea/handleKeyDown.js.map +1 -1
- package/lib/components/TextArea/index.js +15 -37
- package/lib/components/TextArea/index.js.map +1 -1
- package/lib/components/TextArea/shortcuts.js +1 -17
- package/lib/components/TextArea/shortcuts.js.map +2 -2
- package/lib/components/Toolbar/Child.js +8 -18
- package/lib/components/Toolbar/Child.js.map +1 -1
- package/lib/components/Toolbar/index.js +14 -36
- package/lib/components/Toolbar/index.js.map +1 -1
- package/lib/index.js +0 -9
- package/lib/index.js.map +1 -1
- package/lib/utils/InsertTextAtPosition.js +28 -37
- package/lib/utils/InsertTextAtPosition.js.map +1 -1
- package/lib/utils/markdownUtils.js +17 -28
- package/lib/utils/markdownUtils.js.map +1 -1
- package/package.json +1 -1
- package/src/commands/code.tsx +2 -2
- package/src/commands/comment.tsx +19 -4
- package/src/commands/fullscreen.tsx +3 -2
- package/src/commands/image.tsx +1 -1
- package/src/commands/index.ts +8 -7
- package/src/commands/preview.tsx +35 -4
- package/src/components/TextArea/shortcuts.ts +2 -2
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"names": [
|
|
4
4
|
"getCommands",
|
|
5
|
-
"comment",
|
|
6
5
|
"bold",
|
|
7
6
|
"italic",
|
|
8
7
|
"strikethrough",
|
|
@@ -23,6 +22,7 @@
|
|
|
23
22
|
"quote",
|
|
24
23
|
"code",
|
|
25
24
|
"codeBlock",
|
|
25
|
+
"comment",
|
|
26
26
|
"image",
|
|
27
27
|
"unorderedListCommand",
|
|
28
28
|
"orderedListCommand",
|
|
@@ -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
|
|
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 TextAreaTextApi,\n};\n"
|
|
61
62
|
],
|
|
62
|
-
"mappings": "
|
|
63
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA;AACA;AACA;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BAAiBM,IAAY,EAAa;MACxC,IAAAK,0CAAoB,EAAC,IAAI,CAACX,QAAQ,EAAEM,IAAI,CAAC;MACzC,OAAOP,oBAAoB,CAAC,IAAI,CAACC,QAAQ,CAAC;IAC5C;;IAEA;AACF;AACA;AACA;EAHE;IAAA;IAAA,OAIA,2BAAkBC,SAAoB,EAAa;MACjD,IAAI,CAACD,QAAQ,CAACY,KAAK,EAAE;MACrB,IAAI,CAACZ,QAAQ,CAACG,cAAc,GAAGF,SAAS,CAACC,KAAK;MAC9C,IAAI,CAACF,QAAQ,CAACK,YAAY,GAAGJ,SAAS,CAACG,GAAG;MAC1C,OAAOL,oBAAoB,CAAC,IAAI,CAACC,QAAQ,CAAC;IAC5C;EAAC;EAAA;AAAA;AAAA;AAAA,IAGGa,2BAA2B;EAI/B,qCAAYb,QAA6B,EAAE;IAAA;IAAA;IAAA;IACzC,IAAI,CAACA,QAAQ,GAAGA,QAAQ;IACxB,IAAI,CAACc,OAAO,GAAG,IAAIJ,eAAe,CAACV,QAAQ,CAAC;EAC9C;EAAC;IAAA;IAAA,OAED,oBAAW;MACT,IAAI,CAAC,IAAI,CAACA,QAAQ,EAAE,OAAO,KAAK;MAChC,OAAOD,oBAAoB,CAAC,IAAI,CAACC,QAAQ,CAAC;IAC5C;EAAC;IAAA;IAAA,OAED,wBACEe,OAAyB,EACzBC,QAAuC,EACvCC,KAA2B,EAC3BC,SAAoB,EACd;MACNH,OAAO,CAACI,OAAO,IAAIJ,OAAO,CAACI,OAAO,CAACpB,oBAAoB,CAAC,IAAI,CAACC,QAAQ,CAAC,EAAE,IAAI,CAACc,OAAO,EAAEE,QAAQ,EAAEC,KAAK,EAAEC,SAAS,CAAC;IACnH;EAAC;EAAA;AAAA;AAAA"
|
|
63
64
|
}
|
package/lib/commands/italic.js
CHANGED
|
@@ -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);
|
|
43
|
-
|
|
44
|
-
var state2 = api.replaceSelection("*".concat(state1.selectedText, "*"));
|
|
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": "
|
|
34
|
+
"mappings": ";;;;;;;AAAA;AAEA;AAAoD;AAE7C,IAAMA,MAAgB,GAAG;EAC9BC,IAAI,EAAE,QAAQ;EACdC,UAAU,EAAE,QAAQ;EACpBC,SAAS,EAAE,WAAW;EACtBC,KAAK,EAAE,KAAK;EACZC,WAAW,EAAE;IAAE,YAAY,EAAE,4BAA4B;IAAEC,KAAK,EAAE;EAA6B,CAAC;EAChGC,IAAI,eACF;IAAK,aAAU,QAAQ;IAAC,KAAK,EAAC,IAAI;IAAC,MAAM,EAAC,IAAI;IAAC,IAAI,EAAC,KAAK;IAAC,OAAO,EAAC,aAAa;IAAA,uBAC7E;MACE,IAAI,EAAC,cAAc;MACnB,CAAC,EAAC;IAAoX;EACtX,EAEL;EACDC,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,YAAKH,MAAM,CAACI,YAAY,OAAI;IAC/D;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;AACF,CAAC;AAAC"
|
|
35
35
|
}
|
package/lib/commands/link.js
CHANGED
|
@@ -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);
|
|
43
|
-
|
|
44
|
-
var state2 = api.replaceSelection("[".concat(state1.selectedText, "](url)"));
|
|
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
|
package/lib/commands/link.js.map
CHANGED
|
@@ -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": "
|
|
34
|
+
"mappings": ";;;;;;;AAAA;AAEA;AAAoD;AAE7C,IAAMA,IAAc,GAAG;EAC5BC,IAAI,EAAE,MAAM;EACZC,UAAU,EAAE,MAAM;EAClBC,SAAS,EAAE,WAAW;EACtBC,KAAK,EAAE,SAAS;EAChBC,WAAW,EAAE;IAAE,YAAY,EAAE,uBAAuB;IAAEC,KAAK,EAAE;EAAwB,CAAC;EACtFC,IAAI,eACF;IAAK,aAAU,QAAQ;IAAC,KAAK,EAAC,IAAI;IAAC,MAAM,EAAC,IAAI;IAAC,IAAI,EAAC,KAAK;IAAC,OAAO,EAAC,aAAa;IAAA,uBAC7E;MACE,IAAI,EAAC,cAAc;MACnB,CAAC,EAAC;IAA2tE;EAC7tE,EAEL;EACDC,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,YAAKH,MAAM,CAACI,YAAY,YAAS;IACpE;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;AACF,CAAC;AAAC"
|
|
35
35
|
}
|
package/lib/commands/list.js
CHANGED
|
@@ -1,20 +1,15 @@
|
|
|
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.checkedListCommand = void 0;
|
|
9
8
|
exports.insertBeforeEachLine = insertBeforeEachLine;
|
|
10
9
|
exports.unorderedListCommand = exports.orderedListCommand = exports.makeList = void 0;
|
|
11
|
-
|
|
12
10
|
var React = _interopRequireWildcard(require("react"));
|
|
13
|
-
|
|
14
11
|
var _markdownUtils = require("../utils/markdownUtils");
|
|
15
|
-
|
|
16
12
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
17
|
-
|
|
18
13
|
/**
|
|
19
14
|
* Inserts insertionString before each line
|
|
20
15
|
*/
|
|
@@ -30,7 +25,6 @@ function insertBeforeEachLine(selectedText, insertBefore) {
|
|
|
30
25
|
insertionLength += insertionResult.length;
|
|
31
26
|
return insertBefore(item, index) + item;
|
|
32
27
|
}
|
|
33
|
-
|
|
34
28
|
throw Error('insertion is expected to be either a string or a function');
|
|
35
29
|
}).join('\n');
|
|
36
30
|
return {
|
|
@@ -38,7 +32,6 @@ function insertBeforeEachLine(selectedText, insertBefore) {
|
|
|
38
32
|
insertionLength: insertionLength
|
|
39
33
|
};
|
|
40
34
|
}
|
|
41
|
-
|
|
42
35
|
var makeList = function makeList(state, api, insertBefore) {
|
|
43
36
|
// Adjust the selection to encompass the whole word if the caret is inside one
|
|
44
37
|
var newSelectionRange = (0, _markdownUtils.selectWord)({
|
|
@@ -51,18 +44,19 @@ var makeList = function makeList(state, api, insertBefore) {
|
|
|
51
44
|
var breaksAfterCount = (0, _markdownUtils.getBreaksNeededForEmptyLineAfter)(state1.text, state1.selection.end);
|
|
52
45
|
var breaksAfter = Array(breaksAfterCount + 1).join('\n');
|
|
53
46
|
var modifiedText = insertBeforeEachLine(state1.selectedText, insertBefore);
|
|
54
|
-
api.replaceSelection("".concat(breaksBefore).concat(modifiedText.modifiedText).concat(breaksAfter));
|
|
47
|
+
api.replaceSelection("".concat(breaksBefore).concat(modifiedText.modifiedText).concat(breaksAfter));
|
|
55
48
|
|
|
49
|
+
// Specifically when the text has only one line, we can exclude the "- ", for example, from the selection
|
|
56
50
|
var oneLinerOffset = state1.selectedText.indexOf('\n') === -1 ? modifiedText.insertionLength : 0;
|
|
57
51
|
var selectionStart = state1.selection.start + breaksBeforeCount + oneLinerOffset;
|
|
58
|
-
var selectionEnd = selectionStart + modifiedText.modifiedText.length - oneLinerOffset;
|
|
52
|
+
var selectionEnd = selectionStart + modifiedText.modifiedText.length - oneLinerOffset;
|
|
59
53
|
|
|
54
|
+
// Adjust the selection to not contain the **
|
|
60
55
|
api.setSelectionRange({
|
|
61
56
|
start: selectionStart,
|
|
62
57
|
end: selectionEnd
|
|
63
58
|
});
|
|
64
59
|
};
|
|
65
|
-
|
|
66
60
|
exports.makeList = makeList;
|
|
67
61
|
var unorderedListCommand = {
|
|
68
62
|
name: 'unordered-list',
|
package/lib/commands/list.js.map
CHANGED
|
@@ -56,5 +56,5 @@
|
|
|
56
56
|
"sourcesContent": [
|
|
57
57
|
"import * as React from 'react';\nimport { ICommand, TextState, TextAreaTextApi } from './';\nimport {\n selectWord,\n getBreaksNeededForEmptyLineBefore,\n getBreaksNeededForEmptyLineAfter,\n} from '../utils/markdownUtils';\n\nexport type AlterLineFunction = (line: string, index: number) => string;\n\n/**\n * Inserts insertionString before each line\n */\nexport function insertBeforeEachLine(\n selectedText: string,\n insertBefore: string | AlterLineFunction,\n): { modifiedText: string; insertionLength: number } {\n const lines = selectedText.split(/\\n/);\n\n let insertionLength = 0;\n const modifiedText = lines\n .map((item, index) => {\n if (typeof insertBefore === 'string') {\n insertionLength += insertBefore.length;\n return insertBefore + item;\n } else if (typeof insertBefore === 'function') {\n const insertionResult = insertBefore(item, index);\n insertionLength += insertionResult.length;\n return insertBefore(item, index) + item;\n }\n throw Error('insertion is expected to be either a string or a function');\n })\n .join('\\n');\n\n return { modifiedText, insertionLength };\n}\n\nexport const makeList = (state: TextState, api: TextAreaTextApi, insertBefore: string | AlterLineFunction) => {\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\n const breaksBeforeCount = getBreaksNeededForEmptyLineBefore(state1.text, state1.selection.start);\n const breaksBefore = Array(breaksBeforeCount + 1).join('\\n');\n\n const breaksAfterCount = getBreaksNeededForEmptyLineAfter(state1.text, state1.selection.end);\n const breaksAfter = Array(breaksAfterCount + 1).join('\\n');\n\n const modifiedText = insertBeforeEachLine(state1.selectedText, insertBefore);\n\n api.replaceSelection(`${breaksBefore}${modifiedText.modifiedText}${breaksAfter}`);\n\n // Specifically when the text has only one line, we can exclude the \"- \", for example, from the selection\n const oneLinerOffset = state1.selectedText.indexOf('\\n') === -1 ? modifiedText.insertionLength : 0;\n\n const selectionStart = state1.selection.start + breaksBeforeCount + oneLinerOffset;\n const selectionEnd = selectionStart + modifiedText.modifiedText.length - oneLinerOffset;\n\n // Adjust the selection to not contain the **\n api.setSelectionRange({\n start: selectionStart,\n end: selectionEnd,\n });\n};\n\nexport const unorderedListCommand: ICommand = {\n name: 'unordered-list',\n keyCommand: 'list',\n shortcuts: 'ctrl+shift+u',\n value: '- ',\n buttonProps: {\n 'aria-label': 'Add unordered list (ctrl + shift + u)',\n title: 'Add unordered list (ctrl + shift + u)',\n },\n icon: (\n <svg data-name=\"unordered-list\" width=\"12\" height=\"12\" viewBox=\"0 0 512 512\">\n <path\n fill=\"currentColor\"\n d=\"M96 96c0 26.51-21.49 48-48 48S0 122.51 0 96s21.49-48 48-48 48 21.49 48 48zM48 208c-26.51 0-48 21.49-48 48s21.49 48 48 48 48-21.49 48-48-21.49-48-48-48zm0 160c-26.51 0-48 21.49-48 48s21.49 48 48 48 48-21.49 48-48-21.49-48-48-48zm96-236h352c8.837 0 16-7.163 16-16V76c0-8.837-7.163-16-16-16H144c-8.837 0-16 7.163-16 16v40c0 8.837 7.163 16 16 16zm0 160h352c8.837 0 16-7.163 16-16v-40c0-8.837-7.163-16-16-16H144c-8.837 0-16 7.163-16 16v40c0 8.837 7.163 16 16 16zm0 160h352c8.837 0 16-7.163 16-16v-40c0-8.837-7.163-16-16-16H144c-8.837 0-16 7.163-16 16v40c0 8.837 7.163 16 16 16z\"\n />\n </svg>\n ),\n execute: (state: TextState, api: TextAreaTextApi) => {\n makeList(state, api, '- ');\n },\n};\n\nexport const orderedListCommand: ICommand = {\n name: 'ordered-list',\n keyCommand: 'list',\n shortcuts: 'ctrl+shift+o',\n value: '1. ',\n buttonProps: { 'aria-label': 'Add ordered list (ctrl + shift + o)', title: 'Add ordered list (ctrl + shift + o)' },\n icon: (\n <svg data-name=\"ordered-list\" width=\"12\" height=\"12\" role=\"img\" viewBox=\"0 0 512 512\">\n <path\n fill=\"currentColor\"\n d=\"M3.263 139.527c0-7.477 3.917-11.572 11.573-11.572h15.131V88.078c0-5.163.534-10.503.534-10.503h-.356s-1.779 2.67-2.848 3.738c-4.451 4.273-10.504 4.451-15.666-1.068l-5.518-6.231c-5.342-5.341-4.984-11.216.534-16.379l21.72-19.938C32.815 33.602 36.732 32 42.785 32H54.89c7.656 0 11.749 3.916 11.749 11.572v84.384h15.488c7.655 0 11.572 4.094 11.572 11.572v8.901c0 7.477-3.917 11.572-11.572 11.572H14.836c-7.656 0-11.573-4.095-11.573-11.572v-8.902zM2.211 304.591c0-47.278 50.955-56.383 50.955-69.165 0-7.18-5.954-8.755-9.28-8.755-3.153 0-6.479 1.051-9.455 3.852-5.079 4.903-10.507 7.004-16.111 2.451l-8.579-6.829c-5.779-4.553-7.18-9.805-2.803-15.409C13.592 201.981 26.025 192 47.387 192c19.437 0 44.476 10.506 44.476 39.573 0 38.347-46.753 46.402-48.679 56.909h39.049c7.529 0 11.557 4.027 11.557 11.382v8.755c0 7.354-4.028 11.382-11.557 11.382h-67.94c-7.005 0-12.083-4.028-12.083-11.382v-4.028zM5.654 454.61l5.603-9.28c3.853-6.654 9.105-7.004 15.584-3.152 4.903 2.101 9.63 3.152 14.359 3.152 10.155 0 14.358-3.502 14.358-8.23 0-6.654-5.604-9.106-15.934-9.106h-4.728c-5.954 0-9.28-2.101-12.258-7.88l-1.05-1.926c-2.451-4.728-1.226-9.806 2.801-14.884l5.604-7.004c6.829-8.405 12.257-13.483 12.257-13.483v-.35s-4.203 1.051-12.608 1.051H16.685c-7.53 0-11.383-4.028-11.383-11.382v-8.755c0-7.53 3.853-11.382 11.383-11.382h58.484c7.529 0 11.382 4.027 11.382 11.382v3.327c0 5.778-1.401 9.806-5.079 14.183l-17.509 20.137c19.611 5.078 28.716 20.487 28.716 34.845 0 21.363-14.358 44.126-48.503 44.126-16.636 0-28.192-4.728-35.896-9.455-5.779-4.202-6.304-9.805-2.626-15.934zM144 132h352c8.837 0 16-7.163 16-16V76c0-8.837-7.163-16-16-16H144c-8.837 0-16 7.163-16 16v40c0 8.837 7.163 16 16 16zm0 160h352c8.837 0 16-7.163 16-16v-40c0-8.837-7.163-16-16-16H144c-8.837 0-16 7.163-16 16v40c0 8.837 7.163 16 16 16zm0 160h352c8.837 0 16-7.163 16-16v-40c0-8.837-7.163-16-16-16H144c-8.837 0-16 7.163-16 16v40c0 8.837 7.163 16 16 16z\"\n />\n </svg>\n ),\n execute: (state: TextState, api: TextAreaTextApi) => {\n makeList(state, api, (item, index) => `${index + 1}. `);\n },\n};\n\nexport const checkedListCommand: ICommand = {\n name: 'checked-list',\n keyCommand: 'list',\n shortcuts: 'ctrl+shift+c',\n value: '- [x] ',\n buttonProps: { 'aria-label': 'Add checked list (ctrl + shift + c)', title: 'Add checked list (ctrl + shift + c)' },\n icon: (\n <svg data-name=\"checked-list\" width=\"12\" height=\"12\" role=\"img\" viewBox=\"0 0 512 512\">\n <path\n fill=\"currentColor\"\n d=\"M208 132h288c8.8 0 16-7.2 16-16V76c0-8.8-7.2-16-16-16H208c-8.8 0-16 7.2-16 16v40c0 8.8 7.2 16 16 16zm0 160h288c8.8 0 16-7.2 16-16v-40c0-8.8-7.2-16-16-16H208c-8.8 0-16 7.2-16 16v40c0 8.8 7.2 16 16 16zm0 160h288c8.8 0 16-7.2 16-16v-40c0-8.8-7.2-16-16-16H208c-8.8 0-16 7.2-16 16v40c0 8.8 7.2 16 16 16zM64 368c-26.5 0-48.6 21.5-48.6 48s22.1 48 48.6 48 48-21.5 48-48-21.5-48-48-48zm92.5-299l-72.2 72.2-15.6 15.6c-4.7 4.7-12.9 4.7-17.6 0L3.5 109.4c-4.7-4.7-4.7-12.3 0-17l15.7-15.7c4.7-4.7 12.3-4.7 17 0l22.7 22.1 63.7-63.3c4.7-4.7 12.3-4.7 17 0l17 16.5c4.6 4.7 4.6 12.3-.1 17zm0 159.6l-72.2 72.2-15.7 15.7c-4.7 4.7-12.9 4.7-17.6 0L3.5 269c-4.7-4.7-4.7-12.3 0-17l15.7-15.7c4.7-4.7 12.3-4.7 17 0l22.7 22.1 63.7-63.7c4.7-4.7 12.3-4.7 17 0l17 17c4.6 4.6 4.6 12.2-.1 16.9z\"\n />\n </svg>\n ),\n execute: (state: TextState, api: TextAreaTextApi) => {\n makeList(state, api, (item, index) => `- [ ] `);\n },\n};\n"
|
|
58
58
|
],
|
|
59
|
-
"mappings": "
|
|
59
|
+
"mappings": ";;;;;;;;;AAAA;AAEA;AAIgC;AAIhC;AACA;AACA;AACO,SAASA,oBAAoB,CAClCC,YAAoB,EACpBC,YAAwC,EACW;EACnD,IAAMC,KAAK,GAAGF,YAAY,CAACG,KAAK,CAAC,IAAI,CAAC;EAEtC,IAAIC,eAAe,GAAG,CAAC;EACvB,IAAMC,YAAY,GAAGH,KAAK,CACvBI,GAAG,CAAC,UAACC,IAAI,EAAEC,KAAK,EAAK;IACpB,IAAI,OAAOP,YAAY,KAAK,QAAQ,EAAE;MACpCG,eAAe,IAAIH,YAAY,CAACQ,MAAM;MACtC,OAAOR,YAAY,GAAGM,IAAI;IAC5B,CAAC,MAAM,IAAI,OAAON,YAAY,KAAK,UAAU,EAAE;MAC7C,IAAMS,eAAe,GAAGT,YAAY,CAACM,IAAI,EAAEC,KAAK,CAAC;MACjDJ,eAAe,IAAIM,eAAe,CAACD,MAAM;MACzC,OAAOR,YAAY,CAACM,IAAI,EAAEC,KAAK,CAAC,GAAGD,IAAI;IACzC;IACA,MAAMI,KAAK,CAAC,2DAA2D,CAAC;EAC1E,CAAC,CAAC,CACDC,IAAI,CAAC,IAAI,CAAC;EAEb,OAAO;IAAEP,YAAY,EAAZA,YAAY;IAAED,eAAe,EAAfA;EAAgB,CAAC;AAC1C;AAEO,IAAMS,QAAQ,GAAG,SAAXA,QAAQ,CAAIC,KAAg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,EAAE,cAAc;EACpBC,UAAU,EAAE,MAAM;EAClBC,SAAS,EAAE,cAAc;EACzBC,KAAK,EAAE,QAAQ;EACfC,WAAW,EAAE;IAAE,YAAY,EAAE,qCAAqC;IAAEC,KAAK,EAAE;EAAsC,CAAC;EAClHC,IAAI,eACF;IAAK,aAAU,cAAc;IAAC,KAAK,EAAC,IAAI;IAAC,MAAM,EAAC,IAAI;IAAC,IAAI,EAAC,KAAK;IAAC,OAAO,EAAC,aAAa;IAAA,uBACnF;MACE,IAAI,EAAC,cAAc;MACnB,CAAC,EAAC;IAA2vB;EAC7vB,EAEL;EACDC,OAAO,EAAE,iBAAC9B,KAAgB,EAAEC,GAAoB,EAAK;IACnDF,QAAQ,CAACC,KAAK,EAAEC,GAAG,EAAE,UAACR,IAAI,EAAEC,KAAK;MAAA;IAAA,CAAa,CAAC;EACjD;AACF,CAAC;AAAC"
|
|
60
60
|
}
|
package/lib/commands/preview.js
CHANGED
|
@@ -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.codePreview = exports.codeLive = exports.codeEdit = void 0;
|
|
9
|
-
|
|
10
8
|
var React = _interopRequireWildcard(require("react"));
|
|
11
|
-
|
|
12
9
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
13
|
-
|
|
14
10
|
var codePreview = {
|
|
15
11
|
name: 'preview',
|
|
16
12
|
keyCommand: 'preview',
|
|
@@ -32,7 +28,13 @@ var codePreview = {
|
|
|
32
28
|
points: "148.023 72.293 520 71.293 520 122 200.023 124 200.023 397 520 396 520 449.707 148.023 450.413"
|
|
33
29
|
})]
|
|
34
30
|
}),
|
|
35
|
-
execute: function execute() {
|
|
31
|
+
execute: function execute(state, api, dispatch, executeCommandState, shortcuts) {
|
|
32
|
+
if (shortcuts && dispatch && executeCommandState) {
|
|
33
|
+
dispatch({
|
|
34
|
+
preview: 'preview'
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
}
|
|
36
38
|
};
|
|
37
39
|
exports.codePreview = codePreview;
|
|
38
40
|
var codeEdit = {
|
|
@@ -56,7 +58,13 @@ var codeEdit = {
|
|
|
56
58
|
points: "429 71.293 520 71.293 520 122 481 123 481 396 520 396 520 449.707 429 449.413"
|
|
57
59
|
})]
|
|
58
60
|
}),
|
|
59
|
-
execute: function execute() {
|
|
61
|
+
execute: function execute(state, api, dispatch, executeCommandState, shortcuts) {
|
|
62
|
+
if (shortcuts && dispatch && executeCommandState) {
|
|
63
|
+
dispatch({
|
|
64
|
+
preview: 'edit'
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
}
|
|
60
68
|
};
|
|
61
69
|
exports.codeEdit = codeEdit;
|
|
62
70
|
var codeLive = {
|
|
@@ -80,7 +88,13 @@ var codeLive = {
|
|
|
80
88
|
points: "289 71.293 520 71.293 520 122 341 123 341 396 520 396 520 449.707 289 449.413"
|
|
81
89
|
})]
|
|
82
90
|
}),
|
|
83
|
-
execute: function execute() {
|
|
91
|
+
execute: function execute(state, api, dispatch, executeCommandState, shortcuts) {
|
|
92
|
+
if (shortcuts && dispatch && executeCommandState) {
|
|
93
|
+
dispatch({
|
|
94
|
+
preview: 'live'
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
}
|
|
84
98
|
};
|
|
85
99
|
exports.codeLive = codeLive;
|
|
86
100
|
//# sourceMappingURL=preview.js.map
|
|
@@ -10,6 +10,11 @@
|
|
|
10
10
|
"title",
|
|
11
11
|
"icon",
|
|
12
12
|
"execute",
|
|
13
|
+
"state",
|
|
14
|
+
"api",
|
|
15
|
+
"dispatch",
|
|
16
|
+
"executeCommandState",
|
|
17
|
+
"preview",
|
|
13
18
|
"codeEdit",
|
|
14
19
|
"codeLive"
|
|
15
20
|
],
|
|
@@ -17,7 +22,7 @@
|
|
|
17
22
|
"../../src/commands/preview.tsx"
|
|
18
23
|
],
|
|
19
24
|
"sourcesContent": [
|
|
20
|
-
"import * as React from 'react';\nimport { ICommand } from './';\n\nexport const codePreview: ICommand = {\n name: 'preview',\n keyCommand: 'preview',\n value: 'preview',\n shortcuts: 'ctrlcmd+9',\n buttonProps: { 'aria-label': 'Preview code (ctrl + 9)', title: 'Preview code (ctrl + 9)' },\n icon: (\n <svg width=\"12\" height=\"12\" viewBox=\"0 0 520 520\">\n <polygon\n fill=\"currentColor\"\n points=\"0 71.293 0 122 38.023 123 38.023 398 0 397 0 449.707 91.023 450.413 91.023 72.293\"\n />\n <polygon\n fill=\"currentColor\"\n points=\"148.023 72.293 520 71.293 520 122 200.023 124 200.023 397 520 396 520 449.707 148.023 450.413\"\n />\n </svg>\n ),\n execute: () => {},\n};\n\nexport const codeEdit: ICommand = {\n name: 'edit',\n keyCommand: 'preview',\n value: 'edit',\n shortcuts: 'ctrlcmd+7',\n buttonProps: { 'aria-label': 'Edit code (ctrl + 7)', title: 'Edit code (ctrl + 7)' },\n icon: (\n <svg width=\"12\" height=\"12\" viewBox=\"0 0 520 520\">\n <polygon fill=\"currentColor\" points=\"0 71.293 0 122 319 122 319 397 0 397 0 449.707 372 449.413 372 71.293\" />\n <polygon\n fill=\"currentColor\"\n points=\"429 71.293 520 71.293 520 122 481 123 481 396 520 396 520 449.707 429 449.413\"\n />\n </svg>\n ),\n execute: () => {},\n};\n\nexport const codeLive: ICommand = {\n name: 'live',\n keyCommand: 'preview',\n value: 'live',\n shortcuts: 'ctrlcmd+8',\n buttonProps: { 'aria-label': 'Live code (ctrl + 8)', title: 'Live code (ctrl + 8)' },\n icon: (\n <svg width=\"12\" height=\"12\" viewBox=\"0 0 520 520\">\n <polygon fill=\"currentColor\" points=\"0 71.293 0 122 179 122 179 397 0 397 0 449.707 232 449.413 232 71.293\" />\n <polygon\n fill=\"currentColor\"\n points=\"289 71.293 520 71.293 520 122 341 123 341 396 520 396 520 449.707 289 449.413\"\n />\n </svg>\n ),\n execute: () => {},\n};\n"
|
|
25
|
+
"import * as React from 'react';\nimport { ICommand, TextState, TextAreaTextApi } from './';\nimport { ContextStore, ExecuteCommandState } from '../Context';\n\nexport const codePreview: ICommand = {\n name: 'preview',\n keyCommand: 'preview',\n value: 'preview',\n shortcuts: 'ctrlcmd+9',\n buttonProps: { 'aria-label': 'Preview code (ctrl + 9)', title: 'Preview code (ctrl + 9)' },\n icon: (\n <svg width=\"12\" height=\"12\" viewBox=\"0 0 520 520\">\n <polygon\n fill=\"currentColor\"\n points=\"0 71.293 0 122 38.023 123 38.023 398 0 397 0 449.707 91.023 450.413 91.023 72.293\"\n />\n <polygon\n fill=\"currentColor\"\n points=\"148.023 72.293 520 71.293 520 122 200.023 124 200.023 397 520 396 520 449.707 148.023 450.413\"\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 if (shortcuts && dispatch && executeCommandState) {\n dispatch({ preview: 'preview' });\n }\n },\n};\n\nexport const codeEdit: ICommand = {\n name: 'edit',\n keyCommand: 'preview',\n value: 'edit',\n shortcuts: 'ctrlcmd+7',\n buttonProps: { 'aria-label': 'Edit code (ctrl + 7)', title: 'Edit code (ctrl + 7)' },\n icon: (\n <svg width=\"12\" height=\"12\" viewBox=\"0 0 520 520\">\n <polygon fill=\"currentColor\" points=\"0 71.293 0 122 319 122 319 397 0 397 0 449.707 372 449.413 372 71.293\" />\n <polygon\n fill=\"currentColor\"\n points=\"429 71.293 520 71.293 520 122 481 123 481 396 520 396 520 449.707 429 449.413\"\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 if (shortcuts && dispatch && executeCommandState) {\n dispatch({ preview: 'edit' });\n }\n },\n};\n\nexport const codeLive: ICommand = {\n name: 'live',\n keyCommand: 'preview',\n value: 'live',\n shortcuts: 'ctrlcmd+8',\n buttonProps: { 'aria-label': 'Live code (ctrl + 8)', title: 'Live code (ctrl + 8)' },\n icon: (\n <svg width=\"12\" height=\"12\" viewBox=\"0 0 520 520\">\n <polygon fill=\"currentColor\" points=\"0 71.293 0 122 179 122 179 397 0 397 0 449.707 232 449.413 232 71.293\" />\n <polygon\n fill=\"currentColor\"\n points=\"289 71.293 520 71.293 520 122 341 123 341 396 520 396 520 449.707 289 449.413\"\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 if (shortcuts && dispatch && executeCommandState) {\n dispatch({ preview: 'live' });\n }\n },\n};\n"
|
|
21
26
|
],
|
|
22
|
-
"mappings": "
|
|
27
|
+
"mappings": ";;;;;;;AAAA;AAA+B;AAIxB,IAAMA,WAAqB,GAAG;EACnCC,IAAI,EAAE,SAAS;EACfC,UAAU,EAAE,SAAS;EACrBC,KAAK,EAAE,SAAS;EAChBC,SAAS,EAAE,WAAW;EACtBC,WAAW,EAAE;IAAE,YAAY,EAAE,yBAAyB;IAAEC,KAAK,EAAE;EAA0B,CAAC;EAC1FC,IAAI,eACF;IAAK,KAAK,EAAC,IAAI;IAAC,MAAM,EAAC,IAAI;IAAC,OAAO,EAAC,aAAa;IAAA,wBAC/C;MACE,IAAI,EAAC,cAAc;MACnB,MAAM,EAAC;IAAmF,EAC1F,eACF;MACE,IAAI,EAAC,cAAc;MACnB,MAAM,EAAC;IAA+F,EACtG;EAAA,EAEL;EACDC,OAAO,EAAE,iBACPC,KAAgB,EAChBC,GAAoB,EACpBC,QAAuC,EACvCC,mBAAyC,EACzCR,SAAoB,EACjB;IACH,IAAIA,SAAS,IAAIO,QAAQ,IAAIC,mBAAmB,EAAE;MAChDD,QAAQ,CAAC;QAAEE,OAAO,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BAAyC,EACzCR,SAAoB,EACjB;IACH,IAAIA,SAAS,IAAIO,QAAQ,IAAIC,mBAAmB,EAAE;MAChDD,QAAQ,CAAC;QAAEE,OAAO,EAAE;MAAO,CAAC,CAAC;IAC/B;EACF;AACF,CAAC;AAAC"
|
|
23
28
|
}
|
package/lib/commands/quote.js
CHANGED
|
@@ -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.quote = 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 quote = {
|
|
17
12
|
name: 'quote',
|
|
18
13
|
keyCommand: 'quote',
|
|
@@ -40,8 +35,9 @@ var quote = {
|
|
|
40
35
|
var breaksBeforeCount = (0, _markdownUtils.getBreaksNeededForEmptyLineBefore)(state1.text, state1.selection.start);
|
|
41
36
|
var breaksBefore = Array(breaksBeforeCount + 1).join('\n');
|
|
42
37
|
var breaksAfterCount = (0, _markdownUtils.getBreaksNeededForEmptyLineAfter)(state1.text, state1.selection.end);
|
|
43
|
-
var breaksAfter = Array(breaksAfterCount + 1).join('\n');
|
|
38
|
+
var breaksAfter = Array(breaksAfterCount + 1).join('\n');
|
|
44
39
|
|
|
40
|
+
// Replaces the current selection with the quote mark up
|
|
45
41
|
api.replaceSelection("".concat(breaksBefore, "> ").concat(state1.selectedText).concat(breaksAfter));
|
|
46
42
|
var selectionStart = state1.selection.start + breaksBeforeCount + 2;
|
|
47
43
|
var selectionEnd = selectionStart + state1.selectedText.length;
|
|
@@ -39,5 +39,5 @@
|
|
|
39
39
|
"sourcesContent": [
|
|
40
40
|
"import * as React from 'react';\nimport { ICommand, TextState, TextAreaTextApi } from './';\nimport {\n getBreaksNeededForEmptyLineBefore,\n getBreaksNeededForEmptyLineAfter,\n selectWord,\n} from '../utils/markdownUtils';\n\nexport const quote: ICommand = {\n name: 'quote',\n keyCommand: 'quote',\n shortcuts: 'ctrlcmd+q',\n buttonProps: { 'aria-label': 'Insert a quote (ctrl + q)', title: 'Insert a quote (ctrl + q)' },\n icon: (\n <svg width=\"12\" height=\"12\" viewBox=\"0 0 520 520\">\n <path\n fill=\"currentColor\"\n d=\"M520,95.75 L520,225.75 C520,364.908906 457.127578,437.050625 325.040469,472.443125 C309.577578,476.586875 294.396016,464.889922 294.396016,448.881641 L294.396016,414.457031 C294.396016,404.242891 300.721328,395.025078 310.328125,391.554687 C377.356328,367.342187 414.375,349.711094 414.375,274.5 L341.25,274.5 C314.325781,274.5 292.5,252.674219 292.5,225.75 L292.5,95.75 C292.5,68.8257812 314.325781,47 341.25,47 L471.25,47 C498.174219,47 520,68.8257812 520,95.75 Z M178.75,47 L48.75,47 C21.8257813,47 0,68.8257812 0,95.75 L0,225.75 C0,252.674219 21.8257813,274.5 48.75,274.5 L121.875,274.5 C121.875,349.711094 84.8563281,367.342187 17.828125,391.554687 C8.22132813,395.025078 1.89601563,404.242891 1.89601563,414.457031 L1.89601563,448.881641 C1.89601563,464.889922 17.0775781,476.586875 32.5404687,472.443125 C164.627578,437.050625 227.5,364.908906 227.5,225.75 L227.5,95.75 C227.5,68.8257812 205.674219,47 178.75,47 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 const breaksBeforeCount = getBreaksNeededForEmptyLineBefore(state1.text, state1.selection.start);\n const breaksBefore = Array(breaksBeforeCount + 1).join('\\n');\n\n const breaksAfterCount = getBreaksNeededForEmptyLineAfter(state1.text, state1.selection.end);\n const breaksAfter = Array(breaksAfterCount + 1).join('\\n');\n\n // Replaces the current selection with the quote mark up\n api.replaceSelection(`${breaksBefore}> ${state1.selectedText}${breaksAfter}`);\n\n const selectionStart = state1.selection.start + breaksBeforeCount + 2;\n const selectionEnd = selectionStart + state1.selectedText.length;\n\n api.setSelectionRange({\n start: selectionStart,\n end: selectionEnd,\n });\n },\n};\n"
|
|
41
41
|
],
|
|
42
|
-
"mappings": "
|
|
42
|
+
"mappings": ";;;;;;;AAAA;AAEA;AAIgC;AAEzB,IAAMA,KAAe,GAAG;EAC7BC,IAAI,EAAE,OAAO;EACbC,UAAU,EAAE,OAAO;EACnBC,SAAS,EAAE,WAAW;EACtBC,WAAW,EAAE;IAAE,YAAY,EAAE,2BAA2B;IAAEC,KAAK,EAAE;EAA4B,CAAC;EAC9FC,IAAI,eACF;IAAK,KAAK,EAAC,IAAI;IAAC,MAAM,EAAC,IAAI;IAAC,OAAO,EAAC,aAAa;IAAA,uBAC/C;MACE,IAAI,EAAC,cAAc;MACnB,CAAC,EAAC;IAA05B;EAC55B,EAEL;EACDC,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,IAAMM,iBAAiB,GAAG,IAAAC,gDAAiC,EAACH,MAAM,CAACF,IAAI,EAAEE,MAAM,CAACD,SAAS,CAACK,KAAK,CAAC;IAChG,IAAMC,YAAY,GAAGC,KAAK,CAACJ,iBAAiB,GAAG,CAAC,CAAC,CAACK,IAAI,CAAC,IAAI,CAAC;IAE5D,IAAMC,gBAAgB,GAAG,IAAAC,+CAAgC,EAACT,MAAM,CAACF,IAAI,EAAEE,MAAM,CAACD,SAAS,CAACW,GAAG,CAAC;IAC5F,IAAMC,WAAW,GAAGL,KAAK,CAACE,gBAAgB,GAAG,CAAC,CAAC,CAACD,IAAI,CAAC,IAAI,CAAC;;IAE1D;IACAZ,GAAG,CAACiB,gBAAgB,WAAIP,YAAY,eAAKL,MAAM,CAACa,YAAY,SAAGF,WAAW,EAAG;IAE7E,IAAMG,cAAc,GAAGd,MAAM,CAACD,SAAS,CAACK,KAAK,GAAGF,iBAAiB,GAAG,CAAC;IACrE,IAAMa,YAAY,GAAGD,cAAc,GAAGd,MAAM,CAACa,YAAY,CAACG,MAAM;IAEhErB,GAAG,CAACM,iBAAiB,CAAC;MACpBG,KAAK,EAAEU,cAAc;MACrBJ,GAAG,EAAEK;IACP,CAAC,CAAC;EACJ;AACF,CAAC;AAAC"
|
|
43
43
|
}
|
|
@@ -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.strikethrough = 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 strikethrough = {
|
|
17
12
|
name: 'strikethrough',
|
|
18
13
|
keyCommand: 'strikethrough',
|
|
@@ -39,10 +34,10 @@ var strikethrough = {
|
|
|
39
34
|
text: state.text,
|
|
40
35
|
selection: state.selection
|
|
41
36
|
});
|
|
42
|
-
var state1 = api.setSelectionRange(newSelectionRange);
|
|
43
|
-
|
|
44
|
-
var state2 = api.replaceSelection("~~".concat(state1.selectedText, "~~"));
|
|
45
|
-
|
|
37
|
+
var state1 = api.setSelectionRange(newSelectionRange);
|
|
38
|
+
// Replaces the current selection with the strikethrough 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 - 2 - state1.selectedText.length,
|
|
48
43
|
end: state2.selection.end - 2
|
|
@@ -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 strikethrough: ICommand = {\n name: 'strikethrough',\n keyCommand: 'strikethrough',\n shortcuts: 'ctrl+shift+x',\n buttonProps: {\n 'aria-label': 'Add strikethrough text (ctrl + shift + x)',\n title: 'Add strikethrough text (ctrl + shift + x)',\n },\n value: '~~',\n icon: (\n <svg data-name=\"strikethrough\" width=\"12\" height=\"12\" role=\"img\" viewBox=\"0 0 512 512\">\n <path\n fill=\"currentColor\"\n 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\"\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 strikethrough 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 - 2 - state1.selectedText.length,\n end: state2.selection.end - 2,\n });\n },\n};\n"
|
|
33
33
|
],
|
|
34
|
-
"mappings": "
|
|
34
|
+
"mappings": ";;;;;;;AAAA;AAEA;AAAoD;AAE7C,IAAMA,aAAuB,GAAG;EACrCC,IAAI,EAAE,eAAe;EACrBC,UAAU,EAAE,eAAe;EAC3BC,SAAS,EAAE,cAAc;EACzBC,WAAW,EAAE;IACX,YAAY,EAAE,2CAA2C;IACzDC,KAAK,EAAE;EACT,CAAC;EACDC,KAAK,EAAE,IAAI;EACXC,IAAI,eACF;IAAK,aAAU,eAAe;IAAC,KAAK,EAAC,IAAI;IAAC,MAAM,EAAC,IAAI;IAAC,IAAI,EAAC,KAAK;IAAC,OAAO,EAAC,aAAa;IAAA,uBACpF;MACE,IAAI,EAAC,cAAc;MACnB,CAAC,EAAC;IAAyuB;EAC3uB,EAEL;EACDC,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,aAAMH,MAAM,CAACI,YAAY,QAAK;IACjE;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;AACF,CAAC;AAAC"
|
|
35
35
|
}
|
package/lib/commands/title.js
CHANGED
|
@@ -1,20 +1,14 @@
|
|
|
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.title = void 0;
|
|
9
|
-
|
|
10
8
|
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
|
11
|
-
|
|
12
9
|
var _react = _interopRequireDefault(require("react"));
|
|
13
|
-
|
|
14
10
|
var _title = require("./title1");
|
|
15
|
-
|
|
16
11
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
17
|
-
|
|
18
12
|
var title = (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, _title.title1), {}, {
|
|
19
13
|
icon: /*#__PURE__*/(0, _jsxRuntime.jsx)("svg", {
|
|
20
14
|
width: "12",
|
|
@@ -11,5 +11,5 @@
|
|
|
11
11
|
"sourcesContent": [
|
|
12
12
|
"import React from 'react';\nimport { ICommand } from './';\nimport { title1 } from './title1';\n\nexport const title: ICommand = {\n ...title1,\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};\n"
|
|
13
13
|
],
|
|
14
|
-
"mappings": "
|
|
14
|
+
"mappings": ";;;;;;;;AAAA;AAEA;AAAkC;AAE3B,IAAMA,KAAe,qEACvBC,aAAM;EACTC,IAAI,eACF;IAAK,KAAK,EAAC,IAAI;IAAC,MAAM,EAAC,IAAI;IAAC,OAAO,EAAC,aAAa;IAAA,uBAC/C;MACE,IAAI,EAAC,cAAc;MACnB,CAAC,EAAC;IAA24B;EAC74B;AAEL,EACF;AAAC"
|
|
15
15
|
}
|
package/lib/commands/title1.js
CHANGED
|
@@ -1,18 +1,13 @@
|
|
|
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.title1 = void 0;
|
|
9
|
-
|
|
10
8
|
var _react = _interopRequireDefault(require("react"));
|
|
11
|
-
|
|
12
9
|
var _InsertTextAtPosition = require("../utils/InsertTextAtPosition");
|
|
13
|
-
|
|
14
10
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
15
|
-
|
|
16
11
|
var title1 = {
|
|
17
12
|
name: 'title1',
|
|
18
13
|
keyCommand: 'title1',
|
|
@@ -28,5 +28,5 @@
|
|
|
28
28
|
"sourcesContent": [
|
|
29
29
|
"import React from 'react';\nimport { insertAtLineStart } from '../utils/InsertTextAtPosition';\nimport { ICommand, TextState, TextAreaTextApi } from './';\n\nexport const title1: ICommand = {\n name: 'title1',\n keyCommand: 'title1',\n shortcuts: 'ctrlcmd+1',\n value: 'title1',\n buttonProps: { 'aria-label': 'Insert title1 (ctrl + 1)', title: 'Insert title1 (ctrl + 1)' },\n icon: <div style={{ fontSize: 18, textAlign: 'left' }}>Title 1</div>,\n execute: (state: TextState, api: TextAreaTextApi) => {\n if (state.selection.start === 0 || /\\n$/.test(state.text)) {\n api.replaceSelection('# ');\n } else {\n insertAtLineStart('# ', state.selection.start, api.textArea);\n }\n },\n};\n"
|
|
30
30
|
],
|
|
31
|
-
"mappings": "
|
|
31
|
+
"mappings": ";;;;;;;AAAA;AACA;AAAkE;AAG3D,IAAMA,MAAgB,GAAG;EAC9BC,IAAI,EAAE,QAAQ;EACdC,UAAU,EAAE,QAAQ;EACpBC,SAAS,EAAE,WAAW;EACtBC,KAAK,EAAE,QAAQ;EACfC,WAAW,EAAE;IAAE,YAAY,EAAE,0BAA0B;IAAEC,KAAK,EAAE;EAA2B,CAAC;EAC5FC,IAAI,eAAE;IAAK,KAAK,EAAE;MAAEC,QAAQ,EAAE,EAAE;MAAEC,SAAS,EAAE;IAAO,CAAE;IAAA;EAAA,EAAc;EACpEC,OAAO,EAAE,iBAACC,KAAgB,EAAEC,GAAoB,EAAK;IACnD,IAAID,KAAK,CAACE,SAAS,CAACC,KAAK,KAAK,CAAC,IAAI,KAAK,CAACC,IAAI,CAACJ,KAAK,CAACK,IAAI,CAAC,EAAE;MACzDJ,GAAG,CAACK,gBAAgB,CAAC,IAAI,CAAC;IAC5B,CAAC,MAAM;MACL,IAAAC,uCAAiB,EAAC,IAAI,EAAEP,KAAK,CAACE,SAAS,CAACC,KAAK,EAAEF,GAAG,CAACO,QAAQ,CAAC;IAC9D;EACF;AACF,CAAC;AAAC"
|
|
32
32
|
}
|
package/lib/commands/title2.js
CHANGED
|
@@ -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.title2 = void 0;
|
|
9
|
-
|
|
10
8
|
var React = _interopRequireWildcard(require("react"));
|
|
11
|
-
|
|
12
9
|
var _InsertTextAtPosition = require("../utils/InsertTextAtPosition");
|
|
13
|
-
|
|
14
10
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
15
|
-
|
|
16
11
|
var title2 = {
|
|
17
12
|
name: 'title2',
|
|
18
13
|
keyCommand: 'title2',
|
|
@@ -28,5 +28,5 @@
|
|
|
28
28
|
"sourcesContent": [
|
|
29
29
|
"import * as React from 'react';\nimport { insertAtLineStart } from '../utils/InsertTextAtPosition';\nimport { ICommand, TextState, TextAreaTextApi } from './';\n\nexport const title2: ICommand = {\n name: 'title2',\n keyCommand: 'title2',\n shortcuts: 'ctrlcmd+2',\n value: 'title2',\n buttonProps: { 'aria-label': 'Insert title2 (ctrl + 2)', title: 'Insert title2 (ctrl + 2)' },\n icon: <div style={{ fontSize: 16, textAlign: 'left' }}>Title 2</div>,\n execute: (state: TextState, api: TextAreaTextApi) => {\n if (state.selection.start === 0 || /\\n$/.test(state.text)) {\n api.replaceSelection('## ');\n } else {\n insertAtLineStart('## ', state.selection.start, api.textArea);\n }\n },\n};\n"
|
|
30
30
|
],
|
|
31
|
-
"mappings": "
|
|
31
|
+
"mappings": ";;;;;;;AAAA;AACA;AAAkE;AAG3D,IAAMA,MAAgB,GAAG;EAC9BC,IAAI,EAAE,QAAQ;EACdC,UAAU,EAAE,QAAQ;EACpBC,SAAS,EAAE,WAAW;EACtBC,KAAK,EAAE,QAAQ;EACfC,WAAW,EAAE;IAAE,YAAY,EAAE,0BAA0B;IAAEC,KAAK,EAAE;EAA2B,CAAC;EAC5FC,IAAI,eAAE;IAAK,KAAK,EAAE;MAAEC,QAAQ,EAAE,EAAE;MAAEC,SAAS,EAAE;IAAO,CAAE;IAAA;EAAA,EAAc;EACpEC,OAAO,EAAE,iBAACC,KAAgB,EAAEC,GAAoB,EAAK;IACnD,IAAID,KAAK,CAACE,SAAS,CAACC,KAAK,KAAK,CAAC,IAAI,KAAK,CAACC,IAAI,CAACJ,KAAK,CAACK,IAAI,CAAC,EAAE;MACzDJ,GAAG,CAACK,gBAAgB,CAAC,KAAK,CAAC;IAC7B,CAAC,MAAM;MACL,IAAAC,uCAAiB,EAAC,KAAK,EAAEP,KAAK,CAACE,SAAS,CAACC,KAAK,EAAEF,GAAG,CAACO,QAAQ,CAAC;IAC/D;EACF;AACF,CAAC;AAAC"
|
|
32
32
|
}
|