Closed INKGROUP closed 3 years ago
@INKGROUP When calling getHtml
of the editor in WYSIWYG mode, html is converted to markdown and then only valid markdown syntax is returned. Currently, you control DOM directly in the WYSIWYG editor, and it comes out as removed because it is a value that cannot be included in the markdown syntax. If you want to get the html set in the WYSIWYG editor as it is, you can call editor.getCurrentModeEditor().getValue()
.
const editor = new Editor({
el: document.querySelector('#editor'),
height: '500px',
initialEditType: 'wysiwyg'
});
let range = editor.getCurrentModeEditor().getRange();
let a = document.createElement('a');
a.innerText = 'foo';
a.href = 'url';
a.target = '_blank';
range.insertNode(a);
console.log(editor.getHtml()); // <a href="url" target="_blank">foo</a><br>
console.log(editor.getCurrentModeEditor().getValue()); // <a href="url" target="_blank">foo</a><br>
@INKGROUP But why do you manipulate DOM directly in WYSIWYG without using linkAttribute
? I hope you don't use the method and I recommend using linkAttribute
.
This issue has been automatically marked as inactive because there hasn’t been much going on it lately. It is going to be closed after 7 days. Thanks!
This issue will be closed due to inactivity. Thanks for your contribution!
Any thoughts on how to add an option, i.e. a dropdown for _blank
or _self
? Right now all I see is URL text and URL link.
We are using Toast UI in React
Summary
I want to set target property for link feature on demand. The editor supply a method to set, like this
but it's a global setup. How to set different target value for every link element.
Screenshots
If applicable, add screenshots to help explain your question.
Version
"@toast-ui/vue-editor": "^2.2.0",
Additional context
I added a checkbox for link feature