[英]How to get the current cursor position in Sharepoint Inputformtextbox control's RTE window?
我已经使用Sharepoint InputformTextBox控件创建了一个自定义Web部件,以输入RichText项目。
我必须在InputformTextBox控件的RichTextEditor窗口中的光标位置插入图像。
我有一个图像按钮,单击它,我试图将图像插入RTE窗口中的光标位置。但是我无法获得当前的光标位置。
这是代码,
受保护的无效btnimgnew_Click(对象发送者,ImageClickEventArgs e){
字符串newImage =“”; txtcontent.Text = txtcontent.Text.Insert(indexPosition,newImage.ToString()); }
如何在InputformTextBox控件的RichTextEditor窗口中获取光标位置?
谢谢。
当前光标位置是javascript。
var rng = RTE.Cursor.get_range().$3_0;
上面将选择所选文本的范围。 这将在该范围之后插入一些内容(在这种情况下,是变量a定义的“内容”):
SP.UI.UIUtility.insertAfter(a, rng);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.