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 🙏

© 2024 – Pkg Stats / Ryan Hefner

ngx-ace-icy

v1.0.0

Published

angular9+版本以上ace语法编辑器

Downloads

7

Readme

angular ace编辑器

基于angular9、ace-builds构建的ace编辑器组件。demo地址

开始使用

安装

npm i ngx-ace-icy

使用

安装成功后需要在项目中引入对应的ace的模式、主题文件。比如:需要的时sql语言:

修改angular.json文件

{
  "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
  "version": 1,
  "newProjectRoot": "projects",
  "projects": {
    "ace-test": {
      ...
      "architect": {
        "builder": {
          ....
          
            "scripts": [
              "./node_modules/ace-builds/src-min/ace.js",  // ace 核心文件
              "./node_modules/ace-builds/src-min/mode-sql.js", // sql 模式文件
              "./node_modules/ace-builds/src-min/snippets/sql.js",  // sql 模式部分文件
              "./node_modules/ace-builds/src-min/theme-monokai.js" // 主题样式文件
            ]
        }
      }
    }
  }
}

项目引入

NgxAceModule应该在AppModule中使用或通用的module模块中便于任何模块方便使用。

/**
 * 以AppModule引入为例
 */
import { BrowserModule } from '@angular/platform-browser';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { NgModule } from '@angular/core';

import { NgxAceModule } from 'ngx-ace-icy'; // 引入

import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';

@NgModule({
  declarations: [
    AppComponent
  ],
  imports: [
    BrowserModule,
    FormsModule,
    ReactiveFormsModule,
    AppRoutingModule,
    NgxAceModule, // 导入模块
  ],
  providers: [],
  bootstrap: [AppComponent]
})
export class AppModule { }
/**
 * AppComponent
 */
import { Component, OnInit } from '@angular/core';

@Component({
  selector: 'app-root',
  template: `
	// 普通使用方式
	<c-ngx-ace
  [options]="aclOptions"
  [text]="aceText"
  (textChange)="textChange($event)"
  ></c-ngx-ace>
	// ngModel 使用
	<c-ngx-ace
  [options]="aclOptions"
  [(ngModel)]="aceText"
  (ngModelChange)="textChange($event)"
  ></c-ngx-ace>
	`
})
export class AppComponent implements OnInit {
  /** ace 配置 **/
  public aclOptions = {
    enableBasicAutocompletion: true,
    enableSnippets: true,
    enableLiveAutocompletion: true,
    showGutter: false,
    maxLines: 3,
    minLines: 4,
    autoScrollEditorIntoView: false,
  };
	/** ace 内容 **/
  public aceText = '';
  constructor() { }

  ngOnInit() {
  }
	/** ace 内容更改的回调函数 */
  public textChange(value): void {
    console.log(value);
  }
}

Api说明

| 名称 | 说明 | 类型 | 必填 | 默认值 | | :---------------- | :----------------------------------------------------------- | :--------------------- | :-----: | :----------: | | [options] | ace的配置信息.具体参考ace api | object | false | - | | [placeholder] | 为空时的内容提示信息 | string | false | 请输入内容 | | [style] | 样式 | object | false | - | | [readOnly] | 是否为只读 | boolean | false | false | | [theme] | 使用主题,ace官网主题,也可自行开发主题。 | string | fasle | monokai | | [mode] | 语言模式,ace官方模式,也可以自行开发。 | string | false | sql | | [(text)] | 文本内容,可进行双向 绑定。非form表单模式下可以使用。 | string | false | - | | (textChange) | text文本更改后的回调。 | EventEmitter<string> | false | - | | [(ngModel)] | angular表单属性。与[(text)]互斥 | string | false | - | | [ngModelChange] | ngModel内容更改后的回调 | EventEmitter<string> | false | - |