@gravity-ui/markdown-editor 15.13.3 → 15.14.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/build/cjs/toolbar/ToolbarButton.d.ts +1 -0
- package/build/cjs/toolbar/ToolbarButton.js +2 -2
- package/build/cjs/toolbar/ToolbarButton.js.map +1 -1
- package/build/cjs/version.js +1 -1
- package/build/cjs/version.js.map +1 -1
- package/build/esm/toolbar/ToolbarButton.d.ts +1 -0
- package/build/esm/toolbar/ToolbarButton.js +2 -2
- package/build/esm/toolbar/ToolbarButton.js.map +1 -1
- package/build/esm/version.js +1 -1
- package/build/esm/version.js.map +1 -1
- package/package.json +1 -1
|
@@ -12,7 +12,7 @@ const const_1 = require("./const.js");
|
|
|
12
12
|
require("./ToolbarButton.css");
|
|
13
13
|
const b = (0, classname_1.cn)('toolbar-button');
|
|
14
14
|
const DEFAULT_ICON_SIZE = 16;
|
|
15
|
-
exports.ToolbarButtonView = (0, react_1.forwardRef)(function ToolbarButtonView({ title, hint, hotkey, hintWhenDisabled, active, enabled, onClick, className, qa, ...props }, ref) {
|
|
15
|
+
exports.ToolbarButtonView = (0, react_1.forwardRef)(function ToolbarButtonView({ title, hint, hotkey, hintWhenDisabled, active, enabled, onClick, className, qa, id, ...props }, ref) {
|
|
16
16
|
const disabled = !active && !enabled;
|
|
17
17
|
const titleText = (0, lodash_1.isFunction)(title) ? title() : title;
|
|
18
18
|
const hintText = (0, lodash_1.isFunction)(hint) ? hint() : hint;
|
|
@@ -26,7 +26,7 @@ exports.ToolbarButtonView = (0, react_1.forwardRef)(function ToolbarButtonView({
|
|
|
26
26
|
(0, uikit_1.setRef)(ref, elem);
|
|
27
27
|
(0, uikit_1.setRef)(refForPopover, elem);
|
|
28
28
|
(0, uikit_1.setRef)(refForTooltip, elem);
|
|
29
|
-
}, selected: active, disabled: disabled, view: active ? 'normal' : 'flat', onClick: onClick, className: b(null, [className]), "aria-label": titleText, children: 'icon' in props ? ((0, jsx_runtime_1.jsx)(uikit_1.Icon, { data: props.icon.data, size: props.icon.size ?? DEFAULT_ICON_SIZE })) : (props.children) })) })) }));
|
|
29
|
+
}, selected: active, disabled: disabled, view: active ? 'normal' : 'flat', onClick: onClick, className: b(null, [className]), "aria-label": titleText, "data-toolbar-item": id, children: 'icon' in props ? ((0, jsx_runtime_1.jsx)(uikit_1.Icon, { data: props.icon.data, size: props.icon.size ?? DEFAULT_ICON_SIZE })) : (props.children) })) })) }));
|
|
30
30
|
});
|
|
31
31
|
function ToolbarButton(props) {
|
|
32
32
|
const { id, editor, focus, isActive, isEnable, exec, onClick } = props;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ToolbarButton.js","sourceRoot":"../../../src","sources":["toolbar/ToolbarButton.tsx"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"ToolbarButton.js","sourceRoot":"../../../src","sources":["toolbar/ToolbarButton.tsx"],"names":[],"mappings":";;;AA0GA,sCAaC;;AAvHD,iCAAiD;AAEjD,6CAA+E;AAE/E,+CAAgC;AAChC,oDAAoC;AACpC,yCAAqC;AAErC,sCAA4C;AAG5C,+BAA8B;AAE9B,MAAM,CAAC,GAAG,IAAA,cAAE,EAAC,gBAAgB,CAAC,CAAC;AAe/B,MAAM,iBAAiB,GAAG,EAAE,CAAC;AAEhB,QAAA,iBAAiB,GAAG,IAAA,kBAAU,EACvC,SAAS,iBAAiB,CACtB,EACI,KAAK,EACL,IAAI,EACJ,MAAM,EACN,gBAAgB,EAChB,MAAM,EACN,OAAO,EACP,OAAO,EACP,SAAS,EACT,EAAE,EACF,EAAE,EACF,GAAG,KAAK,EACX,EACD,GAAG;IAEH,MAAM,QAAQ,GAAG,CAAC,MAAM,IAAI,CAAC,OAAO,CAAC;IACrC,MAAM,SAAS,GAAW,IAAA,mBAAU,EAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC;IAC9D,MAAM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AAC,CAAC,CAAC,MAAM,EAChC,OAAO,EAAE,OAAO,EAChB,SAAS,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,SAAS,CAAC,CAAC,gBACnB,SAAS,uBACF,EAAE,YAEpB,MAAM,IAAI,KAAK,CAAC,CAAC,CAAC,CACf,uBAAC,YAAI,IACD,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,EACrB,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,IAAI,iBAAiB,GAC5C,CACL,CAAC,CAAC,CAAC,CACA,KAAK,CAAC,QAAQ,CACjB,GACI,CACZ,GACW,CACnB,GACK,CACb,CAAC;AACN,CAAC,CACJ,CAAC;AAEF,SAAgB,aAAa,CAAI,KAA4B;IACzD,MAAM,EAAC,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAC,GAAG,KAAK,CAAC;IAErE,MAAM,MAAM,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC;IAChC,MAAM,OAAO,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC;IAEjC,MAAM,WAAW,GAAG,GAAG,EAAE;QACrB,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,MAAM,CAAC,CAAC;QACb,OAAO,EAAE,CAAC,EAAE,CAAC,CAAC;IAClB,CAAC,CAAC;IAEF,OAAO,uBAAC,yBAAiB,OAAK,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,WAAW,GAAI,CAAC;AACpG,CAAC","sourcesContent":["import {type ReactNode, forwardRef} from 'react';\n\nimport {ActionTooltip, Button, Icon, Popover, setRef} from '@gravity-ui/uikit';\n\nimport {cn} from '../classname';\nimport {i18n} from '../i18n/common';\nimport {isFunction} from '../lodash';\n\nimport {ToolbarTooltipDelay} from './const';\nimport type {ToolbarBaseProps, ToolbarItemData} from './types';\n\nimport './ToolbarButton.scss';\n\nconst b = cn('toolbar-button');\n\nexport type ToolbarButtonProps<E> = ToolbarBaseProps<E> & ToolbarItemData<E>;\n\nexport type ToolbarButtonViewProps = Pick<\n ToolbarItemData<unknown>,\n 'title' | 'hint' | 'hotkey' | 'hintWhenDisabled' | 'qa'\n> & {\n active: boolean;\n enabled: boolean;\n onClick: () => void;\n id?: string;\n className?: string;\n} & (Pick<ToolbarItemData<unknown>, 'icon'> | {children: ReactNode});\n\nconst DEFAULT_ICON_SIZE = 16;\n\nexport const ToolbarButtonView = forwardRef<HTMLButtonElement, ToolbarButtonViewProps>(\n function ToolbarButtonView(\n {\n title,\n hint,\n hotkey,\n hintWhenDisabled,\n active,\n enabled,\n onClick,\n className,\n qa,\n id,\n ...props\n },\n ref,\n ) {\n const disabled = !active && !enabled;\n const titleText: string = isFunction(title) ? title() : title;\n const hintText: string | undefined = isFunction(hint) ? hint() : hint;\n const hideHintWhenDisabled = hintWhenDisabled === false || !disabled;\n const hintWhenDisabledText =\n typeof hintWhenDisabled === 'string'\n ? hintWhenDisabled\n : typeof hintWhenDisabled === 'function'\n ? hintWhenDisabled()\n : i18n('toolbar_action_disabled');\n\n return (\n <Popover\n content={<div className={b('action-disabled-tooltip')}>{hintWhenDisabledText}</div>}\n disabled={hideHintWhenDisabled}\n placement={['bottom']}\n >\n {(_, refForPopover) => (\n <ActionTooltip\n openDelay={ToolbarTooltipDelay.Open}\n closeDelay={ToolbarTooltipDelay.Close}\n description={hintText}\n title={titleText}\n hotkey={hotkey}\n >\n {(__, refForTooltip) => (\n <Button\n qa={qa}\n size=\"m\"\n ref={(elem: HTMLButtonElement) => {\n setRef(ref, elem);\n setRef(refForPopover, elem);\n setRef(refForTooltip, elem);\n }}\n selected={active}\n disabled={disabled}\n view={active ? 'normal' : 'flat'}\n onClick={onClick}\n className={b(null, [className])}\n aria-label={titleText}\n data-toolbar-item={id}\n >\n {'icon' in props ? (\n <Icon\n data={props.icon.data}\n size={props.icon.size ?? DEFAULT_ICON_SIZE}\n />\n ) : (\n props.children\n )}\n </Button>\n )}\n </ActionTooltip>\n )}\n </Popover>\n );\n },\n);\n\nexport function ToolbarButton<E>(props: ToolbarButtonProps<E>) {\n const {id, editor, focus, isActive, isEnable, exec, onClick} = props;\n\n const active = isActive(editor);\n const enabled = isEnable(editor);\n\n const handleClick = () => {\n focus();\n exec(editor);\n onClick?.(id);\n };\n\n return <ToolbarButtonView {...props} active={active} enabled={enabled} onClick={handleClick} />;\n}\n"]}
|
package/build/cjs/version.js
CHANGED
|
@@ -2,5 +2,5 @@
|
|
|
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 '15.
|
|
5
|
+
exports.VERSION = typeof '15.14.0' !== 'undefined' ? '15.14.0' : 'unknown';
|
|
6
6
|
//# sourceMappingURL=version.js.map
|
package/build/cjs/version.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.js","sourceRoot":"../../src","sources":["version.ts"],"names":[],"mappings":";;;AAAA,sEAAsE;AACzD,QAAA,OAAO,GAAG,OAAO,WAAW,KAAK,WAAW,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,SAAS,CAAC","sourcesContent":["/** During build process, the current version will be injected here */\nexport const VERSION = typeof '15.
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"../../src","sources":["version.ts"],"names":[],"mappings":";;;AAAA,sEAAsE;AACzD,QAAA,OAAO,GAAG,OAAO,WAAW,KAAK,WAAW,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,SAAS,CAAC","sourcesContent":["/** During build process, the current version will be injected here */\nexport const VERSION = typeof '15.14.0' !== 'undefined' ? '15.14.0' : 'unknown';\n"]}
|
|
@@ -8,7 +8,7 @@ import { ToolbarTooltipDelay } from "./const.js";
|
|
|
8
8
|
import "./ToolbarButton.css";
|
|
9
9
|
const b = cn('toolbar-button');
|
|
10
10
|
const DEFAULT_ICON_SIZE = 16;
|
|
11
|
-
export const ToolbarButtonView = forwardRef(function ToolbarButtonView({ title, hint, hotkey, hintWhenDisabled, active, enabled, onClick, className, qa, ...props }, ref) {
|
|
11
|
+
export const ToolbarButtonView = forwardRef(function ToolbarButtonView({ title, hint, hotkey, hintWhenDisabled, active, enabled, onClick, className, qa, id, ...props }, ref) {
|
|
12
12
|
const disabled = !active && !enabled;
|
|
13
13
|
const titleText = isFunction(title) ? title() : title;
|
|
14
14
|
const hintText = isFunction(hint) ? hint() : hint;
|
|
@@ -22,7 +22,7 @@ export const ToolbarButtonView = forwardRef(function ToolbarButtonView({ title,
|
|
|
22
22
|
setRef(ref, elem);
|
|
23
23
|
setRef(refForPopover, elem);
|
|
24
24
|
setRef(refForTooltip, elem);
|
|
25
|
-
}, selected: active, disabled: disabled, view: active ? 'normal' : 'flat', onClick: onClick, className: b(null, [className]), "aria-label": titleText, children: 'icon' in props ? (_jsx(Icon, { data: props.icon.data, size: props.icon.size ?? DEFAULT_ICON_SIZE })) : (props.children) })) })) }));
|
|
25
|
+
}, selected: active, disabled: disabled, view: active ? 'normal' : 'flat', onClick: onClick, className: b(null, [className]), "aria-label": titleText, "data-toolbar-item": id, children: 'icon' in props ? (_jsx(Icon, { data: props.icon.data, size: props.icon.size ?? DEFAULT_ICON_SIZE })) : (props.children) })) })) }));
|
|
26
26
|
});
|
|
27
27
|
export function ToolbarButton(props) {
|
|
28
28
|
const { id, editor, focus, isActive, isEnable, exec, onClick } = props;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ToolbarButton.js","sourceRoot":"../../../src","sources":["toolbar/ToolbarButton.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAiB,UAAU,EAAC,MAAM,OAAO,CAAC;AAEjD,OAAO,EAAC,aAAa,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAC,MAAM,mBAAmB,CAAC;AAE/E,OAAO,EAAC,EAAE,EAAC,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KAAK,CAAC,CAAC,CAAC,CACf,KAAC,IAAI,IACD,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,EACrB,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,IAAI,iBAAiB,GAC5C,CACL,CAAC,CAAC,CAAC,CACA,KAAK,CAAC,QAAQ,CACjB,GACI,CACZ,GACW,CACnB,GACK,CACb,CAAC;AACN,CAAC,CACJ,CAAC;AAEF,MAAM,UAAU,aAAa,CAAI,KAA4B;IACzD,MAAM,EAAC,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAC,GAAG,KAAK,CAAC;IAErE,MAAM,MAAM,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC;IAChC,MAAM,OAAO,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC;IAEjC,MAAM,WAAW,GAAG,GAAG,EAAE;QACrB,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,MAAM,CAAC,CAAC;QACb,OAAO,EAAE,CAAC,EAAE,CAAC,CAAC;IAClB,CAAC,CAAC;IAEF,OAAO,KAAC,iBAAiB,OAAK,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,WAAW,GAAI,CAAC;AACpG,CAAC","sourcesContent":["import {type ReactNode, forwardRef} from 'react';\n\nimport {ActionTooltip, Button, Icon, Popover, setRef} from '@gravity-ui/uikit';\n\nimport {cn} from '../classname';\nimport {i18n} from '../i18n/common';\nimport {isFunction} from '../lodash';\n\nimport {ToolbarTooltipDelay} from './const';\nimport type {ToolbarBaseProps, ToolbarItemData} from './types';\n\nimport './ToolbarButton.scss';\n\nconst b = cn('toolbar-button');\n\nexport type ToolbarButtonProps<E> = ToolbarBaseProps<E> & ToolbarItemData<E>;\n\nexport type ToolbarButtonViewProps = Pick<\n ToolbarItemData<unknown>,\n 'title' | 'hint' | 'hotkey' | 'hintWhenDisabled' | 'qa'\n> & {\n active: boolean;\n enabled: boolean;\n onClick: () => void;\n id?: string;\n className?: string;\n} & (Pick<ToolbarItemData<unknown>, 'icon'> | {children: ReactNode});\n\nconst DEFAULT_ICON_SIZE = 16;\n\nexport const ToolbarButtonView = forwardRef<HTMLButtonElement, ToolbarButtonViewProps>(\n function ToolbarButtonView(\n {\n title,\n hint,\n hotkey,\n hintWhenDisabled,\n active,\n enabled,\n onClick,\n className,\n qa,\n id,\n ...props\n },\n ref,\n ) {\n const disabled = !active && !enabled;\n const titleText: string = isFunction(title) ? title() : title;\n const hintText: string | undefined = isFunction(hint) ? hint() : hint;\n const hideHintWhenDisabled = hintWhenDisabled === false || !disabled;\n const hintWhenDisabledText =\n typeof hintWhenDisabled === 'string'\n ? hintWhenDisabled\n : typeof hintWhenDisabled === 'function'\n ? hintWhenDisabled()\n : i18n('toolbar_action_disabled');\n\n return (\n <Popover\n content={<div className={b('action-disabled-tooltip')}>{hintWhenDisabledText}</div>}\n disabled={hideHintWhenDisabled}\n placement={['bottom']}\n >\n {(_, refForPopover) => (\n <ActionTooltip\n openDelay={ToolbarTooltipDelay.Open}\n closeDelay={ToolbarTooltipDelay.Close}\n description={hintText}\n title={titleText}\n hotkey={hotkey}\n >\n {(__, refForTooltip) => (\n <Button\n qa={qa}\n size=\"m\"\n ref={(elem: HTMLButtonElement) => {\n setRef(ref, elem);\n setRef(refForPopover, elem);\n setRef(refForTooltip, elem);\n }}\n selected={active}\n disabled={disabled}\n view={active ? 'normal' : 'flat'}\n onClick={onClick}\n className={b(null, [className])}\n aria-label={titleText}\n data-toolbar-item={id}\n >\n {'icon' in props ? (\n <Icon\n data={props.icon.data}\n size={props.icon.size ?? DEFAULT_ICON_SIZE}\n />\n ) : (\n props.children\n )}\n </Button>\n )}\n </ActionTooltip>\n )}\n </Popover>\n );\n },\n);\n\nexport function ToolbarButton<E>(props: ToolbarButtonProps<E>) {\n const {id, editor, focus, isActive, isEnable, exec, onClick} = props;\n\n const active = isActive(editor);\n const enabled = isEnable(editor);\n\n const handleClick = () => {\n focus();\n exec(editor);\n onClick?.(id);\n };\n\n return <ToolbarButtonView {...props} active={active} enabled={enabled} onClick={handleClick} />;\n}\n"]}
|
package/build/esm/version.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/** During build process, the current version will be injected here */
|
|
2
|
-
export const VERSION = typeof '15.
|
|
2
|
+
export const VERSION = typeof '15.14.0' !== 'undefined' ? '15.14.0' : 'unknown';
|
|
3
3
|
//# sourceMappingURL=version.js.map
|
package/build/esm/version.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.js","sourceRoot":"../../src","sources":["version.ts"],"names":[],"mappings":"AAAA,sEAAsE;AACtE,MAAM,CAAC,MAAM,OAAO,GAAG,OAAO,WAAW,KAAK,WAAW,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,SAAS,CAAC","sourcesContent":["/** During build process, the current version will be injected here */\nexport const VERSION = typeof '15.
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"../../src","sources":["version.ts"],"names":[],"mappings":"AAAA,sEAAsE;AACtE,MAAM,CAAC,MAAM,OAAO,GAAG,OAAO,WAAW,KAAK,WAAW,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,SAAS,CAAC","sourcesContent":["/** During build process, the current version will be injected here */\nexport const VERSION = typeof '15.14.0' !== 'undefined' ? '15.14.0' : 'unknown';\n"]}
|