Skip to content

Commit

Permalink
Meta: Prettier and cleanup (#182)
Browse files Browse the repository at this point in the history
  • Loading branch information
fregante authored Jan 29, 2021
1 parent 261c838 commit d8703b5
Show file tree
Hide file tree
Showing 16 changed files with 15,394 additions and 15,376 deletions.
15 changes: 15 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
root = true

[*]
indent_style = tab
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.yml]
indent_style = space
indent_size = 2

[*.md]
trim_trailing_whitespace = false
11 changes: 4 additions & 7 deletions .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,16 @@
Thanks for trying out GhostText and opening this issue!
Before opening an issue for a possible bug,
please make sure you try GhostText in Chrome and Sublime Text.
This is the most common configuration and will help me
understand better where the problem is.
Before opening an issue for a possible bug, please make sure you try GhostText in Chrome and Sublime Text.
This is the most common configuration and will help me understand better where the problem is.
If it works with Sublime Text but not with a third party editor,
please open an issue in their repository.
If it works with Sublime Text but not with a third party editor, please open an issue in their repository.
-->

# Setup

Browser:
Browser:
Editor:

# Description
19 changes: 19 additions & 0 deletions .github/workflows/labeler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
env: {}

# DO NOT EDIT BELOW, USE: npx ghat fregante/title-to-labels-action/workflow

name: Labeler

on:
pull_request:
types: [opened, edited]
issues:
types: [opened, edited]

jobs:
Label:
runs-on: ubuntu-latest
steps:
- uses: fregante/title-to-labels-action@v1
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
47 changes: 4 additions & 43 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,44 +1,5 @@
*.py[cod]

# C extensions
*.so

# Packages
*.egg
*.egg-info
dist
build
eggs
parts
bin
var
sdist
develop-eggs
.installed.cfg
lib
lib64
__pycache__

# Installer logs
pip-log.txt

# Unit test / coverage reports
.coverage
.tox
nosetests.xml

# Translations
*.mo

# Mr Developer
.mr.developer.cfg
.project
.pydevproject

.idea
.xpi

node_modules

ChromeExtension.pem
browser/scripts/input-area.js
yarn.lock
distribution
.cache
.parcel-cache
64 changes: 32 additions & 32 deletions PROTOCOL.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ The Server responds with a `200` and a content type of `application/json`.

The JSON payload is an object with the following properties:

| Property | Type | Description |
|-------------------|--------|-------------|
| `ProtocolVersion` | Number | The protocol version |
| Property | Type | Description |
| ----------------- | ------ | ------------------------------------ |
| `ProtocolVersion` | Number | The protocol version |
| `WebSocketPort` | Number | The port for the listening WebSocket |

#### Example
Expand Down Expand Up @@ -53,37 +53,37 @@ Each time the user makes a change in the browser (or on first WebSocket
connect) the Client sends via the WebSocket a JSON object message with the
following properties:

| Property | Value | Description |
|--------------|------------------------|-------------|
| `title` | String | The title of the document |
| `url` | String | The URL of the document |
| `syntax` | String | *Not used* |
| `text` | String | The value of the textarea/content |
| Property | Value | Description |
| ------------ | ---------------------- | ---------------------------------------------------------------------------------------------- |
| `title` | String | The title of the document |
| `url` | String | The URL of the document |
| `syntax` | String | _Not used_ |
| `text` | String | The value of the textarea/content |
| `selections` | Array(SelectionObject) | An array of selection objects that describe the user's current cursor selections in the editor |

#### Selection Object

Selection objects have the following properties:

| Property | Value | Description |
|----------|--------|-------------|
| Property | Value | Description |
| -------- | ------ | ------------------------------ |
| `start` | Number | 0-index start of the selection |
| `end` | Number | 0-index end of the selection |
| `end` | Number | 0-index end of the selection |

#### Example

```json
{
"title": "Test Document",
"url": "http://example.com/test-document",
"syntax": "",
"text": "Adipisicing excepturi voluptate nostrum quas veritatis?",
"selections": [
{
"start": 10,
"end": 20
}
]
"title": "Test Document",
"url": "http://example.com/test-document",
"syntax": "",
"text": "Adipisicing excepturi voluptate nostrum quas veritatis?",
"selections": [
{
"start": 10,
"end": 20
}
]
}
```

Expand All @@ -92,22 +92,22 @@ Selection objects have the following properties:
Each time the user makes a change in the editor the Server sends via the
WebSocket a JSON object message with the following properties:

| Property | Value | Description |
|--------------|------------------------|-------------|
| `text` | String | The temporary file content |
| Property | Value | Description |
| ------------ | ---------------------- | ---------------------------------------------------------------------------------------------- |
| `text` | String | The temporary file content |
| `selections` | Array(SelectionObject) | An array of selection objects that describe the user's current cursor selections in the editor |

#### Example

