[SSE] Refactoring TabColor

This commit is contained in:
ShimaginAndrey 2022-01-28 14:20:41 +03:00
parent 4f92a75911
commit ad71560b8d
2 changed files with 6 additions and 6 deletions

View file

@ -71,7 +71,6 @@ const StatusbarController = inject('sheets', 'storeFocusObjects', 'users')(obser
sheets.setActiveWorksheet(index);
Common.Notifications.trigger('sheet:active', index);
}
onApiSheetsChanged();
};
const onApiHideTabContextMenu = () => {
@ -375,10 +374,11 @@ const Statusbar = inject('sheets', 'storeAppOptions', 'users')(observer(props =>
const onSetWorkSheetColor = (color) => {
const api = Common.EditorApi.get();
let arrIndex = [];
const active_index = api.asc_getActiveWorksheetIndex();
const arrIndex = [];
if (api) {
arrIndex.push(api.asc_getActiveWorksheetIndex());
arrIndex.push(active_index);
if (arrIndex) {
if(color === 'transparent') {
api.asc_setWorksheetTabColor(null, arrIndex);
@ -392,6 +392,7 @@ const Statusbar = inject('sheets', 'storeAppOptions', 'users')(observer(props =>
}
}
}
sheets.sheets[active_index].color = api.asc_getWorksheetTabColor(active_index);
}
}

View file

@ -81,8 +81,7 @@ const PageCustomTabColor = inject("storePalette")(observer (props => {
const PageTabColor = inject("storePalette")(observer(props => {
const { t } = useTranslation();
const {sheets} = props;
const allSheets = sheets.sheets;
const {sheets, allSheets = sheets.sheets} = props;
const storePalette = props.storePalette;
const customColors = storePalette.customColors;
const activeIndex = sheets.activeWorksheet;
@ -96,7 +95,7 @@ const PageTabColor = inject("storePalette")(observer(props => {
sheets.changeTabColor('transparent');
}
}
}, [allSheets])
}, [activeIndex]);
const changeColor = (color, effectId, effectValue) => {
if (color !== 'empty') {