Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
chenpangpang
ComfyUI
Commits
a9622229
Commit
a9622229
authored
Apr 17, 2023
by
EllangoK
Browse files
correctly checks end of the text
parent
79ba0399
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
2 deletions
+10
-2
web/extensions/core/editAttention.js
web/extensions/core/editAttention.js
+10
-2
No files found.
web/extensions/core/editAttention.js
View file @
a9622229
...
@@ -79,8 +79,16 @@ name:id,
...
@@ -79,8 +79,16 @@ name:id,
selectedText
=
inputField
.
value
.
substring
(
start
,
end
);
selectedText
=
inputField
.
value
.
substring
(
start
,
end
);
}
else
{
}
else
{
// Select the current word, find the start and end of the word (first space before and after)
// Select the current word, find the start and end of the word (first space before and after)
start
=
inputField
.
value
.
substring
(
0
,
start
).
lastIndexOf
(
"
"
)
+
1
;
const
wordStart
=
inputField
.
value
.
substring
(
0
,
start
).
lastIndexOf
(
"
"
)
+
1
;
end
=
inputField
.
value
.
substring
(
end
).
indexOf
(
"
"
)
+
end
;
const
wordEnd
=
inputField
.
value
.
substring
(
end
).
indexOf
(
"
"
);
// If there is no space after the word, select to the end of the string
if
(
wordEnd
===
-
1
)
{
end
=
inputField
.
value
.
length
;
}
else
{
end
+=
wordEnd
;
}
start
=
wordStart
;
// Remove all punctuation at the end and beginning of the word
// Remove all punctuation at the end and beginning of the word
while
(
inputField
.
value
[
start
].
match
(
/
[
.,
\/
#!$%
\^
&
\*
;:{}=
\-
_`~()
]
/
))
{
while
(
inputField
.
value
[
start
].
match
(
/
[
.,
\/
#!$%
\^
&
\*
;:{}=
\-
_`~()
]
/
))
{
start
++
;
start
++
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment