Creating a handler for a link popup/modal
See original GitHub issueI’m using react-quill@1.0.0 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?
Issue Analytics
- State:
- Created 6 years ago
- Comments:7
Top Results From Across the Web
How to open the modal popup using a link, instead of button
As of right now, I have the code as a button to open the modal, and buttons are pre styles, I just want...
Read more >How to Make an External Link Pop-up Modal
The modals show additional content or opportunities -- both in context of your page's content or out of context depending on your usage...
Read more >4 Ways to Create a Modal Popup Box with HTML, CSS and ...
We declared a createCustomAlert() function. This is where we create the body of our modal, displayed on the page. Then we created a...
Read more >How to implement custom URL handler to access JS modal ...
What I would like to achieve, is to make the modal content accessible by url, so that external users can be directed to...
Read more >Popups and window methods
A popup can navigate (change URL) and send messages to the opener window. ... called outside of user-triggered event handlers like onclick ....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
http://quilljs.com/docs/modules/toolbar/#handlers
modules.toolbar, notmodules<ReactQuill />and callinggetEditor: https://github.com/zenoamaro/react-quill#methods@KiranVH Hi, look at my answer https://github.com/zenoamaro/react-quill/issues/471#issuecomment-579971349, maybe it will helpful for you