Append text to TextArea in the currentcursor position
来源:互联网 发布:ie href javascript 编辑:程序博客网 时间:2024/06/08 17:32
Append text to TextArea in the currentcursor position
I've a question, about howto append text to the TextArea, I need to create WYSIWYG texteditor which is created with ExtJs 4. Currently what I only can useis thewhich it'll replace all the value, and what I need is that,example: I click an icon it'll write the icon after the currentcursor position.TextArea.setValue("new value");
I've already googled about this issue and also found severalsolutions which is not working:
even only to get the cursor position, in:
http://www.sencha.com/forum/showthre...l=1#post451800
or, it is also fail:
http://www.sencha.com/forum/showthre...348#post593348
and also this one:
http://hutten.org/bill/extjs/2010/11...-in-a-tex.html
it keeps saying either:
component.selectionundefined
or even:
component.selection.createRange(); undefined
or
component.el.dom.createTextRange() is not afunction, (createTextRange)
I don't know why it is not working in mine, or is there a commonmistake which a person usually do?
insertAtCursor: function(v) { var document_id = this.getFocusEl().id;var text_field = document.getElementByIdx_x(document_id); var startPos = text_field.selectionStart; var endPos = text_field.selectionEnd; text_field.value = text_field.value.substring(0, startPos) + v +text_field.value.substring(endPos, text_field.value.length); this.el.focus(); text_field.setSelectionRange(endPos+v.length,endPos+v.length);}
- Append text to TextArea in the currentcursor position
- ...append HTML Text to a TWebbrowser Document?
- append HTML Text to a TWebbrowser Document?
- Edit Control: How to append text to an edit control?
- How to alignment the center position of the button in Android?
- Append new line of text to current sources.list file
- How to share text to Message in the app you are building(iOS platform)
- How to Change the Text in the Tabs of a CPropertySheet
- Section mismatch in reference from the variable to the function.devinit.text:spiadc_probe()的解决方法
- How to change the text color of the selected property sheet tab in Visual C++
- How To Append Content To File In Java
- 【LR】The Vuser Generator is unable to create a text check in this manner .To create a text check,swich to the Server Response vie
- 【CodeChef】Holes in the text
- Instructing the GSM/GPRS Modem or Mobile Phone to Operate in SMS Text Mode
- How to change the Text color of Menu item in Android?
- How to get the nearest parent node given a text node in jQuery?
- Csharp: speech to text, text to speech in win
- Csharp: speech to text, text to speech in win
- 在Linux中执行.sh脚本,异常/bin/s…
- Mysql增加用户
- php读取大文件详解
- Javascript实现sleep
- createTextRange()的使用总结
- Append text to TextArea in the currentcursor position
- PHP中调用外部程序,及其参数与返…
- JavaScript判断复选框是否被选中
- URAL 1118
- 程序员技术练级攻略(转)
- 程序员未来必备十项技能
- ExtJs下拉列表框
- android 应用层性能优化方案
- EXT怎么在弹出窗口显示一个下拉框?