I'm using [email protected] in my React component, and would like to customize the "link" button so that it displays a popup/modal in which the user can paste the link and the link text.
So far this is what I've got:
var TextEditor = React.createClass({
getInitialState: function () {
return {
text: this.props.initialData
}
},
onTextChange: function (value) {
this.setState({ text: value });
},
modules: {
handlers: {
// handlers object will be merged with default handlers object
'link': function(value) {
if (value) {
var href = prompt('Enter the URL');
this.quill.format('link', href);
} else {
this.quill.format('link', false);
}
}
}
},
formats: [
'header',
'bold', 'italic', 'underline', 'strike', 'blockquote',
'list', 'bullet', 'indent',
'link',
],
render: function () {
return (
<ReactQuill theme="snow"
value={this.state.text}
onChange={this.onTextChange}
modules={this.modules}
formats={this.formats} />
)
}
});
export default TextEditor;
The error message I'm getting is that it can't find the "handlers" module. Any ideas anyone on how to get this working?
I'm running into the same issue attempting to use the handlers property as it is documented
http://quilljs.com/docs/modules/toolbar/#handlers
modules.toolbar, not modules<ReactQuill /> and calling getEditor: https://github.com/zenoamaro/react-quill#methodsThis was helpful https://github.com/zenoamaro/react-quill/issues/131
this works for adding link but how do I get the same behavior for edit link?
afsafsafsaf
Hi I want to create popup on button click in the toolbar which allows user to do search. Does anyone know how to implement in Quill editor
@KiranVH Hi, look at my answer https://github.com/zenoamaro/react-quill/issues/471#issuecomment-579971349, maybe it will helpful for you
Most helpful comment
http://quilljs.com/docs/modules/toolbar/#handlers
modules.toolbar, notmodules<ReactQuill />and callinggetEditor: https://github.com/zenoamaro/react-quill#methods