Comments (7)
I did a little spin off project reworking a bit the restore selection algorithm to use setBaseAndExtent
and I think it works now: https://codepen.io/aziis98/pen/vYOMvex
from codejar.
Thanks! Alright, I will work on that in the following days.
from codejar.
setBaseAndExtent
won't work as it doesn't work with char offsets. Will try to fix other side.
from codejar.
I've tryed:
var endRange = r.cloneRange();
endRange.collapse(false);
s.removeAllRanges();
s.addRange(endRange);
s.extend(r.startContainer, r.startOffset);
But no success.
from codejar.
Here is the snippet for detecting direction:
function isSelectionBackward(sel: Selection) {
var backward = false;
if (!sel.isCollapsed) {
var range = document.createRange();
range.setStart(sel.anchorNode!, sel.anchorOffset);
range.setEnd(sel.focusNode!, sel.focusOffset);
backward = range.collapsed;
}
return backward;
}
from codejar.
This is awesome! Maybe PR to CodeJar?
from codejar.
Fixed!
from codejar.
Related Issues (20)
- missing line numbers HOT 8
- Conflict with ibus IME if highlighting is enabled HOT 8
- HTML tag Bug
- Uncaught SyntaxError: ambiguous indirect export: CodeJar HOT 1
- demo.html won't render HOT 1
- Allow keyboard navigation when capturing tab HOT 1
- cursor hides behind linenumbers HOT 2
- Cursor jumps to end of editor when deleting certain text nodes in Firefox HOT 1
- Typescript incompatible with latest Rollup plugins
- Unexpected token 'export'
- LineNumbers not working in typescript?
- The `getSelection()` function throws an exception if `editor.parentNode` is a `ShadowRoot`. HOT 2
- Document Issue: `Prism.highlightElement` should not be directly used as highlighting function HOT 1
- Strg+A Strg+C copies only subselection in Firefox (when plaintext-only is not supported) HOT 5
- README image has uses `new CodeJar` instead of just `CodeJar`
- Self closing characters logic HOT 4
- Is there any way to configure text wrapping? HOT 1
- [BUG] Cut text & undo not working
- [Feature Request] Multiline Indentation with Tab Key HOT 6
- Typescript source files in bundled package HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from codejar.