Skip to content
Closed
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
41 changes: 23 additions & 18 deletions packages/core/src/editor/Block.css
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,14 @@ BASIC STYLES
*/
}

/* We can't set `display: flex` on `.bn-block-content` while it has inline
content (see comment below). However, it's necessary to set alignment of blocks
without content as these can't use `text-align`, so this additional rule is
used. */
.bn-block-content:not(:has(.bn-inline-content)) {
display: flex;
}

.bn-block-content::before {
/* content: ""; */
transition: all 0.2s;
Expand All @@ -37,6 +45,11 @@ BASIC STYLES
}

.bn-inline-content {
/* Allows displaying `.bn-block-content:before` elements side-by-side with
inline content. This is used instead of setting `display: flex` on
`.bn-block-content` as that causes selection issues for `.bn-inline-content`
elements when clicking the editor padding. */
display: inline;
width: 100%;
}

Expand Down Expand Up @@ -166,9 +179,8 @@ NESTED BLOCKS
}

/* Ordered */
.bn-block-content[data-content-type="numberedListItem"] {
display: flex;
gap: 0.5em;
.bn-block-content[data-content-type="numberedListItem"] .bn-inline-content {
margin-left: 0.5em;
}

[data-content-type="numberedListItem"] {
Expand All @@ -192,20 +204,21 @@ NESTED BLOCKS
}

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

/* Checked */
.bn-block-content[data-content-type="checkListItem"] > div {
display: flex;
width: 100%;
.bn-block-content[data-content-type="checkListItem"] .bn-inline-content {
margin-left: 0.5em;
}

.bn-block-content[data-content-type="checkListItem"] > div > div {
display: inline;
}

.bn-block-content[data-content-type="checkListItem"] > div > div > input {
margin: 0;
margin-inline-end: 0.5em;
cursor: pointer;
}

Expand All @@ -214,14 +227,6 @@ NESTED BLOCKS
text-decoration: line-through;
}

.bn-block-content[data-text-alignment="center"] {
justify-content: center;
}

.bn-block-content[data-text-alignment="right"] {
justify-content: flex-end;
}
Comment on lines -217 to -223
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this right?


/* No list nesting */
.bn-block-outer[data-prev-type="bulletListItem"]
> .bn-block
Expand Down
Copy link
Contributor

Choose a reason for hiding this comment

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

The current spacing looks off, could we get it back to how it was before this?

Copy link
Contributor

Choose a reason for hiding this comment

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

Like there is something with the bullet list spacing to be doing this:
image
(where the cursor is right up to the bullet)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Looks like display: inline is just a nightmare. The empty list item cursor is browser-specific, and the PW snapshot has an additional space between the inline elements that you can't remove without some hacks. I'll see if I can get the selection working with flexbox.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading