# NPM Installation

> Install the Editor42 WYSIWYG HTML editor from NPM and bundle it with Vite, Webpack or Rollup. MIT-licensed, no account and no API key.

Source: https://editor42.com/docs/install/npm  
Section: Installation > Integrations > NPM  
Every page of editor42.com has a Markdown copy at its URL + `.md` (`index.md` after a URL that ends in `/`); all of them are in one file: https://editor42.com/llms-full.txt

The `editor42` package is the editor itself, ready for a bundler. There is no account, no sign-up and no key of any kind.

## Install

```sh
npm install editor42
```

or for Yarn users:

```sh
yarn add editor42
```

## Basic Setup

```js
import editor42 from 'editor42';

editor42.init({
  selector: '#my-editor'
});
```

The package also sets `window.editor42` (and `window.tinymce`, for compatibility) when it loads, so existing code that reaches for the global keeps working.

## Where the Editor Loads Its Files From

Editor42 is not a single file. Skins, icons, themes, models and plugins are fetched at runtime, relative to the script that loaded the editor — and a bundler rewrites your code into a hashed file somewhere else, so the editor cannot guess that path. Tell it with `base_url`.

### From your own project

Copy the runtime folders out of the package into your public directory — `skins/`, `icons/`, `themes/`, `models/` and `plugins/` from `node_modules/editor42/` into `public/editor42/` — then point at your copy:

```js
editor42.init({
  selector: '#my-editor',
  base_url: '/editor42'
});
```

In Vite that copy is a job for `vite-plugin-static-copy`; in Webpack, for `copy-webpack-plugin`.

### From the CDN

Nothing to copy: point at the same folders on the CDN.

```js
editor42.init({
  selector: '#my-editor',
  base_url: 'https://cdn.editor42.com/editor42/latest'
});
```

## TypeScript

Type definitions ship inside the package, so nothing extra is needed:

```ts
import editor42, { Editor, EditorOptions } from 'editor42';

const options: EditorOptions['init_instance_callback'] = (editor: Editor) => {
  console.log(editor.id + ' is ready');
};
```

## Framework Components

Using a framework? Each one has its own component with the same options:

[React](https://editor42.com/docs/install/react) · [Vue](https://editor42.com/docs/install/vue) · [Angular](https://editor42.com/docs/install/angular) · [Svelte](https://editor42.com/docs/install/svelte) · [jQuery](https://editor42.com/docs/install/jquery) · [Web Component](https://editor42.com/docs/install/web-component)

## Configuration

Editor42 uses the same configuration options as TinyMCE. See the [Configuration Options](https://editor42.com/api/configuration) for the full list.

## Live Demo

See it running, with its full source: the [NPM demo](https://editor42.com/examples/npm).

## Links

- NPM: [`editor42`](https://www.npmjs.com/package/editor42)
- GitHub: [editor42com/editor42](https://github.com/editor42com/editor42)
