textolite
v1.1.0
Published
Text editor.
Downloads
3
Maintainers
Readme
Textolite
Textolite is a simle text editor.
Using
In order to install package:
npm i textolite
Then you can use it in your project:
<div id="editor-container"></div>
import { Editor } from 'textolite';
const editor = new Editor("editor-container");
For now editor still doesn't support json export, so the easiest method of getting inserted text is to read innerHTML property of editor container.
const html = editor.getHTML();
Please find example of usage below.
Running tests
Running unit/integration tests: npm test
Running unit/integration tests with coverage details: npm test -- --coverage
Checking formatting: npx eslint .
or npm run lint .
Example
There are 2 exemples. One uses React, second is just Vanilla JS.
Examples were meant to be used with local version of textolite
library, but you can also use latest released version.
Using latest released version of textolite library:
Skip this is you want to use local library.
- Go to folder with example:
cd examples/react-example
- Install textolite:
npm i textolite
Create link to local textolite library:
Skip this is you use latest released textolite.
- Go to
textolite
directory. - Transpile typescript files to js:
tsc
- Create global link to package:
npm link
- Go to folder with example:
cd examples/react-example
- Link local library to project:
npm link textolite
Running example
- Go to folder with example:
cd examples/react-example
- Install packages:
npm install
- Build main.js using webpack:
npm run build
- Run example:
npm start