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

@talrace/ngx-noder

v0.0.2

Published

## Description

Downloads

8

Readme

NgxNoder

Description

Rich Text Editor for Angular with basic WORD features and ability to create and use your own custom components. The package also provides customizable toolbar, header, custom search in editor and basic interfaces of custom components which you can overwrite to suit your needs in your application.\

You can get information about the API and more NgxNoder examples from the documentation.

Installation

Run this command to add ngx-noder package to your project

npm i @talrace/ngx-noder

Editor

Import editor module. This is basic module and provides creating, editing and viewing document functionality.

import { EditorModule } from '@talrace/ngx-noder';

@NgModule({
    // ...
    imports: [EditorModule],
    // ...
})
export class SomeModule{}

If you need save your changes in document, you need provide CommandsService in your module. This service provides passing commands from the editor to your application for further saving and applying them to your document.

import { CommandsService } from '@talrace/ngx-noder';

@NgModule({
    // ...
    provides: [CommandsService],
    // ...
})
export class SomeModule{}

Editor Toolbar

Import editor toolbar module, if you need toolbar for your editor. This module provides ready-made toolbar with buttons that covers all basic logic of the document content editing functionality.

import { EditorToolbarModule } from '@talrace/ngx-noder';

@NgModule({
    // ...
    imports: [EditorToolbarModule],
    // ...
})
export class SomeModule{}

Editor Header

Import standalone editor header component, if you need header for your editor. This component provides editor header component with buttons that contains basic functional with document and part of the document content editing functionality.

import { EditorHeaderComponent } from '@talrace/ngx-noder';

@NgModule({
    // ...
    imports: [EditorHeaderComponent],
    // ...
})
export class SomeModule{}

Editor Search

Import standalone editor search component, if you need custom search in your editor. This component provides custom search component and search and replace functionality in editor.

import { EditorSearchDialogComponent } from '@talrace/ngx-noder';

@NgModule({
    // ...
    imports: [EditorSearchDialogComponent],
    // ...
})
export class SomeModule{}

Editor Service

Provide Editor Service in your component with editor if you need to send commands to editor or gets some document status data. This service provides functionality of send data or commands to the editor and receive document state data or document interaction mode

import { EditorService } from '@talrace/ngx-noder';

@NgModule({
    // ...
    provides: [EditorService],
    // ...
})
export class SomeModule {}

Usage

Example of full-featured NgxNoder with toolbar, header, custom search and receiving commands from editor.

app.module.ts

import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { AppComponent } from './app.component';
import {
    EditorHeaderComponent,
    EditorModule,
    EditorSearchDialogComponent,
    EditorToolbarModule
} from '@talrace/ngx-noder';

@NgModule({
    declarations: [AppComponent],
    imports: [
        BrowserModule,
        EditorHeaderComponent,
        EditorModule,
        EditorSearchDialogComponent,
        EditorToolbarModule
    ],
    providers: [CommandsService],
    bootstrap: [AppComponent]
})
export class AppModule{}

app.component.html

<app-editor-header
    [title]="title"
    [isViewOnly]="isViewOnly$ | async"
    (openFileFromDisk)="onConvertFile($event)"
    (addCustomElement)="addCustomElement($event)"
    (insertPageBreak)="onInsertPageBreak()"
    (createDocument)="createDocument()"
    (changeMode)="onModeChanged($event.value)"
    (saveAs)="onSave()"
    (print)="onPrint()"
    (insertImage)="onInsertImage($event)"
    (renameDocumentTitle)="onRenameDocumentTitle($event)"></app-editor-header>
<app-editor-toolbar
    [isViewOnly]="isViewOnly$ | async"
    [styles]="styles$ | async"
    [historyInfo]="historyInfo$ | async"
    (changeParagraphStyle)="onSetParagraphStyle($event)"
    (changeTextStyle)="onSetTextStyle($event)"
    (setNumberingTemplateType)="onSetNumberingTemplateType($event)"
    (removeNumberings)="onRemoveNumberings()"
    (undo)="onUndo()"
    (redo)="onRedo()"></app-editor-toolbar>
<app-editor
    #editor
    [content]="content$ | async"></app-editor>

app.component.ts

import { Store } from '@ngxs/store';
import { BehaviorSubject, filter, Observable, Subscription, take, tap } from 'rxjs';
import {
    BreakTypes,
    CommandsService,
    DEFAULT_FILE_NAME,
    DocxModel,
    EditorComponent,
    EditorSearchDialogComponent,
    EditorService,
    ElementDataModel,
    Mode,
    NumberingLevelModel,
    RevisionHelper,
    TextStyleModel
} from '@talrace/ngx-noder';
import { Component, OnInit, ViewChild } from '@angular/core';

import { CreateOperation } from "../../store/operations/operations.actions";
import { NoderState } from '../../store/noder/noder.state';
import { ObserverComponent } from '../../../+shared/abstract/observer.component';

@Component({
    selector: 'app-root',
    templateUrl: './app.component.html',
    styleUrls: ['./app.component.scss']
})
export class AppComponent extends ObserverComponent implements OnInit {
    isViewOnly$: Observable<boolean>;

    documentId: number;

    get content$(): Observable<DocxModel> {
        return this._content$.asObservable();
    }
    private _content$ = new BehaviorSubject<DocxModel>(RevisionHelper.getEmptyDocxModel());

    @ViewChild('editor', { static: true }) editor: EditorComponent;

    constructor(
        private editorService: EditorService,
        private store: Store,
        private commandService: CommandsService
    ) {
        super();
        const mode: Mode = this.store.selectSnapshot(NoderState.mode);
        this.editorService.setIsViewOnly(mode !== Mode.Edit);
        this.isViewOnly$ = this.editorService.isViewOnly$;
    }

    ngOnInit() {
        this.subscriptions.push(
            this.createCommandSubscription()
        );
    }

    onPrint(): void {
        this.editor.printDocument();
    }

    onInsertPageBreak(): void {
        this.editorService.insertBreak(BreakTypes.Page);
    }

    onSetTextStyle(value: TextStyleModel): void {
        this.editorService.setTextStyles(value);
    }

    onSetNumberingTemplateType(value: NumberingLevelModel[]): void {
        this.editorService.setNumberingTemplateType(value);
    }

    addCustomElement(model: ElementDataModel): void {
        this.editorService.createCustomComponent(model);
    }

    onUndo(): void {
        this.editorService.undo();
    }

    private onOpenSearch(): void {
        this.dialog.open(EditorSearchDialogComponent, {
            position: { top: '0px', right: '0px' },
            hasBackdrop: false
        });
    }

    private createCommandSubscription(): Subscription {
        return this.commandService.createCommand$
            .pipe(
                filter(x => !!x),
                tap(command => {
                    this.store.dispatch(new CreateOperation(command));
                })
            )
            .subscribe()
    }
}

app.component.scss

// styles of your app component
:host {
    height: inherit;
    width: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}