Poprawione przelaczanie przypisow.
background-color: #dfdfdf;
}
background-color: #dfdfdf;
}
-.htmlview .annotation-inline-box[x-focused] > .annotation {
- background-color: #860000;
- color: #dfdfdf;
-}
-
*.htmlview *.annotation-inline-box {
position: static;
}
*.htmlview *.annotation-inline-box {
position: static;
}
text-decoration: none;
z-index: 10;
}
text-decoration: none;
z-index: 10;
}
-
-.htmlview .annotation-inline-box[x-focused] > span[x-annotation-box],
-.htmlview .annotation-inline-box:hover > span[x-annotation-box] {
- display: block;
- }
counter-increment: secondary;
}
counter-increment: secondary;
}
/*
* EDITABLE ELEMENTS
*/
/*
* EDITABLE ELEMENTS
*/
.htmlview *[x-editable] {
padding-left: 3px;
}
.htmlview *[x-editable] {
padding-left: 3px;
}
+.htmlview *[x-annotation-box][x-editable] > .default-menu {
+ opacity: 1;
+}
+
.htmlview *[x-editable][x-open] > .default-menu {
visibility: hidden;
}
.htmlview *[x-editable][x-open] > .default-menu {
visibility: hidden;
}
if($e.hasClass('annotation'))
{
if($e.hasClass('annotation'))
{
- var $box = $e.parent();
-
+ if(this.currentOpen) return false;
+
+ var $p = $e.parent();
if(this.currentFocused)
{
if(this.currentFocused)
{
- if($box[0] == this.currentFocused[0]) {
+ console.log(this.currentFocused, $p);
+ if($p[0] == this.currentFocused[0]) {
console.log('unfocus of current');
this.unfocusAnnotation();
return false;
console.log('unfocus of current');
this.unfocusAnnotation();
return false;
this.unfocusAnnotation();
}
this.unfocusAnnotation();
}
- this.focusAnnotation($box);
+ this.focusAnnotation($p);
this.closeWithoutSave( this.editableFor($e) );
},
this.closeWithoutSave( this.editableFor($e) );
},
- unfocusAnnotation: function() {
+ unfocusAnnotation: function()
+ {
+ {
+ console.log('Redundant unfocus');
if(this.currentOpen
&& this.currentOpen.is("*[x-annotation-box]")
&& this.currentOpen.parent()[0] == this.currentFocused[0])
if(this.currentOpen
&& this.currentOpen.is("*[x-annotation-box]")
&& this.currentOpen.parent()[0] == this.currentFocused[0])
+ {
+ console.log("Can't unfocus open box");
-
- this.currentFocused.removeAttr('x-focused');
+ }
+
+ var $box = $("*[x-annotation-box]", this.currentFocused);
+ $box.css({'display': 'none'});
+ // this.currentFocused.removeAttr('x-focused');
+ // this.currentFocused.hide();
this.currentFocused = null;
},
focusAnnotation: function($e) {
this.currentFocused = $e;
this.currentFocused = null;
},
focusAnnotation: function($e) {
this.currentFocused = $e;
- $e.attr('x-focused', 'focused');
+ var $box = $("*[x-annotation-box]", $e);
+ $box.css({'display': 'block'});
+
+ // $e.attr('x-focused', 'focused');
},
closeWithSave: function($e) {
},
closeWithSave: function($e) {
},
renderPart: function($e, html) {
},
renderPart: function($e, html) {
- $e.html(html);
- $e.append( this.$menuTemplate.clone() );
+ // exceptions aren't good, but I don't have a better idea right now
+ if($e.attr('x-annotation-box')) {
+ // replace the whole annotation
+ var $p = $e.parent();
+ $p.html(html);
+ var $box = $('*[x-annotation-box]', $p);
+ $box.append( this.$menuTemplate.clone() );
+
+ if(this.currentFocused && $p[0] == this.currentFocused[0])
+ {
+ this.currentFocused = $p;
+ $box.css({'display': 'block'});
+ }
+
+ return;
+ }
+
+ $e.html(html);
+ $e.append( this.$menuTemplate.clone() );
},
editableFor: function($button)
},
editableFor: function($button)
this.model.getXMLPart($origin, function(path, data) {
$('textarea', $overlay).val(data);
this.model.getXMLPart($origin, function(path, data) {
$('textarea', $overlay).val(data);
- });
-
- this.currentOpen = $origin;
- $origin.attr('x-open', 'open');
if($origin.is("*[x-annotation-box]"))
{
var $b = $origin.parent();
if(this.currentFocused) {
if($origin.is("*[x-annotation-box]"))
{
var $b = $origin.parent();
if(this.currentFocused) {
- if($b[0] != this.currentFocused[0])
+ // if some other is focused
+ if($b[0] != this.currentFocused[0]) {
this.unfocusAnnotation();
this.unfocusAnnotation();
+ this.focusAnnotation($b);
+ }
+ // already focues
+ }
+ else { // nothing was focused
+ this.focusAnnotation($b);
-
- this.focusAnnotation($origin);
+ else { // this item is not focusable
if(this.currentFocused) this.unfocusAnnotation();
}
if(this.currentFocused) this.unfocusAnnotation();
}
+
+ this.currentOpen = $origin;
+ $origin.attr('x-open', 'open');