Как добавить пользовательскую кнопку для ссылки в draft.js - PullRequest
0 голосов
/ 30 апреля 2019

Я использую draft.js в панели администратора, как это

enter image description here

Теперь мне нужно добавить настраиваемую кнопку для тега, который имеет настроенную ссылкувот так:

 link = `RCAApp://PATH/${ANYKEY}`

Мой код такой:

 _toggleBlockType(blockType) {
const { visible } = this.state
const { editorState } = this.props;
const selection = editorState.getSelection();
const start = selection.getStartOffset();
const end = selection.getEndOffset();

if (blockType === 'LINK' && (end !== start)) {
  this.setState({
    visible: !visible,
  });
}
else if (blockType === 'LINK' && (end === start)) {
  notification.error({
    message: `Error`,
    description: `You need to select a word!`,
  });
}
this.onChange(
  RichUtils.toggleBlockType(
    editorState,
    blockType
  )
 );
}

Теперь я понятия не имею, как вставить свой настроенный href в сам текст html, документации было недостаточно для понимания.

...