Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
@ctrl/ngx-codemirror
Advanced tools
DEMO: https://ngx-codemirror.vercel.app
Latest version available for each version of Angular
@ctrl/ngx-codemirror | Angular | Codemirror |
---|---|---|
1.3.10 | 6.x 7.x | 5 |
2.2.1 | 8.x | 5 |
3.1.3 | 9.x | 5 |
4.1.1 | 10.x 11.x | 5 |
5.1.1 | 12.x-14x | 5 |
6.1.0 | 15.x | 5 |
current | >= 16.x | 5 |
An Angular component wrapper for CodeMirror that extends ngModel. Based on JedWatson/react-codemirror
tsquery playground: https://tsquery-playground.firebaseapp.com/
codemirror
is a peer dependency and must also be installed
npm install @ctrl/ngx-codemirror codemirror@5
Import CodemirrorModule
and FormsModule
and bring in the codemirror files for parsing the language you wish to use.
In your NgModule
:
import { FormsModule } from '@angular/forms';
import { NgModule } from '@angular/core';
import { CodemirrorModule } from '@ctrl/ngx-codemirror';
// add to imports:
imports: [
BrowserModule,
FormsModule,
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 base css file and your theme
@import '~codemirror/lib/codemirror';
@import '~codemirror/theme/material';
Use The Component
<ngx-codemirror
[(ngModel)]="content"
[options]="{
lineNumbers: true,
theme: 'material',
mode: 'markdown'
}"
></ngx-codemirror>
All Inputs of ngModel and
options
- options passed to the CodeMirror instance see http://codemirror.net/doc/manual.html#configname
- name applied to the created textareaautoFocus
- setting applied to the created textareapreserveScrollPosition
- preserve previous scroll position after updating valueAll outputs of ngModel and
codeMirrorLoaded
- called when codeMirror instance is initiatedfocusChange
- called when the editor is focused or loses focusscroll
- called when the editor is scrolled (not wrapped inside angular change detection must manually trigger change detection or run inside ngzone)cursorActivity
- called when the text cursor is moveddrop
- called when file(s) are droppedMIT
FAQs
CodeMirror wrapper for Angular
We found that @ctrl/ngx-codemirror demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.