ハイライトの背景色を復活・末尾カンマを保持
- 構文ハイライトでtextareaを透明化した際に黒背景が消えていたのを修正 (背景をバックドロップ側に持たせる) - 末尾のカンマ(,)を記憶し、チップ操作後もプロンプト末尾に維持 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Fable 5
parent
8a765f4946
commit
e96f66c495
@@ -62,10 +62,13 @@ export class Highlighter {
|
||||
const parent = ta.parentElement;
|
||||
const cs = getComputedStyle(ta);
|
||||
this._origColor = cs.color;
|
||||
const origBg = cs.backgroundColor;
|
||||
|
||||
const bd = document.createElement("div");
|
||||
bd.className = "pte-hl-backdrop";
|
||||
const s = bd.style;
|
||||
// 背景はバックドロップ側に持たせる(textareaを透明化すると黒背景が消えるため)
|
||||
s.background = origBg && origBg !== "rgba(0, 0, 0, 0)" ? origBg : "var(--comfy-input-bg, #222)";
|
||||
s.position = "absolute";
|
||||
s.margin = "0";
|
||||
s.borderWidth = cs.borderWidth;
|
||||
|
||||
+5
-1
@@ -24,18 +24,22 @@ export class TagEditor {
|
||||
this.tokens = [];
|
||||
this.editing = false; // inline編集中(逆同期抑制用)
|
||||
this._dragIndex = -1;
|
||||
this._trailingSep = ""; // 末尾のカンマ(+空白)を保持
|
||||
this.container.classList.add("pte-chips");
|
||||
}
|
||||
|
||||
// 外部の文字列からチップを再構築(逆同期時)
|
||||
setFromString(str) {
|
||||
if (this.editing) return; // 編集中は再構築しない
|
||||
// 末尾のカンマ(全角/半角+空白)を記憶し、チップ操作後も維持する
|
||||
const m = (str || "").match(/[,,][ \t]*$/);
|
||||
this._trailingSep = m ? m[0] : "";
|
||||
this.tokens = tokenize(str);
|
||||
this.render();
|
||||
}
|
||||
|
||||
_emit() {
|
||||
this.onChange(serialize(this.tokens));
|
||||
this.onChange(serialize(this.tokens) + this._trailingSep);
|
||||
}
|
||||
|
||||
_emitAndRender() {
|
||||
|
||||
Reference in New Issue
Block a user