X-Git-Url: https://git.mdrn.pl/redakcja.git/blobdiff_plain/85b88321baaf99ad7133cbd195018d7ed1cab165..cb50c78e7f77e5416fa405db18d142c96d16a543:/platforma/static/js/main.js diff --git a/platforma/static/js/main.js b/platforma/static/js/main.js index a92dfe4a..cdcc21a8 100644 --- a/platforma/static/js/main.js +++ b/platforma/static/js/main.js @@ -328,8 +328,8 @@ function reverseTransform(editor, cont, errorCont, dontBlock) { $.blockUI({message: 'Ładowanie...'}); } setTimeout(function() { - html2xml({ - xml: serializer.serializeToString($('#html-view div').get(0)), + html2text({ + element: $('#html-view div').get(0), success: function(text) { editor.setCode(text); if (!dontBlock) { @@ -595,9 +595,9 @@ function html(element) { var serializer = new XMLSerializer(); - html2xml({ - xml: serializer.serializeToString($box[0]), - inner: true, + html2text({ + element: $box[0], + stripOuter: true, success: function(text) { $('textarea', $overlay).val($.trim(text)); @@ -616,7 +616,7 @@ function html(element) { xml2html({ xml: '<' + nodeName + '>' + insertedText + '', success: function(element) { - $box.html($(element).html()); + $origin.html($(element).html()); $overlay.remove(); }, error: function(text) { @@ -659,6 +659,13 @@ function html(element) { if (!editable.hasClass('active')) { editable.addClass('active').append(button); } + if (editable.is('.annotation-inline-box')) { + $('*[x-annotation-box]', editable) + .css({position: 'absolute', left: event.clientX - editable.offset().left + 5, top: event.clientY - editable.offset().top + 5}) + .show(); + } else { + $('*[x-annotation-box]').hide(); + } }); $('.motyw').live('click', function() { @@ -708,7 +715,7 @@ function refreshHistory(callback){ +''+ this[1]+'') }); $.unblockUI(); - callback(); + if(callback) callback(); } }); }; @@ -760,9 +767,10 @@ $(function() { parserConfig: { useHTMLKludges: false }, - iframeClass: 'xml-iframe', + iframeClass: 'xml-iframe', textWrapping: true, - /* lineNumbers: true, */ + lineNumbers: true, + width: "100%", tabMode: 'spaces', indentUnit: 0, initCallback: function(editor) { @@ -879,15 +887,18 @@ $(function() { $('.vsplitbar').click(function() { if ($('#sidebar').width() == 0) { $('#sidebar').width(480).css({right: 0}).show(); - $('#source-editor, #simple-editor').css({right: 495}); + $('#editor .editor').css({right: 495}); $('.vsplitbar').css({right: 480}).addClass('active'); } else { $('#sidebar').width(0).hide(); - $('#source-editor, #simple-editor').css({right: 15}); + $('#editor .editor').css({right: 15}); $('.vsplitbar').css({right: 0}).removeClass('active'); } $(window).resize(); }); - + + $(window).bind('beforeunload', function(event) { + return "Na stronie mogą być niezapisane zmiany."; + }); });