在 contenteditable 元素中自定义文本光标
是否可以在 contenteditable="true"
div
标记中自定义闪烁文本光标?
比如获取光标位置并在其上放置自定义光标,或者任何其他技巧?
Is it possible to customize blinking text cursor in a contenteditable="true"
div
tag?
Something like getting cursor position and putting a custom cursor on it, or any other trick?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
必须绘制自己的光标(例如,Google Docs 就是这样做的)。这样做是一项艰巨的任务,我不会推荐这样做。
Not without drawing your own cursor (which is what Google Docs does, for example). Doing this is a major undertaking to get right and I wouldn't recommend it.
我同意 Tim 的观点,我也不会推荐它。
但是,这里是一个示例页面,其中包含在
我相信这是
自定义插入符
最基本的实现。祝您在
contenteditable
中实现这一点好运。我当然希望这不会是您的下一个问题 (:p)!I agree with Tim, I wouldn't recommend it either.
However, here is a sample page with a
custom caret
used in a<textarea>
.. Just to give you an idea of how you can achieve this.I beleive this is the most basic implementation of a
custom caret
.Good luck implementing this in a
contenteditable
.. And I certainly hope this won't be your next question (:p) !