X-Git-Url: https://git.mdrn.pl/redakcja.git/blobdiff_plain/41e4e58d2d389558b91565c16b0c7c0ec7c558fa..5ef8e304790026b27417d8ff3c76c18858ba708f:/redakcja/static/js/wiki/view_editor_wysiwyg.js?ds=inline diff --git a/redakcja/static/js/wiki/view_editor_wysiwyg.js b/redakcja/static/js/wiki/view_editor_wysiwyg.js index 5f450622..4e0bdee8 100644 --- a/redakcja/static/js/wiki/view_editor_wysiwyg.js +++ b/redakcja/static/js/wiki/view_editor_wysiwyg.js @@ -44,7 +44,7 @@ } /* 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 = ""; @@ -91,7 +91,6 @@ // BUG #273 - selected text can contain themes, which should be omitted from // defining term var text = html2plainText(range.cloneContents()); - var tag = $(''); range.collapse(false); range.insertNode(tag[0]); @@ -289,11 +288,8 @@ else { $box = $origin; } - - /* always stick to the left to avoid interfering with gallery */ - var x = 20; - var y = $origin.offset().top + $("#html-view").scrollTop(); - + var x = $box[0].offsetLeft; + var y = $box[0].offsetTop; var w = $box.outerWidth(); var h = $box.innerHeight(); @@ -301,25 +297,33 @@ if ($origin.is(".annotation-inline-box")) { w = Math.max(w, 400); h = Math.max(h, 60); + if($('.htmlview div').offset().left + $('.htmlview div').width() > ($('.vsplitbar').offset().left - 480)){ + x = -(Math.max($origin.offset().left, $origin.width())); + } else { + x = 100; + } } // start edition on this node - var $overlay = $('
').css({ + var $overlay = $('').css({ position: 'absolute', height: h, left: x, top: y, width: w - }).appendTo($('#html-view')).show(); /* appending outside of the document structure */ + }).appendTo($box[0].offsetParent || $box.parent()).show(); if ($origin.is('.motyw')) { - $('textarea', $overlay).autocomplete('/themes', { - autoFill: true, - multiple: true, - selectFirst: true, - highlight: false - }); + $('.akap-edit-button').remove(); + withThemes(function(canonThemes){ + $('textarea', $overlay).autocomplete(canonThemes, { + autoFill: true, + multiple: true, + selectFirst: true, + highlight: false + }); + }) } if ($origin.is('.motyw')){ @@ -343,7 +347,14 @@ }); } else { - $('.delete-button', $overlay).hide(); + $('.delete-button', $overlay).html("Anuluj"); + $('.delete-button', $overlay).click(function(){ + if (window.confirm("Czy jesteÅ pewien, że chcesz anulowaÄ zmiany?")) { + $overlay.remove(); + $(document).unbind('click.blur-overlay'); + return false; + }; + }); } @@ -370,7 +381,13 @@ xml2html({ xml: '<' + nodeName + '>' + insertedText + '' + nodeName + '>', success: function(element){ - $origin.html($(element).html()); + if (nodeName == 'out-of-flow-text') { + $(element).children().insertAfter($origin); + $origin.remove() + } + else { + $origin.html($(element).html()); + } $overlay.remove(); }, error: function(text){ @@ -378,8 +395,49 @@ alert('BÅÄ d! ' + text); } }) + + var msg = $("Twoje zmiany zostaÅy naniesione na tekst źródÅowy. PamiÄtaj, że aby zmiany zostaÅy utrwalone należy je zapisaÄ!
Ta wiadomoÅÄ zostanie automatycznie zamkniÄta za 6 sekund.
WystÄ piÅ bÅÄ d:
' + - message.html() + - ''); + error: function(text, source){ + err = '
WystÄ piÅ bÅÄ d:
'+text+'
'; + if (source) + err += ''+source.replace(/&/g, '&').replace(/' + $('#html-view').html(err); _finalize(failure); } });