2

我们正在使用 DraftJS 创建具有用户提及(draft-js-mention-plugin)和主题标签(draft-js-hashtag-plugin)功能的富文本帖子/评论。以下是代码示例。

<FieldContainer
  containerStyles={this.props.containerStyles}
  editorStyles={this.props.editorStyles}
  placeholderStyles={this.props.placeholderStyles}
  height={this.props.height}
  onClick={this.focus}
>
  <Editor
    editorState={this.props.editorState}
    onChange={this.onChange}
    plugins={this.plugins}
    placeholder={this.props.placeholder}
    ref={element => { this.editor = element;} }
    onfocus={this.props.handleFocus}
    onBlur={this.props.handleBlur}
    handleKeyCommand={this.handleKeyCommand}
    keyBindingFn={e => myKeyBindingFn(e, this.props.allowNewLine)}
    readOnly={this.props.readOnly}
    autoCapitalize={'none'}
    autoComplete={'off'}
    autoCorrect={'off'}
    spellCheck={false}
  />
</PostFieldContainer>

这在桌面网络浏览器中运行良好。现在我们也在尝试支持移动平台。我们在android chrome中面临以下两个问题:

  1. 每当我在一个单词后输入空格时,键盘就会关闭。

  2. 清除提及或标签会完全破坏我们的应用程序并出现以下错误

    Uncaught DOMException: Failed to execute 'removeChild' on 'Node': The node to be removed is not a child of this node

     at removeChild (https://192.168.1.9:3000/static/js/1.chunk.js:253583:22)
     at unmountHostComponents (https://192.168.1.9:3000/static/js/1.chunk.js:264847:13)
     at commitDeletion (https://192.168.1.9:3000/static/js/1.chunk.js:264915:9)
     at commitMutationEffects (https://192.168.1.9:3000/static/js/1.chunk.js:267143:15)
     .....
    

    上述错误发生在您的一个 React 组件中:

     in div (created by DraftEditorBlock)
     in DraftEditorBlock (created by DraftEditorContents)
     in div (created by DraftEditorContents)
     in div (created by DraftEditorContents)
     in DraftEditorContents (created by DraftEditor)
     in div (created by DraftEditor)
     in div (created by DraftEditor)
     in div (created by DraftEditor)
     in DraftEditor (created by PluginEditor)
     in PluginEditor (at PostField/index.js:363)
     ....
    

任何帮助或指导表示赞赏。使用 android chrome 和 google 键盘对其进行了测试。

4

0 回答 0