Socket
Socket
Sign inDemoInstall

@weekwood/editorjs-hyperlink

Package Overview
Dependencies
0
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @weekwood/editorjs-hyperlink

Link with target & rel attribute for Editor.js


Version published
Maintainers
1
Created

Readme

Source

A tool link with target & rel attribute for Editor.js.

Screen Shot 2020-11-08 at 23 51 36

Screen Shot 2020-11-08 at 23 51 43

Screen Shot 2020-11-08 at 23 52 04

Installation

Get the package via NPM

npm i editorjs-hyperlink -D

or via Yarn

yarn add editorjs-hyperlink -D

Include module at your application

const Hyperlink = require('editorjs-hyperlink');

Usage

Add a new Tool to the tools property of the Editor.js initial config.

var editor = EditorJS({
  ...
  
  tools: {
    ...

    hyperlink: {
      class: Hyperlink,
      config: {
        shortcut: 'CMD+L',
        target: '_blank',
        rel: 'nofollow',
        availableTargets: ['_blank', '_self'],
        availableRels: ['author', 'noreferrer'],
        validate: false,
      }
    },

    ...
  },

  ...

  i18n: {
    toolNames: {
      Hyperlink: 'Link'
    },
    tools: {
      hyperlink: {
        Save: 'Salvar',
        'Select target': 'Seleziona destinazione',
        'Select rel': 'Wählen rel'
      }
    }
  }
  
  ...
});

Config Params (optional)

FieldTypeDescription
shortcutstringShortcut, defaults to 'CMD+L'
targetstringDefines a default target, defaults to null
relstringDefines a default rel, defaults to null
availableTargetsstring[]Available link targets, defaults to all targets.
If empty array is provided, the control will be hidden and the default value applied.
availableRelsstring[]Available link rels, defaults to all rels.
If empty array is provided, the control will be hidden and the default value applied.
validatebooleanDefines if an URL should be validated on saving

License

MIT

Keywords

FAQs

Last updated on 04 Jan 2023

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc