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
3
votes
0 answers

JavaScript - Split Parent of Selection

Using JavaScript (and potentially Rangy) I am trying to create a utility function that will allow me to "split" an element based on the selection and a selector that I pass in. For instance, let's say we had the following:
William
  • 3,335
  • 9
  • 42
  • 74
3
votes
0 answers

TextAngular and Rangy classes and ids

For this text something something something new line new line new line textAngular generates the following html:

something something something
new line new line new line

But if I select text from both rows and apply something on…
Robert Sandu
  • 673
  • 1
  • 6
  • 15
3
votes
2 answers

Discontiguous selection is not supported

I am trying bootstrap-wysihtml5-rails, I am using twitter bootstrap 2 but when I get this result as in the image, and the error: Discontiguous selection is not supported. I tried to window['rangy'].initialized = false; like this:
simo
  • 23,342
  • 38
  • 121
  • 218
3
votes
3 answers

How can I best make an inline span draggable within a paragraph of text?

I have a paragraph of text in which the user may place a "pin" to mark a position. Once a pin has been placed, I would like to allow the user to move its position by dragging it to a new location in the paragraph. This is simple to do with block…
3
votes
1 answer

How can I select a text node using Rangy?

I have a regular text node that I just inserted into the DOM. I'd like to select it (same as if the user physically selected it with his mouse), either with Javascript or Rangy. I have the following (and I think pretty ugly) code: // insert…
nkkollaw
  • 1,947
  • 1
  • 19
  • 29
3
votes
1 answer

Get selection's offset relative to certain parent node

I would like to be able to find out the position (also known as: offset, index) of the user's selection of text (highlighted) within a web page, relative to a particular parent node. I have been using Rangy to try to help me out, but it doesn't seem…
Doug
  • 5,116
  • 10
  • 33
  • 42
3
votes
1 answer

Javascript: Getting and saving text selection ranges in a database

I'm building a gramma-checker system for a client, where users can add comments/suggestions to a given text. When a user selects some text, a button appear to create a comment/suggestion to that given text selection. My problem comes when I want to…
TheNish
  • 330
  • 3
  • 15
3
votes
0 answers

Inconsistent DOM structure of the loaded HTML page in webview

I am making Highlighter for Android in WebView. For the highlighting purpose, in one example i am using JQuery and Rangy, in another pure Javascript and XPath. I am trying the same Highlight in Desktop Browsers also. Please refer to the previous…
Neernay
  • 379
  • 1
  • 4
  • 13
3
votes
1 answer

rangy deserialize not working on webview android

I am trying to make "Highlighter" for epub reader in one my Android project using webview. I am using Rangy for getting Selected text. The serialize functions gives me this value after selecting text from the below sample…
Neernay
  • 379
  • 1
  • 4
  • 13
3
votes
0 answers

Rangy: Adding multiple highlights for the same piece of text

I am using Rangy to do some text highlighting. The user selects a bit of text, clicks a button, and the text is highlighted using the Rangy highlighter module. I am also allowing the user to search for pieces of text, search results are again…
musefan
  • 47,875
  • 21
  • 135
  • 185
3
votes
2 answers

Rangy Error: deserializeRange: checksums of serialized range root node do not match after page load

I am saving the selection through rangy on my dynamic web page. But when I reload the page and restore the selections, I get the following error: Error: deserializeRange: checksums of serialized range root node (f3909155) and target root node…
Arvind Bhardwaj
  • 5,231
  • 5
  • 35
  • 49
3
votes
1 answer

Split HTML Tags when applying custom styling

When you are using a WYSIWYG editor, and you select text and apply, for example, bold to it, the browser will wrap the selection with a tag (assuming you've called document.execCommand("useCSS", false) and/or…
Thomas Jones
  • 4,892
  • 26
  • 34
3
votes
1 answer

Rangy SurroundContents Replacement

I'm looking at implementing a simple 2 button toggle on a webpage to switch some selected text between having a H1 heading and H2. The surroundContents method works great, however I'm encountering a problem when trying to replace an existing parent…
Vault
  • 31
  • 2
3
votes
1 answer

simulate the cursor keys (left,right,down,up arrows) in a content editable div?

Is it possible to simulate the arrow keys on a content editable div? I tried to fire "key press" events but it seems that contenteditable ignores them. (I just need a webkit/safari solution) I just need to move the caret inside the div like the…
2
votes
1 answer

Rangy - Module 'WrappedSelection' Not Supported

I am trying to use Rangy in my Google Chrome extension, but I keep on receiving the error "Module 'WrappedSelection' not supported". This is a bare-bones extension so I have not implemented any code in this project other then Rangy. Does anyone…
user27279
  • 145
  • 1
  • 1
  • 8
1 2
3
14 15