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

.bn-inline-content {
width: 100%;
/* Ensure pre-wrap even when a parent node view wrapper (e.g. tiptap's
NodeViewWrapper) resets white-space to "normal". Without this, browsers
normalize trailing spaces to NBSP on input, which causes ProseMirror to
Expand Down Expand Up @@ -552,15 +551,13 @@ NESTED BLOCKS
}

/* PLACEHOLDERS*/
.bn-inline-content:has(> .ProseMirror-trailingBreak:only-child):before {
/*float: left; */
pointer-events: none;
height: 0;
/* width: 0; */
position: absolute;
.bn-block-content:has(.ProseMirror-trailingBreak:only-child):after {
font-style: italic;
/* Removes text cursor offset. */
margin-inline: -2px;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is to be able to show the text cursor underneath the placeholder.

There may be a way around this, by adding data attributes to make the width of the flex layout different based on whether the placeholder is showing or not.

But, doesn't seem to cause issues, may revisit if it does something weird

pointer-events: none;
max-width: 100%;
}
/* TODO: should this be here? */

/* TEXT COLORS */
[data-style-type="textColor"][data-value="gray"],
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/extensions/Placeholder/Placeholder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export const PlaceholderExtension = createExtension(
const styleSheet = styleEl.sheet!;

const getSelector = (additionalSelectors = "") =>
`.${uniqueEditorSelector} .bn-block-content${additionalSelectors} .bn-inline-content:has(> .ProseMirror-trailingBreak:only-child):before`;
`.${uniqueEditorSelector} .bn-block-content${additionalSelectors}:has(.ProseMirror-trailingBreak:only-child):after`;

try {
// FIXME: the names "default" and "emptyDocument" are hardcoded
Expand Down
2 changes: 1 addition & 1 deletion packages/react/src/editor/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@
}

/* Placeholder styling */
.bn-inline-content:has(> .ProseMirror-trailingBreak):before {
.bn-block-content:has(.ProseMirror-trailingBreak:only-child):after {
color: var(--bn-colors-side-menu);
}

Expand Down
Loading