[SSE mobile] Bug 49779

This commit is contained in:
SergeyEzhin 2021-05-21 16:02:28 +03:00
parent b8004facae
commit 9c6a685bf5
2 changed files with 11 additions and 26 deletions

View file

@ -23,24 +23,15 @@ class EditLinkController extends Component {
let items = []; let items = [];
let wsc = api.asc_getWorksheetsCount(); let wsc = api.asc_getWorksheetsCount();
// const aws = api.asc_getActiveWorksheetIndex();
if (wsc > 0) { if (wsc > 0) {
items = []; items = [];
while ( !(--wsc < 0) ) { while (!(--wsc < 0)) {
if ( !api.asc_isWorksheetHidden(wsc) ) { if (!api.asc_isWorksheetHidden(wsc)) {
items.unshift({ items.unshift({
value: wsc, value: wsc,
caption: api.asc_getWorksheetName(wsc) caption: api.asc_getWorksheetName(wsc)
}); });
console.log(api.asc_getWorksheetName(wsc))
// if (wsc === aws) {
// this.activeSheet = {
// value: wsc,
// caption: api.asc_getWorksheetName(wsc)
// }
// }
} }
} }
this.sheets = items; this.sheets = items;
@ -105,7 +96,7 @@ class EditLinkController extends Component {
defaultDisplay = url; defaultDisplay = url;
} }
if (args.isLock) { if (this.isLock) {
linkProps.asc_setText(null); linkProps.asc_setText(null);
} else { } else {
if (!displayText) { if (!displayText) {
@ -133,7 +124,6 @@ class EditLinkController extends Component {
linkInfo={this.linkInfo} linkInfo={this.linkInfo}
isLock={this.isLock} isLock={this.isLock}
sheets={this.sheets} sheets={this.sheets}
// activeSheet={this.activeSheet}
currentSheet={this.currentSheet} currentSheet={this.currentSheet}
onEditLink={this.onEditLink} onEditLink={this.onEditLink}
onRemoveLink={this.onRemoveLink} onRemoveLink={this.onRemoveLink}

View file

@ -81,17 +81,12 @@ const EditLink = props => {
const isLock = props.isLock; const isLock = props.isLock;
const sheets = props.sheets; const sheets = props.sheets;
const currentSheet = props.currentSheet; const currentSheet = props.currentSheet;
const valueTypeLink = linkInfo.asc_getType();
const valueLinkSheet = linkInfo.asc_getSheet();
const getLinkSheet = () => sheets.find(sheet => sheet.caption === valueLinkSheet);
const linkSheet = (valueTypeLink == Asc.c_oAscHyperlinkType.RangeLink) ? getLinkSheet() ? getLinkSheet().caption : '' : currentSheet;
console.log(linkInfo); const [typeLink, setTypeLink] = useState(valueTypeLink);
const valueLinkInfo = linkInfo.asc_getType();
const linkSheet = (valueLinkInfo == Asc.c_oAscHyperlinkType.RangeLink) ? linkInfo.asc_getSheet() : currentSheet;
console.log(valueLinkInfo);
console.log(currentSheet);
console.log(linkSheet);
const [typeLink, setTypeLink] = useState(valueLinkInfo);
const textType = typeLink != Asc.c_oAscHyperlinkType.RangeLink ? _t.textExternalLink : _t.textInternalDataRange; const textType = typeLink != Asc.c_oAscHyperlinkType.RangeLink ? _t.textExternalLink : _t.textInternalDataRange;
const changeType = (newType) => { const changeType = (newType) => {
@ -164,10 +159,10 @@ const EditLink = props => {
</List> </List>
<List> <List>
<ListButton title={_t.textEditLink} <ListButton title={_t.textEditLink}
className={`button-fill button-raised${(typeLink === 'ext' && link.length < 1 || typeLink === 'int' && range.length < 1) && ' disabled'}`} className={`button-fill button-raised${(typeLink === 'ext' && link.length < 1 || typeLink === 'int' || range.length < 1 || !curSheet.length) && ' disabled'}`}
onClick={() => {props.onEditLink(typeLink === 1 ? onClick={() => {props.onEditLink(typeLink === 1 ?
{type: 1, url: link, text: stateDisplayText, tooltip: screenTip, isLock} : {type: 1, url: link, text: stateDisplayText, tooltip: screenTip} :
{type: 2, url: range, sheet: curSheet, text: stateDisplayText, tooltip: screenTip, isLock})}} {type: 2, url: range, sheet: curSheet, text: stateDisplayText, tooltip: screenTip})}}
/> />
<ListButton title={_t.textRemoveLink} <ListButton title={_t.textRemoveLink}
className={`button-fill button-red`} className={`button-fill button-red`}