@gravity-ui/markdown-editor 14.12.2 → 14.12.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/build/cjs/bundle/toolbar/ToolbarSelect.js +11 -9
- package/build/cjs/bundle/toolbar/utils/toolbarsConfigs.js +1 -1
- package/build/cjs/extensions/yfm/YfmCut/index.css +3 -0
- package/build/cjs/toolbar/PreviewTooltip.js +3 -1
- package/build/cjs/version.js +1 -1
- package/build/esm/bundle/toolbar/ToolbarSelect.js +11 -9
- package/build/esm/bundle/toolbar/utils/toolbarsConfigs.js +1 -1
- package/build/esm/extensions/yfm/YfmCut/index.css +3 -0
- package/build/esm/toolbar/PreviewTooltip.js +3 -1
- package/build/esm/version.js +1 -1
- package/build/styles.css +3 -0
- package/package.json +1 -1
|
@@ -7,6 +7,7 @@ const components_1 = require("@gravity-ui/components");
|
|
|
7
7
|
const uikit_1 = require("@gravity-ui/uikit");
|
|
8
8
|
const classname_1 = require("../../classname");
|
|
9
9
|
const lodash_1 = require("../../lodash");
|
|
10
|
+
const PreviewTooltip_1 = require("../../toolbar/PreviewTooltip");
|
|
10
11
|
const b = (0, classname_1.cn)('toolbar-select');
|
|
11
12
|
const ToolbarSelect = ({ className, editor, focus, onClick, items, }) => {
|
|
12
13
|
const activeItem = items.find((item) => item.isActive(editor));
|
|
@@ -19,16 +20,17 @@ const ToolbarSelect = ({ className, editor, focus, onClick, items, }) => {
|
|
|
19
20
|
text: (0, lodash_1.isFunction)(item.title) ? item.title() : item.title,
|
|
20
21
|
})), renderOption: ({ text, data }) => {
|
|
21
22
|
var _a;
|
|
22
|
-
const { icon, hotkey, hint } = data;
|
|
23
|
+
const { icon, hotkey, hint, preview } = data;
|
|
23
24
|
const hintText = (0, lodash_1.isFunction)(hint) ? hint() : hint;
|
|
24
|
-
return (react_1.default.createElement(
|
|
25
|
-
react_1.default.createElement("div", { className: b('item
|
|
26
|
-
react_1.default.createElement(
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
25
|
+
return (react_1.default.createElement(PreviewTooltip_1.PreviewTooltip, { preview: preview },
|
|
26
|
+
react_1.default.createElement("div", { "aria-label": text, className: b('item') },
|
|
27
|
+
react_1.default.createElement("div", { className: b('item-icon') },
|
|
28
|
+
react_1.default.createElement(uikit_1.Icon, { data: icon.data, size: Number((_a = icon.size) !== null && _a !== void 0 ? _a : 16) + 2 })),
|
|
29
|
+
react_1.default.createElement("div", { className: b('item-content') },
|
|
30
|
+
text,
|
|
31
|
+
react_1.default.createElement("div", { className: b('item-extra') },
|
|
32
|
+
hotkey && react_1.default.createElement(uikit_1.Hotkey, { value: hotkey }),
|
|
33
|
+
hintText && (react_1.default.createElement(components_1.HelpPopover, { content: hintText, className: b('item-hint') })))))));
|
|
32
34
|
}, onUpdate: ([id]) => {
|
|
33
35
|
var _a;
|
|
34
36
|
(_a = items.find((item) => item.id === id)) === null || _a === void 0 ? void 0 : _a.exec(editor);
|
|
@@ -20,7 +20,7 @@ const transformItem = (type, item, id = 'unknown') => {
|
|
|
20
20
|
}
|
|
21
21
|
const isListButton = item.view.type === types_1.ToolbarDataType.ListButton;
|
|
22
22
|
const isSingleButton = item.view.type === types_1.ToolbarDataType.SingleButton;
|
|
23
|
-
return Object.assign(Object.assign(Object.assign(Object.assign({ type: (_a = item.view.type) !== null && _a !== void 0 ? _a : types_1.ToolbarDataType.SingleButton, id, title: item.view.title, hint: item.view.hint, icon: item.view.icon, hotkey: item.view.hotkey }, (isSingleButton && { preview: item.view.preview })), (isListButton && { withArrow: item.view.withArrow })), (type === 'wysiwyg' && item.wysiwyg && Object.assign({}, item.wysiwyg))), (type === 'markup' && item.markup && Object.assign({}, item.markup)));
|
|
23
|
+
return Object.assign(Object.assign(Object.assign(Object.assign({ type: (_a = item.view.type) !== null && _a !== void 0 ? _a : types_1.ToolbarDataType.SingleButton, id, title: item.view.title, hint: item.view.hint, icon: item.view.icon, hotkey: item.view.hotkey, doNotActivateList: item.view.doNotActivateList }, (isSingleButton && { preview: item.view.preview })), (isListButton && { withArrow: item.view.withArrow })), (type === 'wysiwyg' && item.wysiwyg && Object.assign({}, item.wysiwyg))), (type === 'markup' && item.markup && Object.assign({}, item.markup)));
|
|
24
24
|
};
|
|
25
25
|
const createToolbarConfig = (editorType, toolbarPreset, toolbarName) => {
|
|
26
26
|
var _a;
|
|
@@ -8,6 +8,8 @@ const classname_1 = require("../classname");
|
|
|
8
8
|
const const_1 = require("./const");
|
|
9
9
|
const b = (0, classname_1.cn)('preview-tooltip');
|
|
10
10
|
const PreviewTooltip = ({ preview, children }) => {
|
|
11
|
-
|
|
11
|
+
if (!preview)
|
|
12
|
+
return children;
|
|
13
|
+
return (react_1.default.createElement(uikit_1.Tooltip, { placement: ['right', 'left'], className: b(), contentClassName: b('content'), disabled: !preview, openDelay: const_1.ToolbarTooltipDelay.Open, closeDelay: const_1.ToolbarTooltipDelay.Close, content: preview }, children));
|
|
12
14
|
};
|
|
13
15
|
exports.PreviewTooltip = PreviewTooltip;
|
package/build/cjs/version.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.VERSION = void 0;
|
|
4
4
|
/** During build process, the current version will be injected here */
|
|
5
|
-
exports.VERSION = typeof '14.12.
|
|
5
|
+
exports.VERSION = typeof '14.12.3' !== 'undefined' ? '14.12.3' : 'unknown';
|
|
@@ -3,6 +3,7 @@ import { HelpPopover } from '@gravity-ui/components';
|
|
|
3
3
|
import { Hotkey, Icon, Select } from '@gravity-ui/uikit';
|
|
4
4
|
import { cn } from '../../classname';
|
|
5
5
|
import { isFunction } from '../../lodash';
|
|
6
|
+
import { PreviewTooltip } from '../../toolbar/PreviewTooltip';
|
|
6
7
|
import './ToolbarSelect.css';
|
|
7
8
|
const b = cn('toolbar-select');
|
|
8
9
|
export const ToolbarSelect = ({ className, editor, focus, onClick, items, }) => {
|
|
@@ -16,16 +17,17 @@ export const ToolbarSelect = ({ className, editor, focus, onClick, items, }) =>
|
|
|
16
17
|
text: isFunction(item.title) ? item.title() : item.title,
|
|
17
18
|
})), renderOption: ({ text, data }) => {
|
|
18
19
|
var _a;
|
|
19
|
-
const { icon, hotkey, hint } = data;
|
|
20
|
+
const { icon, hotkey, hint, preview } = data;
|
|
20
21
|
const hintText = isFunction(hint) ? hint() : hint;
|
|
21
|
-
return (React.createElement(
|
|
22
|
-
React.createElement("div", { className: b('item
|
|
23
|
-
React.createElement(
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
22
|
+
return (React.createElement(PreviewTooltip, { preview: preview },
|
|
23
|
+
React.createElement("div", { "aria-label": text, className: b('item') },
|
|
24
|
+
React.createElement("div", { className: b('item-icon') },
|
|
25
|
+
React.createElement(Icon, { data: icon.data, size: Number((_a = icon.size) !== null && _a !== void 0 ? _a : 16) + 2 })),
|
|
26
|
+
React.createElement("div", { className: b('item-content') },
|
|
27
|
+
text,
|
|
28
|
+
React.createElement("div", { className: b('item-extra') },
|
|
29
|
+
hotkey && React.createElement(Hotkey, { value: hotkey }),
|
|
30
|
+
hintText && (React.createElement(HelpPopover, { content: hintText, className: b('item-hint') })))))));
|
|
29
31
|
}, onUpdate: ([id]) => {
|
|
30
32
|
var _a;
|
|
31
33
|
(_a = items.find((item) => item.id === id)) === null || _a === void 0 ? void 0 : _a.exec(editor);
|
|
@@ -17,7 +17,7 @@ const transformItem = (type, item, id = 'unknown') => {
|
|
|
17
17
|
}
|
|
18
18
|
const isListButton = item.view.type === ToolbarDataType.ListButton;
|
|
19
19
|
const isSingleButton = item.view.type === ToolbarDataType.SingleButton;
|
|
20
|
-
return Object.assign(Object.assign(Object.assign(Object.assign({ type: (_a = item.view.type) !== null && _a !== void 0 ? _a : ToolbarDataType.SingleButton, id, title: item.view.title, hint: item.view.hint, icon: item.view.icon, hotkey: item.view.hotkey }, (isSingleButton && { preview: item.view.preview })), (isListButton && { withArrow: item.view.withArrow })), (type === 'wysiwyg' && item.wysiwyg && Object.assign({}, item.wysiwyg))), (type === 'markup' && item.markup && Object.assign({}, item.markup)));
|
|
20
|
+
return Object.assign(Object.assign(Object.assign(Object.assign({ type: (_a = item.view.type) !== null && _a !== void 0 ? _a : ToolbarDataType.SingleButton, id, title: item.view.title, hint: item.view.hint, icon: item.view.icon, hotkey: item.view.hotkey, doNotActivateList: item.view.doNotActivateList }, (isSingleButton && { preview: item.view.preview })), (isListButton && { withArrow: item.view.withArrow })), (type === 'wysiwyg' && item.wysiwyg && Object.assign({}, item.wysiwyg))), (type === 'markup' && item.markup && Object.assign({}, item.markup)));
|
|
21
21
|
};
|
|
22
22
|
export const createToolbarConfig = (editorType, toolbarPreset, toolbarName) => {
|
|
23
23
|
var _a;
|
|
@@ -5,5 +5,7 @@ import { ToolbarTooltipDelay } from './const';
|
|
|
5
5
|
import './PreviewTooltip.css';
|
|
6
6
|
const b = cn('preview-tooltip');
|
|
7
7
|
export const PreviewTooltip = ({ preview, children }) => {
|
|
8
|
-
|
|
8
|
+
if (!preview)
|
|
9
|
+
return children;
|
|
10
|
+
return (React.createElement(Tooltip, { placement: ['right', 'left'], className: b(), contentClassName: b('content'), disabled: !preview, openDelay: ToolbarTooltipDelay.Open, closeDelay: ToolbarTooltipDelay.Close, content: preview }, children));
|
|
9
11
|
};
|
package/build/esm/version.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/** During build process, the current version will be injected here */
|
|
2
|
-
export const VERSION = typeof '14.12.
|
|
2
|
+
export const VERSION = typeof '14.12.3' !== 'undefined' ? '14.12.3' : 'unknown';
|
package/build/styles.css
CHANGED
|
@@ -1158,6 +1158,9 @@ body :has(.g-md-resizable_resizing) {
|
|
|
1158
1158
|
.ProseMirror.yfm .yfm-cut .yfm-cut-title:focus {
|
|
1159
1159
|
outline: 0;
|
|
1160
1160
|
}
|
|
1161
|
+
.ProseMirror.yfm .yfm-cut.open .yfm-cut-title:before {
|
|
1162
|
+
transform: translateY(-50%);
|
|
1163
|
+
}
|
|
1161
1164
|
.yfm-editor .yfm-file {
|
|
1162
1165
|
pointer-events: none;
|
|
1163
1166
|
}
|