Skip to content

Commit 2337551

Browse files
authored
fix: Fix multiline expression (#4297)
## Description 1. What is this PR about (link the issue and add a short description) ## Steps for reproduction 1. click button 2. expect xyz ## Code Review - [ ] hi @kof, I need you to do - conceptual review (architecture, feature-correctness) - detailed review (read every line) - test it on preview ## Before requesting a review - [ ] made a self-review - [ ] added inline comments where things may be not obvious (the "why", not "what") ## Before merging - [ ] tested locally and on preview environment (preview dev login: 5de6) - [ ] updated [test cases](https://github.com/webstudio-is/webstudio/blob/main/apps/builder/docs/test-cases.md) document - [ ] added tests - [ ] if any new env variables are added, added them to `.env` file
1 parent 17b3159 commit 2337551

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

apps/builder/app/builder/shared/expression-editor.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -268,8 +268,6 @@ const variableMatcher = new MatchDecorator({
268268
regexp: /(\$ws\$dataSource\$\w+)/g,
269269

270270
decorate: (add, from, _to, match, view) => {
271-
const startPos = match.index;
272-
273271
const name = match[1];
274272
const [{ aliases }] = view.state.facet(VariablesData);
275273

@@ -282,7 +280,8 @@ const variableMatcher = new MatchDecorator({
282280
if (dataSourceId === undefined) {
283281
return;
284282
}
285-
const endPos = startPos + dataSourceId.length;
283+
284+
const endPos = from + dataSourceId.length;
286285

287286
add(
288287
from,

0 commit comments

Comments
 (0)