This commit is contained in:
Nils Norman Haukås 2015-11-30 22:50:40 +01:00
parent f8a7234200
commit af34537c5b

View file

@ -41,7 +41,7 @@ module tagIt {
this.tagStorageService.deleteTagById(evt.target.parentElement.id);
}
else if (this.findSelectedText()) {
updateSavedSelection();
this.updateSavedSelection();
callbackOnSelectFunc(joinLongWords(this.findSelectedText()));
} else {
callbackOnDeSelectFunc();
@ -59,12 +59,6 @@ module tagIt {
theSurroundingSpanElement.parentNode
.replaceChild(theOriginalTextNode, theSurroundingSpanElement);
}
function updateSavedSelection() {
if (this.savedSelection) {
rangy.removeMarkers(this.savedSelection);
}
this.savedSelection = rangy.saveSelection();
}
}
findSelectedText() {
@ -85,7 +79,7 @@ module tagIt {
range, true, document.getElementById('tagit-body'));
var generatedUuid: string = uuid.v4();
var parentElement = <HTMLElement>range.commonAncestorContainer;
return {
id: generatedUuid,
userEmail: 'testEmail',
@ -154,6 +148,13 @@ module tagIt {
}
}
}
private updateSavedSelection() {
if (this.savedSelection) {
rangy.removeMarkers(this.savedSelection);
}
this.savedSelection = rangy.saveSelection();
}
private surroundRangeWithSpan(sense: ISense, range: Range, uuid: string) {
// add span around content