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

ng-wysiwygjs

v0.0.10

Published

An angular wysiwyg editor component using [wysiwyg.js](http://wysiwygjs.github.io/). It also uses [prismjs](http://prismjs.com/) for code highligting.

Downloads

15

Readme

Angular WYSIWYG.JS Component

An angular wysiwyg editor component using wysiwyg.js. It also uses prismjs for code highligting.

Prerequisites - dependencies

  1. jquery (optionally required by wysiwygjs library)
  2. fontawesome (required by wysiwygjs libary)
  3. prismjs (code highlighter used by this component)

Installation

npm install --save ng-wysiwygjs

Setup

  1. Add dependent libaries to .angular-cli.json file

        "styles": [
            "styles.css",
            "../node_modules/font-awesome/css/font-awesome.css",
            "../node_modules/prismjs/themes/prism-okaidia.css"
        ],
        "scripts": [
            "../node_modules/jquery/dist/jquery.min.js",
            "../node_modules/wysiwyg.js/src/wysiwyg.js",
            "../node_modules/wysiwyg.js/src/wysiwyg-editor.js",
            "../node_modules/prismjs/prism.js",
            "../node_modules/prismjs/components/prism-typescript.js",
            ...
        ],
    
  2. (Optional) add programming languages of choice to be used for code highlighting. Full list is:

     "scripts": [
            "../node_modules/prismjs/components/prism-typescript.js",
            "../node_modules/prismjs/components/prism-go.js",
            "../node_modules/prismjs/components/prism-markup.min.js",
            "../node_modules/prismjs/components/prism-css.min.js",
            "../node_modules/prismjs/components/prism-scss.min.js",
            "../node_modules/prismjs/components/prism-sass.min.js",
            "../node_modules/prismjs/components/prism-less.min.js",
            "../node_modules/prismjs/components/prism-typescript.min.js",
            "../node_modules/prismjs/components/prism-php.min.js",
            "../node_modules/prismjs/components/prism-go.min.js",
            "../node_modules/prismjs/components/prism-python.min.js",
            "../node_modules/prismjs/components/prism-ruby.min.js",
            "../node_modules/prismjs/components/prism-rust.min.js",
            "../node_modules/prismjs/components/prism-c.min.js",
            "../node_modules/prismjs/components/prism-java.min.js",        
            "../node_modules/prismjs/components/prism-lua.min.js",
            "../node_modules/prismjs/components/prism-dart.min.js",
            "../node_modules/prismjs/components/prism-swift.min.js",
            "../node_modules/prismjs/components/prism-scala.min.js",
            "../node_modules/prismjs/components/prism-sql.min.js",
            "../node_modules/prismjs/components/prism-json.min.js",
            "../node_modules/prismjs/components/prism-r.min.js",
            "../node_modules/prismjs/components/prism-sas.min.js",
            "../node_modules/prismjs/components/prism-matlab.min.js",
            "../node_modules/prismjs/components/prism-bash.min.js",
            "../node_modules/prismjs/components/prism-yaml.min.js",
            "../node_modules/prismjs/components/prism-nginx.min.js",
            "../node_modules/prismjs/components/prism-docker.min.js",
            "../node_modules/prismjs/components/prism-vim.min.js"
     ]

Note: This is just the most common programming languages supported by Prismjs personally selected by author.

Usage

  1. Import component module

        import { WygEditorModule } from 'wyg-editor/wyg-editor.module';
        ...
    
        @NgModule({
        ...
        imports: [
            ...
            WygEditorModule
        ],
        providers: [],
        bootstrap: [AppComponent]
        })
        export class AppModule { }
  2. Use wyg-editor in your component class

    • Component

          import { WygEditorComponent } from 'wyg-editor/wyg-editor.component';
      
          @Component({
          selector: 'app-demo',
          templateUrl: './demo.component.html',
          styleUrls: ['./demo.component.css']
          })
          export class DemoComponent implements OnInit {
      
          public testContent: string;
      
          constructor() { }
      
          ngOnInit() {
              this.testContent = "<p>Hello world!</p>";
          }
      
          }
    • Template

          <wygeditor [(ngModel)]="testContent" name="testContent"></wygeditor>
    • Full example

          <h1>ng-wysiwygjs & prismjs demo</h1>
      
          <div>
              <wygeditor [(ngModel)]="testContent" name="testContent"></wygeditor>
          </div>
      
          <!--<div>{{testContent}}</div>-->
          <h2>Note:</h2>
          <p>Press <strong>Ctl+Shift+h</strong> to highlight all code blocks</p>
          <h2>Output: </h2>
          <div [innerHTML]="testContent" ></div>
  3. Using code highlighting

    • Click on </> icon of the toolbar to select programming language
    • Edit your code in pre-format code block
    • Press Ctrl+Shift+h to highlight your code blocks

Customisation

  • Changing format: you can change format of the editor by adding your .css file to .angular-cli.json

TODOs

  • Testing
  • Get focus back to editor after code highligting (this is a current issue of angular 4 with new renderer2)