r1515 - branches/bxe_2_0/js
[email protected] Wed, 27 Sep 2006 15:15:36 +0200 (CEST)
| Newsgroups | gmane.editors.bitflux.cvs |
|---|---|
| Message-ID | <[email protected]> |
Author: chregu
Date: Wed Sep 27 15:15:34 2006
New Revision: 1515
Modified:
branches/bxe_2_0/js/bxeFunctions.js
Log:
add helper functions for remembering cursor positions
Modified: branches/bxe_2_0/js/bxeFunctions.js
==============================================================================
--- branches/bxe_2_0/js/bxeFunctions.js (original)
+++ branches/bxe_2_0/js/bxeFunctions.js Wed Sep 27 15:15:34 2006
@@ -2576,4 +2576,34 @@
return true;
+}
+var bxe_lastCursorPositionAnchorNode = null;
+var bxe_lastCursorPositionAnchorOffset = null;
+var bxe_lastCursorPositionFocusNode = null;
+var bxe_lastCursorPositionFocusOffset = null;
+
+
+function bxe_cursorPositionSave() {
+
+ var sel = window.getSelection();
+
+ bxe_lastCursorPositionAnchorNode = sel.anchorNode;
+ bxe_lastCursorPositionAnchorOffset = sel.anchorOffset;
+ if (sel.isCollapsed) {
+ bxe_lastCursorPositionFocusNode = null;
+ bxe_lastCursorPositionFocusOffset = null;
+ } else {
+ bxe_lastCursorPositionFocusNode = sel.focusNode;
+ bxe_lastCursorPositionFocusOffset = sel.focusOffset;;
+ }
+
+}
+
+function bxe_cursorPositionLoad() {
+ var sel = window.getSelection();
+ sel.collapse(bxe_lastCursorPositionAnchorNode, bxe_lastCursorPositionAnchorOffset);
+
+ if (bxe_lastCursorPositionFocusNode) {
+ sel.extend(bxe_lastCursorPositionFocusNode, bxe_lastCursorPositionFocusOffset);
+ }
}
\ No newline at end of file
--
Bx-editor-cvs mailing list
[email protected]
http://lists.bitflux.ch/cgi-bin/listinfo/bx-editor-cvs