Bug 44821: save type of the last added hyperlink

This commit is contained in:
Julia Radzhabova 2020-03-17 10:42:03 +03:00
parent f6f64218d2
commit e826d8a8e1
3 changed files with 9 additions and 6 deletions

View file

@ -308,7 +308,7 @@ define([
var me = this; var me = this;
var bookmark = props.get_Bookmark(), var bookmark = props.get_Bookmark(),
type = (bookmark === null || bookmark=='') ? c_oHyperlinkType.WebLink : c_oHyperlinkType.InternalLink; type = (bookmark === null || bookmark=='') ? ((props.get_Value() || !Common.Utils.InternalSettings.get("de-settings-link-type")) ? c_oHyperlinkType.WebLink : c_oHyperlinkType.InternalLink) : c_oHyperlinkType.InternalLink;
(type == c_oHyperlinkType.WebLink) ? me.btnExternal.toggle(true) : me.btnInternal.toggle(true); (type == c_oHyperlinkType.WebLink) ? me.btnExternal.toggle(true) : me.btnInternal.toggle(true);
me.ShowHideElem(type); me.ShowHideElem(type);
@ -426,6 +426,7 @@ define([
this.inputDisplay.cmpEl.find('input').focus(); this.inputDisplay.cmpEl.find('input').focus();
return; return;
} }
(!this._originalProps.get_Bookmark() && !this._originalProps.get_Value()) && Common.Utils.InternalSettings.set("de-settings-link-type", this.btnInternal.isActive()); // save last added hyperlink
} }
this.options.handler.call(this, this, state); this.options.handler.call(this, this, state);

View file

@ -210,6 +210,7 @@ define([
me.inputUrl.cmpEl.find('input').focus(); me.inputUrl.cmpEl.find('input').focus();
},50); },50);
} }
me._originalProps = props;
} }
}, },
@ -275,8 +276,8 @@ define([
this.inputDisplay.cmpEl.find('input').focus(); this.inputDisplay.cmpEl.find('input').focus();
return; return;
} }
!this._originalProps.get_Value() && Common.Utils.InternalSettings.set("pe-settings-link-type", this.btnInternal.isActive());
} }
this.options.handler.call(this, this, state); this.options.handler.call(this, this, state);
} }
@ -390,7 +391,7 @@ define([
parseUrl: function(url) { parseUrl: function(url) {
if (url===null || url===undefined || url=='' ) if (url===null || url===undefined || url=='' )
return c_oHyperlinkType.WebLink; return Common.Utils.InternalSettings.get("pe-settings-link-type") ? c_oHyperlinkType.InternalLink : c_oHyperlinkType.WebLink;
var indAction = url.indexOf("ppaction://hlink"); var indAction = url.indexOf("ppaction://hlink");
if (0 == indAction) if (0 == indAction)

View file

@ -220,16 +220,16 @@ define([
var me = this; var me = this;
me.settings = settings; me.settings = settings;
var type = (settings.props) ? settings.props.asc_getType() : Asc.c_oAscHyperlinkType.WebLink; var type = (settings.props) ? settings.props.asc_getType() : (Common.Utils.InternalSettings.get("sse-settings-link-type") ? Asc.c_oAscHyperlinkType.RangeLink : Asc.c_oAscHyperlinkType.WebLink);
(type == Asc.c_oAscHyperlinkType.WebLink) ? me.btnExternal.toggle(true) : me.btnInternal.toggle(true); (type == Asc.c_oAscHyperlinkType.WebLink) ? me.btnExternal.toggle(true) : me.btnInternal.toggle(true);
me.ShowHideElem(type, settings.props); me.ShowHideElem(type, settings.props);
me.btnInternal.setDisabled(!settings.allowInternal && (type == Asc.c_oAscHyperlinkType.WebLink)); me.btnInternal.setDisabled(!settings.allowInternal && (type == Asc.c_oAscHyperlinkType.WebLink));
me.btnExternal.setDisabled(!settings.allowInternal && (type == Asc.c_oAscHyperlinkType.RangeLink)); me.btnExternal.setDisabled(!settings.allowInternal && (type == Asc.c_oAscHyperlinkType.RangeLink));
var defrange = ''; var defrange = '';
if (!settings.props) { if (!settings.props) { // add link
this.inputDisplay.setValue(settings.isLock ? this.textDefault : settings.text); this.inputDisplay.setValue(settings.isLock ? this.textDefault : settings.text);
this.focusedInput = this.inputUrl.cmpEl.find('input'); this.focusedInput = (type == Asc.c_oAscHyperlinkType.WebLink) ? this.inputUrl.cmpEl.find('input') : this.inputRange.cmpEl.find('input');
} else { } else {
if (type == Asc.c_oAscHyperlinkType.RangeLink) { if (type == Asc.c_oAscHyperlinkType.RangeLink) {
if (settings.props.asc_getSheet()) { if (settings.props.asc_getSheet()) {
@ -324,6 +324,7 @@ define([
this.inputDisplay.cmpEl.find('input').focus(); this.inputDisplay.cmpEl.find('input').focus();
return; return;
} }
!this.settings.props && Common.Utils.InternalSettings.set("sse-settings-link-type", this.btnInternal.isActive()); // save last added hyperlink
} }
this.options.handler.call(this, this, state); this.options.handler.call(this, this, state);