strapi-plugin-comments 2.1.8 → 2.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -3
- package/admin/src/components/Avatar/index.d.ts +3 -2
- package/admin/src/components/CommentReviewModal/index.d.ts +11 -0
- package/admin/src/components/CommentReviewModal/index.js +19 -0
- package/admin/src/components/ConfirmationDialog/index.d.ts +12 -10
- package/admin/src/components/ConfirmationDialog/index.js +3 -3
- package/admin/src/components/DiscussionStatus/index.d.ts +2 -1
- package/admin/src/components/DiscussionThread/index.d.ts +11 -5
- package/admin/src/components/DiscussionThread/index.js +3 -3
- package/admin/src/components/DiscussionThreadItem/index.d.ts +2 -7
- package/admin/src/components/DiscussionThreadItem/index.js +3 -12
- package/admin/src/components/DiscussionThreadItemActions/index.d.ts +10 -6
- package/admin/src/components/DiscussionThreadItemActions/index.js +75 -53
- package/admin/src/components/DiscussionThreadItemApprovalFlowActions/index.d.ts +9 -6
- package/admin/src/components/DiscussionThreadItemApprovalFlowActions/index.js +6 -9
- package/admin/src/components/DiscussionThreadItemFooter/index.d.ts +14 -7
- package/admin/src/components/DiscussionThreadItemFooter/index.js +3 -3
- package/admin/src/components/DiscussionThreadItemReviewAction/index.d.ts +14 -18
- package/admin/src/components/DiscussionThreadItemReviewAction/index.js +71 -52
- package/admin/src/components/FormSwitch/index.d.ts +2 -1
- package/admin/src/components/Hint/index.d.ts +14 -0
- package/admin/src/components/Hint/index.js +22 -0
- package/admin/src/components/LoadingIndicatorOverlay/index.d.ts +2 -1
- package/admin/src/components/ModeratorResponse/index.d.ts +8 -0
- package/admin/src/components/ModeratorResponse/index.js +108 -0
- package/admin/src/components/ModeratorResponse/styles.d.ts +2 -0
- package/admin/src/components/ModeratorResponse/styles.js +12 -0
- package/admin/src/components/ModeratorResponseModal/ModeratorResponseModal.d.ts +11 -0
- package/admin/src/components/ModeratorResponseModal/ModeratorResponseModal.js +98 -0
- package/admin/src/components/Nav/index.d.ts +2 -1
- package/admin/src/components/Nav/index.js +6 -9
- package/admin/src/components/PluginIcon/index.d.ts +2 -1
- package/admin/src/components/PluginIcon/index.js +2 -6
- package/admin/src/components/PreviewWysiwyg/Wrapper.d.ts +3 -0
- package/admin/src/components/PreviewWysiwyg/Wrapper.js +162 -0
- package/admin/src/components/PreviewWysiwyg/index.d.ts +7 -0
- package/admin/src/components/PreviewWysiwyg/index.js +39 -0
- package/admin/src/components/PreviewWysiwyg/utils/mdRenderer.d.ts +3 -0
- package/admin/src/components/PreviewWysiwyg/utils/mdRenderer.js +88 -0
- package/admin/src/components/PreviewWysiwyg/utils/satinizeHtml.d.ts +3 -0
- package/admin/src/components/PreviewWysiwyg/utils/satinizeHtml.js +18 -0
- package/admin/src/components/ReportsActions/components/BlockMenu/index.d.ts +16 -0
- package/admin/src/components/ReportsActions/components/BlockMenu/index.js +51 -0
- package/admin/src/components/ReportsActions/index.d.ts +12 -0
- package/admin/src/components/ReportsActions/index.js +31 -0
- package/admin/src/components/ReportsReviewModal/index.d.ts +14 -8
- package/admin/src/components/ReportsReviewTable/index.d.ts +13 -24
- package/admin/src/components/ReportsReviewTable/index.js +11 -24
- package/admin/src/components/StatusBadge/index.d.ts +2 -1
- package/admin/src/components/TableFilters/index.d.ts +12 -2
- package/admin/src/components/TableFilters/index.js +2 -2
- package/admin/src/components/TablePagination/index.d.ts +9 -2
- package/admin/src/components/Wysiwyg/Editor.d.ts +17 -0
- package/admin/src/components/Wysiwyg/Editor.js +84 -0
- package/admin/src/components/Wysiwyg/EditorLayout.d.ts +12 -0
- package/admin/src/components/Wysiwyg/EditorLayout.js +99 -0
- package/admin/src/components/Wysiwyg/EditorStylesContainer.d.ts +2 -0
- package/admin/src/components/Wysiwyg/EditorStylesContainer.js +348 -0
- package/admin/src/components/Wysiwyg/WysiwygFooter.d.ts +7 -0
- package/admin/src/components/Wysiwyg/WysiwygFooter.js +25 -0
- package/admin/src/components/Wysiwyg/WysiwygNav.d.ts +13 -0
- package/admin/src/components/Wysiwyg/WysiwygNav.js +118 -0
- package/admin/src/components/Wysiwyg/WysiwygStyles.d.ts +8 -0
- package/admin/src/components/Wysiwyg/WysiwygStyles.js +59 -0
- package/admin/src/components/Wysiwyg/index.d.ts +28 -0
- package/admin/src/components/Wysiwyg/index.js +136 -0
- package/admin/src/components/Wysiwyg/tests/index.test.d.ts +2 -0
- package/admin/src/components/Wysiwyg/tests/index.test.js +1633 -0
- package/admin/src/components/Wysiwyg/utils/continueList.d.ts +3 -0
- package/admin/src/components/Wysiwyg/utils/continueList.js +83 -0
- package/admin/src/components/Wysiwyg/utils/utils.d.ts +15 -0
- package/admin/src/components/Wysiwyg/utils/utils.js +249 -0
- package/admin/src/components/icons/comments.d.ts +2 -1
- package/admin/src/components/icons/index.d.ts +2 -5
- package/admin/src/components/icons/index.js +24 -12
- package/admin/src/components/icons/lock.d.ts +2 -1
- package/admin/src/components/icons/review.d.ts +2 -1
- package/admin/src/components/icons/strapiIcons.d.ts +24 -0
- package/admin/src/components/icons/strapiIcons.js +35 -0
- package/admin/src/components/icons/unlock.d.ts +2 -1
- package/admin/src/custom-fields/comments/components/icon.d.ts +3 -0
- package/admin/src/custom-fields/comments/components/icon.js +14 -0
- package/admin/src/custom-fields/comments/components/index.d.ts +3 -0
- package/admin/src/custom-fields/comments/components/index.js +19 -0
- package/admin/src/custom-fields/comments/components/input/index.d.ts +3 -0
- package/admin/src/custom-fields/comments/components/input/index.js +5 -0
- package/admin/src/custom-fields/comments/components/input/input.d.ts +4 -0
- package/admin/src/custom-fields/comments/components/input/input.js +102 -0
- package/admin/src/custom-fields/comments/components/input/types.d.ts +10 -0
- package/admin/src/custom-fields/comments/components/input/types.js +3 -0
- package/admin/src/custom-fields/comments/components/input/utils.d.ts +35 -0
- package/admin/src/custom-fields/comments/components/input/utils.js +146 -0
- package/admin/src/custom-fields/comments/index.d.ts +3 -0
- package/admin/src/custom-fields/comments/index.js +53 -0
- package/admin/src/custom-fields/index.d.ts +3 -0
- package/admin/src/custom-fields/index.js +13 -0
- package/admin/src/hooks/useConfig.d.ts +4 -4
- package/admin/src/hooks/useConfig.js +3 -6
- package/admin/src/hooks/useReportsActionsHandlers.d.ts +19 -0
- package/admin/src/hooks/useReportsActionsHandlers.js +70 -0
- package/admin/src/index.d.ts +2 -1
- package/admin/src/index.js +4 -2
- package/admin/src/pages/App/index.js +8 -7
- package/admin/src/pages/App/reducer/index.d.ts +1 -1
- package/admin/src/pages/ComingSoonPage/index.d.ts +2 -1
- package/admin/src/pages/ComingSoonPage/index.js +2 -2
- package/admin/src/pages/Details/components/DetailsEntity/index.d.ts +8 -6
- package/admin/src/pages/Details/components/DetailsFilters/index.d.ts +5 -3
- package/admin/src/pages/Details/index.js +10 -7
- package/admin/src/pages/Discover/components/DiscoverTableRow/index.d.ts +11 -5
- package/admin/src/pages/Discover/components/DiscoverTableRow/index.js +7 -81
- package/admin/src/pages/Discover/index.js +14 -13
- package/admin/src/pages/NoAccessPage/index.d.ts +4 -0
- package/admin/src/pages/NoAccessPage/index.js +31 -0
- package/admin/src/pages/Reports/components/ReportsTableRow/index.d.ts +16 -0
- package/admin/src/pages/Reports/components/ReportsTableRow/index.js +91 -0
- package/admin/src/pages/Reports/components/ReportsTableRow/styles.d.ts +2 -0
- package/admin/src/pages/Reports/components/ReportsTableRow/styles.js +14 -0
- package/admin/src/pages/Reports/index.d.ts +4 -0
- package/admin/src/pages/Reports/index.js +196 -0
- package/admin/src/pages/Reports/utils/api.d.ts +2 -0
- package/admin/src/pages/Reports/utils/api.js +16 -0
- package/admin/src/pages/Reports/utils/filtersSchema.d.ts +11 -0
- package/admin/src/pages/Reports/utils/filtersSchema.js +11 -0
- package/admin/src/pages/Settings/index.d.ts +2 -1
- package/admin/src/pages/Settings/index.js +6 -7
- package/admin/src/pages/utils/api.d.ts +17 -10
- package/admin/src/pages/utils/api.js +25 -2
- package/admin/src/reducers.d.ts +1 -1
- package/admin/src/translations/en.json +49 -1
- package/admin/src/utils/axiosInstance.d.ts +1 -1
- package/admin/src/utils/constants.d.ts +9 -5
- package/admin/src/utils/constants.js +5 -3
- package/admin/src/utils/errors.d.ts +5 -0
- package/admin/src/utils/errors.js +10 -0
- package/admin/src/utils/functions.d.ts +2 -0
- package/admin/src/utils/functions.js +11 -0
- package/admin/src/utils/getMessage.d.ts +1 -1
- package/admin/src/utils/getMessage.js +1 -1
- package/admin/src/utils/getRelatedGroups.d.ts +6 -2
- package/admin/src/utils/handleAPIError.d.ts +1 -1
- package/admin/src/utils/index.d.ts +16 -11
- package/admin/src/utils/index.js +12 -1
- package/admin/src/utils/resolveCommentStatus.d.ts +8 -2
- package/admin/src/utils/resolveReportStatus.d.ts +4 -0
- package/admin/src/utils/resolveReportStatus.js +23 -0
- package/admin/src/utils/resolveReportStatusColor.d.ts +4 -0
- package/admin/src/utils/resolveReportStatusColor.js +17 -0
- package/package.json +6 -3
- package/server/controllers/admin.js +67 -2
- package/server/index.d.ts +1 -1
- package/server/register/custom-fields/comments.d.ts +6 -0
- package/server/register/custom-fields/comments.js +9 -0
- package/server/register/custom-fields/index.d.ts +3 -0
- package/server/register/custom-fields/index.js +14 -0
- package/server/register/index.d.ts +4 -0
- package/server/register/index.js +8 -0
- package/server/routes/admin.js +56 -0
- package/server/services/admin.d.ts +1 -1
- package/server/services/admin.js +196 -10
- package/server/utils/error.js +1 -1
- package/strapi-server.d.ts +1 -1
- package/tsconfig.tsbuildinfo +1 -1
- package/types/utils.d.ts +5 -0
- package/types/utils.js +10 -0
- package/server/register.d.ts +0 -3
- package/server/register.js +0 -4
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const codemirror_1 = __importDefault(require("codemirror"));
|
|
7
|
+
var listRE = /^(\s*)(>[> ]*|[*+-] \[[x ]\]\s|[*+-]\s|(\d+)([.)]))(\s*)/, emptyListRE = /^(\s*)(>[> ]*|[*+-] \[[x ]\]|[*+-]|(\d+)[.)])(\s*)$/, unorderedListRE = /[*+-]\s/;
|
|
8
|
+
function newlineAndIndentContinueMarkdownList(cm) {
|
|
9
|
+
if (cm.getOption('disableInput'))
|
|
10
|
+
return codemirror_1.default.Pass;
|
|
11
|
+
var ranges = cm.listSelections(), replacements = [];
|
|
12
|
+
for (var i = 0; i < ranges.length; i++) {
|
|
13
|
+
var pos = ranges[i].head;
|
|
14
|
+
var eolState = cm.getStateAfter(pos.line);
|
|
15
|
+
var inList = eolState.list !== false;
|
|
16
|
+
var inQuote = eolState.quote !== 0;
|
|
17
|
+
var line = cm.getLine(pos.line), match = listRE.exec(line);
|
|
18
|
+
var cursorBeforeBullet = /^\s*$/.test(line.slice(0, pos.ch));
|
|
19
|
+
if (!ranges[i].empty() || (!inList && !inQuote) || !match || cursorBeforeBullet) {
|
|
20
|
+
cm.execCommand('newlineAndIndent');
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
if (emptyListRE.test(line)) {
|
|
24
|
+
var endOfQuote = inQuote && />\s*$/.test(line);
|
|
25
|
+
var endOfList = !/>\s*$/.test(line);
|
|
26
|
+
if (endOfQuote || endOfList)
|
|
27
|
+
cm.replaceRange('', {
|
|
28
|
+
line: pos.line,
|
|
29
|
+
ch: 0,
|
|
30
|
+
}, {
|
|
31
|
+
line: pos.line,
|
|
32
|
+
ch: pos.ch + 1,
|
|
33
|
+
});
|
|
34
|
+
replacements[i] = '\n';
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
var indent = match[1], after = match[5];
|
|
38
|
+
var numbered = !(unorderedListRE.test(match[2]) || match[2].indexOf('>') >= 0);
|
|
39
|
+
var bullet = numbered ? parseInt(match[3], 10) + 1 + match[4] : match[2].replace('x', ' ');
|
|
40
|
+
replacements[i] = '\n' + indent + bullet + after;
|
|
41
|
+
if (numbered)
|
|
42
|
+
incrementRemainingMarkdownListNumbers(cm, pos);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
cm.replaceSelections(replacements);
|
|
46
|
+
}
|
|
47
|
+
function incrementRemainingMarkdownListNumbers(cm, pos) {
|
|
48
|
+
var startLine = pos.line, lookAhead = 0, skipCount = 0;
|
|
49
|
+
var startItem = listRE.exec(cm.getLine(startLine)), startIndent = startItem[1];
|
|
50
|
+
do {
|
|
51
|
+
lookAhead += 1;
|
|
52
|
+
var nextLineNumber = startLine + lookAhead;
|
|
53
|
+
var nextLine = cm.getLine(nextLineNumber);
|
|
54
|
+
var nextItem = listRE.exec(nextLine);
|
|
55
|
+
if (nextItem) {
|
|
56
|
+
var nextIndent = nextItem[1];
|
|
57
|
+
var newNumber = parseInt(startItem[3], 10) + lookAhead - skipCount;
|
|
58
|
+
var nextNumber = parseInt(nextItem[3], 10), itemNumber = nextNumber;
|
|
59
|
+
if (startIndent === nextIndent && !isNaN(nextNumber)) {
|
|
60
|
+
if (newNumber === nextNumber)
|
|
61
|
+
itemNumber = nextNumber + 1;
|
|
62
|
+
if (newNumber > nextNumber)
|
|
63
|
+
itemNumber = newNumber + 1;
|
|
64
|
+
cm.replaceRange(nextLine.replace(listRE, nextIndent + itemNumber + nextItem[4] + nextItem[5]), {
|
|
65
|
+
line: nextLineNumber,
|
|
66
|
+
ch: 0,
|
|
67
|
+
}, {
|
|
68
|
+
line: nextLineNumber,
|
|
69
|
+
ch: nextLine.length,
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
else {
|
|
73
|
+
if (startIndent.length > nextIndent.length)
|
|
74
|
+
return;
|
|
75
|
+
if (startIndent.length < nextIndent.length && lookAhead === 1)
|
|
76
|
+
return;
|
|
77
|
+
skipCount += 1;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
} while (nextItem);
|
|
81
|
+
}
|
|
82
|
+
exports.default = newlineAndIndentContinueMarkdownList;
|
|
83
|
+
//# sourceMappingURL=continueList.js.map
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export declare const replaceText: (markdownName: any, textToChange: any) => any;
|
|
2
|
+
export declare const insertText: (markdownName: any) => {
|
|
3
|
+
editedText: string;
|
|
4
|
+
selection: {
|
|
5
|
+
start: any;
|
|
6
|
+
end: number;
|
|
7
|
+
};
|
|
8
|
+
};
|
|
9
|
+
export declare const insertListOrTitle: (markdown: any) => string;
|
|
10
|
+
export declare const markdownHandler: (editor: any, markdownType: any) => void;
|
|
11
|
+
export declare const listHandler: (editor: any, listType: any) => void;
|
|
12
|
+
export declare const titleHandler: (editor: any, titleType: any) => void;
|
|
13
|
+
export declare const insertFile: (editor: any, files: any) => void;
|
|
14
|
+
export declare const quoteAndCodeHandler: (editor: any, markdownType: any) => void;
|
|
15
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.quoteAndCodeHandler = exports.insertFile = exports.titleHandler = exports.listHandler = exports.markdownHandler = exports.insertListOrTitle = exports.insertText = exports.replaceText = void 0;
|
|
4
|
+
const replaceText = (markdownName, textToChange) => {
|
|
5
|
+
let editedText;
|
|
6
|
+
switch (markdownName) {
|
|
7
|
+
case 'Strikethrough':
|
|
8
|
+
editedText = `~~${textToChange}~~`;
|
|
9
|
+
break;
|
|
10
|
+
case 'Bold':
|
|
11
|
+
editedText = `**${textToChange}**`;
|
|
12
|
+
break;
|
|
13
|
+
case 'Italic':
|
|
14
|
+
editedText = `_${textToChange}_`;
|
|
15
|
+
break;
|
|
16
|
+
case 'Underline':
|
|
17
|
+
editedText = `<u>${textToChange}</u>`;
|
|
18
|
+
break;
|
|
19
|
+
case 'Code':
|
|
20
|
+
editedText = `\`\`\`\n${textToChange}\n\`\`\``;
|
|
21
|
+
break;
|
|
22
|
+
case 'Link':
|
|
23
|
+
editedText = `[${textToChange}](link)`;
|
|
24
|
+
break;
|
|
25
|
+
case 'Quote':
|
|
26
|
+
editedText = `>${textToChange}`;
|
|
27
|
+
break;
|
|
28
|
+
default:
|
|
29
|
+
editedText = textToChange;
|
|
30
|
+
}
|
|
31
|
+
return editedText;
|
|
32
|
+
};
|
|
33
|
+
exports.replaceText = replaceText;
|
|
34
|
+
const insertText = markdownName => {
|
|
35
|
+
let editedText;
|
|
36
|
+
let selection = { start: markdownName.length, end: 0 };
|
|
37
|
+
switch (markdownName) {
|
|
38
|
+
case 'Strikethrough':
|
|
39
|
+
editedText = `~~${markdownName}~~`;
|
|
40
|
+
selection.end = 2;
|
|
41
|
+
break;
|
|
42
|
+
case 'Bold':
|
|
43
|
+
editedText = `**${markdownName}**`;
|
|
44
|
+
selection.end = 2;
|
|
45
|
+
break;
|
|
46
|
+
case 'Italic':
|
|
47
|
+
editedText = `_${markdownName}_`;
|
|
48
|
+
selection.end = 1;
|
|
49
|
+
break;
|
|
50
|
+
case 'alt':
|
|
51
|
+
editedText = `[${markdownName}]()`;
|
|
52
|
+
selection.end = 3;
|
|
53
|
+
break;
|
|
54
|
+
case 'Underline':
|
|
55
|
+
editedText = `<u>${markdownName}</u>`;
|
|
56
|
+
selection.end = 4;
|
|
57
|
+
break;
|
|
58
|
+
case 'Code':
|
|
59
|
+
editedText = `\`\`\`\n${markdownName}\n\`\`\``;
|
|
60
|
+
selection.end = 3;
|
|
61
|
+
break;
|
|
62
|
+
case 'Link':
|
|
63
|
+
editedText = `[${markdownName}](link)`;
|
|
64
|
+
selection.end = 7;
|
|
65
|
+
break;
|
|
66
|
+
case 'Quote':
|
|
67
|
+
editedText = `>${markdownName}`;
|
|
68
|
+
selection.end = 0;
|
|
69
|
+
break;
|
|
70
|
+
default:
|
|
71
|
+
editedText = '';
|
|
72
|
+
}
|
|
73
|
+
return { editedText, selection };
|
|
74
|
+
};
|
|
75
|
+
exports.insertText = insertText;
|
|
76
|
+
const insertListOrTitle = markdown => {
|
|
77
|
+
let textToInsert;
|
|
78
|
+
switch (markdown) {
|
|
79
|
+
case 'BulletList':
|
|
80
|
+
textToInsert = '- ';
|
|
81
|
+
break;
|
|
82
|
+
case 'NumberList':
|
|
83
|
+
textToInsert = '1. ';
|
|
84
|
+
break;
|
|
85
|
+
case 'h1':
|
|
86
|
+
textToInsert = '# ';
|
|
87
|
+
break;
|
|
88
|
+
case 'h2':
|
|
89
|
+
textToInsert = '## ';
|
|
90
|
+
break;
|
|
91
|
+
case 'h3':
|
|
92
|
+
textToInsert = '### ';
|
|
93
|
+
break;
|
|
94
|
+
case 'h4':
|
|
95
|
+
textToInsert = '#### ';
|
|
96
|
+
break;
|
|
97
|
+
case 'h5':
|
|
98
|
+
textToInsert = '##### ';
|
|
99
|
+
break;
|
|
100
|
+
case 'h6':
|
|
101
|
+
textToInsert = '###### ';
|
|
102
|
+
break;
|
|
103
|
+
default:
|
|
104
|
+
return '';
|
|
105
|
+
}
|
|
106
|
+
return textToInsert;
|
|
107
|
+
};
|
|
108
|
+
exports.insertListOrTitle = insertListOrTitle;
|
|
109
|
+
const markdownHandler = (editor, markdownType) => {
|
|
110
|
+
const textToEdit = editor.current.getSelection();
|
|
111
|
+
let textToInsert;
|
|
112
|
+
if (textToEdit) {
|
|
113
|
+
const editedText = (0, exports.replaceText)(markdownType, textToEdit);
|
|
114
|
+
editor.current.replaceSelection(editedText);
|
|
115
|
+
editor.current.focus();
|
|
116
|
+
}
|
|
117
|
+
else {
|
|
118
|
+
textToInsert = (0, exports.insertText)(markdownType);
|
|
119
|
+
editor.current.replaceSelection(textToInsert.editedText);
|
|
120
|
+
editor.current.focus();
|
|
121
|
+
const { line, ch } = editor.current.getCursor();
|
|
122
|
+
const endSelection = ch - textToInsert.selection.end;
|
|
123
|
+
const startSelection = ch - textToInsert.selection.end - textToInsert.selection.start;
|
|
124
|
+
editor.current.setSelection({ line, ch: startSelection }, { line, ch: endSelection });
|
|
125
|
+
}
|
|
126
|
+
};
|
|
127
|
+
exports.markdownHandler = markdownHandler;
|
|
128
|
+
const listHandler = (editor, listType) => {
|
|
129
|
+
const doc = editor.current.getDoc();
|
|
130
|
+
const insertion = listType === 'BulletList' ? '- ' : '1. ';
|
|
131
|
+
if (doc.somethingSelected()) {
|
|
132
|
+
const selections = doc.listSelections();
|
|
133
|
+
let remove = null;
|
|
134
|
+
editor.current.operation(function () {
|
|
135
|
+
selections.forEach(function (selection) {
|
|
136
|
+
const pos = [selection.head.line, selection.anchor.line].sort();
|
|
137
|
+
if (remove == null) {
|
|
138
|
+
remove = doc.getLine(pos[0]).startsWith(insertion);
|
|
139
|
+
}
|
|
140
|
+
for (let i = pos[0]; i <= pos[1]; i++) {
|
|
141
|
+
if (remove) {
|
|
142
|
+
if (doc.getLine(i).startsWith(insertion)) {
|
|
143
|
+
doc.replaceRange('', { line: i, ch: 0 }, { line: i, ch: insertion.length });
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
else {
|
|
147
|
+
const lineInsertion = listType === 'BulletList' ? '- ' : `${i + 1}. `;
|
|
148
|
+
doc.replaceRange(lineInsertion, { line: i, ch: 0 });
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
});
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
else {
|
|
155
|
+
let { line: currentLine } = doc.getCursor();
|
|
156
|
+
const listToInsert = (0, exports.insertListOrTitle)(listType);
|
|
157
|
+
const lineContent = editor.current.getLine(currentLine);
|
|
158
|
+
const textToInsert = listToInsert + lineContent;
|
|
159
|
+
editor.current.setSelection({ line: currentLine, ch: 0 }, { line: currentLine, ch: lineContent.length });
|
|
160
|
+
editor.current.replaceSelection(textToInsert);
|
|
161
|
+
}
|
|
162
|
+
editor.current.focus();
|
|
163
|
+
};
|
|
164
|
+
exports.listHandler = listHandler;
|
|
165
|
+
const titleHandler = (editor, titleType) => {
|
|
166
|
+
let { line: currentLine } = editor.current.getCursor();
|
|
167
|
+
const titleToInsert = (0, exports.insertListOrTitle)(titleType);
|
|
168
|
+
const lineContent = editor.current.getLine(currentLine);
|
|
169
|
+
const lineWithNoTitle = lineContent.replace(/#{1,6}\s/g, '').trim();
|
|
170
|
+
const textToInsert = titleToInsert + lineWithNoTitle;
|
|
171
|
+
editor.current.setSelection({ line: currentLine, ch: 0 }, { line: currentLine, ch: lineContent.length });
|
|
172
|
+
editor.current.replaceSelection(textToInsert);
|
|
173
|
+
setTimeout(() => {
|
|
174
|
+
const newLastLineLength = editor.current.getLine(currentLine).length;
|
|
175
|
+
editor.current.focus();
|
|
176
|
+
editor.current.setCursor({ line: currentLine, ch: newLastLineLength });
|
|
177
|
+
}, 0);
|
|
178
|
+
};
|
|
179
|
+
exports.titleHandler = titleHandler;
|
|
180
|
+
const insertFile = (editor, files) => {
|
|
181
|
+
let { line, ch } = editor.current.getCursor();
|
|
182
|
+
files.forEach((file, i) => {
|
|
183
|
+
let contentLength = editor.current.getLine(line).length;
|
|
184
|
+
editor.current.setCursor({ line, ch: contentLength });
|
|
185
|
+
if (i > 0 || (i === 0 && ch !== 0)) {
|
|
186
|
+
contentLength = editor.current.getLine(line).length;
|
|
187
|
+
editor.current.setCursor({ line, ch: contentLength });
|
|
188
|
+
line++;
|
|
189
|
+
editor.current.replaceSelection('\n');
|
|
190
|
+
}
|
|
191
|
+
if (file.mime.includes('image')) {
|
|
192
|
+
editor.current.replaceSelection(``);
|
|
193
|
+
}
|
|
194
|
+
else {
|
|
195
|
+
editor.current.replaceSelection(`[${file.alt}](${file.url})`);
|
|
196
|
+
}
|
|
197
|
+
});
|
|
198
|
+
setTimeout(() => editor.current.focus(), 0);
|
|
199
|
+
};
|
|
200
|
+
exports.insertFile = insertFile;
|
|
201
|
+
const insertWithTextToEdit = (editor, markdownType, line, contentLength, textToEdit) => {
|
|
202
|
+
const textToInsert = (0, exports.replaceText)(markdownType, textToEdit);
|
|
203
|
+
const contentToMove = editor.current.getRange({ line: line + 1, ch: 0 }, { line: Infinity, ch: Infinity });
|
|
204
|
+
editor.current.replaceRange('', { line: line + 1, ch: 0 }, { line: Infinity, ch: Infinity });
|
|
205
|
+
editor.current.replaceSelection('');
|
|
206
|
+
editor.current.setCursor({ line, ch: contentLength });
|
|
207
|
+
editor.current.replaceSelection('\n');
|
|
208
|
+
editor.current.replaceSelection(textToInsert);
|
|
209
|
+
if (markdownType === 'Code') {
|
|
210
|
+
let { line: newLine } = editor.current.getCursor();
|
|
211
|
+
editor.current.setCursor({ line: newLine - 1, ch: textToEdit.length });
|
|
212
|
+
}
|
|
213
|
+
editor.current.replaceRange(contentToMove, { line: line + 4, ch: 0 }, { line: Infinity, ch: Infinity });
|
|
214
|
+
editor.current.focus();
|
|
215
|
+
};
|
|
216
|
+
const insertWithoutTextToEdit = (editor, markdownType, line, contentLength) => {
|
|
217
|
+
const textToInsert = (0, exports.insertText)(markdownType);
|
|
218
|
+
const contentToMove = editor.current.getRange({ line: line + 1, ch: 0 }, { line: Infinity, ch: Infinity });
|
|
219
|
+
editor.current.replaceRange('', { line: line + 1, ch: 0 }, { line: Infinity, ch: Infinity });
|
|
220
|
+
editor.current.setCursor({ line, ch: contentLength });
|
|
221
|
+
editor.current.replaceSelection('\n');
|
|
222
|
+
editor.current.replaceSelection(textToInsert.editedText);
|
|
223
|
+
if (markdownType === 'Code') {
|
|
224
|
+
line += 2;
|
|
225
|
+
editor.current.setSelection({ line, ch: 0 }, { line, ch: 4 });
|
|
226
|
+
}
|
|
227
|
+
else {
|
|
228
|
+
line += 1;
|
|
229
|
+
let { ch } = editor.current.getCursor();
|
|
230
|
+
let endSelection = ch - textToInsert.selection.end;
|
|
231
|
+
let startSelection = ch - textToInsert.selection.end - textToInsert.selection.start;
|
|
232
|
+
editor.current.setSelection({ line, ch: startSelection }, { line, ch: endSelection });
|
|
233
|
+
}
|
|
234
|
+
editor.current.replaceRange(contentToMove, { line: line + 2, ch: 0 }, { line: Infinity, ch: Infinity });
|
|
235
|
+
editor.current.focus();
|
|
236
|
+
};
|
|
237
|
+
const quoteAndCodeHandler = (editor, markdownType) => {
|
|
238
|
+
const textToEdit = editor.current.getSelection();
|
|
239
|
+
let { line } = editor.current.getCursor();
|
|
240
|
+
let contentLength = editor.current.getLine(line).length;
|
|
241
|
+
if (textToEdit) {
|
|
242
|
+
insertWithTextToEdit(editor, markdownType, line, contentLength, textToEdit);
|
|
243
|
+
}
|
|
244
|
+
else {
|
|
245
|
+
insertWithoutTextToEdit(editor, markdownType, line, contentLength);
|
|
246
|
+
}
|
|
247
|
+
};
|
|
248
|
+
exports.quoteAndCodeHandler = quoteAndCodeHandler;
|
|
249
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
import LockIcon from "./lock";
|
|
4
|
-
import UnlockIcon from "./unlock";
|
|
5
|
-
export { CommentsIcon, ReviewIcon, LockIcon, UnlockIcon };
|
|
1
|
+
import { apps, arrowLeft, arrowRight, arrowUp, carretDown, check, comments, cross, emptyPictures, exclamationMarkCircle, eye, filter, illo, information, lock, play, refresh, review, unlock, trash, pencil, plus } from "./strapiIcons";
|
|
2
|
+
export { apps, arrowLeft, arrowRight, arrowUp, carretDown, check, comments, cross, emptyPictures, exclamationMarkCircle, eye, filter, illo, information, lock, play, refresh, review, unlock, trash, pencil, plus };
|
|
6
3
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,15 +1,27 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
7
|
-
const
|
|
8
|
-
exports
|
|
9
|
-
|
|
10
|
-
exports
|
|
11
|
-
|
|
12
|
-
exports
|
|
13
|
-
|
|
14
|
-
exports
|
|
3
|
+
exports.plus = exports.pencil = exports.trash = exports.unlock = exports.review = exports.refresh = exports.play = exports.lock = exports.information = exports.illo = exports.filter = exports.eye = exports.exclamationMarkCircle = exports.emptyPictures = exports.cross = exports.comments = exports.check = exports.carretDown = exports.arrowUp = exports.arrowRight = exports.arrowLeft = exports.apps = void 0;
|
|
4
|
+
const strapiIcons_1 = require("./strapiIcons");
|
|
5
|
+
Object.defineProperty(exports, "apps", { enumerable: true, get: function () { return strapiIcons_1.apps; } });
|
|
6
|
+
Object.defineProperty(exports, "arrowLeft", { enumerable: true, get: function () { return strapiIcons_1.arrowLeft; } });
|
|
7
|
+
Object.defineProperty(exports, "arrowRight", { enumerable: true, get: function () { return strapiIcons_1.arrowRight; } });
|
|
8
|
+
Object.defineProperty(exports, "arrowUp", { enumerable: true, get: function () { return strapiIcons_1.arrowUp; } });
|
|
9
|
+
Object.defineProperty(exports, "carretDown", { enumerable: true, get: function () { return strapiIcons_1.carretDown; } });
|
|
10
|
+
Object.defineProperty(exports, "check", { enumerable: true, get: function () { return strapiIcons_1.check; } });
|
|
11
|
+
Object.defineProperty(exports, "comments", { enumerable: true, get: function () { return strapiIcons_1.comments; } });
|
|
12
|
+
Object.defineProperty(exports, "cross", { enumerable: true, get: function () { return strapiIcons_1.cross; } });
|
|
13
|
+
Object.defineProperty(exports, "emptyPictures", { enumerable: true, get: function () { return strapiIcons_1.emptyPictures; } });
|
|
14
|
+
Object.defineProperty(exports, "exclamationMarkCircle", { enumerable: true, get: function () { return strapiIcons_1.exclamationMarkCircle; } });
|
|
15
|
+
Object.defineProperty(exports, "eye", { enumerable: true, get: function () { return strapiIcons_1.eye; } });
|
|
16
|
+
Object.defineProperty(exports, "filter", { enumerable: true, get: function () { return strapiIcons_1.filter; } });
|
|
17
|
+
Object.defineProperty(exports, "illo", { enumerable: true, get: function () { return strapiIcons_1.illo; } });
|
|
18
|
+
Object.defineProperty(exports, "information", { enumerable: true, get: function () { return strapiIcons_1.information; } });
|
|
19
|
+
Object.defineProperty(exports, "lock", { enumerable: true, get: function () { return strapiIcons_1.lock; } });
|
|
20
|
+
Object.defineProperty(exports, "play", { enumerable: true, get: function () { return strapiIcons_1.play; } });
|
|
21
|
+
Object.defineProperty(exports, "refresh", { enumerable: true, get: function () { return strapiIcons_1.refresh; } });
|
|
22
|
+
Object.defineProperty(exports, "review", { enumerable: true, get: function () { return strapiIcons_1.review; } });
|
|
23
|
+
Object.defineProperty(exports, "unlock", { enumerable: true, get: function () { return strapiIcons_1.unlock; } });
|
|
24
|
+
Object.defineProperty(exports, "trash", { enumerable: true, get: function () { return strapiIcons_1.trash; } });
|
|
25
|
+
Object.defineProperty(exports, "pencil", { enumerable: true, get: function () { return strapiIcons_1.pencil; } });
|
|
26
|
+
Object.defineProperty(exports, "plus", { enumerable: true, get: function () { return strapiIcons_1.plus; } });
|
|
15
27
|
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare const apps: JSX.Element;
|
|
3
|
+
export declare const arrowLeft: JSX.Element;
|
|
4
|
+
export declare const arrowRight: JSX.Element;
|
|
5
|
+
export declare const arrowUp: JSX.Element;
|
|
6
|
+
export declare const carretDown: JSX.Element;
|
|
7
|
+
export declare const check: JSX.Element;
|
|
8
|
+
export declare const cross: JSX.Element;
|
|
9
|
+
export declare const emptyPictures: JSX.Element;
|
|
10
|
+
export declare const exclamationMarkCircle: JSX.Element;
|
|
11
|
+
export declare const eye: JSX.Element;
|
|
12
|
+
export declare const filter: JSX.Element;
|
|
13
|
+
export declare const illo: JSX.Element;
|
|
14
|
+
export declare const information: JSX.Element;
|
|
15
|
+
export declare const play: JSX.Element;
|
|
16
|
+
export declare const refresh: JSX.Element;
|
|
17
|
+
export declare const review: JSX.Element;
|
|
18
|
+
export declare const lock: JSX.Element;
|
|
19
|
+
export declare const unlock: JSX.Element;
|
|
20
|
+
export declare const comments: JSX.Element;
|
|
21
|
+
export declare const trash: JSX.Element;
|
|
22
|
+
export declare const pencil: JSX.Element;
|
|
23
|
+
export declare const plus: JSX.Element;
|
|
24
|
+
//# sourceMappingURL=strapiIcons.d.ts.map
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.plus = exports.pencil = exports.trash = exports.comments = exports.unlock = exports.lock = exports.review = exports.refresh = exports.play = exports.information = exports.illo = exports.filter = exports.eye = exports.exclamationMarkCircle = exports.emptyPictures = exports.cross = exports.check = exports.carretDown = exports.arrowUp = exports.arrowRight = exports.arrowLeft = exports.apps = void 0;
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const icons_1 = require("@strapi/icons");
|
|
9
|
+
const review_1 = __importDefault(require("./review"));
|
|
10
|
+
const lock_1 = __importDefault(require("./lock"));
|
|
11
|
+
const unlock_1 = __importDefault(require("./unlock"));
|
|
12
|
+
const comments_1 = __importDefault(require("./comments"));
|
|
13
|
+
exports.apps = react_1.default.createElement(icons_1.Apps, null);
|
|
14
|
+
exports.arrowLeft = react_1.default.createElement(icons_1.ArrowLeft, null);
|
|
15
|
+
exports.arrowRight = react_1.default.createElement(icons_1.ArrowRight, null);
|
|
16
|
+
exports.arrowUp = react_1.default.createElement(icons_1.ArrowUp, null);
|
|
17
|
+
exports.carretDown = react_1.default.createElement(icons_1.CarretDown, null);
|
|
18
|
+
exports.check = react_1.default.createElement(icons_1.Check, null);
|
|
19
|
+
exports.cross = react_1.default.createElement(icons_1.Cross, null);
|
|
20
|
+
exports.emptyPictures = react_1.default.createElement(icons_1.EmptyPictures, { width: "10rem" });
|
|
21
|
+
exports.exclamationMarkCircle = react_1.default.createElement(icons_1.ExclamationMarkCircle, null);
|
|
22
|
+
exports.eye = react_1.default.createElement(icons_1.Eye, null);
|
|
23
|
+
exports.filter = react_1.default.createElement(icons_1.Filter, null);
|
|
24
|
+
exports.illo = react_1.default.createElement(icons_1.Illo, null);
|
|
25
|
+
exports.information = react_1.default.createElement(icons_1.Information, { "aria-hidden": true });
|
|
26
|
+
exports.play = react_1.default.createElement(icons_1.Play, null);
|
|
27
|
+
exports.refresh = react_1.default.createElement(icons_1.Refresh, null);
|
|
28
|
+
exports.review = react_1.default.createElement(review_1.default, null);
|
|
29
|
+
exports.lock = react_1.default.createElement(lock_1.default, null);
|
|
30
|
+
exports.unlock = react_1.default.createElement(unlock_1.default, null);
|
|
31
|
+
exports.comments = react_1.default.createElement(comments_1.default, null);
|
|
32
|
+
exports.trash = react_1.default.createElement(icons_1.Trash, null);
|
|
33
|
+
exports.pencil = react_1.default.createElement(icons_1.Pencil, null);
|
|
34
|
+
exports.plus = react_1.default.createElement(icons_1.Plus, null);
|
|
35
|
+
//# sourceMappingURL=strapiIcons.js.map
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.CustomFieldIcon = void 0;
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const CustomFieldIcon = () => (react_1.default.createElement("svg", { width: "2em", height: "1.5em", viewBox: "0 0 50 36", fill: "none", xmlns: "http://www.w3.org/2000/svg" },
|
|
9
|
+
react_1.default.createElement("rect", { x: "0.75", y: "0.75", width: "48.5", height: "34.5", rx: "2.25", fill: "#FDF4DC", stroke: "#FAE7B9", "stroke-width": "1.5" }),
|
|
10
|
+
react_1.default.createElement("path", { d: "M34 10H16V23.6098H21.7073L25.2195 28L28.2927 23.6098H34V10Z", stroke: "#D9822F", "stroke-width": "1.5" }),
|
|
11
|
+
react_1.default.createElement("path", { d: "M21.2686 15.2676H28.2929", stroke: "#D9822F", "stroke-width": "1.5" }),
|
|
12
|
+
react_1.default.createElement("path", { d: "M21.2686 18.3418H28.2929", stroke: "#D9822F", "stroke-width": "1.5" })));
|
|
13
|
+
exports.CustomFieldIcon = CustomFieldIcon;
|
|
14
|
+
//# sourceMappingURL=icon.js.map
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./icon"), exports);
|
|
18
|
+
__exportStar(require("./input"), exports);
|
|
19
|
+
//# sourceMappingURL=index.js.map
|