0

我正在尝试使用 draft-js-linkify-plugin创建一个简单的富文本编辑器。我要求在编辑内容时链接应该是可点击的。

有什么办法吗?

4

1 回答 1

0

您想要的是所见即所得的编辑器类型功能。您可以在 DraftJS 上使用只读模式。它会将您的文本转换为相应的 html,并且不可编辑。基本上它就像预览模式一样工作。您将需要同一组件的两个实例才能使其工作。 isReadOnly在预览模式下为真,在编辑模式下isReadOnly 为假

像这样:

<Editor editorState={this.state.editorState}
                        placeholder={placeholderLabel}
                        handleKeyCommand={this.handleKeyCommand}
                        keyBindingFn={this.keyBindingFunction}
                        onChange={this.onChange}
                        readOnly={isReadOnly}
                        onEscape={this.onEscape}
                        plugins={this.state.plugins}
                        ref={this.editorRef}/>
于 2018-03-19T08:31:32.860 回答