@skbkontur/markdown 2.1.0 → 2.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +4 -5
- package/src/Markdown/Emoji/Emoji.styled.js +18 -1
- package/src/Markdown/Emoji/EmojiDropdown.js +4 -1
- package/src/Markdown/Emoji/helpers.d.ts +1 -0
- package/src/Markdown/Emoji/helpers.js +4 -0
- package/src/Markdown/Markdown.creevey.js +28 -21
- package/src/Markdown/Markdown.d.ts +3 -1
- package/src/Markdown/Markdown.js +6 -2
- package/src/Markdown/Markdown.styled.js +1 -1
- package/src/Markdown/MarkdownActions.js +1 -1
- package/src/Markdown/MarkdownMention.js +1 -1
- package/src/styles/theme.d.ts +1 -0
- package/src/styles/theme.js +18 -1
- package/src/styles/types.d.ts +3 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@skbkontur/markdown",
|
|
3
|
-
"version": "2.1
|
|
3
|
+
"version": "2.2.1",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"registry": "https://registry.npmjs.org/",
|
|
6
6
|
"access": "public"
|
|
@@ -97,14 +97,13 @@
|
|
|
97
97
|
"jest-teamcity-reporter": "0.9.0",
|
|
98
98
|
"lerna": "5.0.0",
|
|
99
99
|
"lint-staged": "12.3.4",
|
|
100
|
+
"postcss-styled-syntax": "0.5.0",
|
|
100
101
|
"prettier": "2.2.1",
|
|
101
102
|
"react": "17",
|
|
102
103
|
"react-dom": "17",
|
|
103
104
|
"storybook": "8.2.8",
|
|
104
|
-
"stylelint": "
|
|
105
|
-
"stylelint-config-standard": "
|
|
106
|
-
"stylelint-config-styled-components": "^0.1.1",
|
|
107
|
-
"stylelint-processor-styled-components": "^1.10.0",
|
|
105
|
+
"stylelint": "15.11.0",
|
|
106
|
+
"stylelint-config-standard": "34.0.0",
|
|
108
107
|
"typescript": "4.9.4",
|
|
109
108
|
"vite": "5.4.11"
|
|
110
109
|
},
|
|
@@ -2,10 +2,27 @@ var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cook
|
|
|
2
2
|
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
|
3
3
|
return cooked;
|
|
4
4
|
};
|
|
5
|
+
import { getColor } from './helpers';
|
|
5
6
|
import styled from '../../styles/styled-components';
|
|
6
7
|
/**
|
|
7
8
|
* Все доступные переменные для кастомизации стилей можно посмотреть здесь:
|
|
8
9
|
* https://github.com/missive/emoji-mart/blob/main/packages/emoji-mart-website/example-custom-styles.html
|
|
9
10
|
*/
|
|
10
|
-
|
|
11
|
+
/* stylelint-disable function-name-case */
|
|
12
|
+
export var EmojiPickerWrapper = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n em-emoji-picker {\n --font-family: inherit;\n --shadow: unset;\n --rgb-accent: ", ";\n --color-border: ", ";\n --rgb-background: ", ";\n --rgb-input: ", ";\n --rgb-color: ", ";\n\n max-height: 300px;\n }\n"], ["\n em-emoji-picker {\n --font-family: inherit;\n --shadow: unset;\n --rgb-accent: ", ";\n --color-border: ", ";\n --rgb-background: ", ";\n --rgb-input: ", ";\n --rgb-color: ", ";\n\n max-height: 300px;\n }\n"])), function (_a) {
|
|
13
|
+
var theme = _a.theme;
|
|
14
|
+
return getColor(theme.colors.brand);
|
|
15
|
+
}, function (_a) {
|
|
16
|
+
var theme = _a.theme;
|
|
17
|
+
return getColor(theme.colors.grayDefault);
|
|
18
|
+
}, function (_a) {
|
|
19
|
+
var theme = _a.theme;
|
|
20
|
+
return getColor(theme.colors.emojiPickerBackgroundRGBColor);
|
|
21
|
+
}, function (_a) {
|
|
22
|
+
var theme = _a.theme;
|
|
23
|
+
return getColor(theme.colors.emojiPickerBackgroundRGBColor);
|
|
24
|
+
}, function (_a) {
|
|
25
|
+
var theme = _a.theme;
|
|
26
|
+
return getColor(theme.colors.text);
|
|
27
|
+
});
|
|
11
28
|
var templateObject_1;
|
|
@@ -11,7 +11,10 @@ export var EmojiDropdown = function (_a) {
|
|
|
11
11
|
var dropdownMenuRef = useRef(null);
|
|
12
12
|
return (React.createElement(MarkdownThemeConsumer, null, function (theme) {
|
|
13
13
|
var currentTheme = theme !== null && theme !== void 0 ? theme : DEFAULT_MARKDOWN_THEME;
|
|
14
|
-
return (React.createElement(DropdownMenu, { ref: dropdownMenuRef, caption:
|
|
14
|
+
return (React.createElement(DropdownMenu, { ref: dropdownMenuRef, caption: function (_a) {
|
|
15
|
+
var toggleMenu = _a.toggleMenu;
|
|
16
|
+
return (React.createElement(MarkdownFormatButton, { showShortKey: showShortKey, hintText: "Emoji", disabled: isPreviewMode, icon: React.createElement(EmojiFace, null), text: "Emoji", onClick: toggleMenu }));
|
|
17
|
+
} },
|
|
15
18
|
React.createElement(EmojiPickerWrapper, null,
|
|
16
19
|
React.createElement(EmojiPicker, { data: data, locale: "ru", theme: currentTheme.themeMode, skinTonePosition: "none", previewPosition: "none", onEmojiSelect: handleSelectEmoji }))));
|
|
17
20
|
}));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const getColor: (color: string) => string;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
var RGB_KEY = 'rgb';
|
|
2
|
+
var regExp = /\((.*)\)/;
|
|
3
|
+
var rgbDefaultWhite = '255, 255, 255';
|
|
4
|
+
export var getColor = function (color) { var _a, _b; return color.startsWith(RGB_KEY) ? (_b = (_a = color.match(regExp)) === null || _a === void 0 ? void 0 : _a.pop()) !== null && _b !== void 0 ? _b : rgbDefaultWhite : "from ".concat(color, " r g b / 1"); };
|
|
@@ -73,38 +73,38 @@ kind('Markdown', function () {
|
|
|
73
73
|
var setStoryParameters = _a.setStoryParameters;
|
|
74
74
|
setStoryParameters({ skip: !!process.env.STORYBOOK_TEAMCITY_VERSION });
|
|
75
75
|
test('markdownTests', function () {
|
|
76
|
-
var _a, _b, _c, _d, _e;
|
|
76
|
+
var _a, _b, _c, _d, _e, _f;
|
|
77
77
|
return __awaiter(this, void 0, void 0, function () {
|
|
78
|
-
var textarea, buttons, openedDropdown, newButtons, h1FromButton, h1FromKeyboard, boldFromButton, boldFromKeyboard;
|
|
79
|
-
return __generator(this, function (
|
|
80
|
-
switch (
|
|
78
|
+
var textarea, buttons, openedDropdown, newButtons, h1FromButton, h1FromKeyboard, boldFromButton, boldFromKeyboard, openedEmojiPicker;
|
|
79
|
+
return __generator(this, function (_g) {
|
|
80
|
+
switch (_g.label) {
|
|
81
81
|
case 0: return [4 /*yield*/, this.browser.findElement({ tagName: 'textarea' })];
|
|
82
82
|
case 1:
|
|
83
|
-
textarea =
|
|
83
|
+
textarea = _g.sent();
|
|
84
84
|
return [4 /*yield*/, this.browser.findElements({ css: 'button[class*="react-ui"]' })];
|
|
85
85
|
case 2:
|
|
86
|
-
buttons =
|
|
86
|
+
buttons = _g.sent();
|
|
87
87
|
return [4 /*yield*/, this.browser.actions().click(textarea).perform()];
|
|
88
88
|
case 3:
|
|
89
|
-
|
|
89
|
+
_g.sent();
|
|
90
90
|
return [4 /*yield*/, this.browser.actions().sendKeys('Заголовок').keyDown(this.keys.CONTROL).sendKeys('a').perform()];
|
|
91
91
|
case 4:
|
|
92
|
-
|
|
92
|
+
_g.sent();
|
|
93
93
|
return [4 /*yield*/, this.browser.actions().click(buttons[0]).perform()];
|
|
94
94
|
case 5:
|
|
95
|
-
|
|
95
|
+
_g.sent();
|
|
96
96
|
return [4 /*yield*/, ((_a = this.captureElement) === null || _a === void 0 ? void 0 : _a.takeScreenshot())];
|
|
97
97
|
case 6:
|
|
98
|
-
openedDropdown =
|
|
98
|
+
openedDropdown = _g.sent();
|
|
99
99
|
return [4 /*yield*/, this.browser.findElements({ css: 'button[class*="react-ui"]' })];
|
|
100
100
|
case 7:
|
|
101
|
-
newButtons =
|
|
101
|
+
newButtons = _g.sent();
|
|
102
102
|
return [4 /*yield*/, this.browser.actions().click(newButtons[1]).perform()];
|
|
103
103
|
case 8:
|
|
104
|
-
|
|
104
|
+
_g.sent();
|
|
105
105
|
return [4 /*yield*/, ((_b = this.captureElement) === null || _b === void 0 ? void 0 : _b.takeScreenshot())];
|
|
106
106
|
case 9:
|
|
107
|
-
h1FromButton =
|
|
107
|
+
h1FromButton = _g.sent();
|
|
108
108
|
return [4 /*yield*/, this.browser
|
|
109
109
|
.actions()
|
|
110
110
|
.keyDown(this.keys.CONTROL)
|
|
@@ -117,10 +117,10 @@ kind('Markdown', function () {
|
|
|
117
117
|
.sendKeys('1')
|
|
118
118
|
.perform()];
|
|
119
119
|
case 10:
|
|
120
|
-
|
|
120
|
+
_g.sent();
|
|
121
121
|
return [4 /*yield*/, ((_c = this.captureElement) === null || _c === void 0 ? void 0 : _c.takeScreenshot())];
|
|
122
122
|
case 11:
|
|
123
|
-
h1FromKeyboard =
|
|
123
|
+
h1FromKeyboard = _g.sent();
|
|
124
124
|
return [4 /*yield*/, this.browser
|
|
125
125
|
.actions()
|
|
126
126
|
.keyDown(this.keys.CONTROL)
|
|
@@ -131,10 +131,10 @@ kind('Markdown', function () {
|
|
|
131
131
|
.click(buttons[1])
|
|
132
132
|
.perform()];
|
|
133
133
|
case 12:
|
|
134
|
-
|
|
134
|
+
_g.sent();
|
|
135
135
|
return [4 /*yield*/, ((_d = this.captureElement) === null || _d === void 0 ? void 0 : _d.takeScreenshot())];
|
|
136
136
|
case 13:
|
|
137
|
-
boldFromButton =
|
|
137
|
+
boldFromButton = _g.sent();
|
|
138
138
|
return [4 /*yield*/, this.browser
|
|
139
139
|
.actions()
|
|
140
140
|
.keyDown(this.keys.CONTROL)
|
|
@@ -147,19 +147,26 @@ kind('Markdown', function () {
|
|
|
147
147
|
.sendKeys('b')
|
|
148
148
|
.perform()];
|
|
149
149
|
case 14:
|
|
150
|
-
|
|
150
|
+
_g.sent();
|
|
151
151
|
return [4 /*yield*/, ((_e = this.captureElement) === null || _e === void 0 ? void 0 : _e.takeScreenshot())];
|
|
152
152
|
case 15:
|
|
153
|
-
boldFromKeyboard =
|
|
153
|
+
boldFromKeyboard = _g.sent();
|
|
154
|
+
return [4 /*yield*/, this.browser.actions().click(buttons[12]).perform()];
|
|
155
|
+
case 16:
|
|
156
|
+
_g.sent();
|
|
157
|
+
return [4 /*yield*/, ((_f = this.captureElement) === null || _f === void 0 ? void 0 : _f.takeScreenshot())];
|
|
158
|
+
case 17:
|
|
159
|
+
openedEmojiPicker = _g.sent();
|
|
154
160
|
return [4 /*yield*/, this.expect({
|
|
155
161
|
openedDropdown: openedDropdown,
|
|
156
162
|
h1FromButton: h1FromButton,
|
|
157
163
|
h1FromKeyboard: h1FromKeyboard,
|
|
158
164
|
boldFromButton: boldFromButton,
|
|
159
165
|
boldFromKeyboard: boldFromKeyboard,
|
|
166
|
+
openedEmojiPicker: openedEmojiPicker,
|
|
160
167
|
}).to.matchImages()];
|
|
161
|
-
case
|
|
162
|
-
|
|
168
|
+
case 18:
|
|
169
|
+
_g.sent();
|
|
163
170
|
return [2 /*return*/];
|
|
164
171
|
}
|
|
165
172
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { FC, ReactNode } from 'react';
|
|
2
2
|
import { MarkdownEditorProps } from './MarkdownEditor';
|
|
3
|
-
import { HorizontalPaddings, MarkdownApi, HideActionsOptions } from './types';
|
|
3
|
+
import { HorizontalPaddings, ViewMode, MarkdownApi, HideActionsOptions } from './types';
|
|
4
4
|
export interface MarkdownProps extends MarkdownEditorProps {
|
|
5
5
|
/** Методы апи для загрузки/скачивания файлов и меншена */
|
|
6
6
|
api?: MarkdownApi;
|
|
@@ -12,6 +12,8 @@ export interface MarkdownProps extends MarkdownEditorProps {
|
|
|
12
12
|
hideActionsOptions?: HideActionsOptions;
|
|
13
13
|
/** Превьювер мардауна, по умолчанию используется MarkdownViewer */
|
|
14
14
|
markdownViewer?: (value: string) => ReactNode;
|
|
15
|
+
/** Колбек, срабатывает на изменение режима редактирования или просмотра */
|
|
16
|
+
onChangeViewMode?: (mode: ViewMode) => void;
|
|
15
17
|
/** Padding markdownActions (кнопки помощи форматирования текста), включает режим panel */
|
|
16
18
|
panelHorizontalPadding?: number;
|
|
17
19
|
/** Url для профиля сотрудника */
|
package/src/Markdown/Markdown.js
CHANGED
|
@@ -42,7 +42,7 @@ import { ThemeProvider } from '../styles/styled-components';
|
|
|
42
42
|
import { DEFAULT_MARKDOWN_THEME, MarkdownThemeConsumer } from '../styles/theme';
|
|
43
43
|
export var Markdown = function (props) {
|
|
44
44
|
var _a;
|
|
45
|
-
var panelHorizontalPadding = props.panelHorizontalPadding, onClick = props.onClick, onChange = props.onChange, onSelect = props.onSelect, markdownViewer = props.markdownViewer, renderFilesValidation = props.renderFilesValidation, fileApiUrl = props.fileApiUrl, profileUrl = props.profileUrl, api = props.api, borderless = props.borderless, _b = props.showShotKeys, showShotKeys = _b === void 0 ? true : _b, hideActionsOptions = props.hideActionsOptions, textareaProps = __rest(props, ["panelHorizontalPadding", "onClick", "onChange", "onSelect", "markdownViewer", "renderFilesValidation", "fileApiUrl", "profileUrl", "api", "borderless", "showShotKeys", "hideActionsOptions"]);
|
|
45
|
+
var panelHorizontalPadding = props.panelHorizontalPadding, onClick = props.onClick, onChange = props.onChange, onSelect = props.onSelect, markdownViewer = props.markdownViewer, renderFilesValidation = props.renderFilesValidation, fileApiUrl = props.fileApiUrl, profileUrl = props.profileUrl, api = props.api, borderless = props.borderless, _b = props.showShotKeys, showShotKeys = _b === void 0 ? true : _b, hideActionsOptions = props.hideActionsOptions, onChangeViewMode = props.onChangeViewMode, textareaProps = __rest(props, ["panelHorizontalPadding", "onClick", "onChange", "onSelect", "markdownViewer", "renderFilesValidation", "fileApiUrl", "profileUrl", "api", "borderless", "showShotKeys", "hideActionsOptions", "onChangeViewMode"]);
|
|
46
46
|
var textareaRef = useRef(null);
|
|
47
47
|
var _c = useState(), mention = _c[0], setMention = _c[1];
|
|
48
48
|
var _d = useState(ViewMode.Edit), viewMode = _d[0], setViewMode = _d[1];
|
|
@@ -78,7 +78,7 @@ export var Markdown = function (props) {
|
|
|
78
78
|
};
|
|
79
79
|
var content = (React.createElement(Foco, { component: "div", onClickOutside: resetStates },
|
|
80
80
|
React.createElement(Wrapper, __assign({}, getRootProps()),
|
|
81
|
-
!(hideActionsOptions === null || hideActionsOptions === void 0 ? void 0 : hideActionsOptions.allActions) && (React.createElement(MarkdownActions, { 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), onOpenFileDialog: open, onChangeViewMode:
|
|
81
|
+
!(hideActionsOptions === null || hideActionsOptions === void 0 ? void 0 : hideActionsOptions.allActions) && (React.createElement(MarkdownActions, { 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), onOpenFileDialog: open, onChangeViewMode: handleChangeViewMode, onClickFullscreen: handleClickFullscreen, onSelectEmoji: onSelectEmoji })),
|
|
82
82
|
isEditMode && error && (api === null || api === void 0 ? void 0 : api.getUsersApi) && (renderFilesValidation === null || renderFilesValidation === void 0 ? void 0 : renderFilesValidation(horizontalPaddings, onResetError)),
|
|
83
83
|
isEditMode && renderEditContainer(),
|
|
84
84
|
isDragActive && isEditMode && React.createElement(DroppablePlaceholder, __assign({}, horizontalPaddings))),
|
|
@@ -110,6 +110,10 @@ export var Markdown = function (props) {
|
|
|
110
110
|
return (React.createElement(MarkdownMention, { value: getMentionValue(mention), getUsersApi: api.getUsersApi, y: position.y, x: position.x, onUserSelect: handleSelectUser }));
|
|
111
111
|
}
|
|
112
112
|
}
|
|
113
|
+
function handleChangeViewMode(mode) {
|
|
114
|
+
setViewMode(mode);
|
|
115
|
+
onChangeViewMode === null || onChangeViewMode === void 0 ? void 0 : onChangeViewMode(mode);
|
|
116
|
+
}
|
|
113
117
|
function handleSelectUser(login, name) {
|
|
114
118
|
if (textareaRef.current && mention) {
|
|
115
119
|
var htmlTextArea = textareaRef.current;
|
|
@@ -81,7 +81,7 @@ export var getMarkdownReactUiTheme = function (theme, reactUiTheme, panelHorizon
|
|
|
81
81
|
menuItemFontSize: elementsFontSize,
|
|
82
82
|
menuItemPaddingY: '4px',
|
|
83
83
|
menuItemPaddingX: '28px',
|
|
84
|
-
})), { tabColorHover: 'transparent', tabColorFocus: 'transparent', tabBorderWidth: '0', selectBorderWidth: '0', btnDefaultBg: 'transparent', btnDefaultActiveBorderColor: 'transparent', btnDisabledBg: 'transparent', btnDisabledBorderColor: 'transparent', btnDisabledTextColor: colors.disabledButton, btnDefaultHoverBg: themeMode === 'light' ? reactUiTheme === null || reactUiTheme === void 0 ? void 0 : reactUiTheme.btnDefaultHoverBg : reactUiTheme === null || reactUiTheme === void 0 ? void 0 : reactUiTheme.btnDisabledBg, btnFontSizeSmall: elementsFontSize, checkboxBg: 'transparent', checkboxHoverBg: 'transparent', checkboxCheckedBg: 'transparent', checkboxShadow: "0 0 0 1px ".concat(colors.grayDefault), checkboxShadowHover: "0 0 0 1px ".concat(colors.grayDefault), checkboxCheckedHoverShadow: "0 0 0 1px ".concat(colors.grayDefault), checkboxCheckedShadow: "0 0 0 1px ".concat(colors.grayDefault), checkboxCheckedActiveShadow: "0 0 0 1px ".concat(colors.grayDefault), checkboxShadowActive: "0 0 0 1px ".concat(colors.grayDefault), checkboxCheckedColor: colors.grayDefault, hintFontSize: elementsFontSize, hintColor:
|
|
84
|
+
})), { tabColorHover: 'transparent', tabColorFocus: 'transparent', tabBorderWidth: '0', selectBorderWidth: '0', btnDefaultBg: 'transparent', btnDefaultActiveBorderColor: 'transparent', btnDisabledBg: 'transparent', btnDisabledBorderColor: 'transparent', btnDisabledTextColor: colors.disabledButton, btnDefaultHoverBg: themeMode === 'light' ? reactUiTheme === null || reactUiTheme === void 0 ? void 0 : reactUiTheme.btnDefaultHoverBg : reactUiTheme === null || reactUiTheme === void 0 ? void 0 : reactUiTheme.btnDisabledBg, btnFontSizeSmall: elementsFontSize, checkboxBg: 'transparent', checkboxHoverBg: 'transparent', checkboxCheckedBg: 'transparent', checkboxShadow: "0 0 0 1px ".concat(colors.grayDefault), checkboxShadowHover: "0 0 0 1px ".concat(colors.grayDefault), checkboxCheckedHoverShadow: "0 0 0 1px ".concat(colors.grayDefault), checkboxCheckedShadow: "0 0 0 1px ".concat(colors.grayDefault), checkboxCheckedActiveShadow: "0 0 0 1px ".concat(colors.grayDefault), checkboxShadowActive: "0 0 0 1px ".concat(colors.grayDefault), checkboxCheckedColor: colors.grayDefault, hintFontSize: elementsFontSize, hintColor: colors.textInverse, selectPaddingXSmall: '8px', selectLineHeightSmall: '24px', dropdownBorderWidth: '0' }), (panelHorizontalPadding &&
|
|
85
85
|
extendThemeConfigWithSized({
|
|
86
86
|
textareaPaddingX: "".concat(panelHorizontalPadding, "px"),
|
|
87
87
|
}))), (borderless && borderlessTextareaVariables)), (fullScreenTextareaPadding &&
|
|
@@ -32,7 +32,7 @@ export var MarkdownActions = function (_a) {
|
|
|
32
32
|
React.createElement(ButtonsWrapper, __assign({}, horizontalPaddings),
|
|
33
33
|
React.createElement(ActionsWrapper, null,
|
|
34
34
|
!(hideOptions === null || hideOptions === void 0 ? void 0 : hideOptions.heading) && (React.createElement(MarkdownDropdown, null,
|
|
35
|
-
React.createElement(Dropdown, { disablePortal: true, disabled: isPreviewMode, menuWidth:
|
|
35
|
+
React.createElement(Dropdown, { disablePortal: true, disabled: isPreviewMode, menuWidth: 300, caption: "\u0417\u0430\u0433\u043E\u043B\u043E\u0432\u043E\u043A" }, markdownHelpHeaders.map(function (helper, idx) { return (React.createElement(MarkdownMenuItem, { key: idx, onClick: function (event) { return handleMarkdownItemClick(event, helper.format); } },
|
|
36
36
|
React.createElement(MarkdownCombination, { showShortKey: showShortKeys, format: helper.format, text: helper.node }))); })))),
|
|
37
37
|
markdownHelpText.map(function (helper, idx) {
|
|
38
38
|
if (isHiddenOptions(helper.format))
|
|
@@ -79,7 +79,7 @@ export var MarkdownMention = function (_a) {
|
|
|
79
79
|
if (!(users === null || users === void 0 ? void 0 : users.length))
|
|
80
80
|
return null;
|
|
81
81
|
return createPortal(React.createElement(ZIndex, { priority: "Toast", style: getMarkdownMentionStyle(x, y) },
|
|
82
|
-
React.createElement(Menu, { ref: menuRef, preventWindowScroll: true, hasShadow: true, maxHeight: 300, width:
|
|
82
|
+
React.createElement(Menu, { ref: menuRef, preventWindowScroll: true, hasShadow: true, maxHeight: 300, width: 320 }, users === null || users === void 0 ? void 0 : users.map(function (user) { return (React.createElement(MentionMenuItem, { key: user.id, onClick: function () { var _a; return onUserSelect((_a = user === null || user === void 0 ? void 0 : user.login) !== null && _a !== void 0 ? _a : '', user.name); } },
|
|
83
83
|
React.createElement(UserWrapper, null,
|
|
84
84
|
React.createElement(Avatar, { height: 48, width: 48, src: getAvatarUrl(user.sid) }),
|
|
85
85
|
React.createElement("div", null,
|
package/src/styles/theme.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ export interface MarkdownTheme {
|
|
|
10
10
|
reactUiTheme?: typeof THEME_2022;
|
|
11
11
|
}
|
|
12
12
|
export declare const DEFAULT_MARKDOWN_THEME: MarkdownTheme;
|
|
13
|
+
export declare const DEFAULT_MARKDOWN_DARK_THEME: MarkdownTheme;
|
|
13
14
|
export declare const MarkdownThemeContext: import("react").Context<MarkdownTheme>;
|
|
14
15
|
export declare const MarkdownThemeProvider: import("react").Provider<MarkdownTheme>;
|
|
15
16
|
export declare const MarkdownThemeConsumer: import("react").Consumer<MarkdownTheme>;
|
package/src/styles/theme.js
CHANGED
|
@@ -1,17 +1,34 @@
|
|
|
1
1
|
import { createContext } from 'react';
|
|
2
2
|
export var DEFAULT_MARKDOWN_THEME = {
|
|
3
3
|
colors: {
|
|
4
|
-
|
|
4
|
+
text: '#222',
|
|
5
5
|
brand: '#e76f57',
|
|
6
6
|
grayDefault: '#858585',
|
|
7
7
|
disabledButton: '#adadad',
|
|
8
8
|
panelBg: '#d6d6d6',
|
|
9
9
|
link: '#51adff',
|
|
10
|
+
textInverse: '#fff',
|
|
11
|
+
emojiPickerBackgroundRGBColor: 'rgb(255,255,255, 0)',
|
|
10
12
|
},
|
|
11
13
|
elementsFontSize: '16px',
|
|
12
14
|
elementsLineHeight: '24px',
|
|
13
15
|
themeMode: 'light',
|
|
14
16
|
};
|
|
17
|
+
export var DEFAULT_MARKDOWN_DARK_THEME = {
|
|
18
|
+
colors: {
|
|
19
|
+
text: '#fff',
|
|
20
|
+
brand: '#e76f57',
|
|
21
|
+
grayDefault: '#858585',
|
|
22
|
+
disabledButton: '#adadad',
|
|
23
|
+
panelBg: '#d6d6d6',
|
|
24
|
+
link: '#51adff',
|
|
25
|
+
textInverse: '#222',
|
|
26
|
+
emojiPickerBackgroundRGBColor: 'rgb(0,0,0,0)',
|
|
27
|
+
},
|
|
28
|
+
elementsFontSize: '16px',
|
|
29
|
+
elementsLineHeight: '24px',
|
|
30
|
+
themeMode: 'dark',
|
|
31
|
+
};
|
|
15
32
|
export var MarkdownThemeContext = createContext(DEFAULT_MARKDOWN_THEME);
|
|
16
33
|
export var MarkdownThemeProvider = MarkdownThemeContext.Provider;
|
|
17
34
|
export var MarkdownThemeConsumer = MarkdownThemeContext.Consumer;
|
package/src/styles/types.d.ts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
export interface ColorScheme {
|
|
2
2
|
brand: string;
|
|
3
3
|
disabledButton: string;
|
|
4
|
+
emojiPickerBackgroundRGBColor: string;
|
|
4
5
|
grayDefault: string;
|
|
5
6
|
link: string;
|
|
6
7
|
panelBg: string;
|
|
7
|
-
|
|
8
|
+
text: string;
|
|
9
|
+
textInverse: string;
|
|
8
10
|
}
|
|
9
11
|
export type ThemeMode = 'dark' | 'light';
|