GithubHelp home page GithubHelp logo

dldevinc / editorjs-hyperlink Goto Github PK

View Code? Open in Web Editor NEW

This project forked from wesauis/editorjs-hyperlink

1.0 0.0 1.0 545 KB

Link with target & rel attribute for Editor.js

CSS 6.95% JavaScript 87.04% HTML 6.02%

editorjs-hyperlink's Introduction

Hyperlink Tool

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 -D git+ssh://[email protected]:dldevinc/editorjs-hyperlink.git#bdaf684

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)

Field Type Description
className string Defines a class attribute, defaults to null
shortcut string Shortcut, defaults to 'CMD+L'
target string Defines a default target, defaults to null
rel string or string[] Defines a default rel, defaults to null
availableTargets string[] Available link targets, defaults to all targets.
If empty array is provided, the control will be hidden and the default value applied.
availableRels string[] Available link rels, defaults to all rels.
If empty array is provided, the control will be hidden and the default value applied.
validate boolean Defines if an URL should be validated on saving
configure function Function that accepts URL and returns attributes object with optional fields: {href:"https://...",target:"_blank",rels:{nofollow: true}}

License

MIT

editorjs-hyperlink's People

Contributors

trinhtam avatar pix666 avatar mykhailo-monchak avatar tarik02 avatar robindev avatar wesauis avatar

Stargazers

Egemen Berker Kızılcan avatar

Forkers

hyleeh

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.