Skip to content

Instantly share code, notes, and snippets.

View fedorovsky's full-sized avatar
🎯
Focusing

Anton Fedorovskyi fedorovsky

🎯
Focusing
  • Plarium
  • Ukraine
View GitHub Profile
@fedorovsky
fedorovsky / linkify-plugin.js
Created June 9, 2020 10:26 — forked from bengotow/linkify-plugin.js
A Linkify plugin for DraftJS that creates / syncs entities on the fly
import React from 'react';
import { RichUtils, Modifier, EditorState, SelectionState } from 'draft-js';
function isURL(text) {
return text.startsWith('http://'); // insert your favorite library here
}
/*
Function you can call from your toolbar or "link button" to manually linkify
the selected text with an "explicit" flag that prevents autolinking from
changing the URL if the user changes the link text.