From de81e235a0dce267101ce11d80423f72302dff64 Mon Sep 17 00:00:00 2001 From: zamfofex Date: Fri, 6 Sep 2024 18:45:47 -0300 Subject: [PATCH] fix cursor issue in Firefox closes #111 closes #115 --- codejar.ts | 9 --------- 1 file changed, 9 deletions(-) diff --git a/codejar.ts b/codejar.ts index 0ca786d..9e9ef88 100644 --- a/codejar.ts +++ b/codejar.ts @@ -102,15 +102,6 @@ export function CodeJar(editor: HTMLElement, highlight: (e: HTMLElement, pos?: P let {anchorNode, anchorOffset, focusNode, focusOffset} = s if (!anchorNode || !focusNode) throw 'error1' - // If the anchor and focus are the editor element, return either a full - // highlight or a start/end cursor position depending on the selection - if (anchorNode === editor && focusNode === editor) { - pos.start = (anchorOffset > 0 && editor.textContent) ? editor.textContent.length : 0 - pos.end = (focusOffset > 0 && editor.textContent) ? editor.textContent.length : 0 - pos.dir = (focusOffset >= anchorOffset) ? '->' : '<-' - return pos - } - // Selection anchor and focus are expected to be text nodes, // so normalize them. if (anchorNode.nodeType === Node.ELEMENT_NODE) {