@skbkontur/markdown 1.2.4 → 1.3.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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@skbkontur/markdown",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"registry": "https://registry.npmjs.org/",
|
|
6
6
|
"access": "public"
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"license": "UNLICENSED",
|
|
11
11
|
"author": "tsypilov",
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@types/styled-components": "5.1.
|
|
13
|
+
"@types/styled-components": "5.1.26",
|
|
14
14
|
"@types/turndown": "^5.0.1",
|
|
15
15
|
"@types/uuid": "^9.0.1",
|
|
16
16
|
"react-dropzone": "^14.2.3",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"rehype-sanitize": "5.0.1",
|
|
21
21
|
"remark-breaks": "^3.0.3",
|
|
22
22
|
"remark-gfm": "^3.0.1",
|
|
23
|
-
"styled-components": "5.
|
|
23
|
+
"styled-components": "5.3.11",
|
|
24
24
|
"turndown": "^7.1.2",
|
|
25
25
|
"turndown-plugin-gfm": "^1.0.2",
|
|
26
26
|
"uuid": "^9.0.0"
|
package/src/Markdown/Markdown.js
CHANGED
|
@@ -41,17 +41,17 @@ import { MarkdownThemeProvider, MarkdownThemeConsumer } from '../styles/styled-c
|
|
|
41
41
|
import { DEFAULT_MARKDOWN_THEME } from '../styles/theme';
|
|
42
42
|
export var Markdown = function (props) {
|
|
43
43
|
var _a;
|
|
44
|
-
var panelHorizontalPadding = props.panelHorizontalPadding, hideMarkdownActions = props.hideMarkdownActions, onClick = props.onClick, onChange = props.onChange, onSelect = props.onSelect, markdownViewer = props.markdownViewer, renderFilesValidation = props.renderFilesValidation,
|
|
44
|
+
var panelHorizontalPadding = props.panelHorizontalPadding, hideMarkdownActions = props.hideMarkdownActions, onClick = props.onClick, onChange = props.onChange, onSelect = props.onSelect, markdownViewer = props.markdownViewer, renderFilesValidation = props.renderFilesValidation, fileApiUrl = props.fileApiUrl, profileUrl = props.profileUrl, api = props.api, textareaProps = __rest(props, ["panelHorizontalPadding", "hideMarkdownActions", "onClick", "onChange", "onSelect", "markdownViewer", "renderFilesValidation", "fileApiUrl", "profileUrl", "api"]);
|
|
45
45
|
var textareaRef = useRef(null);
|
|
46
|
-
var
|
|
47
|
-
var
|
|
48
|
-
var
|
|
49
|
-
var
|
|
50
|
-
var
|
|
51
|
-
var
|
|
46
|
+
var _b = useState(), mention = _b[0], setMention = _b[1];
|
|
47
|
+
var _c = useState(ViewMode.Edit), viewMode = _c[0], setViewMode = _c[1];
|
|
48
|
+
var _d = useState(false), fullscreen = _d[0], setFullScreen = _d[1];
|
|
49
|
+
var _e = useState(0), initialWidth = _e[0], setInitialWidth = _e[1];
|
|
50
|
+
var _f = useState(), selectionStart = _f[0], setSelectionStart = _f[1];
|
|
51
|
+
var _g = useState(), selectionEnd = _g[0], setSelectionEnd = _g[1];
|
|
52
52
|
var guid = useRef(new Guid().generate()).current;
|
|
53
53
|
var isEditMode = viewMode === ViewMode.Edit;
|
|
54
|
-
var
|
|
54
|
+
var _h = 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 = _h.getRootProps, isDragActive = _h.isDragActive, requestStatus = _h.requestStatus, open = _h.open, error = _h.error, onResetError = _h.onResetError;
|
|
55
55
|
usePasteFromClipboard(textareaRef.current, api === null || api === void 0 ? void 0 : api.fileUploadApi, api === null || api === void 0 ? void 0 : api.fileDownloadApi, fileApiUrl);
|
|
56
56
|
useListenTextareaScroll(resetMention, textareaRef.current);
|
|
57
57
|
useLayoutEffect(function () {
|
|
@@ -79,7 +79,7 @@ export var Markdown = function (props) {
|
|
|
79
79
|
isEditMode && error && (api === null || api === void 0 ? void 0 : api.getUsersApi) && (renderFilesValidation === null || renderFilesValidation === void 0 ? void 0 : renderFilesValidation(horizontalPaddings, onResetError)),
|
|
80
80
|
isEditMode && renderEditContainer(),
|
|
81
81
|
isDragActive && isEditMode && React.createElement(DroppablePlaceholder, __assign({}, horizontalPaddings))),
|
|
82
|
-
!isEditMode && (React.createElement(MarkdownPreview, __assign({}, horizontalPaddings), (markdownViewer === null || markdownViewer === void 0 ? void 0 : markdownViewer(props.value)) || (React.createElement(MarkdownViewer, { source: (_a = props.value) !== null && _a !== void 0 ? _a : '', fileApiUrl: fileApiUrl, profileUrl: profileUrl }))))));
|
|
82
|
+
!isEditMode && (React.createElement(MarkdownPreview, __assign({}, horizontalPaddings), (markdownViewer === null || markdownViewer === void 0 ? void 0 : markdownViewer(props.value)) || (React.createElement(MarkdownViewer, { source: (_a = props.value) !== null && _a !== void 0 ? _a : '', downloadFileApi: api === null || api === void 0 ? void 0 : api.fileDownloadApi, fileApiUrl: fileApiUrl, profileUrl: profileUrl }))))));
|
|
83
83
|
return (React.createElement(MarkdownThemeConsumer, null, function (theme) {
|
|
84
84
|
var defaultTheme = theme !== null && theme !== void 0 ? theme : DEFAULT_MARKDOWN_THEME;
|
|
85
85
|
var reactUiTheme = getMarkdownReactUiTheme(defaultTheme, theme === null || theme === void 0 ? void 0 : theme.reactUiTheme, panelHorizontalPadding, fullscreenTextareaPadding);
|
|
@@ -38,7 +38,7 @@ export var MarkdownViewer = function (_a) {
|
|
|
38
38
|
}
|
|
39
39
|
function renderLink(props) {
|
|
40
40
|
var _a = props.href, href = _a === void 0 ? '' : _a, children = props.children;
|
|
41
|
-
if (href.startsWith(fileApiUrl)) {
|
|
41
|
+
if (fileApiUrl && href.startsWith(fileApiUrl)) {
|
|
42
42
|
var id_1 = href.replace(fileApiUrl, '');
|
|
43
43
|
return (React.createElement(FileButtonWrapper, null,
|
|
44
44
|
React.createElement(AttachPaperclip, null),
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as styledComponents from 'styled-components';
|
|
2
2
|
import { MarkdownTheme } from './theme';
|
|
3
|
-
declare const styled: styledComponents.ThemedStyledInterface<MarkdownTheme>, css: styledComponents.ThemedCssFunction<MarkdownTheme>, MarkdownThemeProvider: styledComponents.
|
|
3
|
+
declare const styled: styledComponents.ThemedStyledInterface<MarkdownTheme>, css: styledComponents.ThemedCssFunction<MarkdownTheme>, MarkdownThemeProvider: styledComponents.BaseThemeProviderComponent<MarkdownTheme, MarkdownTheme>, MarkdownThemeConsumer: import("react").Consumer<MarkdownTheme>;
|
|
4
4
|
export { css, MarkdownThemeProvider, MarkdownThemeConsumer };
|
|
5
5
|
export default styled;
|