[SSE] Fix applying format settings

This commit is contained in:
Julia Radzhabova 2021-02-05 21:09:35 +03:00
parent 8ab9c050b6
commit 0c981b760f
2 changed files with 16 additions and 7 deletions

View file

@ -1034,6 +1034,8 @@ define([
} else { } else {
picker.select(color, true); picker.select(color, true);
} }
picker && (picker.currentColor = color);
control && (control.currentColor = color);
return color; return color;
}; };

View file

@ -453,7 +453,7 @@ define([ 'text!spreadsheeteditor/main/app/template/FormatRulesManagerDlg.templa
allowBlank : true, allowBlank : true,
disabled : !item.get('activeSheet'), disabled : !item.get('activeSheet'),
validateOnChange: true validateOnChange: true
}).on('button:click', _.bind(this.onSelectData, this, rule)); }).on('button:click', _.bind(this.onSelectData, this, rule, item));
var val = item.get('range'); var val = item.get('range');
(val!==null) && input.setValue(val); (val!==null) && input.setValue(val);
@ -479,14 +479,16 @@ define([ 'text!spreadsheeteditor/main/app/template/FormatRulesManagerDlg.templa
props.asc_getPreview(this.rules[rule.get('ruleIndex')].previewDiv, text); props.asc_getPreview(this.rules[rule.get('ruleIndex')].previewDiv, text);
}, },
onSelectData: function(item, cmp) { onSelectData: function(rule, item) {
var me = this; var me = this;
if (me.api) { if (me.api) {
var handlerDlg = function(dlg, result) { var handlerDlg = function(dlg, result) {
if (result == 'ok') { if (result == 'ok') {
item.dataRangeValid = dlg.getSettings(); rule.dataRangeValid = dlg.getSettings();
item.txtDataRange.setValue(item.dataRangeValid); rule.txtDataRange.setValue(rule.dataRangeValid);
item.txtDataRange.checkValidate(); rule.txtDataRange.checkValidate();
item.set('ruleChanged', true);
item.get('props').asc_setLocation(rule.dataRangeValid);
} }
}; };
@ -501,7 +503,7 @@ define([ 'text!spreadsheeteditor/main/app/template/FormatRulesManagerDlg.templa
win.show(xy.left + 160, xy.top + 125); win.show(xy.left + 160, xy.top + 125);
win.setSettings({ win.setSettings({
api : me.api, api : me.api,
range : (!_.isEmpty(item.txtDataRange.getValue()) && (item.txtDataRange.checkValidate()==true)) ? item.txtDataRange.getValue() : item.dataRangeValid, range : (!_.isEmpty(rule.txtDataRange.getValue()) && (rule.txtDataRange.checkValidate()==true)) ? rule.txtDataRange.getValue() : rule.dataRangeValid,
type : Asc.c_oAscSelectionDialogType.Chart type : Asc.c_oAscSelectionDialogType.Chart
}); });
} }
@ -670,8 +672,13 @@ define([ 'text!spreadsheeteditor/main/app/template/FormatRulesManagerDlg.templa
var store = this.rulesStores[sheet]; var store = this.rulesStores[sheet];
var arr = []; var arr = [];
store && store.each(function(item) { store && store.each(function(item) {
var props = item.get('props');
if (item.get('priority')!==props.asc_getPriority()) {
props.asc_setPriority(item.get('priority'));
item.set('ruleChanged', true);
}
if (item.get('ruleChanged')) if (item.get('ruleChanged'))
arr.push(item.get('props')); arr.push(props);
}); });
(arr.length>0) && (sheets[sheet] = arr); (arr.length>0) && (sheets[sheet] = arr);
} }