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

sc-angular-wysiwyg

v1.0.1

Published

A HTML 5 WYSIWYG text editor, built for Angular 8 and designed to be simple and configurable.

Downloads

3

Readme

Simple Angular WYSIWYG Editor

Note this package uses font-awesome for the icons, you will need to import this or change the icon properties for each button https://fontawesome.com/start

To get started npm install --save sc-angular-wysiwyg

Add the module to your app.module imports section

import { NgModule } from '@angular/core';
import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
import { ScAngularWysiwygModule } from 'sc-angular-wysiwyg';

@NgModule({
  declarations: [
    AppComponent,
  ],
  imports: [
    AppRoutingModule,
    ScAngularWysiwygModule
  ],
  providers: [],
  bootstrap: [AppComponent]
})
export class AppModule { }

Use the component in your template <lib-sc-angular-wysiwyg></lib-sc-angular-wysiwyg>

You can listen for changes to the document by adding to your HTML <lib-sc-angular-wysiwyg (editorHtml)="onChange($event)"></lib-sc-angular-wysiwyg> and then in your code, add the function

    onChange($event) {
        console.log($event);
    }

You can override how the toolbar displays, which buttons display and their icons by passing variables to the editor like

<lib-sc-angular-wysiwyg
  (editorHtml)="onChange($event)" 
  [commands]="customCommands"
  [advanced]="customAdvanced"
></lib-sc-angular-wysiwyg>`

There is two different configs, one for buttons and one for advanced dropdowns.

Note, you can add a text: 'string' property to a command to add text to the button

    public commands: any = [
        {
            command: 'undo',
            isActive: false,
            title: 'Undo',
            icon: 'fas fa-undo',
        },
        {
            command: 'redo',
            isActive: false,
            title: 'Redo',
            icon: 'fas fa-redo',
        },
        {
            command: 'removeFormat',
            isActive: false,
            title: 'Remove Formatting',
            icon: 'fas fa-remove-format',
        },
        {
            command: 'bold',
            isActive: false,
            title: 'Bold',
            icon: 'fas fa-bold',
        },
        {
            command: 'italic',
            isActive: false,
            title: 'Italic',
            icon: 'fas fa-italic',
        },
        {
            command: 'underline',
            isActive: false,
            title: 'Underline',
            icon: 'fas fa-underline',
        },
        {
            command: 'changeColor',
            isActive: false,
            title: 'Font Color',
            icon: 'fas fa-tint',
        },
        {
            command: 'justifyleft',
            isActive: false,
            title: 'Justify Left',
            icon: 'fas fa-align-left',
        },
        {
            command: 'justifycenter',
            isActive: false,
            title: 'Justify Center',
            icon: 'fas fa-align-justify',
        },
        {
            command: 'justifyright',
            isActive: false,
            title: 'Justify Right',
            icon: 'fas fa-align-right',
        },
        {
            command: 'insertorderedlist',
            isActive: false,
            title: 'Insert Ordered List',
            icon: 'fas fa-list-ol',
        },
        {
            command: 'insertunorderedlist',
            isActive: false,
            title: 'Insert Unordered List',
            icon: 'fas fa-list-ul',
        },
        {
            command: 'outdent',
            isActive: false,
            title: 'Outdent',
            icon: 'fas fa-outdent',
        },
        {
            command: 'indent',
            isActive: false,
            title: 'Indent',
            icon: 'fas fa-indent',
        },
        {
            command: 'createLink',
            isActive: false,
            title: 'Link URL',
            icon: 'fas fa-link',
        },
        {
            command: 'cut',
            isActive: false,
            title: 'Cut',
            icon: 'fas fa-cut',
        },
        {
            command: 'copy',
            isActive: false,
            title: 'Copy',
            icon: 'fas fa-copy',
        },
        {
            command: 'getHtml',
            isActive: false,
            title: 'Get HTML',
            icon: '',
            text: 'HTML'
        },
    ]

This is the config for the dropdowns, you can add more values to the dropdown by updating the values property

    public advanced: Object = {
        backColor: {
            isActive: false,
            title: 'changeColor',
            icon: 'fas fa-paint-roller',
            values: {
                red: "Red",
                blue: "Blue",
                green: "Green",
                white: "White",
                black: "Black"
            }
        },
        fontName: {
            isActive: false,
            title: 'Font',
            icon: 'fas fa-text',
            values: [
                "Arial",
                "Arial Black",
                "Courier New",
                "Times New Roman"
            ]
        },
        fontSize: {
            isActive: false,
            title: 'Font Size',
            icon: 'fas fa-text',
            values: {
                1: "Tiny",
                2: "Small",
                3: "Normal",
                4: "Medium",
                5: "Large",
                6: "Huge",
                7: "Max"
            }
        },
        foreColor: {
            isActive: false,
            title: 'Font Color',
            icon: 'fas fa-text',
            values: {
                red: "Red",
                blue: "Blue",
                green: "Green",
                white: "White",
                black: "Black"
            }
        },
        formatblock: {
            isActive: false,
            title: 'Font Color',
            icon: 'fas fa-text',
            values: {
                h1: "Title 1",
                h2: "Title 2",
                h3: "Title 3",
                h4: "Title 4",
                h5: "Title 5",
                h6: "Title 6",
                p: "Paragraph",
                pre: "Preformatted"
            }
        }
    }