[SSE] Fix Bug 51707

This commit is contained in:
ShimaginAndrey 2021-08-04 18:09:50 +03:00
parent 74a0573c2a
commit b16e82ea2e
2 changed files with 8 additions and 1 deletions

View file

@ -6,16 +6,23 @@ const CellEditor = props => {
useEffect(() => {
Common.Notifications.on('engineCreated', api => {
api.asc_registerCallback('asc_onSelectionNameChanged', onApiCellSelection.bind(this));
api.asc_registerCallback('asc_onSelectionChanged', onApiSelectionChanged.bind(this));
});
}, []);
const [cellName, setCellName] = useState('');
const [stateCoauth, setCoauthDisabled] = useState(null);
const onApiCellSelection = info => {
setCellName(typeof(info)=='string' ? info : info.asc_getName());
};
const onApiSelectionChanged = info => {
setCoauthDisabled(info.asc_getLocked() === true || info.asc_getLockedTable() === true || info.asc_getLockedPivotTable()===true);
}
return <CellEditorView cellName={cellName}
stateCoauth = {stateCoauth}
onClickToOpenAddOptions={props.onClickToOpenAddOptions}/>
};

View file

@ -23,7 +23,7 @@ const CellEditorView = props => {
return <View id="idx-celleditor" style={viewStyle} className={expanded?'expanded':'collapsed'}>
<div id="box-cell-name" className="ce-group">
<span id="idx-cell-name">{props.cellName}</span>
<a href="#" id="idx-btn-function" className='link icon-only' disabled={!isEdit && true} onClick={() => {props.onClickToOpenAddOptions('function', '#idx-btn-function');}}>
<a href="#" id="idx-btn-function" className='link icon-only' disabled={(!isEdit && true) || props.stateCoauth} onClick={() => {props.onClickToOpenAddOptions('function', '#idx-btn-function');}}>
<i className="icon icon-function" />
</a>
</div>