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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@fsegurai/ngx-codemirror

v19.1.0

Published

Angular library that uses codemirror to create a code editor

Downloads

34

Readme

This is just a side project to provide additional features that fulfill my needs.

@fsegurai/ngx-codemirror is an Angular library that combines...

  • CodeMirror to provide a versatile text editor implemented in JavaScript for the browser

Table of contents

Installation

@fsegurai/ngx-codemirror

To add @fsegurai/ngx-codemirror along with the required codemirror library to your package.json use the following commands.

npm install @fsegurai/ngx-codemirror --save

Configuration

Component Module

For Not-Standalone mode, you need to import the CodemirrorModule in your Angular module.

import { CodemirrorModule } from '@fsegurai/ngx-codemirror';

@NgModule({
    imports: [
        CodemirrorModule.forRoot({
            // codemirror options
        }),
    ],
})
export class AppModule {
}

Standalone Component

For Standalone mode, you just need to import the components you want to use.

/* CodemirrorComponent */
import { CodemirrorComponent } from '@fsegurai/ngx-codemirror';

// or

/* CodeDiffEditorComponent */
import { CodeDiffEditorComponent } from '@fsegurai/ngx-codemirror';

Usage

Basic Usage

<ngx-code-editor
        [value]="editorContent"
        [theme]="'dark'"
        [language]="'javascript'"
        [placeholder]="'Type your code here...'"
        [lineWrapping]="true"
        (ngModelChange)="onEditorChange($event)">
</ngx-code-editor>
import { Component } from '@angular/core';

@Component({
    selector: 'app-root',
    templateUrl: './app.component.html',
})
export class AppComponent {
    editorContent = '// Start coding...';

    onEditorChange(content: string) {
        console.log('Editor Content:', content);
    }
}

Advanced Usage

Customize themes, languages, and editor behavior dynamically:

<ngx-code-editor
        [(ngModel)]="editorContent"
        [theme]="selectedTheme"
        [language]="selectedLanguage"
        [setup]="editorSetup"
        [indentWithTab]="true"
        [lineWrapping]="true"
        (ngModelChange)="onEditorChange($event)">
</ngx-code-editor>
@Component({
    selector: 'app-advanced-editor',
    templateUrl: './advanced-editor.component.html',
})
export class AdvancedEditorComponent {
    editorContent = '';
    selectedTheme = 'dark';
    selectedLanguage = 'javascript';
    editorSetup = 'basic';

    onEditorChange(updatedContent: string) {
        console.log('Updated Content:', updatedContent);
    }
}

Integration

The library provides a customizable editor component with various inputs and outputs for flexible usage.

Inputs

  • value - The initial content of the editor.
  • theme - The theme of the editor.
  • language - The language mode of the editor.
  • placeholder - The placeholder text of the editor.
  • lineWrapping - Enable line wrapping in the editor.
  • indentWithTab - Enable indentation with tabs in the editor.
  • setup - The setup of the editor.
  • extensions - The extensions of the editor.
  • and more...

Outputs

  • change - The output event when the editor content changes.
  • focus - The output event when the editor is focused.
  • blur - The output event when the editor is blurred.

Demo application

A demo is available @ https://fsegurai.github.io/ngx-codemirror and its source code can be found inside the demo directory.

It's important to mention that for this project I'm using:
Node.js v20.11.1 and Bun v1.1.32 (or later).

The following commands will clone the repository, install npm dependencies and serve the application @ http://localhost:4200

It is advisable to use bun as the package manager for managing numerous dependencies, as it is faster than npm and generally more reliable.

git clone https://github.com/fsegurai/ngx-codemirror.git
cd ngx-codemirror
bun install
bun start

License

Licensed under MIT.