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

froala-editor-paragraph-format-extended-plugin

v0.2.0

Published

A plugin for Froala Editor 3 that allows to choose paragraph format (tag name, class, etc.) from a list

Downloads

1,158

Readme

Froala Editor Paragraph Format Extended plugin

npm Supported Froala Editor versions Gzip size

A plugin for Froala WYSIWYG Editor v3 that allows to choose paragraph format (tag name, class, etc.) from a list. It is like a mixture of the paragraphFormat and the paragraphStyle plugins with some extended features.

If you need a plugin for Froala Editor v2, use version 0.1. It won't get new features.

Status

Build Status dependencies Status devDependencies Status peerDependencies Status

Installation

There are several ways to install the plugin:

Download the plugin script and import it using a <script> tag after the Froala Editor import.

<!-- Froala Editor required stuff -->
<link href="//cdn.jsdelivr.net/npm/[email protected]/css/froala_editor.css" rel="stylesheet" type="text/css" />
<link href="//cdn.jsdelivr.net/npm/[email protected]/css/froala_style.css" rel="stylesheet" type="text/css" />
<script src="//cdn.jsdelivr.net/npm/[email protected]/js/froala_editor.min.js"></script>

<!-- Paragraph Format Extended plugin -->
<script src="//cdn.jsdelivr.net/npm/[email protected]/dist/paragraph_format_extended.umd.min.js"></script>

The script requires the following AMD modules to be available:

  • froala-editor — the Froala Editor main script.

Installation:

require.config({
  paths: {
    'froala-editor': '//cdn.jsdelivr.net/npm/[email protected]/js/froala_editor.min',
    'froala-editor-paragraph-format-extended-plugin': '//cdn.jsdelivr.net/npm/[email protected]/dist/paragraph_format_extended.umd.min'
  }
});

define('myModule', ['froala-editor', 'froala-editor-paragraph-format-extended-plugin'], function (FroalaEditor) {
  // ...
});

You can find more information about installation of Froala Editor using AMD in the editor readme.

Install the plugin:

npm install froala-editor-paragraph-format-extended-plugin --save

Require it:

const FroalaEditor = require('froala-editor');
require('froala-editor-paragraph-format-extended-plugin');

Basic usage

Create an editor, add a paragraphFormatExtended button to the toolbar and set up the formats list:

<div id="editor"></div>
new FroalaEditor({
  toolbarButtons: [/* Other your buttons... */ 'paragraphFormatExtended'],
  paragraphFormatExtended: [
    {title: 'Normal'},
    {tag: 'h1', title: 'Heading 1'},
    {tag: 'h2', title: 'Heading 2'},
    {tag: 'h2', 'class': 'fr-text-bordered', title: 'Header 2 bordered'},
    {tag: 'pre', id: 'code', title: 'Code'}
  ]    
});

Reference

The name of the toolbar button of this plugin is paragraphFormatExtended.

When a paragraph format is changed by the user via the dropdown, the class and id attributes of the selected paragraphs are purged and replaced with the chosen format values even if they are not set.

Options

paragraphFormatExtended

Type: Array

Default value:

[
  {title: 'Normal'},
  {tag: 'h1', title: 'Heading 1'},
  {tag: 'h2', title: 'Heading 2'},
  {tag: 'h3', title: 'Heading 3'},
  {tag: 'h4', title: 'Heading 4'},
  {tag: 'h4', 'class': 'fr-text-bordered', title: 'Header 4 bordered'},
  {tag: 'pre', title: 'Code'}
]

A list with the formats that will appear in the Paragraph Format Extended dropdown from the toolbar. Array items are objects with the following attributes:

  • title (String, required) — Format title that is shown in the dropdown. It is translated by Froala Editor before displaying.
  • tag (String|Null) — Paragraph tag name. If null or nothing is provided the default editor tag is used.
  • class (String|Null) — Paragraph CSS class name. May contain multiple classes devided by space.
  • id (String|Null) — The value of paragraph id HTML attribute.

paragraphFormatExtendedSelection

Type: Boolean

Default value: false

Should the Paragraph Format Extended button from the toolbar be replaced with a dropdown showing the actual paragraph format name for the current text selection.

Building

The source code is located in the src directory. Do the following to modify and compile it:

  1. Install node.js version 8 or greater.
  2. Open a console, go to the project root directory and run npm install.
  3. Run npm run build to compile distribution files from the source files.

Testing

Build the source code, open the index.html file in a browser and test it manually.

Rebuild the source code and reload the browser page manually when you change the source code.

Versions compatibility

The project follows the Semantic Versioning.

License

This package is available under MIT License. However, in order to use Froala WYSIWYG HTML Editor plugin you should purchase a license for it.

See https://froala.com/wysiwyg-editor/pricing for licensing the Froala Editor.