anchor-plugin not inserting an anchor-tag
See original GitHub issueI have added the anchor-plugin to my editor as documented. When I add a link, it appears to get added correctly to the editorState, however the generated html does not have the <a>
tag. What am I missing? My code is shown below:
const linkPlugin = createLinkPlugin();
const inlineToolbarPlugin = createInlineToolbarPlugin({
structure: [
BoldButton,
ItalicButton,
UnderlineButton,
CodeButton,
linkPlugin.LinkButton
]
});
const { InlineToolbar } = inlineToolbarPlugin;
const plugins = [inlineToolbarPlugin, linkPlugin];
export class TextEdit extends React.Component {
...
render() {
const { classes } = this.props;
return (
<div className={classes.editor}>
<Editor
editorState={this.state.editorState}
onChange={this.onChange}
onBlur={this.onBlur}
plugins={plugins}
ref={element => { this.editor = element; }}
/>
<InlineToolbar />
</div>
);
}
...
}
Issue Analytics
- State:
- Created 6 years ago
- Comments:11 (2 by maintainers)
Top Results From Across the Web
No ability to add anchor links? - WordPress.org
I am trying to create anchors to link within my website. This is usually done by adding text to the Advanced box in...
Read more >TinyMCE links plugin doesn't render anchor links in the content
I want the link to be showed as tag so it can be clickable. I have used link plugin commands like: tinymce.init({ selector:...
Read more >How to Create Anchor Links in WordPress (3 Easy Methods)
Highlight the header you want to link it up to. Then click on “Insert” from the button at the top and select “Anchor.”...
Read more >How to "Easily" Add Anchor Links in WordPress (Step by Step)
Creating an anchor link. First you need to select the text that you want to link and then click on the insert link...
Read more >Add Anchor Tags To Jump To Specific Location On A Page
With the Rich Text editor, you can place anchors in your posts. If you prefer to use HTML to code the anchor tags,...
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 FreeTop 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
Top GitHub Comments
I have finally been able to solve this!
TL;DR: I needed to initialize the editorState from props. If I do this in
componentDidMount()
, then the decorators are lost. However if I do this initialization in the constructor (where props are still available), everything works just fine.Old Code
New Code
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.