fregante / GhostText

👻 Use your text editor to write in your browser. Everything you type in the editor will be instantly updated in the browser (and vice versa).
https://GhostText.fregante.com
MIT License
3.28k stars 117 forks source link

No visible edit button #110

Closed gkuenning closed 6 years ago

gkuenning commented 6 years ago

The (minimal) documentation says "click the GhostText button in the upper-right corner of the browser". Only on my browser (Firefox 56.0.2) there doesn't seem to be any such button. I tried turning off ItsAllText (since GhostText is supposed to replace it) and Forecast Fox Fix Version (since it puts a button in the upper-right corner of the current Web page, which may or may not be different from "the upper-right corner of the browser"). That didn't help.

What is the GhostText button supposed to look like? And where in the upper-right corner is it supposed to appear? (At the moment I have four toolbars, plus the status bar on the bottom.)

I imagine there's an extension conflict going on, but when you're running 50-ish extensions it can be painful to try to locate the culprit...

Hints appreciated.

fregante commented 6 years ago

https://github.com/GhostText/GhostText/blob/master/promo/demo.gif

You can see it here. If you have many extensions, it might be hidden in the Firefox menu on the right of the other extensions icons.

gkuenning commented 6 years ago

Thanks; that was very helpful. For some reason the Firefox "Open menu" button had no effect. After I moved it to a different position and moved some other buttons into a different toolbar, I was able to see the GhostText icon (and the Firefox "Open menu" started working--go figure).

However, I'm still having trouble. When I clicked the GhostText icon while filling out the text box for this comment, it identified multiple TextAreas and asked me to click on one; when I did it outlined the box in a very nice blue. So I know it's running. And I'm running a server (in emacs) on the correct port; I checked with netstat and also restarted the server just to be sure. But nothing showed up in emacs. Sniffing with Wireshark suggests that nothing is going to port 4001 (which is indeed the port I'm using; I checked).

Perhaps the browser has to be started after the server is already running?

gkuenning commented 6 years ago

...restarting the browser didn't help, nor did disabling ItsAllText. I'm out of ideas at the moment.

fregante commented 6 years ago

Can you try it with Sublime Text? It’s the only official version, I don’t know how the emacs one works. Make sure you close emacs.

Also look for information in ST’s console and the browser console

gkuenning commented 6 years ago

Sublime isn't really an option for me. As I mentioned, Wireshark sees no traffic to port 4001 (either TCP or UDP). So I'm pretty sure the problem is on the browser end.

The console was a good idea; it has a bit of information. This is what I got after I cleared the console, then did a single click on the GhostText icon followed by a single click on my selected textarea (this comment box):

Got message: Object { action: "select-field", tabId: 71 } content.js:39:9 GhostText: selectField() content.js:150:9 GhostText: There are multiple textarea elements on this page. Click on the one you want to use. content.js:82:9 Got message: Object { action: "select-field", tabId: 71 } content.js:39:9 GhostText: selectField() content.js:150:9 GhostText: There are multiple textarea elements on this page. Click on the one you want to use. content.js:82:9 Got message: Object { action: "select-field", tabId: 71 } content.js:39:9 GhostText: selectField() content.js:150:9 GhostText: There are multiple textarea elements on this page. Click on the one you want to use. content.js:82:9 Got message: Object { action: "select-field", tabId: 71 } content.js:39:9 GhostText: selectField() content.js:150:9 GhostText: There are multiple textarea elements on this page. Click on the one you want to use. content.js:82:9

As a side comment, it appears that the multiple selectField calls happen because clicking on the icon is sticky in some fashion; for every time I click, I get one more popup that needs to be dismissed.

fregante commented 6 years ago

Yeah, the duplicate events is a known issue; focus listeners are just added over and over if you keep pressing the button. The issue is solved by refreshing the page.

To find possible issues in the extension, try looking at the console of background.js: https://stackoverflow.com/questions/10081898/how-to-debug-google-chrome-background-script

There's a chance that the initial connection is failing.

However. The port 4001 is only used for a single initial fetch, it doesn't stay open: https://github.com/GhostText/GhostText/blob/master/browser/scripts/lib.js#L135

gkuenning commented 6 years ago

First, let me express my appreciation for the time you're spending to help me out.

I'm using the extension with Firefox, not Chrome.

Is the protocol documented anywhere? What ports are used after the initial fetch?

(I just tried Wireshark again, after refreshing the page, and still didn't see any activity on 4001.)

The Javascript console doesn't seem to mention background.js at all:

Use of getUserData() or setUserData() is deprecated. Use WeakMap or element.dataset instead. cacheobj.js:877:23 Empty string passed to getElementById(). github-51e7cba2d4786e556908ef6d333b3b023be51c7e1afe1555148eba07229c4b73.js:7:27350 Use of Mutation Events is deprecated. Use MutationObserver instead. sponsoredlinksremover.user.js:660:1

...which seems to be stuff unrelated to GhostText.

I'm going to restart Firefox and try Wireshark one more time to see if there are any packets flowing at all.

gkuenning commented 6 years ago

Nope, even on a fresh Firefox instance there's no communication to 4001. Rats. And puzzling...

fregante commented 6 years ago

The console won't mention background.js, you have to load its own console, it's separate. Try using Chrome, maybe the issue is just Firefox.

gkuenning commented 6 years ago

I suspect the issue is indeed just Firefox, but switching browsers isn't a viable solution. I use FF for a reason.

Well, since it's open-source on Github I guess someday I might find the time to try to debug it in FF.

fregante commented 6 years ago

Yes but to debug this issue we can start with Chrome + Sublime. This way we can exclude issues with Firefox/Emacs, I'm not suggesting you give up browser and editor.

gkuenning commented 6 years ago

OK, that makes sense. It'll take me a few days to find the time to do it--and besides, you've spent WAY too much time helping me!

gkuenning commented 6 years ago

Well, it was more than a few days. I didn't need to switch to sublime; trying with GhostText in Chrome using the latest atomic-chrome.el, it works fine. So the problem is in Firefox.

I tried disabling It's All Text, but that didn't help. When I click the GhostText button it nicely highlights this text area but doesn't send a message to my emacs. I probed with wireshark and there is no traffic going to port 4001, which is where I'm configured and where emacs is listening.

If you can give me any suggestions for debugging on the FIrefox end, I'll give them a shot.

fregante commented 6 years ago

atomic-chrome isn't GhostText, try GhostText-for-Chrome or else the test is null

gkuenning commented 6 years ago

What's ghosttext-for-chrome? It doesn't show up in a Google search except as a defunct GitHub repository that redirects to GhostText iself (this repository). Atomic-chrome is an emacs package that interacts correctly with GhostText when GhostText is run inside Chrome.

In any case, as my previous post points out, the issue isn't on the emacs end, so atomic-chrome isn't relevant. The problem is that Firefox isn't attempting to send any TCP traffic to port 4001, which is where my server is listening. So the test isn't null; the traffic is. ;-)

gkuenning commented 6 years ago

I retried tonight in a VM with a relatively limited Firefox installation, and it works fine there. So the problem is probably one of my FF extensions. I might or might not find the time to track the culprit down, depending on my energy level and other commitments.