X-Git-Url: https://git.mdrn.pl/redakcja.git/blobdiff_plain/23107089660d64637c0459a397dc0ffc77cfceab..d8006182f05f235f38fd7ca1c74a808ffac71a31:/project/templates/explorer/file_xml.html diff --git a/project/templates/explorer/file_xml.html b/project/templates/explorer/file_xml.html index cef1800b..ee332c33 100644 --- a/project/templates/explorer/file_xml.html +++ b/project/templates/explorer/file_xml.html @@ -47,28 +47,37 @@ $(this).html('Nie synchronizuj przewijania'); $('#images').enableAutoscroll(); }) - - keys = {} - function addEditorButton(editor, label, keyCode, fn) { + // Toolbar + $('#toolbar-tabs li').click(function() { + var id = $(this).attr('p:button-list'); + $('#toolbar-tabs li').removeClass('active'); + $(this).addClass('active'); + if (!$('#' + id).is(':visible')) { + $('#toolbar-buttons ol').not('#' + id).hide(); + $('#' + id).show(); + } + }) + + var keys = {}; + $('#toolbar-buttons li').each(function() { + var tag = $(this).attr('p:tag'); var handler = function() { var text = editor.selection(); - editor.replaceSelection(fn(text)); + editor.replaceSelection('<' + tag + '>' + text + ''); + if (text.length == 0) { + var pos = editor.cursorPosition(); + editor.selectLines(pos.line, pos.character + tag.length + 2); + } } - - keys[keyCode] = handler; - - $('').click(function(event) { - event.preventDefault(); - handler(); - }).appendTo('#buttons'); - } - - addEditorButton(editor, 'utwór', 65, function(text) { return '' + text + ''; }); - addEditorButton(editor, 'akap', 83, function(text) { return '' + text + ''; }); + if ($(this).attr('p:key')) { + keys[$(this).attr('p:key')] = handler; + } + $(this).click(handler) + }); editor.grabKeys(function(event) { - // console.log('handle', event, event.keyCode) + console.log('handle', event, event.keyCode) if (keys[event.keyCode]) { keys[event.keyCode](); } @@ -77,7 +86,7 @@ resizePanels(); } }); - + $('#images-wrap').lazyload('.image-box', {threshold: 640 * 10, scrollTreshold: 640 * 5}); }); @@ -87,11 +96,94 @@ {% block breadcrumbs %}Platforma Redakcyjna ❯ plik {{ hash }}{% endblock breadcrumbs %} {% block maincontent %} -
- Źródło - HTML -
+
+
    +
  1. Nagłówki
  2. +
  3. Struktr. i mastery
  4. +
  5. Dramat wiersz.
  6. +
  7. Elementy początk.
  8. +
  9. Akapity i dł. cyt.
  10. +
  11. Style znakowe
  12. +
  13. Polecenia
  14. +
  15. Wersy
  16. +
 
+
+ + + + + + + + +
 
+