Sublime Forum

GhostText

#1

GhostText is a ST3 Plugin and a Chrome extension which connects a text area, a content editable element, the ace editor and the code mirror editor with Sublime Text - everything you type in the editor will be instantly updated in the browser (and vice versa).

You can get it via Package Control
Here is a short video at YouTube which show some useage examples: http://www.youtube.com/watch?v=(https://github.com/Cacodaimon/GhostText-for-SublimeText) !

0 Likes

#2

This is actually really cool! I went ahead and turned the prototype of GhostText for Firefox into an installable Firefox addon. I made a slight modification so that it wouldn’t display an alert window each time one used it. You can unpack the *.xpi file and check the source code yourself if you don’t trust me, or pack it yourself.

0 Likes

#3

Indeed, interesting concept and it works rather well (although not perfect but I’ve opened an issue for that).

Keep it up :smile:

0 Likes

#4

I merged the alpha branch yesterday into the master, the alpha contains almost all features from the Chrome extension and you should not see any alerts anymore.
You can grab a working XPI here.

Yeah, thanks for the feedback!

0 Likes

#5

Looks good, but I had trouble composing email on Gmail – my main use case – with Firefox. I was instructed to choose a field, but GhostText only picked up the “To” field. It didn’t work on the subject or body of the email.

By comparison, I’m writing this forum post in Sublime which makes me very happy :smile:

Let me know if I can help debug this.

P.S. I didn’t try Chrome at all. If it’s relevant, I’m on Linux (Ubuntu 14.04).

0 Likes

#6

In Windows 7 and Chrome Gmail worked, but I had to add HTML tags to format the message properly. That’s make GhostText not very practical for this usage. A layer that does MD -> HTML for this purpose would be great. A freaking headache to sync, though :smile:

0 Likes

#7

Thanks for testing!

Basically both plug ins share many code, especially the support of different editable elements is the same. Therefore it was strange that the Gmail works in Chrome and not in Firefox.
What google does is delivering two different versions of their Gmail frontend the Chrome version uses a contentediable element and the FF version uses a google custom solution, I opened a issue for adding support of it.

Maybe a “simple” plugin replacing the current markdown text with it’s HTML representation, when finished composing the mail, would do the job?
I don’t know if a plugin like this already exists.

0 Likes

#8

Let me know if I can test anything. My main workstations are Ubuntu 14.04/FF and Windows 7/Chrome, using the latest beta/dev of ST3.

0 Likes

#9

Thanks, feel free about opening issues whether you find any bug or when you see room for improvements.

0 Likes

#10

The Firefox add on is now available at Firefox Add-ons.

0 Likes

#11

It appears that the FireFox addon doesn’t work with emtpy text areas. It worked once there was some text in the textarea (on the forum here) but the view just doesn’t open in ST3 when the textarea is empty.

Otherwise, GREAT idea!

As an idea for improvement, you could listen to “save” events in on_text_command (or window, not sure what it is) and then prevent the default if it originated from a ghost text view.
It would also be nice if you could automatically detect the text view that has focus (or had before clicking the button) if there are multiple text areas. And maybe a keyboard shortcut.

Furthermore, I get the following traceback whenever a view is opened:

Traceback (most recent call last):
  File "./subprocess.py", line 1112, in _execute_child
    finally:
FileNotFoundError: [WinError 2] Das System kann die angegebene Datei nicht finden

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Program Files\Sublime Text 3\sublime_plugin.py", line 526, in run_
    return self.run()
  File "FocusSublimeWindow in C:\Users\Fichte\AppData\Roaming\Sublime Text 3\Installed Packages\GhostText.sublime-package", line 24, in run
  File "./subprocess.py", line 824, in __init__
    
  File "./subprocess.py", line 1118, in _execute_child
    # ReadFile will hang.
FileNotFoundError: [WinError 2] Das System kann die angegebene Datei nicht finden

(error translates to “system could not find the specified file”)

0 Likes

#12

Another thing: The Firefox icon is very large and makes my location bar appear higher than it used to without it. All other addons seem to provide a small icon but yours does not (I’m using Classic Theme Restorer).

Edit: Works now. Not sure if you changed something or I just had to restart.

0 Likes

#13

Thanks for the report I openened a issue for this bug.

I have to check the feasibility here, but feel free to open a feature request.

I love feature requests :smile: but keyboard shortcuts are currently not supported by the Firefox add-on SDK, the Chrome extension supports shortcuts :wink: .

It’s not a bug it’s a feature:

[quote]Another thing: The Firefox icon is very large and makes my location bar appear higher than it used to without it. All other addons seem to provide a small icon but yours does not (I’m using Classic Theme Restorer).

Edit: Works now. Not sure if you changed something or I just had to restart.[/quote]

I would have been surprised the icon sizes are take from the official FF add-on SDK documentation.

0 Likes

#14

It has been fixed, this was a really tiny and good hidden bug… :unamused: .
You should get the update via Package Control.

0 Likes

#15

Awesome plugin!

I’m just wrapping up my first plugin here: https://forum.sublimetext.com/t/parkour-navigate-your-code-like-a-ninja/15148/1

Took a look at your code, I’m new to coding & haven’t worked with importing (libraries? is that what WebSocket is?). Do you have any good resources or search topics for getting started with something like that?

Also, do you think it is possible to make something like GhostText for native apps, rather than a web browser?
EG: using Sublime text in parallel to Visual Studio, Android Studio, IntelliJ, etc.

0 Likes

#16

Hey, one quick ask:
the system I work in (CDE plugin @ Pentaho BI Server) uses ACE as background for the files editor (CDE Plugin). It comes with a Save button, which saves the changes to the file we’re editing. Just wondering if there could be any way to make that save to be prompted when we hit save on sublime text, while editing a file with Ghost Text.

Thanks in advance,
Miguel

0 Likes