UNPKG

@ks89/ngx-codemirror6

Version:
168 lines (128 loc) 5.65 kB
<h1 align="center">@ks89/ngx-codemirror6</h1> <h3 align="center"><b>@ks89/ngx-codemirror6</b> is an Angular library to use Codemirror6 library as an Angular Component</h3> <br /> <p align="center"> <a href="https://www.npmjs.com/package/@ks89/ngx-codemirror6"> <img src="https://img.shields.io/npm/v/@ks89/ngx-codemirror6.svg?style=flat-square" alt="npm@latest"> </a> </p> <p align="center"> <a href="https://www.npmjs.com/package/@ks89/ngx-codemirror6"><img src="https://img.shields.io/npm/l/@ks89/ngx-codemirror6.svg?style=flat-square" alt="NPMLicense"></a> <a href="https://semver.org/"><img src="https://img.shields.io/badge/semver-2.0-ff69b4.svg?style=flat-square" alt="Semver"></a> </p> <h5 align="center"> <b>Do you like @ks89/ngx-codemirror6? Please, add a :star: to support this library</b> </h5> <br /> ## Table of Contents 1. **[Features](#boom-features-boom)** 2. **[Installation](#package-installation-package)** 3. **[Choose the version](#warning-choose-the-version-warning)** 4. **[Usage](#usage)** 5. **[Security notes](#security-notes)** 6. **[News](#fire-news-fire)** 7. **[Contributing](#computer-contributing-computer)** 8. **[License](#copyright-license-copyright)** <br /> ## :boom: Features :boom: - Angular Module to import this library - supports all **recommended Angular Compiler Options** - compliant to Angular Package Format specifications - **use [Semantic versioning 2.0.0](http://semver.org/)** also known as 'semver' - official example with `angular-cli` <br /> <p align="center"> <img src="./readme-images/1.png" alt="@ks89/ngx-codemirror6" width="1024"> </p> <br /> <p align="center"> <img src="./readme-images/2.png" alt="@ks89/ngx-codemirror6" width="1024"> </p> <br /> <p align="center"> <img src="./readme-images/3.png" alt="@ks89/ngx-codemirror6" width="1024"> </p> <br /> <p align="center"> <img src="./readme-images/4.png" alt="@ks89/ngx-codemirror6" width="1024"> </p> <br /> ## :package: Installation :package: - `npm install --save @ks89/ngx-codemirror6` Also, you need Codemirror packages as peer dependencies ``` npm i --save codemirror npm i --save @codemirror/state npm i --save @codemirror/view ``` Install only the language packages you need in your application, for example: ``` npm i --save @codemirror/lang-javascript ``` <br /> ## :warning: Choose the right version :warning: | | @ks89/ngx-codemirror6 | |------------|:---------------------:| | Angular 16 | = 1.0.0 | | Angular 17 | = 1.0.0 | | Angular 18 | = 2.0.1 | | Angular 19 | = 2.0.1 | | Angular 20 | = 2.0.1 | | Angular 21 | &gt;= 4.0.0 | <br /> ## Usage Check the official example in `./src`. Pass a CodeMirror language support extension from your application: ```ts import { Component } from '@angular/core'; import { javascript } from '@codemirror/lang-javascript'; @Component({ selector: 'app-root', template: `<ks-codemirror [content]="content" [language]="language"></ks-codemirror>`, standalone: false }) export class AppComponent { content = 'const value = 1;'; language = javascript({ typescript: true }); } ``` <br /> ## :fire: News :fire: - 26/05/2026 - 4.0.0 - @ks89/ngx-codemirror6 - [HERE](https://github.com/Ks89/ngx-codemirror6/releases) - 26/12/2025 - 3.0.0 - @ks89/ngx-codemirror6 - [HERE](https://github.com/Ks89/ngx-codemirror6/releases) - 30/05/2024 - 2.0.1 - @ks89/ngx-codemirror6 - [HERE](https://github.com/Ks89/ngx-codemirror6/releases) - 30/05/2024 - 2.0.0 - @ks89/ngx-codemirror6 - [HERE](https://github.com/Ks89/ngx-codemirror6/releases) - 17/08/2019 - 1.0.0 - @ks89/ngx-codemirror6 - [HERE](https://github.com/Ks89/ngx-codemirror6/releases) <br /> ## :computer: Contributing :computer: Check `CONTRIBUTING.md` in this repository. To understand how to contribute to an open source project, [HERE](https://egghead.io/courses/how-to-contribute-to-an-open-source-project-on-github) you can find useful information. When you create a pull request, please, format your code to be consistent with the existing code. I suggest to use [WebStorm](https://www.jetbrains.com/webstorm/) as IDE and when you commit don't use a third party software, but the official command line `git`. In this way, [prettier](https://prettier.io/) will run using my configuration and it will auto-format the code. If it fails, add files with `git add .` again and retry. <br /> ## :copyright: License :copyright: The MIT License (MIT) Copyright (c) 2023-2026 Stefano Cappa Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. <br/> **Created by Stefano Cappa** **[ back to top](#table-of-contents)**