Closed coltoneakins closed 3 years ago
The error corresponds to the <script>
tags injected by the extension with id: #ghost-text-injected-script-ace_editor_demo
and #ghost-text-injected-script-embedded_ace_code
(two different, injected <script>
tags). Specifically, it refers to line 17:
ghostTextAceDiv.addEventListener("GhostTextServerInput", function (e) { ghostTextAceEditorSession.setValue(e.detail.text); });
In the source, this corresponds to AceCodeEditor.ts
.
It seems that the detail
property became inaccessible when it was dispatched in the input-area.js
(where the CustomEvent was defined) to this injected JS code.
Thank you for your report! Could you look into fixing the issue?
I changed the CustomEventInit
dictionary--the 'detail'--(found here) from:
this.currentText = text;
var details = {detail: {text: this.currentText}};
var gtServerInputEvent = <Event>StandardsCustomEvent.get('GhostTextServerInput', details);
this.jsCodeEditorDiv.dispatchEvent(gtServerInputEvent);
to:
this.currentText = text;
var details = {detail: this.currentText};
var gtServerInputEvent = <Event>StandardsCustomEvent.get('GhostTextServerInput', details);
this.jsCodeEditorDiv.dispatchEvent(gtServerInputEvent);
And, I changed the listener in the injected script (found here) from:
ghostTextAceDiv.addEventListener("GhostTextServerInput", function (e: any) {
ghostTextAceEditorSession.setValue(e.detail.text);
});
to:
ghostTextAceDiv.addEventListener("GhostTextServerInput", function (e: any) {
ghostTextAceEditorSession.setValue(e.detail);
});
This fixed the issue. GhostText is now working for Ace textareas on Firefox. However, this isn't really the fix as I am not sure what would cause the permission to access text
to be denied in the first place. A CustomEvent
dispatched to the injected script with the CustomEventInit
dictionary should be able to share its detail object. My guess is that it could be something related to the CSP for the page/extension. I am still investigating before I submit any sort of pull request.
@coltoneakins did you manage to fix the issue in the end? Would you be willing to supply a pull-request?
any updates on this? I now see this error with Firefox latest/Jupyter lab.
Seems to be the same issue on https://www.shadertoy.com/new
Can you test the new version? It hasn't been published to the stores yet: https://github.com/GhostText/GhostText/issues/172
This should be fixed now
This issue is fixed in the newer rewrite of GhostText.
See: https://github.com/GhostText/GhostText/issues/172
And the report where I test this issue with the new rewrite: https://github.com/GhostText/GhostText/issues/172#issuecomment-749952855
For textareas using Ace on Firefox, text is only sent one-way from the browser to the external text editor. Text sent in the reverse direction is not written to the Ace editor. The browser console lists the following error:
which is listed for every text character the user had typed in the external text editor. In the following examples, the phrase 'test' was typed on the external text editor for a HasteBin textarea versus an Ace editor textarea.
HasteBin:
Ace:
The issue exists in the Firefox release (not using the WE version), Firefox Developer Edition (using the WE version), and Firefox Nightly (using the WE version). Issue does not appear on Google Chrome. Issue was also tested using Atom and Emacs as the external text editor. The issue persists on Firefox regardless of the editor used in my tests.
Notice that the warning does not appear in the first example using the HasteBin textarea.