Skip to content

Commit

Permalink
Restored support for Zoho
Browse files Browse the repository at this point in the history
Zoho has unified cursors and selections.

Fixes #173.
  • Loading branch information
1ec5 committed Jun 12, 2016
1 parent b876905 commit eacab28
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions content/editors/zwrite.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/* global _avim_applyKey, _avim_evtInfo, _avim_textChanged:true, Selection, Op, editor, NODE_TYPE */
/* global _avim_applyKey, _avim_evtInfo, _avim_textChanged:true, Op, editor, NODE_TYPE */
(function () {
"use strict";

let cursor = editor.doc.cursor;
let cursor = editor.doc.cursor || editor.doc.getSelection();
if (!cursor || !cursor.isCollapsed()) return;

//* One-based
Expand All @@ -23,7 +23,7 @@ let [newWord, changed] = JSON.parse(_avim_applyKey(word, {
if (newWord && newWord !== word) {
//dump(">>> zwrite.js -- Replacing <" + word + "> with <" + newWord + ">\n"); // debug

Selection.deleteContents(selectionStart, selectionEnd);
cursor.deleteContents(selectionStart, selectionEnd);
cursor.insert(editor.doc.createElement(NODE_TYPE.TEXT, newWord), {});
Op.sendMsg();
}
Expand Down

0 comments on commit eacab28

Please sign in to comment.