X-Git-Url: https://git.mdrn.pl/redakcja.git/blobdiff_plain/23107089660d64637c0459a397dc0ffc77cfceab..650cb7e30e5ed7def79c14f6ae63353bbf4441f4:/project/templates/explorer/file_xml.html?ds=sidebyside
diff --git a/project/templates/explorer/file_xml.html b/project/templates/explorer/file_xml.html
index cef1800b..1f074fc0 100644
--- a/project/templates/explorer/file_xml.html
+++ b/project/templates/explorer/file_xml.html
@@ -1,4 +1,5 @@
{% extends "base.html" %}
+{% load toolbar_tags %}
{% block extrahead %}
@@ -47,28 +48,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 + '' + tag + '>');
+ 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 '