Skip to content

Commit 6d826aa

Browse files
authored
Merge branch 'main' into fix/sink-list-reverse-selection
2 parents e06c2c8 + 4259431 commit 6d826aa

22 files changed

+347
-39
lines changed

CHANGELOG.md

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

3+
## [15.12.0](https://github.com/gravity-ui/markdown-editor/compare/v15.11.1...v15.12.0) (2025-05-15)
4+
5+
6+
### Features
7+
8+
* **view:** added hook for opening files gallery ([#742](https://github.com/gravity-ui/markdown-editor/issues/742)) ([622fdaa](https://github.com/gravity-ui/markdown-editor/commit/622fdaacd563551373119a2837df9e1672ed098a))
9+
310
## [15.11.1](https://github.com/gravity-ui/markdown-editor/compare/v15.11.0...v15.11.1) (2025-05-13)
411

512

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import transform from '@diplodoc/transform';
2+
import type {StoryObj} from '@storybook/react';
3+
4+
import {ViewWithGallery} from './ViewWithGallery';
5+
import {galleryMarkup} from './markup';
6+
7+
export const Story: StoryObj<typeof ViewWithGallery> = {
8+
args: {
9+
html: transform(galleryMarkup).result.html,
10+
},
11+
};
12+
Story.storyName = 'View gallery';
13+
14+
export default {
15+
title: 'View / Gallery',
16+
component: ViewWithGallery,
17+
};
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
.view-with-gallery {
2+
img {
3+
cursor: pointer;
4+
}
5+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import type {FC} from 'react';
2+
3+
import {GalleryProvider} from '@gravity-ui/components';
4+
5+
import {YfmStaticView, type YfmStaticViewProps, useFilesGallery} from 'src/view';
6+
7+
import './ViewWithGallery.scss';
8+
9+
export type ViewWithGalleryProps = YfmStaticViewProps;
10+
11+
const ViewWithGalleryContent: FC<ViewWithGalleryProps> = (props) => {
12+
const {openFilesGallery} = useFilesGallery();
13+
14+
return (
15+
// eslint-disable-next-line jsx-a11y/click-events-have-key-events,jsx-a11y/no-static-element-interactions
16+
<div className="view-with-gallery" onClick={openFilesGallery}>
17+
<YfmStaticView {...props} />
18+
</div>
19+
);
20+
};
21+
22+
export const ViewWithGallery: FC<ViewWithGalleryProps> = (props) => {
23+
return (
24+
<GalleryProvider>
25+
<ViewWithGalleryContent {...props} />
26+
</GalleryProvider>
27+
);
28+
};

demo/stories/view/gallery/markup.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
export const galleryMarkup = `
2+
## Images
3+
4+
![Minion](https://octodex.github.com/images/minion.png)
5+
![Stormtroopocat](https://octodex.github.com/images/stormtroopocat.jpg "The Stormtroopocat")
6+
7+
![Dojocat](https://octodex.github.com/images/dojocat.jpg "The Dojocat")
8+
9+
[Video](https://static.videezy.com/system/resources/previews/000/013/444/original/Water_43_-_37s_-_4k_res.mp4)
10+
`.trim();
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import transform from '@diplodoc/transform';
2+
import type {StoryObj} from '@storybook/react';
3+
4+
import {YfmStaticView} from 'src/view';
5+
6+
import {markup} from '../../../defaults/content';
7+
8+
export const Story: StoryObj<typeof YfmStaticView> = {
9+
args: {
10+
html: transform(markup).result.html,
11+
},
12+
};
13+
Story.storyName = 'Static view';
14+
15+
export default {
16+
title: 'View / YfmStaticView',
17+
component: YfmStaticView,
18+
};

package-lock.json

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

0 commit comments

Comments
 (0)