2.0.1 • Published 11 months ago

grapesjs-typed v2.0.1

Weekly downloads
352
License
MIT
Repository
github
Last release
11 months ago

GrapesJS Typed

GrapesJS Typed component made by wrapping Typed.js library

DEMO

Screenshot

Summary

  • Plugin name: grapesjs-typed
  • Components

    • typed - Main component
    PropDescriptionDefault
    stringsStrings to be typed[]
    type-speedType speed in milliseconds0
    start-delayTime before typing starts in milliseconds0
    back-speedBackspacing speed in milliseconds0
    smart-backspaceOnly backspace what doesn't match the previous stringtrue
    back-delayTime before backspacing in milliseconds700
    fade-outFade out instead of backspacefalse
    fade-out-classCSS class for fade animationtyped-fade-out
    fade-out-delayFade out delay in milliseconds500
    show-cursorShow cursortrue
    cursor-charCharacter for cursor\|
    auto-insert-cssInsert CSS for cursor and fadeOut into HTML <head>true
    bind-input-focus-eventsBind to focus and blur if el is text inputfalse
    content-type'html' or 'null' for plaintexthtml
    loopLoop stringsfalse
    loop-countAmount of loopsInfinity
    shuffleShuffle the stringsfalse
  • Blocks

    • typed - Main block
  • Traits
    • typed-strings - Textarea input to handle strings (one string per row)

Options

OptionDescriptionDefault
scriptLibrary to load asynchronously in case Typed is not foundCDN
blockObject to extend the default block eg. { label: 'Typed', ... }Pass a falsy value to avoid adding the block{}
propsCustomize component's props. The final object should be returned from the functionprops => props

Download

  • CDN
    • https://unpkg.com/grapesjs-typed
  • NPM
    • npm i grapesjs-typed
  • GIT
    • git clone https://github.com/artf/grapesjs-typed.git

Usage

Directly in the browser

<link href="https://unpkg.com/grapesjs/dist/css/grapes.min.css" rel="stylesheet"/>
<script src="https://unpkg.com/grapesjs"></script>
<script src="path/to/grapesjs-typed.min.js"></script>

<div id="gjs"></div>

<script type="text/javascript">
  const editor = grapesjs.init({
      container: '#gjs',
      // ...
      plugins: ['grapesjs-typed'],
      pluginsOpts: {
        'grapesjs-typed': { /* options */ }
      }
  });
</script>

Modern javascript

import grapesjs from 'grapesjs';
import plugin from 'grapesjs-typed';
import 'grapesjs/dist/css/grapes.min.css';

const editor = grapesjs.init({
  container : '#gjs',
  // ...
  plugins: [plugin],
  pluginsOpts: {
    [plugin]: { /* options */ }
  }
  // or
  plugins: [
    editor => plugin(editor, { /* options */ }),
  ],
});

Development

Clone the repository

$ git clone https://github.com/artf/grapesjs-typed.git
$ cd grapesjs-typed

Install dependencies

$ npm i

Start the dev server

$ npm start

Build the source

$ npm run build

License

MIT