# open-cb-editor

> Open source editor

Latest version **1.0.26** (published 2021-04-10) · ISC license · 0 weekly downloads

## Install

```sh
npm install open-cb-editor
pnpm add open-cb-editor
yarn add open-cb-editor
bun add open-cb-editor
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.26 |
| Published | 2021-04-10 |
| First published | 2021-04-05 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 28.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Carlos Aguilera |
| Maintainers | cagucor |

## Links

- npm: https://www.npmjs.com/package/open-cb-editor
- Repository: https://github.com/cagucor/open-cb-editor
- Homepage: https://github.com/cagucor/open-cb-editor#readme
- Issues: https://github.com/cagucor/open-cb-editor/issues
- npm.io page: https://npm.io/package/open-cb-editor

## Dependencies (2)

- [file-saver](https://npm.io/package/file-saver.md) ^2.0.5
- [monaco-editor](https://npm.io/package/monaco-editor.md) ^0.23.0

## Recent versions

- 1.0.26 (latest) — 2021-04-10
- 1.0.2-0 (next) — 2021-04-05
- 1.0.25 — 2021-04-10
- 1.0.24 — 2021-04-10
- 1.0.23 — 2021-04-09
- 1.0.22 — 2021-04-09
- 1.0.21 — 2021-04-09
- 1.0.20 — 2021-04-09
- 1.0.19 — 2021-04-09
- 1.0.18 — 2021-04-09
- 1.0.17 — 2021-04-09
- 1.0.16 — 2021-04-09
- 1.0.15 — 2021-04-09
- 1.0.14 — 2021-04-09
- 1.0.13 — 2021-04-09
- … 13 more at https://npm.io/package/open-cb-editor/versions

## README

# open-cb-editor

Planned upcoming features can be found in editor-feature-plan.md!

# Installation

```js
npm i open-cb-editor
```

# Usage
This package creates a monaco editor instance on a div element. 

The package exports a class which can be used to construct and interact with the editor.

## To create the editor: 

```js
import { createEditor } from 'open-cb-editor';

htmlDiv = document.querySelector('target-div');

let editor = new createEditor(htmlDiv);

```

## To merge code fragments from two or more editors into a single one:

```js

import { createEditor, mergeCode} from 'open-cb-editor';

let subEditorOne = new createEditor(divOne);
let subEditorTwo = new createEditor(divTwo);
let mainEditor = new createEditor(divThree);

let codeFragmentOne = subEditorOne.getCode();
let codeFragmentTwo = subEditorTwo.getCode();

let combinedCode = mergeCode(codeFragmentOne, codeFragmentTwo);

mainEditor.setCode(combinedCode);

```

---
_Source: https://npm.io/package/open-cb-editor · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
