--- a/src/js/widgets/createAnnotationWidget.js Wed Jan 11 15:05:21 2012 +0100
+++ b/src/js/widgets/createAnnotationWidget.js Wed Jan 11 16:13:29 2012 +0100
@@ -39,9 +39,12 @@
this.selector.find("#" + id).click(function(keyword) { return function() {
var contents = _this.selector.find(".Ldt-createAnnotation-Description").val();
if (contents.indexOf(keyword) != -1) {
- var newVal = contents.replace(keyword, "");
+ var newVal = contents.replace(" " + keyword, "");
} else {
- var newVal = contents + keyword;
+ if (contents === "")
+ var newVal = keyword;
+ else
+ var newVal = contents + " " + keyword;
}
_this.selector.find(".Ldt-createAnnotation-Description").val(newVal);
@@ -143,7 +146,7 @@
// the other event handlers.
textfield.bind("js_mod.tmp propertychange.tmp keyup.tmp input.tmp paste.tmp", IriSP.wrap(this, function() {
var contents = textfield.val();
- console.log(contents);
+
if (contents !== "") {
this.selector.find(".Ldt-createAnnotation-errorMessage").hide();
textfield.css("background-color", "");