Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Edit Visually browser extension – iteration 2 #298

Draft
wants to merge 7 commits into
base: trunk
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
"@uiw/react-codemirror": "^4.21.20",
"@webcontainer/env": "1.1.1",
"@wp-playground/blueprints": "0.6.13",
"@wp-playground/wordpress": "0.7.20",
"classnames": "^2.3.2",
"comlink": "^4.4.1",
"compressible": "2.0.18",
Expand Down
18 changes: 18 additions & 0 deletions packages/edit-visually-browser-extension/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"extends": ["../../../.eslintrc.json"],
"ignorePatterns": ["!**/*"],
"overrides": [
{
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
"rules": {}
},
{
"files": ["*.ts", "*.tsx"],
"rules": {}
},
{
"files": ["*.js", "*.jsx"],
"rules": {}
}
]
}
12 changes: 2 additions & 10 deletions packages/edit-visually-browser-extension/README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
## Edit Visually Browser Extension powered by WordPress Playground
# Edit Visually powered by WordPress Playground

This is an experimental browser extension that allows you to edit GitHub issues and other text formats using WordPress blocks in Playground.

To use it, go to the extensions page in your web browser, load the extension from the `packages/editor-browser-extension` directory, and then navigate to any GitHub issue. Edit it, and you should see a new "Edit in Playground" button in the corner of the editor. Click it to edit the issue in Playground.

Another use-case here: replying to people. It’s frustrating to keep scrolling between what someone posted and the textarea where I can type, but with this extension we could front-load what they said to the editor, package it as quotes, and it would be easy to break it up and type.

### Implementation details

We can't use WordPress Playground client here, because it internally evaluates JavaScript code which seems very difficult to do in browser extensions. Therefore, this extension merely embeds an iframe that handles the client connection, and communicates with Playground via the `postMessage` API.
A Web Extension for editing Markdown (and Trac) content in WordPress.
17 changes: 17 additions & 0 deletions packages/edit-visually-browser-extension/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash

set -e

bun build ./loopback-service-worker/service-worker.ts -e ./src/php_8_0.js > ./loopback-service-worker/service-worker.js
bun build ./loopback-service-worker/index.ts -e ./src/php_8_0.js > ./loopback-service-worker/index.js
bun build ./src/playground-loader.ts -e ./src/php_8_0.js > ./src/playground-loader.js
bun build ./src/sw.ts -e ./src/php_8_0.js > ./src/sw.js
bun build ./src/content-script.ts -e ./src/php_8_0.js > ./src/content-script.js
bun build ./src/wordpress-plugin/script.ts -e ./src/php_8_0.js \
-e '../blocky-formats/*' > ./src/wordpress-plugin/script.js
cd src
rm blocky-formats.zip
zip -rq blocky-formats.zip blocky-formats
zip -rq ../extension.zip ./

echo "Build succesful"
Loading
Loading