google docs textcursor

杀马特。学长 韩版系。学妹 提交于 2019-12-06 06:54:34

问题


I need to create an application which is similar to google docs. I have seen that google docs doesn't use any textarea but regular divs to create pages. But what I don't know is how they manage to get a text cursor. Is it an image blinking? cause I didn't see any image when i tried to see the webpage code with chrome developer tools. How do they do it?


回答1:


Google Docs uses unique editing method. There is no text ares with contentEditable on, but everything is rendered using DOM. It listens for keystrokes and manipulates DIVs.

Cursor is just absolute positioned DIV which is programatically hidden or shown. Search for class named "kix-cursor-caret".

Editor is codenamed Kix and you can see it's source codes here: https://github.com/benjamn/kix-standalone



来源:https://stackoverflow.com/questions/7877225/google-docs-textcursor

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!