GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - worktile/ng-codemirror: Codemirror binding for Angular

BranchesTags
Open more actions menu

Latest commit

 

History

159 Commits
159 Commits

Folders and files

NameName
Last commit message
Last commit date
demo
demo
 
 
e2e
e2e
 
 
src
src
 
 
.browserslistrc
.browserslistrc
 
 
.editorconfig
.editorconfig
 
 
.gitignore
.gitignore
 
 
.wpmrc.js
.wpmrc.js
 
 
CHANGELOG.md
CHANGELOG.md
 
 
README.md
README.md
 
 
angular.json
angular.json
 
 
karma.conf.js
karma.conf.js
 
 
package-lock.json
package-lock.json
 
 
package.json
package.json
 
 
tsconfig.app.json
tsconfig.app.json
 
 
tsconfig.json
tsconfig.json
 
 
tsconfig.spec.json
tsconfig.spec.json
 
 
tslint.json
tslint.json
 
 

Repository files navigation

Angular - Codemirror component

codemirror component for Angular(^8.0+)

Has been formally verified by the production environment。

Features

  • support copy text in readOnly 'nocursor' mode.
  • ensure init codemirror after nativeElement has been attached (codemirror need a real element width).
  • support flexiable height by autoMaxHeight.
  • support all options by codemirror(^5.52.0).

Alternatives

  • ngx-codemirror: An Angular component wrapper for CodeMirror that extends ngModel.

Installation

$ npm i ng-codemirror --save
// or
$ yarn add ng-codemirror

Usage

Import CodemirrorModule and bring in the codemirror files for parsing the langague you wish to use.

In your NgModule:

import { NgModule } from '@angular/core';
import { CodemirrorModule } from 'ng-codemirror';

  // add to imports:
  imports: [
    BrowserModule,
    CodemirrorModule,
    ...
  ]

In your main.ts or at the root of your application, see documentation:

import "codemirror/mode/javascript/javascript";
import "codemirror/mode/markdown/markdown";

Import the scss file

@import "~ng-codemirror/index.scss";

Use The Component

<ng-codemirror
  [options]="options"
  [ngModel]="code"
  [autoMaxHeight]="300"
></ng-codemirror>
  // options 配置
  options = {
    lineNumbers: true,
    readOnly: false, // nocursor can not copy
    mode: 'javascript',
    autofocus: true,
    lineWiseCopyCut: true,
    cursorBlinkRate: 500 // hide cursor
  };

About

Codemirror binding for Angular

Resources

Readme
Activity
Custom properties

Stars

17 stars

Watchers

5 watching

Forks

4 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.