npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@memberjunction/ng-code-editor

v5.26.0

Published

MemberJunction: Angular Code Editor

Downloads

5,180

Readme

@memberjunction/ng-code-editor

A flexible Angular code editor component built on CodeMirror 6, with syntax highlighting for 150+ languages, Angular forms integration, and extensive customization options.

Overview

The @memberjunction/ng-code-editor package wraps CodeMirror 6 in an Angular component with full support for ngModel, formControlName, and ControlValueAccessor. It provides syntax highlighting, line wrapping, whitespace visualization, configurable indentation, and runtime language switching -- all reactive to input property changes.

graph TD
    A[CodeEditorModule] --> B[CodeEditorComponent]
    A --> C[ToolbarConfig]

    B --> D["CodeMirror 6 EditorView"]

    D --> E["Language Support
    (150+ languages)"]
    D --> F["Form Integration
    (ngModel / formControl)"]
    D --> G["Extensions
    (themes, keymaps, custom)"]

    B --> H["Setup Modes"]
    H --> H1["basic (full features)"]
    H --> H2["minimal (lightweight)"]
    H --> H3["null (custom only)"]

    style A fill:#2d6a9f,stroke:#1a4971,color:#fff
    style B fill:#7c5295,stroke:#563a6b,color:#fff
    style D fill:#2d8659,stroke:#1a5c3a,color:#fff
    style H fill:#b8762f,stroke:#8a5722,color:#fff

Installation

npm install @memberjunction/ng-code-editor

Usage

Import the Module

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

@NgModule({
  imports: [CodeEditorModule]
})
export class AppModule { }

Basic Usage

<mj-code-editor
  [value]="code"
  [language]="'javascript'"
  [placeholder]="'// Enter your code here...'"
  (change)="onCodeChange($event)">
</mj-code-editor>

With ngModel

<mj-code-editor
  [(ngModel)]="code"
  [languages]="languages"
  [language]="'typescript'"
  [lineWrapping]="true"
  [indentWithTab]="true">
</mj-code-editor>
import { languages } from '@codemirror/language-data';

export class MyComponent {
  code = '';
  languages = languages;
}

With Reactive Forms

<form [formGroup]="form">
  <mj-code-editor
    formControlName="query"
    [languages]="languages"
    [language]="'sql'"
    [placeholder]="'SELECT * FROM ...'"
    [setup]="'basic'">
  </mj-code-editor>
</form>

API Reference

Component Selector

mj-code-editor

Inputs

| Input | Type | Default | Description | |-------|------|---------|-------------| | value | string | '' | The editor's content | | disabled | boolean | false | Disables the editor | | readonly | boolean | false | Makes the editor read-only | | placeholder | string | '' | Placeholder text when empty | | indentWithTab | boolean | false | Tab key indents instead of focusing next element | | indentUnit | string | '' | Indentation string (e.g., ' ' for 2 spaces) | | lineWrapping | boolean | false | Wrap long lines | | highlightWhitespace | boolean | false | Visualize whitespace characters | | languages | LanguageDescription[] | [] | Available language descriptions (static) | | language | string | '' | Current language for syntax highlighting | | setup | 'basic' \| 'minimal' \| null | 'basic' | Built-in editor setup | | extensions | Extension[] | [] | Additional CodeMirror extensions | | autoFocus | boolean | false | Focus editor on init (static) | | root | Document \| ShadowRoot | undefined | Custom root for the editor (static) |

Outputs

| Output | Type | Description | |--------|------|-------------| | change | EventEmitter<string> | Content changed | | focus | EventEmitter<void> | Editor gained focus | | blur | EventEmitter<void> | Editor lost focus |

Public Properties

| Property | Type | Description | |----------|------|-------------| | view | EditorView \| undefined | Underlying CodeMirror EditorView instance |

Setup Modes

  • 'basic' (default): Full setup with line numbers, fold gutters, search, bracket matching
  • 'minimal': Undo/redo history and basic keymaps only
  • null: No built-in setup; complete customization via extensions

Dependencies

| Package | Description | |---------|-------------| | @memberjunction/core | Core framework | | @memberjunction/core-entities | Entity definitions | | @memberjunction/global | Global utilities | | @memberjunction/ng-container-directives | Container directives | | codemirror | CodeMirror 6 core | | @codemirror/lang-javascript | JavaScript/TypeScript language | | @codemirror/lang-json | JSON language | | @codemirror/lang-python | Python language | | @codemirror/lang-sql | SQL language | | @codemirror/language-data | 150+ language definitions | | @codemirror/merge | Merge/diff extensions |

Peer Dependencies

  • @angular/common ^21.x
  • @angular/core ^21.x

Build

cd packages/Angular/Generic/code-editor
npm run build

License

ISC