问题描述
我正在为我的新语言模式自定义codemirror。作为此新模式实现的一部分,我正在编写一个新的工具栏,用户可以在其中选择一些文本并说出插入。此命令应在用户单击工具栏之前在用户键入的位置插入文本。
I am working on customizing the codemirror for my new language mode. As part of this new mode implementation, I am writing a new tool bar where user can select some text and say insert. This command should insert the text where user was typing just before clicking on tool bar.
我找不到任何API级别的支持。
I could not find any API level support to do so. If there is any other way can someone help me out on this?
基本上可以得到当前光标的位置和当前光标所在的位置。可能是Position对象
Basically get the current cursor positio- line number and position at which cursor is currently present. May be a Position object
用于插入文本的API,例如 insertText( Text,PositionObject)
API for inserting a text, something like insertText("Text", PositionObject)
推荐答案
replaceSelection
()?
这篇关于在给定的光标位置插入新文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!