Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

draft-js-linkify-plugin

draft-js-plugins194.7kMITdeprecated2.0.2

use @draft-js-plugins/linkify >=v4 instead

Linkify Plugin for DraftJS

editor, wysiwyg, draft, react, ux, components, widget, react-component

readme

DraftJS Linkify Plugin

This is a plugin for the draft-js-plugins-editor.

This plugin turns hyperlinks in the text to highlighted, clickable anchor tags!

Usage

import createLinkifyPlugin from 'draft-js-linkify-plugin';

const linkifyPlugin = createLinkifyPlugin();

You may also optionally set the target value for the resulting <a> tag:

const linkifyPlugin = createLinkifyPlugin({
  target: '_blank'  // default is '_self'
});

Importing the default styles

The plugin ships with a default styling available at this location in the installed package: node_modules/draft-js-linkify-plugin/lib/plugin.css.

Webpack Usage

Webpack Usage

Follow the steps below to import the css file by using Webpack's style-loader and css-loader.

  1. Install Webpack loaders: npm install style-loader css-loader --save-dev
  2. Add the below section to Webpack config (if your Webpack already has loaders array, simply add the below loader object({test:foo, loaders:bar[]}) as an item in the array).

     module: {
       loaders: [{
         test: /\.css$/,
         loaders: [
           'style-loader', 'css'
         ]
       }]
     }
  3. Add the below import line to your component to tell Webpack to inject style to your component.

     import 'draft-js-linkify-plugin/lib/plugin.css';
  4. Restart Webpack.

changelog

Change Log

All notable changes to this project will be documented in this file. This project adheres to Semantic Versioning.

To Be Released

2.0.2

  • Allow draft-js v0.11
  • Remove unused dependencies

2.0.0

  • Added rel attribute
  • The plugin now accepts a component config and if provided this component will be rendered instead of the default Anchor tag. Thanks to @antoinerey.

1.0.1 - 2016-04-29

Fix

  • Linkify link email addresses or websites when they are placed inside parenthesis #244

1.0.0 - 2016-04-20

Changed

  • Moved to a flat configuration. Instead of plugin properties (decorators & hooks) being stored within pluginProps they now moved to the root object. See the changes here #150 as well as the initial discussion here #143
  • Moved the option theme from an Immutable Map to a JavaScript object. This is more likely to become a standard.

Added

  • Added the ability to set a target attribute through config.target. The default value is _self.

Fix

  • Utilize the linkify-it library to generate smart href values for the resulting component e.g. www.draft-js-plugins.com will result in http://www.draft-js-plugins.com.

0.0.3 - 2016-03-25

Released the first working version of DraftJS Linkify Plugin

It's not recommended to use the version 0.0.0 - 0.0.2