Merge pull request #1524 from ONLYOFFICE/feature/refactor-tab-color

Feature/refactor tab color
This commit is contained in:
maxkadushkin 2022-02-06 18:59:01 +03:00 committed by GitHub
commit 22a855c9e1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 7 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

@ -394,7 +394,7 @@
&.icon-plus {
width: 22px;
height: 22px;
.encoded-svg-mask('<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 22 22" fill="@{toolbar-icons}"><g><path d="M21,12h-9v9h-2v-9H1v-2h9V1h2v9h9V12z"/></g></svg>', @toolbar-icons);
.encoded-svg-mask('<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 22 22" fill="@{fill-white}"><g><path d="M21,12h-9v9h-2v-9H1v-2h9V1h2v9h9V12z"/></g></svg>', @fill-white);
}
}

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') {