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

StackOverflow https://stackoverflow.com/questions/14020443

  •  12-12-2021
  •  | 
  •  

Вопрос

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 (c21b08a9) do not match

The page source is not changed at all and all HTML is same. I am using Tikiwiki CMS. Any ideas about this?

Это было полезно?

Решение

To solve this error, you need to pass the omitChecksum parameter to the serializeSelection function. This will prevent the DOM validation. serializeSelection will return the serialized form of the selection which you can save in DB or cookie.

See the following example:

var selObj = rangy.getSelection();
var sel = rangy.serializeSelection(selObj, true);

Другие советы

It is likely the DOM is different in some way. Be sure that before serializing you didn't modify the selection, for example using the rangy CssClassApplier.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top