contenido
Version:
Contenido is a library with a set of tools to help you create your own rich text editor on top of draft-js without thinking about how to handle things.
18 lines (12 loc) • 401 B
text/typescript
// Core
import { RichUtils } from '../../core';
// Custom Types
import type { State, StateHandler } from '../../types';
const removeLink = (state: State, stateHandler: StateHandler) => {
const selection = state.getSelection();
if (!selection.isCollapsed()) {
const stateToSet = RichUtils.toggleLink(state, selection, null);
stateHandler(stateToSet);
}
};
export default removeLink;