Skip to content

Commit 81088d5

Browse files
fix: Selection clicking editor padding (#1717)
* Changed block content to use bigger line height instead of padding * Updated PW snaps * Made `:before` elements have 0 height * Removed unnecessary style * Made changes to merge into main * Small changes * Updated PW snaps * Small change * Updated PW snaps
1 parent bdbe84e commit 81088d5

File tree

1 file changed

+14
-19
lines changed

1 file changed

+14
-19
lines changed

packages/core/src/editor/Block.css

Lines changed: 14 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -15,26 +15,9 @@ BASIC STYLES
1515

1616
.bn-block-content {
1717
padding: 3px 0;
18+
display: flex;
1819
transition: font-size 0.2s;
1920
width: 100%;
20-
/*
21-
because the content elements are display: block
22-
we use flex to position them next to list markers
23-
*/
24-
}
25-
26-
/* We can't set `display: flex` on `.bn-block-content` while it has inline
27-
content (see #1629). However, it's necessary to set alignment of blocks
28-
without content as these can't use `text-align`, so this additional rule is
29-
used. */
30-
.bn-block-content:not(:has(.bn-inline-content)) {
31-
display: flex;
32-
}
33-
34-
.bn-block-content::before {
35-
/* content: ""; */
36-
transition: all 0.2s;
37-
/*margin: 0px;*/
3821
}
3922

4023
.bn-block-content.ProseMirror-selectednode > *,
@@ -44,6 +27,19 @@ used. */
4427
outline: 4px solid rgb(100, 160, 255);
4528
}
4629

30+
.bn-block-content::before {
31+
content: "";
32+
margin-right: 0;
33+
transition: all 0.2s;
34+
/* Workaround for selection issue on Chrome, see #1588 and also here:
35+
https://discuss.prosemirror.net/t/mouse-down-selection-behaviour-different-on-chrome/8426
36+
The :before element causes the selection to be set in the wrong place vs
37+
other browsers. Setting no height fixes this, while list item indicators are
38+
still displayed fine as overflow is not hidden. */
39+
height: 0;
40+
overflow: visible;
41+
}
42+
4743
.bn-inline-content {
4844
width: 100%;
4945
}
@@ -175,7 +171,6 @@ NESTED BLOCKS
175171
.bn-block-content::before {
176172
margin-right: 0;
177173
content: "";
178-
display: inline;
179174
}
180175

181176
/* Ordered */

0 commit comments

Comments
 (0)