$(this.contentDiv).html('');
// disconnect the toolbar
- $('div.panel-toolbar span.panel-toolbar-extra', this.wrap).empty();
+ $('div.panel-toolbar span.panel-toolbar-extra', this.wrap).html(
+ '<span />');
this.callHook('unload');
this.hooks = null; // flush the hooks
if(toolbar.length === 0) return;
// move the extra
- var extra_buttons = $('span.panel-toolbar-extra', toolbar);
- var placeholder = $('div.panel-toolbar span.panel-toolbar-extra', this.wrap);
- placeholder.replaceWith(extra_buttons);
- placeholder.hide();
-
- var action_buttons = $('button', extra_buttons);
+ var extra_buttons = $('span.panel-toolbar-extra button', toolbar);
+ var placeholder = $('div.panel-toolbar span.panel-toolbar-extra > span', this.wrap);
+ placeholder.replaceWith(extra_buttons);
// connect group-switch buttons
var group_buttons = $('*.toolbar-tabs-container button', toolbar);
});
// connect action buttons
- var allbuttons = $.makeArray(action_buttons);
+ var allbuttons = $.makeArray(extra_buttons);
$.merge(allbuttons,
$.makeArray($('*.toolbar-button-groups-container button', toolbar)) );
if(event.ctrlKey) code = code | 0x200;
if(event.shiftKey) code = code | 0x400;
- if(this.hotkeys[code] !== null) {
+ $.log(event.character, this.hotkeys[code]);
+
+ if(this.hotkeys[code]) {
return true;
}
return false;
} catch (e) {
this.options = defaultOptions;
}
+
+ this.fileOptions = this.options;
+ var self = this;
+
+ if(!this.options.recentFiles)
+ this.options.recentFiles = [];
+
+ $.each(this.options.recentFiles, function(index) {
+ if (fileId == self.options.recentFiles[index].fileId) {
+ $.log('Found options for', fileId);
+ self.fileOptions = self.options.recentFiles[index];
+ }
+ });
+
$.log(this.options);
+ $.log('fileOptions', this.fileOptions);
this.loadPanelOptions();
+ this.savePanelOptions();
};
Editor.prototype.loadPanelOptions = function() {
- var self = this;
- var totalWidth = 0;
-
- $('.panel-wrap', self.rootDiv).each(function(index) {
- var panelWidth = self.options.panels[index].ratio * self.rootDiv.width();
- if ($(this).hasClass('last-panel')) {
- $(this).css({
- left: totalWidth,
- right: 0
- });
- } else {
- $(this).css({
- left: totalWidth,
- width: panelWidth
- });
- totalWidth += panelWidth;
- }
- $.log('panel:', this, $(this).css('left'));
- $('.panel-toolbar option', this).each(function() {
- if ($(this).attr('p:panel-name') == self.options.panels[index].name) {
- $(this).parent('select').val($(this).attr('value'));
- }
- });
- });
+ // var self = this;
+ // var totalWidth = 0;
+ //
+ // $('.panel-wrap', self.rootDiv).each(function(index) {
+ // var panelWidth = self.fileOptions.panels[index].ratio * self.rootDiv.width();
+ // if ($(this).hasClass('last-panel')) {
+ // $(this).css({
+ // left: totalWidth,
+ // right: 0
+ // });
+ // } else {
+ // $(this).css({
+ // left: totalWidth,
+ // width: panelWidth
+ // });
+ // totalWidth += panelWidth;
+ // }
+ // $.log('panel:', this, $(this).css('left'));
+ // $('.panel-toolbar option', this).each(function() {
+ // if ($(this).attr('p:panel-name') == self.fileOptions.panels[index].name) {
+ // $(this).parent('select').val($(this).attr('value'));
+ // }
+ // });
+ // });
};
Editor.prototype.savePanelOptions = function() {
});
});
self.options.panels = panels;
+
+ // Dodaj obecnie oglÄ…dany plik do listy recentFiles
+ var recentFiles = [{fileId: fileId, panels: panels}];
+ var count = 1;
+ $.each(self.options.recentFiles, function(index) {
+ if (count < 5 && fileId != self.options.recentFiles[index].fileId) {
+ recentFiles.push(self.options.recentFiles[index]);
+ count++;
+ }
+ });
+ self.options.recentFiles = recentFiles;
+
self.options.lastUpdate = new Date().getTime() / 1000;
- $.log($.toJSON(self.options));
+ $.log($.toJSON(self.options));
$.cookie('options', $.toJSON(self.options), {
expires: 7,
path: '/'
var self = this;
$.log('Saving to local branch - panel:', changed_panel);
- if(!msg) msg = "Zapis z edytora platformy.";
+ if(!msg) msg = "Szybki zapis z edytora platformy.";
if( changed_panel.length === 0) {
$.log('Nothing to save.');
if(self.autosaveTimer) {
clearTimeout(self.autosaveTimer);
}
- if (data.warnings === null) {
+ if (data.warnings === null || data.warning === undefined) {
self.showPopup('save-successful');
} else {
self.showPopup('save-warn', data.warnings[0]);
Editor.prototype.onContentChanged = function(event, data) {
var self = this;
- $('#toolbar-button-save').removeAttr('disabled');
- $('#toolbar-button-commit').attr('disabled', 'disabled');
- $('#toolbar-button-update').attr('disabled', 'disabled');
+ $('button.provides-save').removeAttr('disabled');
+ $('button.requires-save').attr('disabled', 'disabled');
if(this.autosaveTimer) return;
this.autosaveTimer = setTimeout( function() {
alert("There are unsaved changes - can't commit.");
}
- var self = this;
- $.log('URL !: ', $('#commit-dialog form').attr('action'));
-
+ var self = this;
+
$.ajax({
url: $('#commit-dialog form').attr('action'),
dataType: 'json',
// do the layout
editor.loadConfig();
- editor.setupUI();
+ editor.setupUI();
});