fnp
/
redakcja.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Quote escape dla tooltipów.
[redakcja.git]
/
project
/
static
/
js
/
views
/
xml.js
diff --git
a/project/static/js/views/xml.js
b/project/static/js/views/xml.js
index
0215472
..
1681cae
100644
(file)
--- a/
project/static/js/views/xml.js
+++ b/
project/static/js/views/xml.js
@@
-1,4
+1,4
@@
-/*global View CodeMirror
Button
ToolbarView render_template panels */
+/*global View CodeMirror ToolbarView render_template panels */
var XMLView = View.extend({
_className: 'XMLView',
element: null,
var XMLView = View.extend({
_className: 'XMLView',
element: null,
@@
-18,8
+18,11
@@
var XMLView = View.extend({
var self = this;
$('.xmlview-toolbar', this.element).bind('resize.xmlview', this.resized.bind(this));
var self = this;
$('.xmlview-toolbar', this.element).bind('resize.xmlview', this.resized.bind(this));
-
-
+
+ // scroll to the given position (if availble)
+ this.scrollCallback = this.scrollOnRequest.bind(this);
+ $(document).bind('xml-scroll-request', this.scrollCallback);
+
this.parent.freeze('Ładowanie edytora...');
this.editor = new CodeMirror($('.xmlview', this.element).get(0), {
parserfile: 'parsexml.js',
this.parent.freeze('Ładowanie edytora...');
this.editor = new CodeMirror($('.xmlview', this.element).get(0), {
parserfile: 'parsexml.js',
@@
-28,7
+31,7
@@
var XMLView = View.extend({
parserConfig: {
useHTMLKludges: false
},
parserConfig: {
useHTMLKludges: false
},
- textWrapping:
fals
e,
+ textWrapping:
tru
e,
tabMode: 'spaces',
indentUnit: 0,
onChange: this.editorDataChanged.bind(this),
tabMode: 'spaces',
indentUnit: 0,
onChange: this.editorDataChanged.bind(this),
@@
-91,6
+94,8
@@
var XMLView = View.extend({
},
dispose: function() {
},
dispose: function() {
+ $(document).unbind('xml-scroll-request', this.scrollCallback);
+
this.model.removeObserver(this);
$(this.editor.frame).remove();
this._super();
this.model.removeObserver(this);
$(this.editor.frame).remove();
this._super();
@@
-102,9
+107,9
@@
var XMLView = View.extend({
|| (code >= 65 && code <= 90)) ) return null;
var ch = String.fromCharCode(code & 0xff).toLowerCase();
|| (code >= 65 && code <= 90)) ) return null;
var ch = String.fromCharCode(code & 0xff).toLowerCase();
- console.log(ch.charCodeAt(0), '#', buttons);
+ /* # console.log(ch.charCodeAt(0), '#', buttons); */
- var buttons = $('.buttontoolbarview-button[
title
='+ch+']', this.element);
+ var buttons = $('.buttontoolbarview-button[
hotkey
='+ch+']', this.element);
var mod = 0;
if(event.altKey) mod |= 0x01;
var mod = 0;
if(event.altKey) mod |= 0x01;
@@
-129,8
+134,7
@@
var XMLView = View.extend({
},
isHotkey: function() {
},
isHotkey: function() {
- console.log(arguments);
-
+ /* console.log(arguments); */
if(this.getHotkey.apply(this, arguments))
return true;
else
if(this.getHotkey.apply(this, arguments))
return true;
else
@@
-142,6
+146,16
@@
var XMLView = View.extend({
this.buttonToolbar.buttonPressed({
target: button
});
this.buttonToolbar.buttonPressed({
target: button
});
+ },
+
+ scrollOnRequest: function(event, data)
+ {
+ try {
+ var line = this.editor.nthLine(data.line);
+ this.editor.selectLines(line, (data.column-1));
+ } catch(e) {
+ console.log('Exception in scrollOnRequest:', e);
+ }
}
});
}
});