-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Hi,
I am using ZK 5.0.7 version . I have a problem with codeMirror in InternetExplorer and Firefox.
I tried to add code from Listbox to codemirror textarea by using onDoubleClick on Listbox. My problem is....
with Explorer : When i click listItem on listbox, value from listbox is always added at begining of the total entered code. Because cursor is always placed at the begining position of theTextarea.
with Mozilla : At the first attempt of clicking listitem in listbox, value is added and then cursor is going to start position of Textarea.
Code is working fine on google Chrome browser.
MY CODE:
javascript function: function addStringContent(strContent) { zk.Widget.$(jq('$codeMirror'))._editor.replaceSelection(strContent+" ")${cursor}; } ZUL file code: <listbox id="listbox" mold="default" height="100%" w:onDoubleClick="addStringContent(this.getSelectedItem().getLabel())" ></listbox> <codemirror id="codeMirror" syntax="js" ></codemirror>
Please send me any suggestions to solve my issues on these browsers....
Thanks & Regards,
Siva Kumar
Hi Siva,
I don't familiar with CodeMirror. However, I tried with the following javascript code and it works fine in IE, Firefox and Chrome.
function addStringContent(strContent) { zk.Widget.$(jq('$codeMirror'))._editor.insertIntoLine(0, "end", strContent+" ")${cursor}; }
Hi vincentjian,
Thanks for giving me your valuable suggestion.......
I tried your code. But it is not working fine. It takes position of cursor always at the end. Before set the value into codeMirror, i set the cursor position by mouse click. But it takes end position of the line.
And also it is not working for replacing the selected text, what i want to replace in codeMirror.
MAIN PROBLEM: I got the problem in this . CodeMirror doesnot store the cursor position in history. It stores correctly , only when value entered through keyboard or mouse in manually . This problem is mainly in IE Browser
Thanks & Regards,
Siva Kumar
Hi,
Can any one say about , how to set the cursor position dynamically by any method in codemirror using javaScript code.
Thanks & Regards,
Siva Kumar
Asked: 2011-10-31 11:34:59 +0800
Seen: 242 times
Last updated: Nov 01 '11