From: zuber Date: Mon, 24 Aug 2009 14:28:13 +0000 (+0200) Subject: Panel z widokiem HTML reaguje na zmiany w panelu z edytorem XML. X-Git-Url: https://git.mdrn.pl/redakcja.git/commitdiff_plain/51a4b0a4a2aad9b17eb9b6c5d71bb67677e20b50?ds=inline;hp=-c Panel z widokiem HTML reaguje na zmiany w panelu z edytorem XML. --- 51a4b0a4a2aad9b17eb9b6c5d71bb67677e20b50 diff --git a/project/static/css/master.css b/project/static/css/master.css index 5912e1e7..76a56325 100644 --- a/project/static/css/master.css +++ b/project/static/css/master.css @@ -272,3 +272,6 @@ div.isection p { margin: 0.5em 1em; } +.change-notification { + color: red; +} diff --git a/project/static/js/panels.js b/project/static/js/panels.js index 0c8761c8..28970c17 100644 --- a/project/static/js/panels.js +++ b/project/static/js/panels.js @@ -1,5 +1,6 @@ function loadPanel(target, url) { console.log('ajax', url, 'into', target); + $('.change-notification', $(target).parent()).fadeOut(); $(document).trigger('panel:unload', target); $.ajax({ url: url, @@ -9,7 +10,6 @@ function loadPanel(target, url) { $(target).html(data); console.log(target, 'triggering panel:load'); $(document).trigger('panel:load', target); - // panel(target); }, error: function(request, textStatus, errorThrown) { console.log('ajax', url, target, 'error:', textStatus, errorThrown); diff --git a/project/templates/explorer/file_xml.html b/project/templates/explorer/file_xml.html index eb180157..a109f93b 100644 --- a/project/templates/explorer/file_xml.html +++ b/project/templates/explorer/file_xml.html @@ -15,23 +15,26 @@
- - + + +
- + +
diff --git a/project/templates/explorer/panels/htmleditor.html b/project/templates/explorer/panels/htmleditor.html index 0eab0b28..3b1791e1 100644 --- a/project/templates/explorer/panels/htmleditor.html +++ b/project/templates/explorer/panels/htmleditor.html @@ -5,14 +5,14 @@
\ No newline at end of file diff --git a/project/templates/explorer/panels/xmleditor.html b/project/templates/explorer/panels/xmleditor.html index f2a6d733..bb225e4c 100644 --- a/project/templates/explorer/panels/xmleditor.html +++ b/project/templates/explorer/panels/xmleditor.html @@ -15,7 +15,10 @@ path: "/static/js/codemirror/", stylesheet: "/static/css/xmlcolors.css", parserConfig: {useHTMLKludges: false}, - initCallback: function() { + onChange: function() { + $(document).trigger('panel:contentChanged', panel); + }, + initCallback: function(editor) { // Toolbar $('.toolbar-tabs li', panel).click(function() { var id = $(this).attr('p:button-list'); @@ -38,6 +41,7 @@ var pos = editor.cursorPosition(); editor.selectLines(pos.line, pos.character + tag.length + 2); } + $(document).trigger('panel:contentChanged', panel); } if ($(this).attr('p:key')) { keys[$(this).attr('p:key')] = handler;