A deriviative of Zenpen (http://zenpen.io), adapted to be a JavaScript component that you can apply to many different elements on a page.
The code is now arranged as Node modules, so the editor factory can be loaded using the require statement.
I’ve moved everything to “use strict”;.
Added d3 as a dependency - I’m using it for event management and as a DOM helper library.
After creating a toolbar, call it as a function with a d3 selection to hook up events for that node.
I’ve removed the following features:
- HTML local storage
- Fullscreen
- Word count and word count targets
- Colour change
Links now always refer to the browser window when we’re in an iframe (target=”_top”).
First, clone the repository:
git clone [email protected]:GlennS/zenpen.git
Our Javascript files our arranged as node.js modules, and we use the ‘browserify’ tool to combine them into a single file.
Install Node JS. For example, on a Debian-based system using the package manager:
sudo aptitude update;
sudo aptitude install -y nodejs nodejs-legacy;
Next, install browserify using Node’s package manager npm:
sudo npm -g install browserify; # Install Browserify as a command you can run from your shell.
Run ‘make’, or run the appropriate commands manually if you do not have it:
# On Linux, Mac OS, BSD etc., or from mingw32/Git Bash
make; # Runs the build target, which will execute the commands below for you.
# On Windows (if you don't have mingw32).
npm install; # Install the various packages we depend on (listed in package.json).
browserify demo.js -o bin/main.js; # Package all the Javascript code together in a way that we can load into a browser.
Serve index.html using any web server. For example, using python3 on a Debian system:
sudo python3 -m http.server 80;
At this point you should be able to see the demo page on http://localhost.
Get the original source code from which this version is derived.
The Apache License
Copyright (C) 2014 ~ Tim Holman ~ [email protected]
Modifications Copyright (C) 2015 Glenn Searby