Get and set cursor position with contenteditable div

前端 未结 4 1874
星月不相逢
星月不相逢 2020-12-25 13:58

I have a contenteditable div which I would like to be able to have users insert things such as links, images or YouTube videos. At the moment this is what I have:

4条回答
  •  北海茫月
    2020-12-25 14:26

    A good rich-text editor is one of the harder things to do currently, and is pretty much a project by itself (unfriendly API, huge number of corner cases, cross-browser differences, the list goes on). I would strongly advise you to try and find an existing solution.

    Some libraries that can be used include:

    • Quill (http://quilljs.com)
    • WYSGIHTML (http://wysihtml.com)
    • CodeMirror library (http://codemirror.net)

提交回复
热议问题