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

@edsdk/n1ed-react

v1.0.17

Published

React integration for N1ED editor

Downloads

1,030,210

Readme

TinyMCE + N1ED React component

Create and edit HTML content with a powerful visual page builder based on TinyMCE

Q: What can be better than TinyMCE?
A: The latest TinyMCE 6 + a free set of widgets, custom templates, modern UI, Flmngr file manager, ImgPen image editor, Bootstrap column editor, and visual configuration: N1ED.

N1ED screenshot

This module will help to integrate N1ED (bundled TinyMCE + all required free add-ons that power up it) into your React app.

Install

With npm installed, run

$ npm install --save @edsdk/n1ed-react

See full React + TinyMCE + N1ED installation manual for more.

Usage

Here is an example of the usage of TinyMCE + N1ED in your React component. This is a JS sample, see the links below for TypeScript and JavaScript GitHub sample projects.

In this example we use add N1ED and additionally (this is an optional) define a custom toolbar and create inside it a custom TinyMCE button in order to show how to work with basic TinyMCE features from N1ED.

import React from 'react';
import {N1ED} from '@edsdk/n1ed-react';


class YourReactComponent {

    handleEditorChange(content, editor) {
        console.log('Content was updated:', content);
    };
    
    render() {
        
        return <div>
            Edit the content:
            <N1ED
                apiKey="REACDFLT" // you will use your own key later
                initialValue="<p>N1ED react demo</p>"
                onEditorChange={this.handleEditorChange}

                init={{
                    height: 500,
                    toolbar: 'undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | outdent indent | myCustomToolbarButton',
                    setup: (editor) => {
                        // Just a sample of creating a custom button
                        // N1ED does not block this TinyMCE feature
                        // and also does not conflict with TinyMCE plugins
                        console.log("TinyMCE initialized");
                        editor.ui.registry.addButton('myCustomToolbarButton', {
                            text: 'My Custom Button',
                            onAction: () => alert('Custom button clicked!'),
                        });
                    },
                }}
            />
        </div>;
        
    }
    
}

Important note:: do NOT use TinyMCE as a controlled component (do NOT try to control the state of TinyMCE with a pair of initialValue/onEditorChange). TinyMCE supports only setting of initial value once and then notifies your code about its change using the onEditorChange callback. React TinyMCE implementation is a classic uncontrolled component.

All the attributes of <N1ED> element are described in official TinyMCE React docs.

The only difference is:

  • apiKey attribute here is related not to TinyMCE Cloud, but to N1ED cloud and is optional until you need to visually configure it or add some other add-on from N1ED Ecosystem.

  • You do not need to define plugins parameter with the N1ED value: it is already defined until you specify something another.

Examples

We have two examples of how to use the N1ED React component:

Technical details

@edsdk/n1ed-react uses @tinymce/tinymce-react module inside and delegates all calls to TinyMCE, except some special actions it does for initialization of correct environment related to connection with dynamic CDN (which makes possible configuring your N1ED+TinyMCE instance visually online using Dashboard).

TypeScript support

This module is written with TypeScript and can be used in both JS and TS projects. You do not need to install typings separately, they are built into the project.

License

This module is released under LGPL v3 and free to use in your projects. N1ED itself is also a free product.