From 07a93013d3278201bd66803e5a34b4ecc94b42f4 Mon Sep 17 00:00:00 2001 From: yuhe Date: Fri, 21 Nov 2025 15:33:29 +0800 Subject: [PATCH] Fix: Force cache refresh for advanced text editors --- source/ghost-text.js | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/source/ghost-text.js b/source/ghost-text.js index e377692..503c658 100644 --- a/source/ghost-text.js +++ b/source/ghost-text.js @@ -152,13 +152,27 @@ class GhostTextField { return; } + // For advanced editors, request fresh value before sending + if (this.field instanceof AdvancedTextWrapper) { + console.log('DEBUG: Requesting fresh value from advanced editor'); + this.field.el.dispatchEvent(new CustomEvent('gt:get', {bubbles: true})); + // Wait a bit for the gt:input response to update this.field._value + setTimeout(() => this._doSend(), 50); + return; + } + + this._doSend(); + } + + _doSend() { if (this.field.value === undefined) { console.log('field value is undefined'); console.log(this.field); return; } - console.info('sending', this.field.value.length, 'characters'); + console.info('DEBUG: GhostText sending', this.field.value.length, 'characters'); + console.log('DEBUG: GhostText sent: text=[' + this.field.value + '], title=[' + document.title + ']'); this.port.postMessage( JSON.stringify({ title: document.title, // TODO: move to first fetch