@uiw/react-md-editor 3.19.0 → 3.19.2
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.css +2 -0
- package/dist/mdeditor.js +834 -834
- package/dist/mdeditor.min.css +1 -1
- 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 +4 -6
- package/esm/commands/code.js.map +1 -1
- package/esm/commands/comment.js +4 -4
- package/esm/commands/comment.js.map +1 -1
- 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 +4 -4
- package/esm/commands/image.js.map +1 -1
- package/esm/commands/index.d.ts +2 -2
- package/esm/commands/index.js +6 -17
- 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 +4 -11
- package/lib/commands/code.js.map +1 -1
- package/lib/commands/comment.js +4 -7
- package/lib/commands/comment.js.map +1 -1
- 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 +4 -9
- package/lib/commands/image.js.map +1 -1
- package/lib/commands/index.d.ts +2 -2
- package/lib/commands/index.js +4 -41
- package/lib/commands/index.js.map +3 -2
- 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 +2 -2
- package/src/commands/fullscreen.tsx +3 -2
- package/src/commands/index.ts +3 -1
- package/src/commands/preview.tsx +35 -4
- package/src/components/TextArea/shortcuts.ts +2 -2
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,KAAgB,EAAEC,GAAoB,EAAEd,YAAwC,EAAK;EAC5G;EACA,IAAMe,iBAAiB,GAAG,IAAAC,yBAAU,EAAC;IAAEC,IAAI,EAAEJ,KAAK,CAACI,IAAI;IAAEC,SAAS,EAAEL,KAAK,CAACK;EAAU,CAAC,CAAC;EACtF,IAAMC,MAAM,GAAGL,GAAG,CAACM,iBAAiB,CAACL,iBAAiB,CAAC;EAEvD,IAAMM,iBAAiB,GAAG,IAAAC,gDAAiC,EAACH,MAAM,CAACF,IAAI,EAAEE,MAAM,CAACD,SAAS,CAACK,KAAK,CAAC;EAChG,IAAMC,YAAY,GAAGC,KAAK,CAACJ,iBAAiB,GAAG,CAAC,CAAC,CAACV,IAAI,CAAC,IAAI,CAAC;EAE5D,IAAMe,gBAAgB,GAAG,IAAAC,+CAAgC,EAACR,MAAM,CAACF,IAAI,EAAEE,MAAM,CAACD,SAAS,CAACU,GAAG,CAAC;EAC5F,IAAMC,WAAW,GAAGJ,KAAK,CAACC,gBAAgB,GAAG,CAAC,CAAC,CAACf,IAAI,CAAC,IAAI,CAAC;EAE1D,IAAMP,YAAY,GAAGN,oBAAoB,CAACqB,MAAM,CAACpB,YAAY,EAAEC,YAAY,CAAC;EAE5Ec,GAAG,CAACgB,gBAAgB,WAAIN,YAAY,SAAGpB,YAAY,CAACA,YAAY,SAAGyB,WAAW,EAAG;;EAEjF;EACA,IAAME,cAAc,GAAGZ,MAAM,CAACpB,YAAY,CAACiC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG5B,YAAY,CAACD,eAAe,GAAG,CAAC;EAElG,IAAM8B,cAAc,GAAGd,MAAM,CAACD,SAAS,CAACK,KAAK,GAAGF,iBAAiB,GAAGU,cAAc;EAClF,IAAMG,YAAY,GAAGD,cAAc,GAAG7B,YAAY,CAACA,YAAY,CAACI,MAAM,GAAGuB,cAAc;;EAEvF;EACAjB,GAAG,CAACM,iBAAiB,CAAC;IACpBG,KAAK,EAAEU,cAAc;IACrBL,GAAG,EAAEM;EACP,CAAC,CAAC;AACJ,CAAC;AAAC;AAEK,IAAMC,oBAA8B,GAAG;EAC5CC,IAAI,EAAE,gBAAgB;EACtBC,UAAU,EAAE,MAAM;EAClBC,SAAS,EAAE,cAAc;EACzBC,KAAK,EAAE,IAAI;EACXC,WAAW,EAAE;IACX,YAAY,EAAE,uCAAuC;IACrDC,KAAK,EAAE;EACT,CAAC;EACDC,IAAI,eACF;IAAK,aAAU,gBAAgB;IAAC,KAAK,EAAC,IAAI;IAAC,MAAM,EAAC,IAAI;IAAC,OAAO,EAAC,aAAa;IAAA,uBAC1E;MACE,IAAI,EAAC,cAAc;MACnB,CAAC,EAAC;IAA8jB;EAChkB,EAEL;EACDC,OAAO,EAAE,iBAAC9B,KAAgB,EAAEC,GAAoB,EAAK;IACnDF,QAAQ,CAACC,KAAK,EAAEC,GAAG,EAAE,IAAI,CAAC;EAC5B;AACF,CAAC;AAAC;AAEK,IAAM8B,kBAA4B,GAAG;EAC1CR,IAAI,EAAE,cAAc;EACpBC,UAAU,EAAE,MAAM;EAClBC,SAAS,EAAE,cAAc;EACzBC,KAAK,EAAE,KAAK;EACZC,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;IAA62D;EAC/2D,EAEL;EACDC,OAAO,EAAE,iBAAC9B,KAAgB,EAAEC,GAAoB,EAAK;IACnDF,QAAQ,CAACC,KAAK,EAAEC,GAAG,EAAE,UAACR,IAAI,EAAEC,KAAK;MAAA,iBAAQA,KAAK,GAAG,CAAC;IAAA,CAAI,CAAC;EACzD;AACF,CAAC;AAAC;AAEK,IAAMsC,kBAA4B,GAAG;EAC1CT,IAAI,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,EAAE;MAAU,CAAC,CAAC;IAClC;EACF;AACF,CAAC;AAAC;AAEK,IAAMC,QAAkB,GAAG;EAChCb,IAAI,EAAE,MAAM;EACZC,UAAU,EAAE,SAAS;EACrBC,KAAK,EAAE,MAAM;EACbC,SAAS,EAAE,WAAW;EACtBC,WAAW,EAAE;IAAE,YAAY,EAAE,sBAAsB;IAAEC,KAAK,EAAE;EAAuB,CAAC;EACpFC,IAAI,eACF;IAAK,KAAK,EAAC,IAAI;IAAC,MAAM,EAAC,IAAI;IAAC,OAAO,EAAC,aAAa;IAAA,wBAC/C;MAAS,IAAI,EAAC,cAAc;MAAC,MAAM,EAAC;IAAuE,EAAG,eAC9G;MACE,IAAI,EAAC,cAAc;MACnB,MAAM,EAAC;IAA+E,EACtF;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,EAAE;MAAO,CAAC,CAAC;IAC/B;EACF;AACF,CAAC;AAAC;AAEK,IAAME,QAAkB,GAAG;EAChCd,IAAI,EAAE,MAAM;EACZC,UAAU,EAAE,SAAS;EACrBC,KAAK,EAAE,MAAM;EACbC,SAAS,EAAE,WAAW;EACtBC,WAAW,EAAE;IAAE,YAAY,EAAE,sBAAsB;IAAEC,KAAK,EAAE;EAAuB,CAAC;EACpFC,IAAI,eACF;IAAK,KAAK,EAAC,IAAI;IAAC,MAAM,EAAC,IAAI;IAAC,OAAO,EAAC,aAAa;IAAA,wBAC/C;MAAS,IAAI,EAAC,cAAc;MAAC,MAAM,EAAC;IAAuE,EAAG,eAC9G;MACE,IAAI,EAAC,cAAc;MACnB,MAAM,EAAC;IAA+E,EACtF;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,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
|
}
|
package/lib/commands/title3.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.title3 = 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 title3 = {
|
|
17
12
|
name: 'title3',
|
|
18
13
|
keyCommand: 'title3',
|
|
@@ -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 title3: ICommand = {\n name: 'title3',\n keyCommand: 'title3',\n shortcuts: 'ctrlcmd+3',\n value: 'title3',\n buttonProps: { 'aria-label': 'Insert title3 (ctrl + 3)', title: 'Insert title3 (ctrl + 3)' },\n icon: <div style={{ fontSize: 15, textAlign: 'left' }}>Title 3</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,MAAM,CAAC;IAC9B,CAAC,MAAM;MACL,IAAAC,uCAAiB,EAAC,MAAM,EAAEP,KAAK,CAACE,SAAS,CAACC,KAAK,EAAEF,GAAG,CAACO,QAAQ,CAAC;IAChE;EACF;AACF,CAAC;AAAC"
|
|
32
32
|
}
|
package/lib/commands/title4.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.title4 = 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 title4 = {
|
|
17
12
|
name: 'title4',
|
|
18
13
|
keyCommand: 'title4',
|
|
@@ -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 title4: ICommand = {\n name: 'title4',\n keyCommand: 'title4',\n shortcuts: 'ctrlcmd+4',\n value: 'title4',\n buttonProps: { 'aria-label': 'Insert title4 (ctrl + 4)', title: 'Insert title4 (ctrl + 4)' },\n icon: <div style={{ fontSize: 14, textAlign: 'left' }}>Title 4</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,OAAO,CAAC;IAC/B,CAAC,MAAM;MACL,IAAAC,uCAAiB,EAAC,OAAO,EAAEP,KAAK,CAACE,SAAS,CAACC,KAAK,EAAEF,GAAG,CAACO,QAAQ,CAAC;IACjE;EACF;AACF,CAAC;AAAC"
|
|
32
32
|
}
|
package/lib/commands/title5.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.title5 = 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 title5 = {
|
|
17
12
|
name: 'title5',
|
|
18
13
|
keyCommand: 'title5',
|
|
@@ -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 title5: ICommand = {\n name: 'title5',\n keyCommand: 'title5',\n shortcuts: 'ctrlcmd+5',\n value: 'title5',\n buttonProps: { 'aria-label': 'Insert title5 (ctrl + 5)', title: 'Insert title5 (ctrl + 5)' },\n icon: <div style={{ fontSize: 12, textAlign: 'left' }}>Title 5</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,QAAQ,CAAC;IAChC,CAAC,MAAM;MACL,IAAAC,uCAAiB,EAAC,QAAQ,EAAEP,KAAK,CAACE,SAAS,CAACC,KAAK,EAAEF,GAAG,CAACO,QAAQ,CAAC;IAClE;EACF;AACF,CAAC;AAAC"
|
|
32
32
|
}
|
package/lib/commands/title6.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.title6 = 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 title6 = {
|
|
17
12
|
name: 'title6',
|
|
18
13
|
keyCommand: 'title6',
|
|
@@ -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 title6: ICommand = {\n name: 'title6',\n keyCommand: 'title6',\n shortcuts: 'ctrlcmd+6',\n value: 'title6',\n buttonProps: { 'aria-label': 'Insert title6 (ctrl + 6)', title: 'Insert title6 (ctrl + 6)' },\n icon: <div style={{ fontSize: 12, textAlign: 'left' }}>Title 6</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,SAAS,CAAC;IACjC,CAAC,MAAM;MACL,IAAAC,uCAAiB,EAAC,SAAS,EAAEP,KAAK,CAACE,SAAS,CAACC,KAAK,EAAEF,GAAG,CAACO,QAAQ,CAAC;IACnE;EACF;AACF,CAAC;AAAC"
|
|
32
32
|
}
|