Skip to content

Commit 32ab6c3

Browse files
authored
Merge branch 'main' into fix/tooltip-hidden-under-toolbar
2 parents 2e602da + 05fa997 commit 32ab6c3

File tree

12 files changed

+64
-27
lines changed

12 files changed

+64
-27
lines changed

CHANGELOG.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,18 @@
11
# Changelog
22

3+
## [15.0.1](https://github.com/gravity-ui/markdown-editor/compare/v15.0.0...v15.0.1) (2025-02-12)
4+
5+
6+
### Bug Fixes
7+
8+
* **bundle:** added missing toolbar types ([#611](https://github.com/gravity-ui/markdown-editor/issues/611)) ([40a5ff2](https://github.com/gravity-ui/markdown-editor/commit/40a5ff2f7354ece6bc783bf3a3a89e6fa7e02e88))
9+
* **bundle:** added preview in toolbar select ([#615](https://github.com/gravity-ui/markdown-editor/issues/615)) ([4dfb4fc](https://github.com/gravity-ui/markdown-editor/commit/4dfb4fca360c20307f4a2f64e03e230fab97a01c))
10+
* **bundle:** fixed active list element ([#625](https://github.com/gravity-ui/markdown-editor/issues/625)) ([60e16d4](https://github.com/gravity-ui/markdown-editor/commit/60e16d4126f7533d61dba98fbdfc837aff670130))
11+
* **cut:** fixed open state styles ([#616](https://github.com/gravity-ui/markdown-editor/issues/616)) ([f80fe92](https://github.com/gravity-ui/markdown-editor/commit/f80fe922af88d9e547d25b9d590ac40a94f7de2d))
12+
* **plugins:** mark TooltipButtonPlugin and TooltipSelectPlugin deprecated ([#621](https://github.com/gravity-ui/markdown-editor/issues/621)) ([06d4c6c](https://github.com/gravity-ui/markdown-editor/commit/06d4c6ce6c78e6667b5253d5797592ef3515c21d))
13+
* **toolbar:** dont render tooltip if preview is empty ([#622](https://github.com/gravity-ui/markdown-editor/issues/622)) ([4e9d19f](https://github.com/gravity-ui/markdown-editor/commit/4e9d19fe13d79e0724732f48fe6c9073f8c197e2))
14+
* **toolbar:** fixed preview tooltip placement ([#607](https://github.com/gravity-ui/markdown-editor/issues/607)) ([de141f2](https://github.com/gravity-ui/markdown-editor/commit/de141f22ea0d8b770e9737ff21dd25da20d9e3ff))
15+
316
## [15.0.0](https://github.com/gravity-ui/markdown-editor/compare/v14.12.2...v15.0.0) (2025-02-11)
417

518
See [the migration guide here](https://github.com/gravity-ui/markdown-editor/discussions/610).

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@gravity-ui/markdown-editor",
3-
"version": "15.0.0",
3+
"version": "15.0.1",
44
"description": "Markdown wysiwyg and markup editor",
55
"license": "MIT",
66
"repository": {

src/bundle/toolbar/ToolbarSelect.tsx

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import {
99

1010
import {cn} from '../../classname';
1111
import {isFunction} from '../../lodash';
12+
import {PreviewTooltip} from '../../toolbar/PreviewTooltip';
1213

1314
import type {WToolbarBaseProps, WToolbarItemData} from './types';
1415

@@ -46,28 +47,30 @@ export const ToolbarSelect: React.FC<ToolbarSelectProps> = ({
4647
text: isFunction(item.title) ? item.title() : item.title,
4748
}))}
4849
renderOption={({text, data}) => {
49-
const {icon, hotkey, hint} = data as WToolbarItemData;
50+
const {icon, hotkey, hint, preview} = data as WToolbarItemData;
5051
const hintText = isFunction(hint) ? hint() : hint;
5152
return (
52-
<div aria-label={text} className={b('item')}>
53-
<div className={b('item-icon')}>
54-
<Icon data={icon.data} size={Number(icon.size ?? 16) + 2} />
55-
</div>
56-
<div className={b('item-content')}>
57-
{text}
58-
<div className={b('item-extra')}>
59-
{hotkey && <Hotkey value={hotkey} />}
60-
{hintText && (
61-
<HelpMark
62-
popoverProps={{modal: false}}
63-
className={b('item-hint')}
64-
>
65-
{hintText}
66-
</HelpMark>
67-
)}
53+
<PreviewTooltip preview={preview}>
54+
<div aria-label={text} className={b('item')}>
55+
<div className={b('item-icon')}>
56+
<Icon data={icon.data} size={Number(icon.size ?? 16) + 2} />
57+
</div>
58+
<div className={b('item-content')}>
59+
{text}
60+
<div className={b('item-extra')}>
61+
{hotkey && <Hotkey value={hotkey} />}
62+
{hintText && (
63+
<HelpMark
64+
popoverProps={{modal: false}}
65+
className={b('item-hint')}
66+
>
67+
{hintText}
68+
</HelpMark>
69+
)}
70+
</div>
6871
</div>
6972
</div>
70-
</div>
73+
</PreviewTooltip>
7174
);
7275
}}
7376
onUpdate={([id]) => {

src/bundle/toolbar/utils/toolbarsConfigs.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ interface TransformedItem {
2929
icon?: ToolbarIconData;
3030
hotkey?: string;
3131
withArrow?: boolean;
32+
doNotActivateList?: boolean;
3233
preview?: React.ReactNode;
3334
wysiwyg?: ToolbarItemWysiwyg<ToolbarDataType>;
3435
markup?: ToolbarItemMarkup<ToolbarDataType>;
@@ -56,6 +57,7 @@ const transformItem = (
5657
hint: item.view.hint,
5758
icon: item.view.icon,
5859
hotkey: item.view.hotkey,
60+
doNotActivateList: item.view.doNotActivateList,
5961
...(isSingleButton && {preview: (item.view as any).preview}),
6062
...(isListButton && {withArrow: (item.view as any).withArrow}),
6163
...(type === 'wysiwyg' && item.wysiwyg && {...item.wysiwyg}),

src/extensions/yfm/YfmCut/index.scss

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
11
@use '../../../styles/mixins.scss';
22

3-
.ProseMirror.yfm .yfm-cut {
4-
@include mixins.block-border-hover();
3+
.ProseMirror.yfm {
4+
.yfm-cut {
5+
@include mixins.block-border-hover();
56

6-
&.yfm-cut-active {
7-
border-color: var(--g-color-line-generic);
7+
&.yfm-cut-active {
8+
border-color: var(--g-color-line-generic);
9+
}
10+
.yfm-cut-title:focus {
11+
outline: 0;
12+
}
813
}
9-
.yfm-cut-title:focus {
10-
outline: 0;
14+
.yfm-cut.open .yfm-cut-title:before {
15+
transform: translateY(-50%);
1116
}
1217
}

src/plugins/TooltipButton/TooltipButton.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,13 @@ import {Button, Icon, Popup, type PopupPlacement, type PopupProps} from '@gravit
55

66
import {useBooleanState, useElementState} from '../../react-utils';
77

8+
/** @deprecated */
89
type TooltipButtonProps = Pick<PopupProps, 'onOutsideClick'> & {
910
domElem: HTMLElement | null;
1011
children?: React.ReactNode;
1112
};
1213

14+
/** @deprecated */
1315
export const TooltipButton: React.FC<TooltipButtonProps> = ({
1416
domElem,
1517
children,

src/plugins/TooltipButton/index.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,24 +10,28 @@ import {
1010

1111
import {TooltipButton} from './TooltipButton';
1212

13+
/** @deprecated */
1314
type ButtonContent = (
1415
view: EditorView,
1516
node: BaseTooltipNode,
1617
toggleEdit: () => void,
1718
) => React.ReactElement;
1819

20+
/** @deprecated */
1921
type FormContent = (
2022
view: EditorView,
2123
node: BaseTooltipNode,
2224
onChange?: TooltipOnChangeCallback,
2325
) => React.ReactElement;
2426

27+
/** @deprecated */
2528
interface TooltipMenuOptions extends BaseTooltipPluginOptions {
2629
disableHideOnBlur?: boolean;
2730
buttonContent: ButtonContent;
2831
formContent: FormContent;
2932
}
3033

34+
/** @deprecated */
3135
export class TooltipButtonPluginView extends BaseTooltipPluginView {
3236
private enableHideOnBlur?: boolean;
3337
private forceEdit = false;

src/plugins/TooltipSelect/TooltipSelect.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import {
1212

1313
import {useBooleanState} from '../../react-utils';
1414

15+
/** @deprecated */
1516
type TooltipButtonProps = Pick<PopupProps, 'onOutsideClick'> & {
1617
domRef: HTMLElement | null;
1718
buttonTitle?: string;
@@ -20,6 +21,7 @@ type TooltipButtonProps = Pick<PopupProps, 'onOutsideClick'> & {
2021
withSearch?: boolean;
2122
};
2223

24+
/** @deprecated */
2325
export const TooltipButton: React.FC<TooltipButtonProps> = ({
2426
domRef,
2527
buttonTitle = 'Settings',

src/plugins/TooltipSelect/index.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import {
1010

1111
import {TooltipButton} from './TooltipSelect';
1212

13+
/** @deprecated */
1314
interface TooltipSelectOptions extends BaseTooltipPluginOptions {
1415
buttonText?: (node: Node) => string;
1516
items?: SelectOption[] | SelectOptionGroup[];
@@ -18,6 +19,7 @@ interface TooltipSelectOptions extends BaseTooltipPluginOptions {
1819
disableHideOnBlur?: boolean;
1920
}
2021

22+
/** @deprecated */
2123
export class TooltipSelectPluginView extends BaseTooltipPluginView {
2224
private buttonText?: (node: Node) => string;
2325
private items?: SelectOption[] | SelectOptionGroup[];

0 commit comments

Comments
 (0)