[SSE] Disable parsing text for multiselect, add error for empty source

This commit is contained in:
Julia Radzhabova 2019-04-18 11:39:58 +03:00
parent df151f23d4
commit 59997a0212
4 changed files with 28 additions and 4 deletions

View file

@ -144,6 +144,7 @@ define([
this.handler = _options.handler;
this.type = _options.type;
this.preview = _options.preview;
this.previewData = _options.previewData;
this.warning = _options.warning || false;
this.closable = _options.closable;
this.codepages = _options.codepages;
@ -188,8 +189,9 @@ define([
});
} else {
this.initCodePages();
if (this.preview)
this.updatePreview();
if (this.preview) {
(this.previewData) ? this.previewCallback(this.previewData) : this.updatePreview();
}
}
this.onPrimary = function() {
me._handleInput('ok');

View file

@ -1365,6 +1365,10 @@ define([
config.msg = this.errorEmailClient;
break;
case Asc.c_oAscError.ID.NoDataToParse:
config.msg = this.errorNoDataToParse;
break;
default:
config.msg = (typeof id == 'string') ? id : this.errorDefaultMessage.replace('%1', id);
break;
@ -2495,7 +2499,8 @@ define([
errorEmailClient: 'No email client could be found',
txtPrintArea: 'Print_Area',
txtTable: 'Table',
textCustomLoader: 'Please note that according to the terms of the license you are not entitled to change the loader.<br>Please contact our Sales Department to get a quote.'
textCustomLoader: 'Please note that according to the terms of the license you are not entitled to change the loader.<br>Please contact our Sales Department to get a quote.',
errorNoDataToParse: 'No data was selected to parse.'
}
})(), SSE.Controllers.Main || {}))
});

View file

@ -71,11 +71,13 @@ define([
this._state = {
BackColor: undefined,
DisabledControls: true,
CellAngle: undefined
CellAngle: undefined,
CSVOptions: new Asc.asc_CCSVAdvancedOptions(0, 4, '')
};
this.lockedControls = [];
this._locked = true;
this.isEditCell = false;
this.isMultiSelect = false;
this.BorderType = 1;
this.render();
@ -140,12 +142,20 @@ define([
},
onTextToColumn: function() {
this.api.asc_TextImport(this._state.CSVOptions, _.bind(this.onTextToColumnCallback, this), false);
},
onTextToColumnCallback: function(data) {
if (!data || !data.length) return;
var me = this;
(new Common.Views.OpenDialog({
title: me.txtImportWizard,
closable: true,
type: Common.Utils.importTextType.Columns,
preview: true,
previewData: data,
settings: this._state.CSVOptions,
api: me.api,
handler: function (result, encoding, delimiter, delimiterChar) {
if (result == 'ok') {
@ -168,6 +178,7 @@ define([
this.api = o;
if (o) {
this.api.asc_registerCallback('asc_onEditCell', this.onApiEditCell.bind(this));
this.api.asc_registerCallback('asc_onSelectionChanged', _.bind(this.onApiSelectionChanged, this));
}
return this;
},
@ -358,6 +369,10 @@ define([
this.disableControls(this._locked);
},
onApiSelectionChanged: function(info) {
this.isMultiSelect = info.asc_getFlags().asc_getMultiselect() || info.asc_getSelectedColsCount()>1;
},
setLocked: function (locked) {
this._locked = locked;
},
@ -372,6 +387,7 @@ define([
item.setDisabled(disable);
});
}
this.btnTextToColumn.setDisabled(disable || this.isMultiSelect);
},
textBorders: 'Border\'s Style',

View file

@ -725,6 +725,7 @@
"SSE.Controllers.Main.warnNoLicense": "This version of ONLYOFFICE Editors has certain limitations for concurrent connections to the document server.<br>If you need more please consider purchasing a commercial license.",
"SSE.Controllers.Main.warnNoLicenseUsers": "This version of ONLYOFFICE Editors has certain limitations for concurrent users.<br>If you need more please consider purchasing a commercial license.",
"SSE.Controllers.Main.warnProcessRightsChange": "You have been denied the right to edit the file.",
"SSE.Controllers.Main.errorNoDataToParse": "No data was selected to parse.",
"SSE.Controllers.Print.strAllSheets": "All Sheets",
"SSE.Controllers.Print.textWarning": "Warning",
"SSE.Controllers.Print.txtCustom": "Custom",