0.0.1 • Published 5 years ago

@penkz/code-editor v0.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
5 years ago

CodeEditor

Git Hub Release npm.io GitHub release (latest by date)

CodeEditor wrappers a CodeMirror editor in a Angular library for use with Angular Forms. Several features have been added to make it easier to use in your applications.

Table of contents

Features

  • Compatible with Angular Forms (Both Reactive and Template-driven forms).
  • Automatic import of code modes.
  • Automatic import of styles.
  • Toolbar with configurable options
  • Footer with configurable options

Getting started

Step 1: Install CodeEditor:

NPM

npm i @penkz/code-editor

Step 2: Import the CodeEditorModule:

import {CodeEditorModule} from '@penkz/code-editor';

@NgModule({
  declarations: [AppComponent],
  imports: [CodeEditorModule],
  bootstrap: [AppComponent]
})
export class AppModule {}

Usage sample

<code-editor
  [(ngModel)]="model"
></code-editor>

API

Inputs

InputTypeDefaultRequiredDescription
titlestring_noHistory identifier of history list. When valid history identifier is given, then component stores selected item to local storage of user's browser. If it is null then history is hidden. History list is visible if at least one history item is stored. History identifier must be unique.
placeHolderstring-noHTML <input> placeholder text.
(ngModel)any_noTracks the value bound to this directive. Used with Template-driven forms. For more details click here
formControl / formControlNamestring_noTracks the FormControl instance bound to the directive. Used with Reactive forms. For more details click here and here
isLoadingbooleanfalsenoSet the loading state when data is being loaded.
disabledbooleanfalsenoinput disable/enable.

Outputs

OutputDescription
(change)Event is emitted when an input is changed.
(focus)Event is emitted when an input is focused.

Methods (controls)

NameDescription
clearClears the editor text

Versioning

We use Semantic for versioning.

For the versions available, see the tags on this repository.

Authors

npm.io