FakeRainBrigandFrodik提出了一个问题:How to replace selected text with html in a contenteditable element? [duplicate],或许与您遇到的问题类似。
回答者CommunityJordan Arron给出了该问题的处理方式:
See here for working jsFiddle: http://jsfiddle.net/dKaJ3/2/
-------- ------------------ - --- ---- - --- -- ------- ------------------- -- ------------ - --- --- - ---------------------- -- ---------------- - --- --------- - ------------------------------ --- ---- - - -- --- - --------------- - - ---- ---- - --------------------------------------------------------- - ---- - -------------------- - - ---- -- ------- ------------------ -- ------------ - -- ------------------------ -- ------- - ---- - ------------------------------------------ - - ------------ -
Code taken from Tim Down: Return HTML from a user-selected text
希望本文对你有帮助,欢迎支持JavaScript中文网
来源:JavaScript中文网 ,转载请注明来源 本文地址:https://www.javascriptcn.com/post/15696