Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/acrodata/code-editor

CodeMirror 6 wrapper for Angular
https://github.com/acrodata/code-editor

Last synced: 3 months ago
JSON representation

CodeMirror 6 wrapper for Angular

Awesome Lists containing this project

README

        

# Code Editor

[![npm](https://img.shields.io/npm/v/@acrodata/code-editor.svg)](https://www.npmjs.com/package/@acrodata/code-editor)
[![license](https://img.shields.io/github/license/mashape/apistatus.svg)](https://github.com/acrodata/code-editor/blob/main/LICENSE)

codemirror+angular

CodeMirror 6 wrapper for Angular

#### Quick links

[Documentation](https://acrodata.github.io/code-editor/) |
[Playground](https://acrodata.github.io/code-editor/)

## Installation

```bash
npm install @acrodata/code-editor --save
```

## Usage

### Code Editor

```ts
import { Component } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { CodeEditor } from '@acrodata/code-editor';

@Component({
selector: 'your-app',
template: ``,
standalone: true,
imports: [FormsModule, CodeEditor],
})
export class YourAppComponent {
code = `console.log("Hello world")`;
}
```

### Diff Editor

```ts
import { Component } from '@angular/core';
import { DiffEditor } from '@acrodata/code-editor';

@Component({
selector: 'your-app',
template: ``,
standalone: true,
imports: [DiffEditor],
})
export class YourAppComponent {
originalCode = `bar`;
modifiedCode = `foo`;
}
```

## License

MIT