Skip to content

Commit 7d07fb0

Browse files
author
Asko Nõmm
committed
bump
1 parent 1b5c5f1 commit 7d07fb0

File tree

5 files changed

+92
-9
lines changed

5 files changed

+92
-9
lines changed

README.md

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,41 @@ Blocko is a block-based WYSIWYG editor written in ClojureScript and compiled to
44

55
![Animated gif of Blocko in action](https://github.com/askonomm/blocko/blob/master/demo.gif?raw=true)
66

7+
## Install
8+
9+
### NPM
10+
11+
1. Run: `npm i blocko-editor`
12+
2. Import it: `import blocko from 'blocko';`
13+
14+
### Browser
15+
16+
1. Download the latest [release](https://github.com/askonomm/blocko/releases)
17+
2. Include `blocko.css` and `blocko.js` in your HTML
18+
19+
## Usage
20+
21+
```javascript
22+
blocko.core.init({
23+
container: '#editor',
24+
initialContent: [],
25+
onChange: (content) => {
26+
// store `content` in your database here.
27+
}
28+
});
29+
```
30+
31+
## API
32+
33+
- `container`: any JS element that can be targeted via `querySelector`
34+
- `initialContent`: a JS or JSON object representing the data
35+
- `onChange`: a callback function called when content changes
36+
737
## Development
838

939
To develop Blocko simply run `./build.sh dev`, which will then compile to `public/js/blocko.js` a development version of Blocko that also auto-reloads as you make changes. After that is done, open `public/index.html` in your browser and have fun!
1040

11-
Once you're done with development and want to get production version run `./build.sh release` and check inside `dist` for a brand new `blocko.js` and a `blocko.css` file.
41+
Once you're done with development and want to get production version, then:
42+
- To get the browser production build, run `./build.sh release-browser` and check inside `dist/browser` for a brand new `blocko.js` and a `blocko.css` file.
43+
- To get the NPM production build, run `./build.sh release-npm` and check inside `dist/npm` for a brand new `blocko.js` and a `blocko.css` file. Note that you have to import the CSS file in your project manually.
44+

build.sh

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,25 @@ if [ "$1" == "dev" ]; then
55
$buildcmd
66
fi
77

8-
if [ "$1" == "release" ]; then
9-
buildcmd="npx shadow-cljs release prod"
8+
if [ "$1" == "release-browser" ]; then
9+
buildcmd="npx shadow-cljs release prod-browser"
1010
$buildcmd
11-
copycsscmd="cp public/blocko.css dist/"
11+
copycsscmd="cp public/blocko.css dist/browser"
1212
$copycsscmd
13+
fi
14+
15+
if [ "$1" == "release-npm" ]; then
16+
buildcmd="npx shadow-cljs release prod-npm"
17+
$buildcmd
18+
copycsscmd="cp public/blocko.css dist/npm"
19+
$copycsscmd
20+
fi
21+
22+
if [ "$1" == "prepare-npm-dist" ]; then
23+
copypackagecmd="cp npm-package.json dist/npm"
24+
$copypackagecmd
25+
renamepackagecmd="mv dist/npm/npm-package.json dist/npm/package.json"
26+
$renamepackagecmd
27+
copyreadmecmd="cp README.md dist/npm"
28+
$copyreadmecmd
1329
fi

npm-package.json

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
"name": "blocko-editor",
3+
"version": "0.0.1",
4+
"description": "A block-based WYSIWYG editor.",
5+
"keywords": [
6+
"editor",
7+
"block-editor",
8+
"wysiwyg"
9+
],
10+
"homepage": "https://github.com/askonomm/blocko",
11+
"author": {
12+
"name": "Asko Nõmm",
13+
"email": "asko@bien.ee",
14+
"url": "https://bien.ee"
15+
},
16+
"repository": {
17+
"type": "git",
18+
"url": "https://github.com/askonomm/blocko.git"
19+
},
20+
"bugs": {
21+
"url": "https://github.com/askonomm/blocko/issues"
22+
},
23+
"main": "blocko.js",
24+
"license": "MIT",
25+
"scripts": {
26+
"test": "echo \"Error: no test specified\" && exit 1"
27+
}
28+
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "editor",
2+
"name": "blocko",
33
"version": "0.0.1",
44
"private": true,
55
"devDependencies": {

shadow-cljs.edn

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@
44

55
:dependencies
66
[[reagent "1.1.0"]
7-
[re-frame "1.2.0"]
8-
[hickory "0.7.1"]]
7+
[re-frame "1.2.0"]]
98

109
:builds
1110
{:dev
@@ -14,9 +13,16 @@
1413
:modules
1514
{:blocko
1615
{:entries [blocko.core]}}}
17-
:prod
16+
:prod-browser
1817
{:target :browser
19-
:output-dir "dist"
18+
:output-dir "dist/browser"
19+
:modules
20+
{:blocko
21+
{:entries [blocko.core]}}}
22+
:prod-npm
23+
{:target :node-library
24+
:exports-fn blocko.core/init
25+
:output-to "dist/npm/blocko.js"
2026
:modules
2127
{:blocko
2228
{:entries [blocko.core]}}}}}

0 commit comments

Comments
 (0)