}
/* Convert HTML fragment to plaintext */
- var ANNOT_FORBIDDEN = ['pt', 'pa', 'pr', 'pe', 'begin', 'end', 'theme'];
+ var ANNOT_FORBIDDEN = ['pt', 'pa', 'pr', 'pe', 'begin', 'end', 'motyw'];
function html2plainText(fragment){
var text = "";
// BUG #273 - selected text can contain themes, which should be omitted from
// defining term
var text = html2plainText(range.cloneContents());
-
var tag = $('<span></span>');
range.collapse(false);
range.insertNode(tag[0]);
$box = $origin;
}
- var x = $box[0].offsetLeft;
- var y = $box[0].offsetTop;
+ /* check sidebar width and display textarea on the right but avoiding interfering with gallery */
+ var x = $(document).width() - $("#sidebar").width() - 576 - 100; // and little margin here: 100px
+ var y = $origin.offset().top + $("#html-view").scrollTop();
+
+
var w = $box.outerWidth();
var h = $box.innerHeight();
left: x,
top: y,
width: w
- }).appendTo($box[0].offsetParent || $box.parent()).show();
+ }).appendTo($('#html-view')).show(); /* appending outside of the document structure */
+
if ($origin.is('.motyw')) {
- $('textarea', $overlay).autocomplete('/themes', {
- autoFill: true,
- multiple: true,
- selectFirst: true,
- highlight: false
- });
+ withThemes(function(canonThemes){
+ $('textarea', $overlay).autocomplete(canonThemes, {
+ autoFill: true,
+ multiple: true,
+ selectFirst: true,
+ highlight: false
+ });
+ })
}
if ($origin.is('.motyw')){
_finalize(success);
},
error: function(text){
- var message = $('<pre></pre>');
- message.text(text);
- $('#html-view').html('<p class="error">Wystąpił błąd:</p><pre>' +
- message.html() +
- '</pre>');
+ /* only basic error message */
+ var errorArray = text.split("\n");
+ if (errorArray.length >= 3) {
+ text = errorArray[2].split(":")[0];
+ }
+ $('#html-view').html('<p class="error">Wystąpił błąd: '+ text + '</p>');
_finalize(failure);
}
});