How to use the @edtr-io/editor-ui.styled.span function in @edtr-io/editor-ui

To help you get started, we’ve selected a few @edtr-io/editor-ui examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github edtr-io / edtr-io / packages / plugins / text / src / plugins / link.tsx View on Github external
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)