Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import isHotkey from 'is-hotkey'
import * as React from 'react'
import { Editor, Inline } from 'slate'
import { trimSelection } from '../helpers'
import { linkNode } from '../model'
import { InlineInput } from './inline-input'
import { InlineSettings } from './inline-settings'
import {
NodeControlsProps,
InlineEditorProps,
InlineRendererProps,
TextPlugin
} from '..'
const OpenInNewTab = styled.span({ margin: '0 0 0 10px' })
export const isLink = (editor: Editor) => {
return editor.value.inlines.some(inline =>
inline ? inline.type === linkNode : false
)
}
export const unwrapLink = (editor: Editor) => {
return editor.unwrapInline(linkNode)
}
export const wrapLink = (data: { href: string } = { href: '' }) => (
editor: Editor
) => {
if (editor.value.selection.isExpanded) {
trimSelection(editor)