Skip to content

Commit 052498c

Browse files
fix: placeholder when overflowing now wraps (#2291)
1 parent c921a7b commit 052498c

File tree

3 files changed

+7
-10
lines changed

3 files changed

+7
-10
lines changed

packages/core/src/editor/Block.css

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ BASIC STYLES
4141
}
4242

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

554553
/* PLACEHOLDERS*/
555-
.bn-inline-content:has(> .ProseMirror-trailingBreak:only-child):before {
556-
/*float: left; */
557-
pointer-events: none;
558-
height: 0;
559-
/* width: 0; */
560-
position: absolute;
554+
.bn-block-content:has(.ProseMirror-trailingBreak:only-child):after {
561555
font-style: italic;
556+
/* Removes text cursor offset. */
557+
margin-inline: -2px;
558+
pointer-events: none;
559+
max-width: 100%;
562560
}
563-
/* TODO: should this be here? */
564561

565562
/* TEXT COLORS */
566563
[data-style-type="textColor"][data-value="gray"],

packages/core/src/extensions/Placeholder/Placeholder.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ export const PlaceholderExtension = createExtension(
4141
const styleSheet = styleEl.sheet!;
4242

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

4646
try {
4747
// FIXME: the names "default" and "emptyDocument" are hardcoded

packages/react/src/editor/styles.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@
120120
}
121121

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

0 commit comments

Comments
 (0)