Commit 464fbcd9 authored by AUTOMATIC1111's avatar AUTOMATIC1111

fix the situation with emphasis editing (aaaa:1.1) bbbb (cccc:1.1)

parent 384fab96
......@@ -19,11 +19,17 @@ function keyupEditAttention(event) {
let beforeParen = before.lastIndexOf(OPEN);
if (beforeParen == -1) return false;
let beforeClosingParen = before.lastIndexOf(CLOSE);
if (beforeClosingParen != -1 && beforeClosingParen > beforeParen) return false;
// Find closing parenthesis around current cursor
const after = text.substring(selectionStart);
let afterParen = after.indexOf(CLOSE);
if (afterParen == -1) return false;
let afterOpeningParen = after.indexOf(OPEN);
if (afterOpeningParen != -1 && afterOpeningParen < beforeParen) return false;
// Set the selection to the text between the parenthesis
const parenContent = text.substring(beforeParen + 1, selectionStart + afterParen);
if (/.*:-?[\d.]+/s.test(parenContent)) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment