-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=4680590
By: rathnavadivel
On clicking of a button, I am trying to insert an image into a FCK Editor (at the cursor position) from a Tree. I am using the Javascript function:
FCKeditorAPI.GetInstance('myFCK!ed').InsertHtml to do this.
This works fine provided i click on the tree item first, then click on FCK editor and finally click the button.
But if i click on the FCK first, followed by clicking on tree and then button, the cursor position is lost and the image is inserted at the starting of the text.
Is there a way to get this to work in whatever order the user clicks. Is there an API to get the current cursor position?
Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=4682152
By: jumperchen
Hi,
I try to resolve this question, but the question is limited in Fckeditor implementation, we cannot get the last cursor position by the input element.
(really fckeditor doesn't use the input element as editable box)
Maybe you can invoke the FCKeditorAPI.GetInstance('myFCK!ed').Focus() method first.
However, the 'Focus' method is not reliable between FF and IE.
BTW, you can also post this question to Fckeditor's forum about how to get the last cursor position from the editable box when the focus target was changed.
/Jumper
Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=4682242
By: tomyeh
Test codes:
<zk>
<window title="tree demo" border="normal"> <tree id="tree" width="90%" rows="5">
<treecols sizable="true">
<treecol label="Name"/>
<treecol label="Description"/>
</treecols>
<treechildren>
<treeitem>
<treerow>
<treecell label="Item 1"/>
<treecell label="Item 1 description"/>
</treerow>
</treeitem>
<treeitem>
<treerow>
<treecell label="Item 2"/>
<treecell label="Item 2 description"/>
</treerow>
<treechildren>
<treeitem>
<treerow>
<treecell label="Item 2.1"/>
</treerow>
<treechildren>
<treeitem>
<treerow>
<treecell label="Item 2.1.1"/>
</treerow>
</treeitem>
<treeitem>
<treerow>
<treecell label="Item 2.1.2"/>
</treerow>
</treeitem>
</treechildren>
</treeitem>
<treeitem>
<treerow>
<treecell label="Item 2.2"/>
<treecell label="Item 2.2 is something who cares"/>
</treerow>
</treeitem>
</treechildren>
</treeitem>
<treeitem label="Item 3"/>
</treechildren>
</tree>
<fckeditor id="fck"/>
<button label="inster" action="onclick:insert(#{fck})"/> </window> <script type="text/javascript"><![CDATA[ function insert (fck) { var editor = FCKeditorAPI.GetInstance(fck.id + "!ed"); editor.Focus(); editor.InsertHtml("TEST"); } ]]></script> </zk>
Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=4682266
By: tomyeh
Hi Rathna,
>From our observation, the problem only happens to IE and it works fine
>with
FF, right?
Anyway, we will give FCK editor 2.5 a try.
Cheers,
Tom
Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=4682562
By: tomyeh
It is the same with FCKeditor 2.5. The cause it how a browser handles selection among iframes.
FCKeditor uses iframe to embed the text area. In IE, a mouse click will cause the selection of iframe (i.e., the text area) to disappear. On the other hand, FF will keep the selection for each individual iframe.
For example, you can try the following example.
<iframe src="http://www.google.com" width="95%"/>
Select a piece of text in the google page, and then click anywhere outside the iframe.
Thus, the only way I can figure now is to remember the current selection when onblur or onselectionchange. For example,
<script type="text/javascript"><![CDATA[ function fckOnSelectionChange(fed) {
zk.debug(fed.EditorDocument);
}
function FCKed_OnComplete(fed) {
fed.Events.AttachEvent("OnSelectionChange", fckOnSelectionChange) ; } ]]></script>
However, the above codes work only with ZK FCKeditor 2.5.0_1 (just released a moment ago)
Asked: 2007-12-18 09:43:38 +0800
Seen: 2,615 times
Last updated: Dec 19 '07