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

https://github.com/aitorllj93/ngx-codex

Angular editor.js component with custom components support.
https://github.com/aitorllj93/ngx-codex

angular editorjs

Last synced: about 1 year ago
JSON representation

Angular editor.js component with custom components support.

Awesome Lists containing this project

README

          

# ngx-codex

[![npm](https://img.shields.io/npm/v/ngx-codex)](https://www.npmjs.com/package/ngx-codex)
[![demo](https://img.shields.io/badge/-demo-ff69b4)](https://d3v0ps.github.io/ngx-codex)

Angular [editor.js](https://editorjs.io/) component with ControlValueAccesorTool Support.

Implements `ControlValueAccesor`.

[Demo](https://d3v0ps.github.io/ngx-codex)

## Getting Started

### 1. Install packages
```sh
npm i @editorjs/editorjs
npm i ngx-codex
```

### 2. Import Module
```typescript
import { NgxCodexModule } from 'ngx-codex';

@NgModule({
declarations: [AppComponent],
imports: [
FormsModule,
NgxCodexModule
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule {}
```

### 3. Load editor.js tools

```typescript

import Header from '@editorjs/header';

const myEditorTools = {
header: {
class: Header,
shortcut: 'CMD+SHIFT+H',
config: {
placeholder: 'Enter a header'
}
}
}
```

### 4. Include the component

```html

```

## Inputs

| name | description |
| ---- | ----------- |
| tools | EditorJS Tools. [See editor.js configuration](https://editorjs.io/configuration) |

## Tips

### Loading Angular Components

```ts
import { Component, ComponentFactoryResolver, ViewContainerRef } from '@angular/core';

import { ControlValueAccesorTool } from 'ngx-codex';
import { NgxBPMNModelerComponent } from 'ngx-bpmn-modeler';

export class BPMNTool extends ControlValueAccesorTool {

static get toolbox() {
return {
title: 'BPMN',
icon: `



`
};
}

}

@Component({
selector: 'app-root',
template: `


`
})
export class AppComponent {
title = 'testing';

codex = {
content: null,
tools: {
bpmn: {
class: BPMNTool,
config: {
getFactoryResolver: () => this.factoryResolver,
getContainerRef: () => this.containerRef,
component: BPMNModelerComponent,
inputs: {
wrapperClass: 'bpmn-wrapper',
containerClass: 'bpmn-container',
propertiesClass: 'bpmn-properties'
}
}
},
}
};

constructor(
private factoryResolver: ComponentFactoryResolver,
private containerRef: ViewContainerRef,
) {}
}

```