nhn / tui.editor

🍞📝 Markdown WYSIWYG Editor. GFM Standard + Chart & UML Extensible.
http://ui.toast.com/tui-editor
MIT License
17.13k stars 1.74k forks source link

Disable HTML in editor #3106

Open Guck1311 opened 1 year ago

Guck1311 commented 1 year ago

Hi,

I'm trying to find a suitable way to disable HTML tags in the markdown editor, so that if someone tries to type a tag like<div> Some Content </div>, it won't create a new div in the WYSIWYG view, but just the div as a string. I tried using a customHTMLRenderer like in the example below:

...
customHTMLRenderer: {   
  htmlBlock: (node) => {  
    let result = node.literal?.replaceAll("<", "\\<");  
    return {
      type: "text",
      content: result || ""
    }
  },
...

But when adding a <div> in the markdown editor, the WYSIWYG seems to get stuck before even typing the <div> out completely:

grafik

Is there another way to simply disable HTML tags and just show them as string in the WYSIWYG editor?

Thanks in advance, Marcel