Skip to content
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

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

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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 @@ -84,6 +84,32 @@ 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 | 2000 |
| tooltip | 2100 |

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

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

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

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

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

Expand Down
27 changes: 27 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,33 @@ 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 | 2000 |
| tooltip | 2100 |

### 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('tooltip');
}
```

### Contributing

- [Contributor Guidelines](https://preview.gravity-ui.com/md-editor/?path=/docs/docs-contributing--docs)
10 changes: 8 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 All @@ -28,6 +30,10 @@
float: right;
}

&__tooltip {
@include mixins.z-index('tooltip');
}

&__separator {
border-bottom: 1px solid var(--g-color-line-generic);
}
Expand Down
1 change: 1 addition & 0 deletions src/bundle/settings/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ const SettingsContent: React.FC<SettingsContentProps> = function SettingsContent
<MarkdownHints />
</div>
}
tooltipClassName={bContent('tooltip')}
placement={mdHelpPlacement}
className={bContent('mode-help')}
/>
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 'node_modules/@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