From 1ea6ac0e5c6ce92a52288e2a390a2817523b770f Mon Sep 17 00:00:00 2001 From: Jonathon Herbert Date: Fri, 19 Jul 2024 09:33:31 +0100 Subject: [PATCH] Do not add the extra space to placeholder searchText elements as they are appended --- prosemirror-client/src/cqlInput/CqlInput.spec.ts | 2 +- prosemirror-client/src/cqlInput/editor.ts | 2 +- prosemirror-client/src/cqlInput/fixtures/TestCqlService.ts | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/prosemirror-client/src/cqlInput/CqlInput.spec.ts b/prosemirror-client/src/cqlInput/CqlInput.spec.ts index 52bdb17..a13d196 100644 --- a/prosemirror-client/src/cqlInput/CqlInput.spec.ts +++ b/prosemirror-client/src/cqlInput/CqlInput.spec.ts @@ -106,7 +106,7 @@ test("accepts the given value when a popover appears", async () => { await selectPopoverOption(container, "Tag"); await findByShadowText(container, "tag"); - expect(valueContainer.value).toBe("example +tag: "); + expect(valueContainer.value).toBe("example +tag: "); }); test("ctrl-a moves the caret to the beginning of the input", async () => { diff --git a/prosemirror-client/src/cqlInput/editor.ts b/prosemirror-client/src/cqlInput/editor.ts index cf5aaa7..a147b27 100644 --- a/prosemirror-client/src/cqlInput/editor.ts +++ b/prosemirror-client/src/cqlInput/editor.ts @@ -58,7 +58,7 @@ export const createEditor = ({ const tr = view.state.tr; tr.insert( view.state.doc.nodeSize - 2, - schema.nodes.searchText.create(undefined, schema.text(" ")) + schema.nodes.searchText.create(undefined) ); view.updateState(view.state.apply(tr)); } diff --git a/prosemirror-client/src/cqlInput/fixtures/TestCqlService.ts b/prosemirror-client/src/cqlInput/fixtures/TestCqlService.ts index fd54662..0e17f0c 100644 --- a/prosemirror-client/src/cqlInput/fixtures/TestCqlService.ts +++ b/prosemirror-client/src/cqlInput/fixtures/TestCqlService.ts @@ -17,9 +17,10 @@ const resultFixtures: Record = { "example ": createTextResponse("example "), "": createTextResponse("example >"), + "": createTextResponse("example >"), "example +": example_plus, "example +: ": example_pluscolon, - "example +tag: ": example_plustagcolon, + "example +tag: ": example_plustagcolon, "example +tag:tags-are-magic": example_tags_are_magic, "example +tag:tags-are-magic ": example_tags_are_magic, "example +tag:tags-are-magic ": example_tags_are_magic,