[SSE mobile] Correct edit link

This commit is contained in:
SergeyEzhin 2021-05-20 23:05:58 +03:00
parent fee213f283
commit b8004facae
2 changed files with 32 additions and 22 deletions

View file

@ -18,12 +18,12 @@ class EditLinkController extends Component {
this.linkInfo = cellInfo.asc_getHyperlink();
this.isLock = cellInfo.asc_getLockText();
this.currentSheet = api.asc_getWorksheetName(api.asc_getActiveWorksheetIndex());
// Sheets
let items = [];
let wsc = api.asc_getWorksheetsCount();
const aws = api.asc_getActiveWorksheetIndex();
// const aws = api.asc_getActiveWorksheetIndex();
if (wsc > 0) {
items = [];
@ -33,12 +33,14 @@ class EditLinkController extends Component {
value: wsc,
caption: api.asc_getWorksheetName(wsc)
});
if (wsc === aws) {
this.activeSheet = {
value: 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;
@ -103,7 +105,7 @@ class EditLinkController extends Component {
defaultDisplay = url;
}
if (this.isLock) {
if (args.isLock) {
linkProps.asc_setText(null);
} else {
if (!displayText) {
@ -131,7 +133,7 @@ class EditLinkController extends Component {
linkInfo={this.linkInfo}
isLock={this.isLock}
sheets={this.sheets}
activeSheet={this.activeSheet}
// activeSheet={this.activeSheet}
currentSheet={this.currentSheet}
onEditLink={this.onEditLink}
onRemoveLink={this.onRemoveLink}

View file

@ -35,7 +35,7 @@ const PageTypeLink = ({curType, changeType, storeFocusObjects}) => {
const PageSheet = ({curSheet, sheets, changeSheet, storeFocusObjects}) => {
const { t } = useTranslation();
const _t = t('View.Edit', {returnObjects: true});
const [stateSheet, setSheet] = useState(curSheet.value);
const [stateSheet, setSheet] = useState(curSheet);
const settings = !storeFocusObjects.focusOn ? [] : (storeFocusObjects.focusOn === 'obj' ? storeFocusObjects.objects : storeFocusObjects.selections);
if (storeFocusObjects.focusOn === 'obj' || settings.indexOf('hyperlink') === -1) {
@ -59,10 +59,10 @@ const PageSheet = ({curSheet, sheets, changeSheet, storeFocusObjects}) => {
key={`sheet-${sheet.value}`}
title={sheet.caption}
radio
checked={stateSheet === sheet.value}
onClick={() => {
setSheet(sheet.value);
changeSheet(sheet);
checked={stateSheet === sheet.caption}
onChange={() => {
setSheet(sheet.caption);
changeSheet(sheet.caption);
}}
/>
)
@ -80,13 +80,20 @@ const EditLink = props => {
const linkInfo = props.linkInfo;
const isLock = props.isLock;
const sheets = props.sheets;
const activeSheet = props.activeSheet;
const currentSheet = props.currentSheet;
console.log(linkInfo);
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 changeType = (newType) => {
setTypeLink(newType);
};
@ -98,7 +105,8 @@ const EditLink = props => {
const [screenTip, setScreenTip] = useState(linkInfo.asc_getTooltip());
const [curSheet, setSheet] = useState(activeSheet);
const [curSheet, setSheet] = useState(linkSheet);
const changeSheet = (sheet) => {
setSheet(sheet);
};
@ -123,8 +131,8 @@ const EditLink = props => {
/>
}
{typeLink == Asc.c_oAscHyperlinkType.RangeLink &&
<ListItem link={'/edit-link-sheet/'} title={_t.textSheet} after={linkSheet} routeProps={{
changeSheet: changeSheet,
<ListItem link={'/edit-link-sheet/'} title={_t.textSheet} after={curSheet} routeProps={{
changeSheet,
sheets,
curSheet
}}/>
@ -158,8 +166,8 @@ const EditLink = props => {
<ListButton title={_t.textEditLink}
className={`button-fill button-raised${(typeLink === 'ext' && link.length < 1 || typeLink === 'int' && range.length < 1) && ' disabled'}`}
onClick={() => {props.onEditLink(typeLink === 1 ?
{type: 1, url: link, text: stateDisplayText, tooltip: screenTip} :
{type: 2, url: range, sheet: curSheet.caption, text: stateDisplayText, tooltip: screenTip})}}
{type: 1, url: link, text: stateDisplayText, tooltip: screenTip, isLock} :
{type: 2, url: range, sheet: curSheet, text: stateDisplayText, tooltip: screenTip, isLock})}}
/>
<ListButton title={_t.textRemoveLink}
className={`button-fill button-red`}