Skip to content

fix: Selection clicking editor padding #1717

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

Merged
merged 10 commits into from
Jun 12, 2025
Prev Previous commit
Next Next commit
Made :before elements have 0 height
  • Loading branch information
matthewlipski committed May 23, 2025
commit 3b92dcbc37a6367dd9484172b66229ae63673361
26 changes: 19 additions & 7 deletions packages/core/src/editor/Block.css
Original file line number Diff line number Diff line change
Expand Up @@ -14,23 +14,33 @@ BASIC STYLES
}

.bn-block-content {
display: flex;
transition: font-size 0.2s;
width: 100%;
}

.bn-block-content::before {
/* content: ""; */
transition: all 0.2s;
/*margin: 0px;*/
}

.bn-block-content.ProseMirror-selectednode > *,
/* Case for node view renderers */
.ProseMirror-selectednode > .bn-block-content > * {
border-radius: 4px;
outline: 4px solid rgb(100, 160, 255);
}

.bn-block-content::before {
transition: all 0.2s;
/* Workaround for selection issue on Chrome, see #1588 and also here:
https://discuss.prosemirror.net/t/mouse-down-selection-behaviour-different-on-chrome/8426
The :before element causes the selection to be set in the wrong place vs
other browsers. Setting no height fixes this, while list item indicators are
still displayed fine as overflow is not hidden. */
height: 0;
/* Also have to center the text vertically to ensure alignment at different
line heights (which we change for `.bn-inline-content` below). */
display: flex;
align-items: center;
vertical-align: middle;
}

.bn-inline-content {
width: 100%;
/* We use line height on `.bn-inline-content` to mimic padding on
Expand Down Expand Up @@ -182,11 +192,11 @@ NESTED BLOCKS
.bn-block-content::before {
margin-right: 0;
content: "";
display: inline;
}

/* Ordered */
.bn-block-content[data-content-type="numberedListItem"] {
align-items: center;
display: flex;
gap: 0.5em;
}
Expand All @@ -213,12 +223,14 @@ NESTED BLOCKS

/* Unordered */
.bn-block-content[data-content-type="bulletListItem"] {
align-items: center;
display: flex;
gap: 0.5em;
}

/* Checked */
.bn-block-content[data-content-type="checkListItem"] > div {
align-items: center;
display: flex;
width: 100%;
}
Expand Down
Loading