@skbkontur/markdown 2.6.1 → 2.6.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -5,6 +5,7 @@ export declare const useFileLogic: (fileUploadApi?: ((file: File) => Promise<Ref
|
|
|
5
5
|
requestStatus: RequestStatus;
|
|
6
6
|
error: boolean;
|
|
7
7
|
getRootProps: <T extends import("react-dropzone").DropzoneRootProps>(props?: T | undefined) => T;
|
|
8
|
+
getInputProps: <T_1 extends import("react-dropzone").DropzoneInputProps>(props?: T_1 | undefined) => T_1;
|
|
8
9
|
isDragActive: boolean;
|
|
9
10
|
open: () => void;
|
|
10
11
|
uploadFile: (file: File) => Promise<void>;
|
|
@@ -48,7 +48,7 @@ export var useFileLogic = function (fileUploadApi, fileDownloadApi, fileApiUrl,
|
|
|
48
48
|
noClick: true,
|
|
49
49
|
disabled: disabled || !fileUploadApi || !fileDownloadApi,
|
|
50
50
|
onDrop: function (files) { return void uploadFile(files[0]); },
|
|
51
|
-
}), getRootProps = _a.getRootProps, isDragActive = _a.isDragActive, open = _a.open;
|
|
51
|
+
}), getRootProps = _a.getRootProps, getInputProps = _a.getInputProps, isDragActive = _a.isDragActive, open = _a.open;
|
|
52
52
|
var _b = useState(RequestStatus.Default), requestStatus = _b[0], setRequestStatus = _b[1];
|
|
53
53
|
var _c = useState(false), error = _c[0], setError = _c[1];
|
|
54
54
|
function uploadFile(file) {
|
|
@@ -114,6 +114,7 @@ export var useFileLogic = function (fileUploadApi, fileDownloadApi, fileApiUrl,
|
|
|
114
114
|
requestStatus: requestStatus,
|
|
115
115
|
error: error,
|
|
116
116
|
getRootProps: getRootProps,
|
|
117
|
+
getInputProps: getInputProps,
|
|
117
118
|
isDragActive: isDragActive,
|
|
118
119
|
open: open,
|
|
119
120
|
uploadFile: uploadFile,
|
package/src/Markdown/Markdown.js
CHANGED
|
@@ -60,7 +60,7 @@ export var Markdown = function (props) {
|
|
|
60
60
|
isSplitViewAvailable: "(width >= ".concat(SPLIT_VIEW_THRESHOLD, ")"),
|
|
61
61
|
},
|
|
62
62
|
}), isSplitViewAvailable = _j.isSplitViewAvailable, isMobile = _j.isMobile;
|
|
63
|
-
var _k = useFileLogic(api === null || api === void 0 ? void 0 : api.fileUploadApi, api === null || api === void 0 ? void 0 : api.fileDownloadApi, fileApiUrl, textareaRef.current, selectionStart, !isEditMode), getRootProps = _k.getRootProps, isDragActive = _k.isDragActive, requestStatus = _k.requestStatus, open = _k.open, error = _k.error, onResetError = _k.onResetError;
|
|
63
|
+
var _k = useFileLogic(api === null || api === void 0 ? void 0 : api.fileUploadApi, api === null || api === void 0 ? void 0 : api.fileDownloadApi, fileApiUrl, textareaRef.current, selectionStart, !isEditMode), getRootProps = _k.getRootProps, getInputProps = _k.getInputProps, isDragActive = _k.isDragActive, requestStatus = _k.requestStatus, open = _k.open, error = _k.error, onResetError = _k.onResetError;
|
|
64
64
|
var onSelectEmoji = useEmojiLogic(textareaRef.current).onSelectEmoji;
|
|
65
65
|
usePasteFromClipboard(textareaRef.current, api === null || api === void 0 ? void 0 : api.fileUploadApi, api === null || api === void 0 ? void 0 : api.fileDownloadApi, fileApiUrl);
|
|
66
66
|
useListenTextareaScroll(resetMention, textareaRef.current);
|
|
@@ -105,6 +105,7 @@ export var Markdown = function (props) {
|
|
|
105
105
|
};
|
|
106
106
|
var content = (React.createElement(Foco, { component: "div", onClickOutside: resetStates },
|
|
107
107
|
React.createElement(Wrapper, __assign({}, getRootProps()),
|
|
108
|
+
React.createElement("input", __assign({}, getInputProps())),
|
|
108
109
|
!(hideActionsOptions === null || hideActionsOptions === void 0 ? void 0 : hideActionsOptions.allActions) && (React.createElement(MarkdownActions, { showActionHints: showActionHints !== undefined ? showActionHints : showShotKeys, showShortKeys: showShortKeys !== undefined ? showShortKeys : showShotKeys, textAreaRef: textareaRef, width: width, viewMode: viewMode, loadingFile: requestStatus === RequestStatus.isFetching, fullscreen: fullscreen, selectionStart: selectionStart, selectionEnd: selectionEnd, horizontalPaddings: horizontalPaddings, hideOptions: hideActionsOptions, hasFilesApi: !!(api === null || api === void 0 ? void 0 : api.fileDownloadApi) && !!(api === null || api === void 0 ? void 0 : api.fileUploadApi), isSplitViewAvailable: isSplitViewAvailable, disableFullscreen: isMobile, AIApi: api === null || api === void 0 ? void 0 : api.AIApi, onOpenFileDialog: open, onChangeViewMode: handleChangeViewMode, onClickFullscreen: handleClickFullscreen, onSelectEmoji: onSelectEmoji })),
|
|
109
110
|
isEditMode && error && (api === null || api === void 0 ? void 0 : api.getUsersApi) && (renderFilesValidation === null || renderFilesValidation === void 0 ? void 0 : renderFilesValidation(horizontalPaddings, onResetError)),
|
|
110
111
|
fullscreen && viewMode === ViewMode.Split && !fullscreenTextareaPadding && (React.createElement(SplitViewContainer, null,
|
|
@@ -5,7 +5,7 @@ import { MarkdownButtonContentWrapper, MarkdownButtonIcon, MarkdownButtonWrapper
|
|
|
5
5
|
export var MarkdownFormatButton = function (_a) {
|
|
6
6
|
var dataTid = _a.dataTid, icon = _a.icon, hintText = _a.hintText, onClick = _a.onClick, format = _a.format, disabled = _a.disabled, text = _a.text, href = _a.href, showActionHint = _a.showActionHint, showHintWhenDisabled = _a.showHintWhenDisabled, showShortKey = _a.showShortKey, showText = _a.showText, hintPos = _a.hintPos;
|
|
7
7
|
var button = (React.createElement(MarkdownButtonWrapper, { borderless: true, disabled: disabled, "data-tid": dataTid, onClick: onClick },
|
|
8
|
-
React.createElement(MarkdownButtonContentWrapper,
|
|
8
|
+
React.createElement(MarkdownButtonContentWrapper, null,
|
|
9
9
|
!!icon && React.createElement(MarkdownButtonIcon, null, icon),
|
|
10
10
|
showText ? text : React.createElement(VisuallyHidden, null, text))));
|
|
11
11
|
var content = href ? (React.createElement("a", { href: href, tabIndex: -1, target: "_blank", rel: "noopener noreferrer nofollow" }, button)) : (button);
|