Skip to content

fix: added z-index to mode help tooltip and z-index system (issue #298) #544

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 20 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 9 commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
52053e5
fix: added z-index to mode help tooltip and z-index system
dpolevodin Dec 27, 2024
b320856
Merge branch 'main' into fix/tooltip-hidden-under-toolbar
dpolevodin Dec 30, 2024
de7a072
fix: added z-index to mode help tooltip and z-index system (fixed lint)
dpolevodin Jan 13, 2025
39a4f7e
Merge branch 'main' into fix/tooltip-hidden-under-toolbar
dpolevodin Jan 13, 2025
f931513
Merge branch 'main' into fix/tooltip-hidden-under-toolbar
dpolevodin Jan 16, 2025
8361dc8
Merge branch 'main' into fix/tooltip-hidden-under-toolbar
makhnatkin Feb 10, 2025
bbb43b2
fix: merge main into fix/tooltip-hidden-under-toolbar
dpolevodin Feb 12, 2025
2e602da
Merge branch 'main' into fix/tooltip-hidden-under-toolbar
dpolevodin Feb 12, 2025
32ab6c3
Merge branch 'main' into fix/tooltip-hidden-under-toolbar
makhnatkin Feb 13, 2025
0e13a7e
Merge branch 'main' into fix/tooltip-hidden-under-toolbar
dpolevodin Feb 26, 2025
93df072
Merge branch 'main' of https://github.com/dpolevodin/markdown-editor …
dpolevodin Feb 26, 2025
9a3ccfd
Merge branch 'fix/tooltip-hidden-under-toolbar' of https://github.com…
dpolevodin Feb 26, 2025
f49eca8
fix: merge main
Apr 17, 2025
2ebcba2
fix: return z-index value to sticky-toolbar
Apr 17, 2025
c3f5a1a
fix: added zIndex varibale to HelpMark
Apr 17, 2025
6efee79
feat: merge master
May 14, 2025
a08425b
feat: upped @gravity-ui/uikit version to latest and added zIndex prop…
May 14, 2025
342eb37
fix: merge master
Jun 2, 2025
380e90e
fix: prettier fix
Jun 2, 2025
40e2aba
Merge branch 'main' into fix/tooltip-hidden-under-toolbar
dpolevodin Jun 2, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions README-ru.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ function Editor({onSubmit}) {
```

Полезные ссылки:

- [Как подключить редактор в Create React App](https://preview.gravity-ui.com/md-editor/?path=/docs/docs-install-create-react-app--docs)
- [Как добавить предварительный просмотр для режима разметки](https://preview.gravity-ui.com/md-editor/?path=/docs/docs-develop-preview--docs)
- [Как добавить расширение HTML](https://preview.gravity-ui.com/md-editor/?path=/docs/docs-connect-html-block--docs)
Expand Down Expand Up @@ -83,6 +84,31 @@ configure({

Обязательно сделайте вызов `configure()` из [UIKit](https://github.com/gravity-ui/uikit?tab=readme-ov-file#i18n) и других UI-библиотек.

### Система z-index

В этом проекте используется система z-index для управления слоями элементов. Ниже приведены определенные уровни и их значения:

| level | z-index value |
| ------------------- | ------------- |
| background | -1 |
| default | 0 |
| forefront | 1 |
| img-settings-button | 2 |
| table-view-button | 100 |
| table-cell-button | 110 |
| sticky-toolbar | 990 |

### Использование

Для применения z-index в компонентах используйте миксин z-index, передавая соответствующий ключ в качестве аргумента:

```scss
@use 'styles/mixins.scss';

.tooltip {
@include mixins.z-index('forefront');
}
```

### Участие в разработке

Expand Down
30 changes: 29 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,9 @@ function Editor({onSubmit}) {
return <MarkdownEditorView stickyToolbar autofocus editor={editor} />;
}
```

Read more:

- [How to connect the editor in the Create React App](https://preview.gravity-ui.com/md-editor/?path=/docs/docs-install-create-react-app--docs)
- [How to add preview for markup mode](https://preview.gravity-ui.com/md-editor/?path=/docs/docs-develop-preview--docs)
- [How to add HTML extension](https://preview.gravity-ui.com/md-editor/?path=/docs/docs-connect-html-block--docs)
Expand All @@ -61,13 +63,13 @@ Read more:
- [How to add text binding extension in markdown](https://preview.gravity-ui.com/md-editor/?path=/docs/docs-develop-extension-with-popup--docs)

### Development

To start the dev storybook

```shell
npm start
```


### i18n

To set up internationalization, you just need to use the `configure`:
Expand All @@ -82,6 +84,32 @@ configure({

Don't forget to call `configure()` from [UIKit](https://github.com/gravity-ui/uikit?tab=readme-ov-file#i18n) and other UI libraries.

### Z-index levels

This project uses a z-index map to control the layers of elements. Defined levels:

| level | z-index value |
| ------------------- | ------------- |
| background | -1 |
| default | 0 |
| forefront | 1 |
| img-settings-button | 2 |
| table-view-button | 100 |
| table-cell-button | 110 |
| sticky-toolbar | 990 |

### Usage

To apply z-index to components, use the z-index mixin, passing the key as an argument:

```scss
@use 'styles/mixins.scss';

.tooltip {
@include mixins.z-index('forefront');
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add to docs plz too

```

### Contributing

- [Contributor Guidelines](https://preview.gravity-ui.com/md-editor/?path=/docs/docs-contributing--docs)
6 changes: 4 additions & 2 deletions src/bundle/settings/index.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@use '../../styles/mixins.scss';

@import '~@gravity-ui/uikit/styles/mixins';

.g-md-editor-settings {
Expand All @@ -13,11 +15,11 @@
}

&__separator {
z-index: 0;

margin: 6px 4px;

border-left: 1px solid var(--g-color-line-generic);

@include mixins.z-index('default');
}
}

Expand Down
6 changes: 3 additions & 3 deletions src/bundle/sticky/sticky.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@use '../../styles/zindex' as zIndexVars;
@use '../../styles/mixins.scss';

$block: 'g-md-editor-sticky';

Expand All @@ -13,10 +13,10 @@ $block: 'g-md-editor-sticky';
}

&_sticky-active:not(.#{$block}_clear) {
z-index: zIndexVars.$sticky-toolbar;

padding: var(--g-md-toolbar-sticky-padding);

@include mixins.z-index('sticky-toolbar');

&::before {
position: absolute;
inset: var(--g-md-toolbar-sticky-inset, -4px);
Expand Down
10 changes: 7 additions & 3 deletions src/extensions/additional/FoldingHeading/plugins/folding.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
@use '~@gravity-ui/uikit/styles/mixins.scss' as uikit;
@use '../../../../styles/mixins.scss';

.pm-h-folding-hidden {
display: none;
Expand All @@ -13,7 +14,6 @@

&::before {
position: absolute;
z-index: 1;
bottom: -4px;
left: 0;

Expand All @@ -27,11 +27,12 @@
mask-size: 12px;

transform: translateY(80%);

@include mixins.z-index('forefront');
}

&::after {
position: absolute;
z-index: 1;
bottom: -8px;
left: 16px;

Expand All @@ -42,13 +43,14 @@
content: '';

border-top: 1px dashed var(--g-color-line-generic);

@include mixins.z-index('forefront');
}
}

.pm-h-folding-label {
&::after {
position: absolute;
z-index: 1;
right: 2px;
bottom: -6px;

Expand All @@ -65,5 +67,7 @@
transform: translate(0, 50%);

@include uikit.text-body-1();

@include mixins.z-index('forefront');
}
}
5 changes: 4 additions & 1 deletion src/extensions/additional/Math/view-and-edit.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@use '../../../styles/mixins.scss';

.math-block {
font-family: var(--g-font-family-monospace);

Expand Down Expand Up @@ -46,7 +48,6 @@

&::before {
position: absolute;
z-index: -1;
inset: -2px;

content: '';
Expand All @@ -55,6 +56,8 @@
background-color: var(--g-md-math-back-color);

transition: background-color 0.15s linear;

@include mixins.z-index('background');
}

&:hover {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@use '../../../../styles/mixins.scss';

.g-md-Mermaid {
display: flex;
justify-content: space-between;
Expand Down Expand Up @@ -32,9 +34,9 @@
}

&__EditorPopover {
z-index: 1;

float: right;

@include mixins.z-index('forefront');
}

&__Controls {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@use '../../../../styles/mixins.scss';

.g-md-yfm-html-block {
position: relative;

Expand Down Expand Up @@ -65,9 +67,9 @@
}

&__editor-popover {
z-index: 1;

float: right;

@include mixins.z-index('forefront');
}

&__controls {
Expand Down
5 changes: 4 additions & 1 deletion src/extensions/behavior/Cursor/gapcursor.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@use '../../../styles//mixins.scss';

.Prosemirror-hide-cursor {
caret-color: transparent;
}
Expand Down Expand Up @@ -28,7 +30,6 @@

&::before {
position: relative;
z-index: 1;

display: inline-block;

Expand All @@ -38,6 +39,8 @@
caret-color: transparent;

border-right: 1px solid transparent;

@include mixins.z-index('forefront');
}

.ProseMirror-focused &::before {
Expand Down
5 changes: 4 additions & 1 deletion src/extensions/behavior/Placeholder/index.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@use '../../../styles/mixins.scss';

.ProseMirror .g-md-placeholder {
display: inline-block;

Expand Down Expand Up @@ -28,7 +30,6 @@
.ProseMirror-focused &_focus {
.g-md-placeholder__cursor {
position: relative;
z-index: 1;

margin-right: -1px;

Expand All @@ -37,6 +38,8 @@

animation: placeholder_blink 1s;
animation-iteration-count: infinite;

@include mixins.z-index('forefront');
}
}
}
5 changes: 4 additions & 1 deletion src/extensions/behavior/Resizable/Resizable.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@use '../../../styles/mixins.scss';

body :has(.g-md-resizable_resizing) {
cursor: col-resize;
}
Expand All @@ -8,7 +10,6 @@ body :has(.g-md-resizable_resizing) {
&_resizing &__resizer-wrapper,
&_hover &__resizer-wrapper {
position: absolute;
z-index: 1;
top: 0;

display: flex;
Expand All @@ -21,6 +22,8 @@ body :has(.g-md-resizable_resizing) {
cursor: col-resize;
pointer-events: auto;

@include mixins.z-index('forefront');

&_left {
left: 0;
}
Expand Down
4 changes: 3 additions & 1 deletion src/extensions/markdown/Code/code.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@use '../../../styles/mixins.scss';
// add custom styles for prosemirror-codemark
// because default styles conflict with the rest of the project styles

Expand All @@ -19,7 +20,6 @@

.ProseMirror-focused .fake-cursor {
position: relative;
z-index: 1;

margin-right: -1px;

Expand All @@ -28,4 +28,6 @@

animation: code_fake_blink 1s;
animation-iteration-count: infinite;

@include mixins.z-index('forefront');
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
@use '../../../../../styles/mixins.scss';

.g-md-img-settings-button {
position: absolute;
z-index: 2;
top: 3px;
right: 3px;

@include mixins.z-index('img-settings-button');
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@use '../../../../../styles/mixins.scss';

$buttons-size: 16px;
$buttons-offset: 2px;

Expand Down Expand Up @@ -42,7 +44,6 @@ $buttons-offset: 2px;

&_right {
position: absolute;
z-index: 100;
top: 0;
right: -$buttons-size - $buttons-offset;

Expand All @@ -51,18 +52,21 @@ $buttons-offset: 2px;

width: $buttons-size;
height: 100%;

@include mixins.z-index('table-view-button');
}

&_bottom {
position: absolute;
z-index: 100;
bottom: -$buttons-size - $buttons-offset;

display: flex;
justify-content: center;

width: 100%;
height: $buttons-size;

@include mixins.z-index('table-view-button');
}
}

Expand Down
Loading
Loading