[SSE] Get link to the internal range

This commit is contained in:
Julia Radzhabova 2020-03-20 15:29:47 +03:00
parent b8ecc04c35
commit 664fae40e5
6 changed files with 71 additions and 2 deletions

View file

@ -258,7 +258,7 @@
line-height: @input-height-base;
}
div {
& > div {
display: inline-block;
}
}

View file

@ -530,6 +530,7 @@ define([
win = new SSE.Views.HyperlinkSettingsDialog({
api: me.api,
appOptions: me.permissions,
handler: handlerDlg
});

View file

@ -351,6 +351,7 @@ define([
this.appOptions.compatibleFeatures = (typeof (this.appOptions.customization) == 'object') && !!this.appOptions.customization.compatibleFeatures;
this.appOptions.canRequestSharingSettings = this.editorConfig.canRequestSharingSettings;
this.appOptions.mentionShare = !((typeof (this.appOptions.customization) == 'object') && (this.appOptions.customization.mentionShare==false));
this.appOptions.canMakeActionLink = this.editorConfig.canMakeActionLink;
this.headerView = this.getApplication().getController('Viewport').getView('Common.Views.Header');
this.headerView.setCanBack(this.appOptions.canBackToFolder === true, (this.appOptions.canBackToFolder) ? this.editorConfig.customization.goback.text : '')

View file

@ -899,6 +899,7 @@ define([
props = cell.asc_getHyperlink();
win = new SSE.Views.HyperlinkSettingsDialog({
api: me.api,
appOptions: me.appOptions,
handler: handlerDlg
});

View file

@ -78,6 +78,13 @@ define([
'<div id="id-internal-link" class="hidden">',
'<div class="input-row">',
'<label>' + this.strLinkTo + '</label>',
'<div style="display: inline-block; position: relative;min-width: 150px;float: right;">',
'<label class="link dropdown-toggle" data-toggle="dropdown" id="id-dlg-hyperlink-get-link" style="line-height: 14px; margin-top: 3px;float: right;">' + this.textGetLink + '</label>',
'<div id="id-clip-copy-box" class="dropdown-menu" style="width: 291px; left: -139px; padding: 10px;">',
'<div id="id-dlg-clip-copy"></div>',
'<button id="id-dlg-copy-btn" class="btn btn-text-default" style="margin-left: 5px; width: 86px;">' + this.textCopy + '</button>',
'</div>',
'</div>',
'</div>',
'<div id="id-dlg-hyperlink-list" style="width:100%; height: 115px;border: 1px solid #cfcfcf;"></div>',
'<div class="input-row">',
@ -98,6 +105,7 @@ define([
this.options.tpl = _.template(this.template)(this.options);
this.api = this.options.api;
this.appOptions = options.appOptions;
Common.UI.Window.prototype.initialize.call(this, this.options);
},
@ -195,6 +203,37 @@ define([
});
me.internalList.on('item:select', _.bind(this.onSelectItem, this));
if (me.appOptions && me.appOptions.canMakeActionLink) {
var inputCopy = new Common.UI.InputField({
el : $('#id-dlg-clip-copy'),
editable : false,
style : 'width: 176px;'
});
var copyBox = $window.find('#id-clip-copy-box');
copyBox.on('click', _.bind(function() {
return false;
}, this));
copyBox.parent().on({
'shown.bs.dropdown': function () {
_.delay(function(){
inputCopy._input.select().focus();
},100);
}
});
copyBox.find('button').on('click', function() {
inputCopy._input.select();
document.execCommand("copy");
});
Common.Gateway.on('setactionlink', function (url) {
inputCopy.setValue(url);
});
}
me.linkGetLink = $('#id-dlg-hyperlink-get-link');
me.linkGetLink.toggleClass('hidden', !(me.appOptions && me.appOptions.canMakeActionLink));
me.btnOk = new Common.UI.Button({
el: $window.find('.primary'),
disabled: true
@ -202,6 +241,8 @@ define([
$window.find('.dlg-btn').on('click', _.bind(this.onBtnClick, this));
me.internalList.on('entervalue', _.bind(me.onPrimary, me));
$window.on('click', '#id-dlg-hyperlink-get-link', _.bind(me.getLink, me));
me.externalPanel = $window.find('#id-external-link');
me.internalPanel = $window.find('#id-internal-link');
},
@ -438,6 +479,27 @@ define([
this.inputDisplay.setValue(list + ((list!=='' && val!=='') ? '!' : '') + val);
}
}
this.linkGetLink.toggleClass('disabled', record.get('level')==0);
},
getLink: function(btn) {
if (btn.cmpEl && btn.cmpEl.parent().hasClass('open')) return;
var record = this.internalList.getSelectedRec();
if (record && record.get('level')) {
var name = record.get('name');
if (record.get('type')==1) {
this.inputDisplay.setValue(name);
} else {
var val = this.inputRange.getValue();
name = (name + ((name!=='' && val!=='') ? '!' : '') + val);
}
name && Common.Gateway.requestMakeActionLink({
action: {
type: "internalLink", data: name
}
});
}
},
textTitle: 'Hyperlink Settings',
@ -456,6 +518,8 @@ define([
txtNotUrl: 'This field should be a URL in the format \"http://www.example.com\"',
textDefault: 'Selected range',
textSheets: 'Sheets',
textNames: 'Defined names'
textNames: 'Defined names',
textGetLink: 'Get Link',
textCopy: 'Copy'
}, SSE.Views.HyperlinkSettingsDialog || {}))
});

View file

@ -1771,6 +1771,8 @@
"SSE.Views.HyperlinkSettingsDialog.txtNotUrl": "This field should be a URL in the \"http://www.example.com\" format",
"SSE.Views.HyperlinkSettingsDialog.textSheets": "Sheets",
"SSE.Views.HyperlinkSettingsDialog.textNames": "Defined names",
"SSE.Views.HyperlinkSettingsDialog.textGetLink": "Get Link",
"SSE.Views.HyperlinkSettingsDialog.textCopy": "Copy",
"SSE.Views.ImageSettings.textAdvanced": "Show advanced settings",
"SSE.Views.ImageSettings.textCrop": "Crop",
"SSE.Views.ImageSettings.textCropFill": "Fill",