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

@bigbigbird/ng-zeditor

v0.0.8

Published

## Description

Downloads

1

Readme

ng-zeditor(Angular版)

Description

一款简单、小清新的编辑器

在线演示
github

UI

image

image

Install

npm install @bigbigbird/ng-zeditor@latest -S
# or
yarn add @bigbigbird/ng-zeditor@latest -S

Quick Start

in app.module.ts

import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';

import { AppComponent } from './app.component';
import {NgZeditorModule} from '@bigbigbird/ng-zeditor';
@NgModule({
  declarations: [
    AppComponent
  ],
  imports: [
    BrowserModule,
    NgZeditorModule
  ],
  providers: [],
  bootstrap: [AppComponent]
})
export class AppModule { }

in app.component.ts

import { Component } from '@angular/core';

@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.scss']
})
export class AppComponent {
  /** 回显 */
  html = '<div>hello world!</div>';
  /** 不要提交按钮 */
  hasBtn = false;
  /** 主题 */
  theme = 'g';
  /** 参数配置,默认为下面这个 */
  options: object = {
    /** 编辑内容的最大字节数 */
    maxsize: 65535,
    image: {
      /** 上传的最大图片或插入图片外链数量 */
      count: 5,
      /** 小于指定字节数会进行base64编码 */
      base64: 60000
    },
    audio: {
      /** 单次上传音频或插入音频外链的最大数量 */
      count: 1,
      /** 小于指定字节数会进行base64编码 */
      base64: 0
    },
    video: {
      /** 单次上传视频或插入视频外链的最大数量 */
      count: 1,
      /** 小于指定字节数会进行base64编码 */
      base64: 0
    }
  };

  /**
   * ngModelChange
   * @param html 输入的html
   */
  change(html: string) {
    console.log('ngModelChange');
    console.log(html);
  }
  /**
   * 前提hasBtn为true
   * 点击提交按钮
   * @param obj 编辑内容详细信息
   */
  recieveContent(obj: {
    innerHTML: string,
    innerText: string,
    media: {
      image: { type: 'url' | 'base64', src: string },
      audio: { type: 'url' | 'base64', src: string },
      video: { type: 'url' | 'base64', src: string },
    }
  }) {
    console.log('recieveContent');
    console.log(obj);
  }
  /**
   * 自定义input事件
   * @param html 输入的html
   */
  onInput(html: string) {
    console.log('onInput');
    console.log(html);
  }
  /**
   * 文件上传
   * @param obj 文件类型,文件,关闭弹窗回调
   */
  uploadFile(obj: {
    type: 'image' | 'audio' | 'video', file: any, callback: (v: string | boolean, t?: number) => void
  }) {
    const callback = obj.callback;
    // 关闭弹窗
    // 上传成功
    const src = 'http://www.example.com';
    callback(src);
    // 上传失败
    // callback(false);
    // 上传超时
    // const t = 3000; // 超时时间(单位ms)
    // callback(false, t);
  }

}

in app.component.html

<app-zeditor [(ngModel)]="html" (ngModelChange)="change($event)" [options]="options" [hasBtn]="false"
    (recieveContent)="recieveContent($event)" [theme]="'g'" (onInput)="onInput($event)"
    (uploadFile)="uploadFile($event)"></app-zeditor>
<textarea [ngStyle]="{
    'min-height': '15rem',
    'width': '100%',
    'outline': 'none',
    'resize': 'none',
    'border': '1PX dashed green'
}" [(ngModel)]="html"></textarea>

Browser Support

PC端标准浏览器和IE9+.

Security

在前端可以使用xss对html进行无害化处理
在后端可以使用jsoup对html进行无害化处理

Concat

QQ交流群:486273737
Name: 木懵の狗纸
个人QQ: 1029512956
Email: [email protected]