@slate-editor/link-plugin

    5.1.0 • Public • Published
    Nossas Cidades logo

    @slate-editor/link-plugin

    SlateJS link plugin.

    npm package npm downloads

    Installation

    The @slate-editor/link-plugin is available as an npm package.

    yarn add @slate-editor/link-plugin
    

    Usage

    Here is a quick example to get you started:

    import React from 'react'
    import { SlateEditor, SlateToolbar, SlateContent } from 'slate-editor'
    import { LinkPlugin, LinkButton } from '@slate-editor/link-plugin'
    
    const plugins = [
      LinkPlugin()
    ]
    
    const SlateRichTextEditor = () => (
      <SlateEditor plugins={plugins}>
        <SlateToolbar>
          <LinkButton />
        </SlateToolbar>
    
        <SlateContent />
      </SlateEditor>
    )
    
    export default SlateRichTextEditor

    Keyboard Shortcut

    OS Shortcut
    Apple Logo + k
    Windows Logo ^ + k

    API

    Name Description
    LinkNode Component that holds the html that will wrap the content with link.
    LinkKeyboardShortcut Keyboard shortcut file that manipulates onKeyDown event inside SlateJS.
    LinkUtils Generic file that holds the util common functions.
    LinkButton Button component that have behaviour to wrap content with link.

    TODO

    • Make keyboard shortcut accepts customization;
    • Add behaviour to catch onPaste command and identify if it is an url and ask if wants to link it;

    Install

    npm i @slate-editor/link-plugin

    DownloadsWeekly Downloads

    882

    Version

    5.1.0

    License

    MIT

    Unpacked Size

    26.9 kB

    Total Files

    12

    Last publish

    Collaborators

    • rolivegab
    • lpirola
    • igrsantos
    • alalbux
    • nossas