```json
{
"text": "Adipisicing ea lorem expedita facere nesciunt",
"selections": [
{
"start": 20,
"end": 30
}
]
"text": "Adipisicing ea lorem expedita facere nesciunt",
"selections": [
{
"start": 20,
"end": 30
}
]
}
```

Expand Down
81 changes: 43 additions & 38 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# <img src="https://raw.githubusercontent.com/GhostText/GhostText/master/promo/gt_banner.png" height="60" alt="GhostText">

[link-cws]: https://chrome.google.com/webstore/detail/ghosttext/godiecgffnchndlihlpaajjcplehddca 'Version published on Chrome Web Store'
[link-amo]: https://addons.mozilla.org/en-US/firefox/addon/ghosttext/ 'Version published on Mozilla Add-ons'

<img src="promo/demo.gif" alt="Demo screencast" align="right">

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).
Expand All @@ -9,31 +12,33 @@ Use your text editor to write in your browser. Everything you type in the editor
## Installation

1. Install your editor extension:
+ [**Sublime Text** extension](https://sublime.wbond.net/packages/GhostText) - [Repo](https://github.com/GhostText/GhostText-for-SublimeText)
+ [**Atom** package](https://github.com/GhostText/GhostText-for-Atom)
+ [**VS Code** extension](https://marketplace.visualstudio.com/items?itemName=tokoph.ghosttext) - [Repo](https://github.com/jtokoph/ghosttext-vscode) (Third party)
+ [**Emacs** package](https://melpa.org/#/atomic-chrome) - [Repo](https://github.com/alpha22jp/atomic-chrome) (Third party)
+ [**Acme** client](https://github.com/fhs/Ghost) (Third party)
+ <details>
<summary><b>Vim</b>/<b>Neovim</b> (Third party)</summary>
<ul>
<li><a href="https://github.com/raghur/vim-ghost"><b>Vim</b> (<tt>+python3</tt>) & <b>Neovim</b> (<tt>pynvim</tt>)</a>
<li><a href="https://github.com/falstro/ghost-text-vim"><b>Vim</b> (<tt>+tcl</tt>)</a>
<li><a href="https://github.com/pandysong/ghost-text.vim"><b>Vim</b> (<tt>+python3 +channel</tt>)</a>
<li><a href="https://github.com/subnut/nvim-ghost.nvim"><b>Neovim</b></a>
</ul>
</details>

- [**Sublime Text**](https://sublime.wbond.net/packages/GhostText) ([Repo](https://github.com/GhostText/GhostText-for-SublimeText))
- [**Atom**](https://github.com/GhostText/GhostText-for-Atom)
- [**VS Code**](https://marketplace.visualstudio.com/items?itemName=tokoph.ghosttext) ([Repo](https://github.com/jtokoph/ghosttext-vscode)) (Third party)
- [**Emacs**](https://melpa.org/#/atomic-chrome) ([Repo](https://github.com/alpha22jp/atomic-chrome)) (Third party)
- [**Acme**](https://github.com/fhs/Ghost) (Third party)
- <details>
<summary><b>Vim</b>/<b>Neovim</b> (Third party)</summary>
<ul>
<li><a href="https://github.com/raghur/vim-ghost"><b>Vim</b> (<tt>+python3</tt>) & <b>Neovim</b> (<tt>pynvim</tt>)</a>
<li><a href="https://github.com/falstro/ghost-text-vim"><b>Vim</b> (<tt>+tcl</tt>)</a>
<li><a href="https://github.com/pandysong/ghost-text.vim"><b>Vim</b> (<tt>+python3 +channel</tt>)</a>
<li><a href="https://github.com/subnut/nvim-ghost.nvim"><b>Neovim</b></a>
</ul>
</details>

2. Install your browser extension:
+ [**Chrome** extension](https://chrome.google.com/webstore/detail/ghosttext/godiecgffnchndlihlpaajjcplehddca)
+ [**Firefox** add-on](https://addons.mozilla.org/en-US/firefox/addon/ghosttext/)
+ Opera - Use [this](https://addons.opera.com/en/extensions/details/download-chrome-extension-9/) to install the Chrome extension.

- [**Chrome**][link-cws] [<img valign="middle" src="https://img.shields.io/chrome-web-store/v/godiecgffnchndlihlpaajjcplehddca.svg?label=%20">][link-cws]
- [**Firefox**][link-amo] [<img valign="middle" src="https://img.shields.io/amo/v/ghosttext.svg?label=%20">][link-amo]

## Website support

* `<textarea>` elements
* [`contentEditable`](https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/Content_Editable) areas: like in Gmail
* [CodeMirror](http://codemirror.net/) editors: used on CodePen, JSFiddle, JS Bin, …
* [Ace](http://ace.c9.io/) editor: used on Tumblr, …
- `<textarea>` elements
- [`contentEditable`](https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/Content_Editable) areas: like in Gmail
- [CodeMirror](http://codemirror.net/) editors: used on CodePen, JSFiddle, JS Bin, …
- [Ace](http://ace.c9.io/) editor: used on Tumblr, …

## Usage

Expand All @@ -51,24 +56,24 @@ or
[like this in Firefox](https://support.mozilla.org/en-US/kb/manage-extension-shortcuts-firefox).

<table>
<tr>
<th>OS</th>
<th>Shortcut</th>
</tr>
<tr>
<td>Windows</td>
<td><kbd>ctrl</kbd> + <kbd>shift</kbd> + <kbd>K</kbd></td>
</tr>
<tr>
<td>Linux</td>
<td><kbd>ctrl</kbd> + <kbd>shift</kbd> + <kbd>H</kbd></td>
</tr>
<tr>
<td>Mac</td>
<td><kbd>cmd</kbd> + <kbd>shift</kbd> + <kbd>K</kbd></td>
</tr>
<tr>
<th>OS</th>
<th>Shortcut</th>
</tr>
<tr>
<td>Windows</td>
<td><kbd>ctrl</kbd> + <kbd>shift</kbd> + <kbd>K</kbd></td>
</tr>
<tr>
<td>Linux</td>
<td><kbd>ctrl</kbd> + <kbd>shift</kbd> + <kbd>H</kbd></td>
</tr>
<tr>
<td>Mac</td>
<td><kbd>cmd</kbd> + <kbd>shift</kbd> + <kbd>K</kbd></td>
</tr>
</table>

## License

MIT © [Federico Brigante](http://twitter.com/bfred_it), Guido Krömer
MIT © [Federico Brigante](https://fregante.com)
14 changes: 6 additions & 8 deletions browser/README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
# <img src="https://raw.githubusercontent.com/GhostText/GhostText/master/promo/gt_banner.png" height="60" alt="GhostText">

[![Chrome version][badge-cws]][link-cws] [![Firefox version][badge-amo]][link-amo] [![Autodeployment][badge-travis]][link-travis]

[badge-cws]: https://img.shields.io/chrome-web-store/v/godiecgffnchndlihlpaajjcplehddca.svg?label=for%20chrome
[badge-amo]: https://img.shields.io/amo/v/ghosttext.svg?label=for%20firefox
[badge-travis]: https://img.shields.io/travis/GhostText/GhostText/master.svg?label=autodeployment
[link-cws]: https://chrome.google.com/webstore/detail/ghosttext/godiecgffnchndlihlpaajjcplehddca "Version published on Chrome Web Store"
[link-amo]: https://addons.mozilla.org/en-US/firefox/addon/ghosttext/ "Version published on Mozilla Add-ons"
[link-travis]: https://travis-ci.org/GhostText/GhostText
[![Chrome version][badge-cws]][link-cws] [![Firefox version][badge-amo]][link-amo]

[badge-cws]: https://img.shields.io/chrome-web-store/v/godiecgffnchndlihlpaajjcplehddca.svg?label=for%20chrome
[badge-amo]: https://img.shields.io/amo/v/ghosttext.svg?label=for%20firefox
[link-cws]: https://chrome.google.com/webstore/detail/ghosttext/godiecgffnchndlihlpaajjcplehddca 'Version published on Chrome Web Store'
[link-amo]: https://addons.mozilla.org/en-US/firefox/addon/ghosttext/ 'Version published on Mozilla Add-ons'

## Installation

Expand Down
2 changes: 1 addition & 1 deletion browser/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
},
"browser_action": {
"default_title": "GhostText",
"default_icon": {
"default_icon": {
"19": "images/icon_19.png",
"38": "images/icon_48.png"
}
Expand Down
24 changes: 18 additions & 6 deletions browser/options.html
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
<!DOCTYPE html>
<meta charset="UTF-8">
<meta charset="UTF-8" />
<title>GhostText options</title>
<style>
html {
font-family: sans-serif;
}
label, button, footer {
label,
button,
footer {
display: block;
margin: 1em 0;
}
Expand All @@ -15,7 +17,7 @@
footer {
font-style: italic;
font-size: 0.8em;
color: gray
color: gray;
}
footer a {
color: inherit;
Expand All @@ -24,11 +26,21 @@
<form id="options-form">
<label>
Server Port
<input name="serverPort" type="number" min="1" max="65536" step="1" placeholder="4001" value="4001" required>
<input
name="serverPort"
type="number"
min="1"
max="65536"
step="1"
placeholder="4001"
value="4001"
required
/>
</label>
</form>
<footer>
Issues? Let’s fix them on <a href="https://github.com/GhostText/GhostText">GhostText’s GitHub repo</a>!
</div>
Issues? Let’s fix them on
<a href="https://github.com/GhostText/GhostText">GhostText’s GitHub repo</a>!
</footer>
<script src="vendor/webext-options-sync.js"></script>
<script src="scripts/options.js"></script>
Loading

0 comments on commit d8703b5

Please sign in to comment.