Questions tagged [rangy]

Rangy is a cross-browser JavaScript range and selection library.

Rangy is a cross-browser JavaScript range and selection library. It provides a simple standards-based API for performing common DOM Range and Selection tasks in all major browsers, abstracting away the wildly different implementations of this functionality between Internet Explorer up to and including version 8 and DOM-compliant browsers.

The project website is http://code.google.com/p/rangy/.

225 questions
0
votes
1 answer

Create and restore text selection

First: I am not entirely sure of the difference between ranges and selections. I want to: Highlight some text Click on a button and wrap a class around the selected text (I am able to do this using rangy, BUT rangy needs the text to be in a…
user1323136
  • 889
  • 2
  • 11
  • 20
0
votes
1 answer

Rangy commonAncestorContainer wrong when using anchor without href

I'm using Rangy in conjunction with AngularJS. Angular replaces href with ng-click, so calling a function becomes: Get Range Unfortunately, range.commonAncestorContainer is returning the node of the…
max
  • 617
  • 8
  • 20
0
votes
1 answer

rangy: detach() needs to be called?

I'm using the rangy library and reading the docs for detach: "Destroys the range when it is no longer to be used.". Currently there's no good place for me to call detach in my code for some ranges I create with cloneRange. Since it's an editor I'm…
Geert-Jan
  • 18,623
  • 16
  • 75
  • 137
0
votes
1 answer

Iris Colour Picker with Rangy Library - Maintaining Text Selection

I'm using Iris Colourpicker (http://automattic.github.io/Iris/) in my rich HTML editor to allow users to update the colour of text in a contenteditable paragraph. The problem is that after the first "change" event is called, I lose the selection,…
0
votes
1 answer

Rangy v13alpha.804 lacks CssClassApplier module?

thanks for Rangy! however, after severe testing (aaargg!) i discovered that rangy.modules.CssClassApplier returns false in .804, but returns true in previous version .772 .. What happened? Am i missing something? -roelof
Roelof Berkepeis
  • 165
  • 1
  • 12
0
votes
1 answer

Restore Text Selection from a Range

I have a range object created by Rangy in Javascript. Now i want to Restore the text from this Range object. E.g range= WrappedRange {nativeRange: Range, commonAncestorContainer: div.ng-scope, collapsed: false, endOffset: 19, endContainer:…
ravisuhag
  • 1,778
  • 1
  • 11
  • 16
0
votes
1 answer

elementProperties of Rangy doesn't work

I'm using Rangy 1.3 TextRange in order to find text in a div and wrap it with a span. I want to add more attributes to the span by adding the option elementProperties but the attributes aren't added at all. var applier =…
carmina
  • 307
  • 2
  • 10
0
votes
1 answer

How to initialise the module TextRange after Aloha-Editor initialised Rangy?

I'm using Aloha Editor for our WYSIWYG form. Since Aloha is using an old version of Rangy, and is initialised by Aloha, is there anyway I can initialise the module TextRange and CssClassApplier after? Also, updating Rangy-Core dependency of Aloha is…
carmina
  • 307
  • 2
  • 10
0
votes
0 answers

Set Rangy selection to an img

I'm trying to highlight an image when it's clicked in a contenteditable iframe. I've tried this but nothing happens: var iframeDoc = editor.contentDocument || editor.contentWindow.document; var range = rangy.createRange(iframeDoc); var sel =…
TimCodes.NET
  • 4,601
  • 1
  • 25
  • 36
0
votes
1 answer

Reported width of "auto" span is greater than actual, rendered width

I'm using rangy to create a highlight for a selection for text that has been rendered using pdf.js. The CSS for the highlighted span is very simple: .image-highlight { background-color: rgba(152, 210, 146, 0.45); border: 1px solid #000000;…
Vivin Paliath
  • 94,126
  • 40
  • 223
  • 295
0
votes
1 answer

jquery rangy get char position of selected text

I am trying to get the char position/ char count of where the selected text occurs in the doc. for example i am doing var selectedText = rangy.getSelection().getRangeAt(0); I need to figure how where in the document this is by char count and save…
randy
  • 1,685
  • 3
  • 34
  • 74
0
votes
3 answers

Using Jquery to end an element

I have the following code using rangy, which allows users to apply a class to selected text:
This is some text that users can select
When a user selects text and applies a class the code turns into:
This is some…
RyanY
  • 635
  • 1
  • 8
  • 20
0
votes
1 answer

Rangy - insertNode IE < 9 doesn't insert at caret

I am using Rangy for compatibility to insert a node within a WYSIWYG editor (uEditor). It works, however in IE < 9 the inserted node is placed at the beginning of the containing element (iframe) instead of at the caret position. This only happens…
Craig Stewart
  • 1,461
  • 2
  • 13
  • 18
0
votes
0 answers

Get Pixel Position of Start and End of User Selection without losing Selection

I'm working on a javascript library that gets the position, in pixels, of the user selection (the content they highlighted). To pull this off, I add invisible markers to the DOM and use jQuery .position to get the pixel location. These DOM changes…
Colin
  • 2,814
  • 5
  • 27
  • 37
0
votes
0 answers

Why does a span of 'display: none' prevent deletion of a preceding, 'contententeditable = false' span?

This behaviour is specific to Chrome (at time of writing version 26.0.1410.64 m but I know it's been happening for a while). Take the following HTML:
Holf
  • 5,605
  • 3
  • 42
  • 63