Skip to content

perehinik/textolite

Repository files navigation

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.

  1. Go to folder with example:
cd examples/react-example
  1. Install textolite:
npm i textolite

Create link to local textolite library:

Skip this is you use latest released textolite.

  1. Go to textolite directory.
  2. Transpile typescript files to js:
tsc
  1. Create global link to package:
npm link
  1. Go to folder with example:
cd examples/react-example
  1. Link local library to project:
npm link textolite

Running example

  1. Go to folder with example:
cd examples/react-example
  1. Install packages:
npm install
  1. Build main.js using webpack:
npm run build
  1. Run example:
npm start