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
Original file line number Diff line number Diff line change
Expand Up @@ -629,7 +629,7 @@ export const SoupView = (props: SoupViewProps) => {
when={!isComponentListView('search')}
fallback={
<Layer depth={2}>
<div class="grow ml-2">
<div class="grow ml-2 min-w-0 [contain:inline-size]">
<SoupSearchbar
variant="secondary"
placeholder="Search, @mention contacts"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,13 @@
* @file A plugin to enforce a single line only.
*/
import { mergeRegister } from '@lexical/utils';
import { type LexicalEditor, LineBreakNode, RootNode } from 'lexical';
import {
$isRootNode,
type LexicalEditor,
LineBreakNode,
ParagraphNode,
RootNode,
} from 'lexical';

export function singleLinePlugin() {
return (editor: LexicalEditor) => {
Expand All @@ -15,6 +21,19 @@ export function singleLinePlugin() {

editor.registerNodeTransform(LineBreakNode, (node) => {
node.remove();
}),

// Programmatic inserts (snippets, paste) can nest block paragraphs inside
// the single root paragraph, which the root-child check above doesn't
// catch. Unwrap them so a nested block's inline content collapses onto the
// one line instead of rendering as extra rows.
editor.registerNodeTransform(ParagraphNode, (node) => {
const parent = node.getParent();
if (!parent || $isRootNode(parent)) return;
for (const child of node.getChildren()) {
node.insertBefore(child);
}
node.remove();
})
);
};
Expand Down
Loading