X-Git-Url: https://git.mdrn.pl/redakcja.git/blobdiff_plain/23107089660d64637c0459a397dc0ffc77cfceab..16c1f6ba31642aa189c514d21dcdc1b27e1dcd4e:/project/templates/explorer/file_xml.html?ds=inline
diff --git a/project/templates/explorer/file_xml.html b/project/templates/explorer/file_xml.html
index cef1800b..2d502cd9 100644
--- a/project/templates/explorer/file_xml.html
+++ b/project/templates/explorer/file_xml.html
@@ -47,28 +47,31 @@
$(this).html('Nie synchronizuj przewijania');
$('#images').enableAutoscroll();
})
-
- keys = {}
- function addEditorButton(editor, label, keyCode, fn) {
+ $('#toolbar li p').click(function() {
+ $('#toolbar ol:visible').hide();
+ $(this).next('ol').show('fast');
+ })
+
+ var keys = {};
+ $('#toolbar ol 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 '