[SSE mobile] Correct edit link
This commit is contained in:
parent
fee213f283
commit
b8004facae
|
@ -18,12 +18,12 @@ class EditLinkController extends Component {
|
||||||
this.linkInfo = cellInfo.asc_getHyperlink();
|
this.linkInfo = cellInfo.asc_getHyperlink();
|
||||||
this.isLock = cellInfo.asc_getLockText();
|
this.isLock = cellInfo.asc_getLockText();
|
||||||
this.currentSheet = api.asc_getWorksheetName(api.asc_getActiveWorksheetIndex());
|
this.currentSheet = api.asc_getWorksheetName(api.asc_getActiveWorksheetIndex());
|
||||||
|
|
||||||
// Sheets
|
// Sheets
|
||||||
|
|
||||||
let items = [];
|
let items = [];
|
||||||
let wsc = api.asc_getWorksheetsCount();
|
let wsc = api.asc_getWorksheetsCount();
|
||||||
const aws = api.asc_getActiveWorksheetIndex();
|
// const aws = api.asc_getActiveWorksheetIndex();
|
||||||
|
|
||||||
if (wsc > 0) {
|
if (wsc > 0) {
|
||||||
items = [];
|
items = [];
|
||||||
|
@ -33,12 +33,14 @@ class EditLinkController extends Component {
|
||||||
value: wsc,
|
value: wsc,
|
||||||
caption: api.asc_getWorksheetName(wsc)
|
caption: api.asc_getWorksheetName(wsc)
|
||||||
});
|
});
|
||||||
if (wsc === aws) {
|
|
||||||
this.activeSheet = {
|
console.log(api.asc_getWorksheetName(wsc))
|
||||||
value: wsc,
|
// if (wsc === aws) {
|
||||||
caption: api.asc_getWorksheetName(wsc)
|
// this.activeSheet = {
|
||||||
}
|
// value: wsc,
|
||||||
}
|
// caption: api.asc_getWorksheetName(wsc)
|
||||||
|
// }
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.sheets = items;
|
this.sheets = items;
|
||||||
|
@ -103,7 +105,7 @@ class EditLinkController extends Component {
|
||||||
defaultDisplay = url;
|
defaultDisplay = url;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.isLock) {
|
if (args.isLock) {
|
||||||
linkProps.asc_setText(null);
|
linkProps.asc_setText(null);
|
||||||
} else {
|
} else {
|
||||||
if (!displayText) {
|
if (!displayText) {
|
||||||
|
@ -131,7 +133,7 @@ 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}
|
// activeSheet={this.activeSheet}
|
||||||
currentSheet={this.currentSheet}
|
currentSheet={this.currentSheet}
|
||||||
onEditLink={this.onEditLink}
|
onEditLink={this.onEditLink}
|
||||||
onRemoveLink={this.onRemoveLink}
|
onRemoveLink={this.onRemoveLink}
|
||||||
|
|
|
@ -35,7 +35,7 @@ const PageTypeLink = ({curType, changeType, storeFocusObjects}) => {
|
||||||
const PageSheet = ({curSheet, sheets, changeSheet, storeFocusObjects}) => {
|
const PageSheet = ({curSheet, sheets, changeSheet, storeFocusObjects}) => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const _t = t('View.Edit', {returnObjects: true});
|
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);
|
const settings = !storeFocusObjects.focusOn ? [] : (storeFocusObjects.focusOn === 'obj' ? storeFocusObjects.objects : storeFocusObjects.selections);
|
||||||
if (storeFocusObjects.focusOn === 'obj' || settings.indexOf('hyperlink') === -1) {
|
if (storeFocusObjects.focusOn === 'obj' || settings.indexOf('hyperlink') === -1) {
|
||||||
|
@ -59,10 +59,10 @@ const PageSheet = ({curSheet, sheets, changeSheet, storeFocusObjects}) => {
|
||||||
key={`sheet-${sheet.value}`}
|
key={`sheet-${sheet.value}`}
|
||||||
title={sheet.caption}
|
title={sheet.caption}
|
||||||
radio
|
radio
|
||||||
checked={stateSheet === sheet.value}
|
checked={stateSheet === sheet.caption}
|
||||||
onClick={() => {
|
onChange={() => {
|
||||||
setSheet(sheet.value);
|
setSheet(sheet.caption);
|
||||||
changeSheet(sheet);
|
changeSheet(sheet.caption);
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
|
@ -80,13 +80,20 @@ const EditLink = props => {
|
||||||
const linkInfo = props.linkInfo;
|
const linkInfo = props.linkInfo;
|
||||||
const isLock = props.isLock;
|
const isLock = props.isLock;
|
||||||
const sheets = props.sheets;
|
const sheets = props.sheets;
|
||||||
const activeSheet = props.activeSheet;
|
|
||||||
const currentSheet = props.currentSheet;
|
const currentSheet = props.currentSheet;
|
||||||
|
|
||||||
|
console.log(linkInfo);
|
||||||
|
|
||||||
const valueLinkInfo = linkInfo.asc_getType();
|
const valueLinkInfo = linkInfo.asc_getType();
|
||||||
const linkSheet = (valueLinkInfo == Asc.c_oAscHyperlinkType.RangeLink) ? linkInfo.asc_getSheet() : currentSheet;
|
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 [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) => {
|
||||||
setTypeLink(newType);
|
setTypeLink(newType);
|
||||||
};
|
};
|
||||||
|
@ -98,7 +105,8 @@ const EditLink = props => {
|
||||||
|
|
||||||
const [screenTip, setScreenTip] = useState(linkInfo.asc_getTooltip());
|
const [screenTip, setScreenTip] = useState(linkInfo.asc_getTooltip());
|
||||||
|
|
||||||
const [curSheet, setSheet] = useState(activeSheet);
|
const [curSheet, setSheet] = useState(linkSheet);
|
||||||
|
|
||||||
const changeSheet = (sheet) => {
|
const changeSheet = (sheet) => {
|
||||||
setSheet(sheet);
|
setSheet(sheet);
|
||||||
};
|
};
|
||||||
|
@ -123,8 +131,8 @@ const EditLink = props => {
|
||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
{typeLink == Asc.c_oAscHyperlinkType.RangeLink &&
|
{typeLink == Asc.c_oAscHyperlinkType.RangeLink &&
|
||||||
<ListItem link={'/edit-link-sheet/'} title={_t.textSheet} after={linkSheet} routeProps={{
|
<ListItem link={'/edit-link-sheet/'} title={_t.textSheet} after={curSheet} routeProps={{
|
||||||
changeSheet: changeSheet,
|
changeSheet,
|
||||||
sheets,
|
sheets,
|
||||||
curSheet
|
curSheet
|
||||||
}}/>
|
}}/>
|
||||||
|
@ -158,8 +166,8 @@ const EditLink = props => {
|
||||||
<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) && ' disabled'}`}
|
||||||
onClick={() => {props.onEditLink(typeLink === 1 ?
|
onClick={() => {props.onEditLink(typeLink === 1 ?
|
||||||
{type: 1, url: link, text: stateDisplayText, tooltip: screenTip} :
|
{type: 1, url: link, text: stateDisplayText, tooltip: screenTip, isLock} :
|
||||||
{type: 2, url: range, sheet: curSheet.caption, text: stateDisplayText, tooltip: screenTip})}}
|
{type: 2, url: range, sheet: curSheet, text: stateDisplayText, tooltip: screenTip, isLock})}}
|
||||||
/>
|
/>
|
||||||
<ListButton title={_t.textRemoveLink}
|
<ListButton title={_t.textRemoveLink}
|
||||||
className={`button-fill button-red`}
|
className={`button-fill button-red`}
|
||||||
|
|
Loading…
Reference in a new issue