mirror of
https://github.com/ONLYOFFICE/web-apps.git
synced 2026-07-25 21:54:49 +08:00
Merge pull request 'feature/pdf-link' (#869) from feature/pdf-link into develop
This commit is contained in:
@ -672,10 +672,11 @@ define([
|
||||
});
|
||||
}
|
||||
|
||||
this.attachKeyEvents();
|
||||
|
||||
if (this.disabled)
|
||||
this.setDisabled(this.disabled);
|
||||
|
||||
this.attachKeyEvents();
|
||||
this.lastSelectedRec = null;
|
||||
this._layoutParams = undefined;
|
||||
},
|
||||
@ -989,7 +990,7 @@ define([
|
||||
if (this.enableKeyEvents && this.handleSelect) {
|
||||
var el = $(this.el).find('.inner').addBack().filter('.inner');
|
||||
el.addClass('canfocused');
|
||||
el.attr('tabindex', this.tabindex.toString());
|
||||
el.attr('tabindex', (this.tabindex || 0).toString());
|
||||
el.on((this.parentMenu && this.useBSKeydown) ? 'dataview:keydown' : 'keydown', _.bind(this.onKeyDown, this));
|
||||
el.on((this.parentMenu && this.useBSKeydown) ? 'dataview:keyup' : 'keyup', _.bind(this.onKeyUp, this));
|
||||
}
|
||||
@ -1013,6 +1014,12 @@ define([
|
||||
disabled = !!disabled;
|
||||
this.disabled = disabled;
|
||||
$(this.el).find('.inner').addBack().filter('.inner').toggleClass('disabled', disabled);
|
||||
|
||||
if (this.tabindex!==undefined) {
|
||||
var el = $(this.el).find('.inner').addBack().filter('.inner');
|
||||
disabled && (this.tabindex = el.attr('tabindex'));
|
||||
el.attr('tabindex', disabled ? "-1" : this.tabindex);
|
||||
}
|
||||
},
|
||||
|
||||
isDisabled: function() {
|
||||
|
||||
@ -254,6 +254,8 @@ define([
|
||||
},
|
||||
|
||||
onClickItem: function(view, record, e) {
|
||||
if ( this.disabled ) return;
|
||||
|
||||
var btn = $(e.target);
|
||||
if (btn && (btn.hasClass('tree-caret') || btn.hasClass('btn-tree-caret'))) {
|
||||
var tip = view.$el.data('bs.tooltip');
|
||||
|
||||
@ -20,7 +20,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
&:focus {
|
||||
&:focus:not(.disabled) {
|
||||
border-color: @border-preview-select-ie;
|
||||
border-color: @border-preview-select;
|
||||
}
|
||||
@ -31,12 +31,6 @@
|
||||
.box-shadow(none);
|
||||
margin: 0;
|
||||
|
||||
&:hover,
|
||||
&.over {
|
||||
background-color: @highlight-button-hover-ie;
|
||||
background-color: @highlight-button-hover;
|
||||
}
|
||||
|
||||
&.selected {
|
||||
background-color: @highlight-button-pressed-ie;
|
||||
background-color: @highlight-button-pressed;
|
||||
@ -47,7 +41,14 @@
|
||||
&.selected .empty {
|
||||
visibility: hidden;
|
||||
}
|
||||
}
|
||||
|
||||
&:not(.disabled) > .item {
|
||||
&:hover,
|
||||
&.over {
|
||||
background-color: @highlight-button-hover-ie;
|
||||
background-color: @highlight-button-hover;
|
||||
}
|
||||
}
|
||||
|
||||
.tree-item {
|
||||
@ -95,6 +96,18 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&.disabled {
|
||||
> .item {
|
||||
cursor: default;
|
||||
opacity: @component-disabled-opacity-ie;
|
||||
opacity: @component-disabled-opacity;
|
||||
}
|
||||
|
||||
.tree-caret {
|
||||
cursor: default;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.safari {
|
||||
|
||||
@ -165,7 +165,7 @@ define([
|
||||
me.api.asc_enableKeyEvents(false);
|
||||
},
|
||||
'modal:close': function(dlg) {
|
||||
Common.Utils.ModalWindow.close();
|
||||
dlg && dlg.isVisible() && Common.Utils.ModalWindow.close(); // close can be called after hiding
|
||||
if (!Common.Utils.ModalWindow.isVisible())
|
||||
me.api.asc_enableKeyEvents(true);
|
||||
},
|
||||
|
||||
@ -356,7 +356,7 @@ define([
|
||||
me.api.asc_enableKeyEvents(false);
|
||||
},
|
||||
'modal:close': function(dlg) {
|
||||
Common.Utils.ModalWindow.close();
|
||||
dlg && dlg.isVisible() && Common.Utils.ModalWindow.close(); // close can be called after hiding
|
||||
if (!Common.Utils.ModalWindow.isVisible())
|
||||
me.api.asc_enableKeyEvents(true);
|
||||
},
|
||||
|
||||
@ -286,6 +286,7 @@ define([
|
||||
var i = -1,
|
||||
in_equation = false,
|
||||
in_chart = false,
|
||||
no_paragraph = true,
|
||||
locked = false;
|
||||
while (++i < selectedElements.length) {
|
||||
var type = selectedElements[i].get_ObjectType();
|
||||
@ -294,12 +295,17 @@ define([
|
||||
} else if (type === Asc.c_oAscTypeSelectElement.Paragraph) {
|
||||
var value = selectedElements[i].get_ObjectValue();
|
||||
value && (locked = locked || value.get_Locked());
|
||||
no_paragraph = false;
|
||||
} else if (type === Asc.c_oAscTypeSelectElement.Shape) { // shape
|
||||
var value = selectedElements[i].get_ObjectValue();
|
||||
if (value && value.get_FromChart()) {
|
||||
in_chart = true;
|
||||
locked = locked || value.get_Locked();
|
||||
}
|
||||
if (value && !value.get_FromImage() && !value.get_FromChart())
|
||||
no_paragraph = false;
|
||||
} else if (type == Asc.c_oAscTypeSelectElement.Table) {
|
||||
no_paragraph = false;
|
||||
}
|
||||
}
|
||||
if (in_equation) {
|
||||
@ -310,6 +316,7 @@ define([
|
||||
this._state.chartLocked = locked;
|
||||
this.disableChartElementButton();
|
||||
}
|
||||
this._state.no_paragraph = no_paragraph;
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
@ -162,6 +162,7 @@ define([], function () {
|
||||
view.menuAddHyperlinkTable.on('click', _.bind(me.addHyperlink, me));
|
||||
view.menuEditHyperlinkPara.on('click', _.bind(me.editHyperlink, me));
|
||||
view.menuEditHyperlinkTable.on('click', _.bind(me.editHyperlink, me));
|
||||
view.menuPDFEditHyperlink.on('click', _.bind(me.editHyperlink, me));
|
||||
view.menuRemoveHyperlinkPara.on('click', _.bind(me.removeHyperlink, me));
|
||||
view.menuRemoveHyperlinkTable.on('click', _.bind(me.removeHyperlink, me));
|
||||
view.menuChartEdit.on('click', _.bind(me.editChartClick, me, undefined));
|
||||
@ -1963,7 +1964,8 @@ define([], function () {
|
||||
dh.editHyperlink = function(item, e){
|
||||
var win, me = this;
|
||||
if (me.api){
|
||||
var _arr = [];
|
||||
var _arr = [],
|
||||
isAnnotation = item.annotProps && item.annotProps.value;
|
||||
for (var i=0; i<me.api.getCountPages(); i++) {
|
||||
_arr.push({
|
||||
displayValue: i+1,
|
||||
@ -1975,11 +1977,14 @@ define([], function () {
|
||||
appOptions: me.mode,
|
||||
handler: function(dlg, result) {
|
||||
if (result == 'ok') {
|
||||
me.api.change_Hyperlink(win.getSettings());
|
||||
me.api.change_Hyperlink(win.getSettings(), isAnnotation ? item.annotProps.value.asc_getIds() : undefined );
|
||||
} else if (result === 'view') {
|
||||
me.api.SetLinkAnnotGoToAction(isAnnotation ? item.annotProps.value.asc_getIds() : undefined);
|
||||
}
|
||||
me.editComplete();
|
||||
},
|
||||
slides: _arr
|
||||
slides: _arr,
|
||||
isAnnotation: isAnnotation
|
||||
});
|
||||
win.show();
|
||||
win.setSettings(item.hyperProps.value);
|
||||
@ -2497,7 +2502,7 @@ define([], function () {
|
||||
dh.onDialogAddHyperlink = function() {
|
||||
var win, props, text;
|
||||
var me = this;
|
||||
if (me.api && me.mode.isEdit && !me._isDisabled && !PDFE.getController('LeftMenu').leftMenu.menuFile.isVisible()){
|
||||
if (me.api && me.mode.isEdit && !me._isDisabled && !PDFE.getController('LeftMenu').leftMenu.menuFile.isVisible() && !this._state.no_paragraph){ // show dialog only for table/shape
|
||||
var handlerDlg = function(dlg, result) {
|
||||
if (result == 'ok') {
|
||||
props = dlg.getSettings();
|
||||
|
||||
@ -66,7 +66,8 @@ define([
|
||||
Common.NotificationCenter.on('document:ready', _.bind(this.onDocumentReady, this));
|
||||
|
||||
this.binding = {
|
||||
checkInsertAutoshape: _.bind(this.checkInsertAutoshape, this)
|
||||
checkInsertAutoshape: _.bind(this.checkInsertAutoshape, this),
|
||||
checkInsertHyperlinkAnnot: _.bind(this.checkInsertHyperlinkAnnot, this)
|
||||
};
|
||||
PDFE.getCollection('ShapeGroups').bind({
|
||||
reset: this.onResetAutoshapes.bind(this)
|
||||
@ -85,6 +86,8 @@ define([
|
||||
this.api.asc_registerCallback('asc_onEndSmartArtPreview', _.bind(this.onApiEndSmartArtPreview, this));
|
||||
this.api.asc_registerCallback('asc_onFocusObject', _.bind(this.onApiFocusObject, this));
|
||||
this.api.asc_registerCallback('asc_onCanAddHyperlink', _.bind(this.onApiCanAddHyperlink, this));
|
||||
this.api.asc_registerCallback('asc_onLinkToolState', _.bind(this.onLinkToolState, this));
|
||||
this.api.asc_registerCallback('asc_onDialogAddAnnotLink', _.bind(this.onDialogAddAnnotLink, this));
|
||||
Common.NotificationCenter.on('storage:image-load', _.bind(this.openImageFromStorage, this));
|
||||
Common.NotificationCenter.on('storage:image-insert', _.bind(this.insertImageFromStorage, this));
|
||||
Common.Gateway.on('insertimage', _.bind(this.insertImage, this));
|
||||
@ -311,12 +314,27 @@ define([
|
||||
});
|
||||
},
|
||||
|
||||
onHyperlinkClick: function(btn) {
|
||||
onLinkToolState: function (state) {
|
||||
this.view && this.view.btnInsertHyperlink.toggle(state, true);
|
||||
},
|
||||
|
||||
onHyperlinkClick: function() {
|
||||
var me = this,
|
||||
win, props, text;
|
||||
|
||||
if (me.api){
|
||||
if (this._state.no_paragraph) {//add hyperlink annotation
|
||||
if (this.view.btnInsertHyperlink.pressed) {
|
||||
this.api.SetLinkTool(true);
|
||||
$(document.body).on('mouseup', this.binding.checkInsertHyperlinkAnnot);
|
||||
} else {
|
||||
this.api.SetLinkTool(false);
|
||||
$(document.body).off('mouseup', this.binding.checkInsertHyperlinkAnnot);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (me.api){// add hyperlink to text in shape
|
||||
this.view.btnInsertHyperlink.toggle(false, true);
|
||||
var handlerDlg = function(dlg, result) {
|
||||
if (result == 'ok') {
|
||||
props = dlg.getSettings();
|
||||
@ -364,6 +382,58 @@ define([
|
||||
Common.component.Analytics.trackEvent('ToolBar', 'Add Hyperlink');
|
||||
},
|
||||
|
||||
onDialogAddAnnotLink: function(arrIds) {
|
||||
$(document.body).off('mouseup', this.binding.checkInsertHyperlinkAnnot);
|
||||
|
||||
if (!this.api) return;
|
||||
|
||||
var me = this,
|
||||
res;
|
||||
var handlerDlg = function(dlg, result) {
|
||||
res = result;
|
||||
if (result === 'ok') {
|
||||
me.api.add_Hyperlink(dlg.getSettings(), arrIds);
|
||||
} else if (result === 'view') {
|
||||
me.api.SetLinkAnnotGoToAction(arrIds);
|
||||
}
|
||||
Common.NotificationCenter.trigger('edit:complete', me.view);
|
||||
};
|
||||
var _arr = [];
|
||||
for (var i=0; i<me.api.getCountPages(); i++) {
|
||||
_arr.push({
|
||||
displayValue: i+1,
|
||||
value: i
|
||||
});
|
||||
}
|
||||
var win = new PDFE.Views.HyperlinkSettingsDialog({
|
||||
api: me.api,
|
||||
appOptions: me.mode,
|
||||
isAnnotation: true,
|
||||
handler: handlerDlg,
|
||||
slides: _arr
|
||||
}).on('close', function() {
|
||||
(res!=='ok' && res!=='view') && me.api.asc_removeAnnots(arrIds);
|
||||
});
|
||||
win.show();
|
||||
win.setSettings();
|
||||
},
|
||||
|
||||
checkInsertHyperlinkAnnot: function(e) {
|
||||
var cmp = $(e.target),
|
||||
cmp_sdk = cmp.closest('#editor_sdk'),
|
||||
btn_id = cmp.closest('button').attr('id');
|
||||
if (btn_id===undefined)
|
||||
btn_id = cmp.closest('.btn-group').attr('id');
|
||||
if (cmp.attr('id') !== 'editor_sdk' && cmp_sdk.length<=0) {
|
||||
if ( this.view.btnInsertHyperlink.pressed && this.view.btnInsertHyperlink.id !== btn_id ) {
|
||||
this.api.SetLinkTool(false);
|
||||
$(document.body).off('mouseup', this.binding.checkInsertHyperlinkAnnot);
|
||||
this.view.btnInsertHyperlink.toggle(false, true);
|
||||
Common.NotificationCenter.trigger('edit:complete', this.view);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
onInsertTableClick: function(type, columns, rows) {
|
||||
if (type==='picker') {
|
||||
this.view.fireEvent('inserttable', this.view);
|
||||
@ -917,7 +987,8 @@ define([
|
||||
paragraph_locked = false,
|
||||
no_paragraph = true,
|
||||
in_chart = false,
|
||||
page_deleted = false;
|
||||
page_deleted = false,
|
||||
has_object = false;
|
||||
|
||||
while (++i < selectedObjects.length) {
|
||||
type = selectedObjects[i].get_ObjectType();
|
||||
@ -937,6 +1008,7 @@ define([
|
||||
} else if (type == Asc.c_oAscTypeSelectElement.PdfPage) {
|
||||
page_deleted = pr.asc_getDeleteLock();
|
||||
}
|
||||
has_object = has_object || type !== Asc.c_oAscTypeSelectElement.PdfPage; // not only page
|
||||
}
|
||||
|
||||
if (in_chart !== this._state.in_chart) {
|
||||
@ -945,17 +1017,22 @@ define([
|
||||
}
|
||||
|
||||
if (this._state.prcontrolsdisable !== paragraph_locked) {
|
||||
if (this._state.activated) this._state.prcontrolsdisable = paragraph_locked;
|
||||
this._state.prcontrolsdisable = paragraph_locked;
|
||||
Common.Utils.lockControls(Common.enumLock.paragraphLock, paragraph_locked===true, {array: this.view.lockedControls});
|
||||
}
|
||||
|
||||
if (this._state.no_paragraph !== no_paragraph) {
|
||||
if (this._state.activated) this._state.no_paragraph = no_paragraph;
|
||||
this._state.no_paragraph = no_paragraph;
|
||||
Common.Utils.lockControls(Common.enumLock.noParagraphSelected, no_paragraph, {array: this.view.lockedControls});
|
||||
}
|
||||
|
||||
if (this._state.object_without_paragraph !== no_paragraph && has_object) {
|
||||
this._state.object_without_paragraph = no_paragraph && has_object;
|
||||
Common.Utils.lockControls(Common.enumLock.noParagraphSelected, no_paragraph && has_object, {array: this.view.lockedControls});
|
||||
}
|
||||
|
||||
if (page_deleted !== undefined && this._state.pagecontrolsdisable !== page_deleted) {
|
||||
if (this._state.activated) this._state.pagecontrolsdisable = page_deleted;
|
||||
this._state.pagecontrolsdisable = page_deleted;
|
||||
Common.Utils.lockControls(Common.enumLock.pageDeleted, page_deleted, {array: this.view.lockedControls});
|
||||
}
|
||||
|
||||
@ -968,7 +1045,7 @@ define([
|
||||
onApiCanAddHyperlink: function(value) {
|
||||
if (this._state.can_hyper !== value) {
|
||||
Common.Utils.lockControls(Common.enumLock.hyperlinkLock, !value, {array: [this.view.btnInsertHyperlink]});
|
||||
if (this._state.activated) this._state.can_hyper = value;
|
||||
this._state.can_hyper = value;
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
@ -307,7 +307,7 @@ define([
|
||||
me.api.asc_enableKeyEvents(false);
|
||||
},
|
||||
'modal:close': function(dlg) {
|
||||
Common.Utils.ModalWindow.close();
|
||||
dlg && dlg.isVisible() && Common.Utils.ModalWindow.close(); // close can be called after hiding
|
||||
if (!Common.Utils.ModalWindow.isVisible())
|
||||
me.api.asc_enableKeyEvents(true);
|
||||
},
|
||||
|
||||
@ -136,6 +136,10 @@ define([], function () {
|
||||
caption : me.removeCommentText
|
||||
});
|
||||
|
||||
me.menuPDFEditHyperlink = new Common.UI.MenuItem({
|
||||
caption : me.editHyperlinkText
|
||||
});
|
||||
|
||||
this.editPDFModeMenu = new Common.UI.Menu({
|
||||
cls: 'shifted-right',
|
||||
initMenu: function (value) {
|
||||
@ -145,10 +149,17 @@ define([], function () {
|
||||
me.menuEditAddComment.setDisabled(disabled);
|
||||
me.menuEditRemoveComment.setVisible(value && value.annotProps && value.annotProps.value);
|
||||
me.menuEditRemoveComment.setDisabled(disabled);
|
||||
|
||||
me.menuPDFEditHyperlink.setVisible(value.annotProps && value.annotProps.value && value.annotProps.value.asc_getType()===AscPDF.ANNOTATIONS_TYPES.Link && !_.isUndefined(value.hyperProps));
|
||||
me.menuPDFEditHyperlink.setDisabled(disabled);
|
||||
me.menuPDFEditHyperlink.hyperProps = value.hyperProps;
|
||||
me.menuPDFEditHyperlink.annotProps = value.annotProps;
|
||||
|
||||
},
|
||||
items: [
|
||||
me.menuPDFEditCopy,
|
||||
me.menuEditAddComment,
|
||||
me.menuPDFEditHyperlink,
|
||||
me.menuEditRemoveComment
|
||||
]
|
||||
}).on('hide:after', function (menu, e, isFromInputControl) {
|
||||
|
||||
@ -48,21 +48,20 @@ var c_oHyperlinkType = {
|
||||
define([], function () { 'use strict';
|
||||
|
||||
PDFE.Views.HyperlinkSettingsDialog = Common.UI.Window.extend(_.extend({
|
||||
options: {
|
||||
width: 350,
|
||||
style: 'min-width: 230px;',
|
||||
cls: 'modal-dlg',
|
||||
id: 'window-hyperlink-settings',
|
||||
buttons: ['ok', 'cancel']
|
||||
},
|
||||
|
||||
initialize : function(options) {
|
||||
_.extend(this.options, {
|
||||
title: this.textTitle
|
||||
var _options = {};
|
||||
_.extend(_options, {
|
||||
title: this.textTitle,
|
||||
width: 350,
|
||||
style: 'min-width: 230px;',
|
||||
cls: 'modal-dlg',
|
||||
id: 'window-hyperlink-settings',
|
||||
buttons: ['ok', 'cancel']
|
||||
}, options || {});
|
||||
|
||||
this.template = [
|
||||
'<div class="box" style="height: 330px;">',
|
||||
'<div class="box" style="height: ' + (options.isAnnotation ? 280 : 330) + 'px;">',
|
||||
'<div style="margin-bottom: 10px;">',
|
||||
'<button type="button" class="btn btn-text-default auto" id="id-dlg-hyperlink-external">', this.textExternalLink,'</button>',
|
||||
'<button type="button" class="btn btn-text-default auto" id="id-dlg-hyperlink-internal">', this.textInternalLink,'</button>',
|
||||
@ -78,25 +77,27 @@ define([], function () { 'use strict';
|
||||
'<label>' + this.strLinkTo + '</label>',
|
||||
'</div>',
|
||||
'<div id="id-dlg-hyperlink-list" style="width:100%; height: 171px;"></div>',
|
||||
'<div id="id-dlg-hyperlink-chb-page" class="input-row" style="margin-top: 15px;"></div>',
|
||||
'</div>',
|
||||
'<div class="input-row">',
|
||||
'<div class="input-row not-annotation">',
|
||||
'<label>' + this.strDisplay + '</label>',
|
||||
'</div>',
|
||||
'<div id="id-dlg-hyperlink-display" class="input-row" style="margin-bottom: 5px;"></div>',
|
||||
'<div class="input-row">',
|
||||
'<div id="id-dlg-hyperlink-display" class="input-row not-annotation" style="margin-bottom: 5px;"></div>',
|
||||
'<div class="input-row not-annotation">',
|
||||
'<label>' + this.textTipText + '</label>',
|
||||
'</div>',
|
||||
'<div id="id-dlg-hyperlink-tip" class="input-row" style="margin-bottom: 5px;"></div>',
|
||||
'<div id="id-dlg-hyperlink-tip" class="input-row not-annotation" style="margin-bottom: 5px;"></div>',
|
||||
'</div>'
|
||||
].join('');
|
||||
|
||||
this.options.tpl = _.template(this.template)(this.options);
|
||||
this.slides = this.options.slides;
|
||||
this.api = this.options.api;
|
||||
_options.tpl = _.template(this.template)(_options);
|
||||
this.slides = _options.slides;
|
||||
this.api = _options.api;
|
||||
this.urlType = AscCommon.c_oAscUrlType.Invalid;
|
||||
this.appOptions = this.options.appOptions;
|
||||
this.appOptions = _options.appOptions;
|
||||
this.isAnnotation = !!_options.isAnnotation;
|
||||
|
||||
Common.UI.Window.prototype.initialize.call(this, this.options);
|
||||
Common.UI.Window.prototype.initialize.call(this, _options);
|
||||
},
|
||||
|
||||
render: function() {
|
||||
@ -180,6 +181,15 @@ define([], function () { 'use strict';
|
||||
});
|
||||
me.internalList.on('item:select', _.bind(this.onSelectItem, this));
|
||||
|
||||
me.chPageView = new Common.UI.CheckBox({
|
||||
el: $window.find('#id-dlg-hyperlink-chb-page'),
|
||||
labelText: this.txtPageView
|
||||
}).on('change', function(field, newValue, oldValue, eOpts){
|
||||
me.internalList.setDisabled(newValue==='checked');
|
||||
var rec = me.internalList.getSelectedRec();
|
||||
me.btnOk.setDisabled((!rec || rec.get('index')==4) && (newValue!=='checked'));
|
||||
});
|
||||
|
||||
me.btnOk = _.find(this.getFooterButtons(), function (item) {
|
||||
return (item.$el && item.$el.find('.primary').addBack().filter('.primary').length>0);
|
||||
}) || new Common.UI.Button({ el: $window.find('.primary') });
|
||||
@ -189,10 +199,15 @@ define([], function () { 'use strict';
|
||||
me.internalList.on('entervalue', _.bind(me.onPrimary, me));
|
||||
me.externalPanel = $window.find('#id-external-link');
|
||||
me.internalPanel = $window.find('#id-internal-link');
|
||||
|
||||
if (me.isAnnotation) {
|
||||
$window.find('.not-annotation').addClass('hidden');
|
||||
} else
|
||||
me.chPageView.setVisible(false);
|
||||
},
|
||||
|
||||
getFocusedComponents: function() {
|
||||
return [this.btnExternal, this.btnInternal, this.inputUrl, this.internalList, this.inputDisplay, this.inputTip].concat(this.getFooterButtons());
|
||||
return [this.btnExternal, this.btnInternal, this.inputUrl, this.internalList, this.inputDisplay, this.inputTip, this.chPageView].concat(this.getFooterButtons());
|
||||
},
|
||||
|
||||
setSettings: function (props) {
|
||||
@ -214,7 +229,11 @@ define([], function () { 'use strict';
|
||||
this.isTextChanged = false;
|
||||
this.inputTip.setValue(props.get_ToolTip());
|
||||
|
||||
this.isAnnotation && this.chPageView.setValue(props.get_PageView());
|
||||
me._originalProps = props;
|
||||
} else {
|
||||
this.btnExternal.toggle(true);
|
||||
this.ShowHideElem(c_oHyperlinkType.WebLink);
|
||||
}
|
||||
},
|
||||
|
||||
@ -233,7 +252,7 @@ define([], function () { 'use strict';
|
||||
tip = rec.get('tiptext');
|
||||
}
|
||||
props.put_Value( url );
|
||||
props.put_ToolTip(_.isEmpty(txttip) ? tip : txttip);
|
||||
!this.isAnnotation && props.put_ToolTip(_.isEmpty(txttip) ? tip : txttip);
|
||||
def_display = tip;
|
||||
} else {
|
||||
var url = $.trim(me.inputUrl.getValue());
|
||||
@ -241,17 +260,17 @@ define([], function () { 'use strict';
|
||||
url = ( (me.urlType==AscCommon.c_oAscUrlType.Email) ? 'mailto:' : 'http://' ) + url;
|
||||
url = url.replace(new RegExp("%20",'g')," ");
|
||||
props.put_Value( url );
|
||||
props.put_ToolTip(me.inputTip.getValue());
|
||||
!this.isAnnotation && props.put_ToolTip(me.inputTip.getValue());
|
||||
def_display = url;
|
||||
}
|
||||
|
||||
if (!me.inputDisplay.isDisabled() && (me.isTextChanged || _.isEmpty(me.inputDisplay.getValue()))) {
|
||||
if (_.isEmpty(me.inputDisplay.getValue()) || type==c_oHyperlinkType.WebLink && me.isAutoUpdate)
|
||||
me.inputDisplay.setValue(def_display);
|
||||
props.put_Text(me.inputDisplay.getValue());
|
||||
!this.isAnnotation && props.put_Text(me.inputDisplay.getValue());
|
||||
}
|
||||
else
|
||||
props.put_Text(null);
|
||||
!this.isAnnotation && props.put_Text(null);
|
||||
|
||||
return props;
|
||||
},
|
||||
@ -272,18 +291,77 @@ define([], function () { 'use strict';
|
||||
|
||||
if (this.options.handler) {
|
||||
if (state == 'ok') {
|
||||
var checkurl = (this.btnExternal.isActive()) ? this.inputUrl.checkValidate() : true,
|
||||
checkdisp = this.inputDisplay.checkValidate();
|
||||
if (this.isAnnotation && this.btnInternal.isActive() && this.chPageView.getValue()==='checked') {
|
||||
var me = this;
|
||||
me.hide();
|
||||
|
||||
Common.NotificationCenter.trigger('editing:disable', true, {
|
||||
viewMode: true,
|
||||
allowSignature: false,
|
||||
statusBar: true,
|
||||
rightMenu: {clear: true, disable: true},
|
||||
leftMenu: {disable: true, previewMode: true},
|
||||
fileMenu: {protect: true},
|
||||
navigation: {disable: true, previewMode: true},
|
||||
comments: {disable: true, previewMode: true},
|
||||
chat: true,
|
||||
viewport: true,
|
||||
documentHolder: {clear: true, disable: true},
|
||||
toolbar: true,
|
||||
plugins: false,
|
||||
header: {docmode: true, search: true},
|
||||
shortcuts: true
|
||||
}, 'setlink');
|
||||
me.api.SetCanInteract(false);
|
||||
Common.UI.alert({
|
||||
modal: false,
|
||||
maxwidth: 400,
|
||||
title: this.txtCreateLink,
|
||||
msg: this.txtCreateDesc,
|
||||
buttons: [ {caption: this.txtSetLink, primary: true, value: 'ok'},
|
||||
'cancel'],
|
||||
callback: function(btn){
|
||||
if (btn === 'ok') {
|
||||
me.options.handler.call(me, me, 'view');
|
||||
}
|
||||
me.close();
|
||||
Common.NotificationCenter.trigger('editing:disable', false, {
|
||||
viewMode: false,
|
||||
allowSignature: false,
|
||||
statusBar: true,
|
||||
rightMenu: {clear: true, disable: true},
|
||||
leftMenu: {disable: true, previewMode: true},
|
||||
fileMenu: {protect: true},
|
||||
navigation: {disable: true, previewMode: true},
|
||||
comments: {disable: true, previewMode: true},
|
||||
chat: true,
|
||||
viewport: true,
|
||||
documentHolder: {clear: true, disable: true},
|
||||
toolbar: true,
|
||||
plugins: false,
|
||||
header: {docmode: true, search: true},
|
||||
shortcuts: true
|
||||
}, 'setlink');
|
||||
me.api.SetCanInteract(true);
|
||||
}
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
var checkurl = (this.btnExternal.isActive()) ? this.inputUrl.checkValidate() : true;
|
||||
if (checkurl !== true) {
|
||||
this.isInputFirstChange = true;
|
||||
this.inputUrl.focus();
|
||||
return;
|
||||
}
|
||||
if (checkdisp !== true) {
|
||||
this.inputDisplay.focus();
|
||||
return;
|
||||
if (!this.isAnnotation) {
|
||||
var checkdisp = this.inputDisplay.checkValidate();
|
||||
if (checkdisp !== true) {
|
||||
this.inputDisplay.focus();
|
||||
return;
|
||||
}
|
||||
!this._originalProps.get_Value() && Common.Utils.InternalSettings.set("pdfe-settings-link-type", this.btnInternal.isActive());
|
||||
}
|
||||
!this._originalProps.get_Value() && Common.Utils.InternalSettings.set("pdfe-settings-link-type", this.btnInternal.isActive());
|
||||
}
|
||||
this.options.handler.call(this, this, state);
|
||||
}
|
||||
@ -378,7 +456,7 @@ define([], function () { 'use strict';
|
||||
}
|
||||
var rec = this.internalList.getSelectedRec();
|
||||
rec && this.internalList.scrollToRecord(rec);
|
||||
this.btnOk.setDisabled(!rec || rec.get('index')==4);
|
||||
this.btnOk.setDisabled((!rec || rec.get('index')==4) && !(this.isAnnotation && this.chPageView.getValue()==='checked'));
|
||||
var me = this;
|
||||
_.delay(function(){
|
||||
me.inputDisplay.focus();
|
||||
@ -421,7 +499,7 @@ define([], function () { 'use strict';
|
||||
|
||||
onSelectItem: function(picker, item, record, e){
|
||||
if (!record) return;
|
||||
this.btnOk.setDisabled(record.get('index')==4);
|
||||
this.btnOk.setDisabled(record.get('index')==4 && !(this.isAnnotation && this.chPageView.getValue()==='checked'));
|
||||
if (this.isAutoUpdate) {
|
||||
this.inputDisplay.setValue((record.get('level') || record.get('index')<4) ? record.get('name') : '');
|
||||
this.isTextChanged = true;
|
||||
|
||||
@ -218,7 +218,8 @@ define([
|
||||
cls: 'btn-toolbar x-huge icon-top',
|
||||
iconCls: 'toolbar__icon btn-big-inserthyperlink',
|
||||
caption: me.capInsertHyperlink,
|
||||
lock: [_set.hyperlinkLock, _set.paragraphLock, _set.lostConnect, _set.noParagraphSelected],
|
||||
lock: [_set.hyperlinkLock, _set.paragraphLock, _set.lostConnect, _set.objectWithoutParagraph],
|
||||
enableToggle: true,
|
||||
dataHint: '1',
|
||||
dataHintDirection: 'bottom',
|
||||
dataHintOffset: 'small'
|
||||
|
||||
@ -105,7 +105,8 @@ define([
|
||||
cantAlign: 'cant-align',
|
||||
cantSave: 'cant-save',
|
||||
cantRotatePage: 'cant-rotate-page',
|
||||
cantDelPage: 'cant-del-page'
|
||||
cantDelPage: 'cant-del-page',
|
||||
objectWithoutParagraph: 'object-without-paragraph',
|
||||
};
|
||||
for (var key in enumLock) {
|
||||
if (enumLock.hasOwnProperty(key)) {
|
||||
|
||||
@ -2329,6 +2329,10 @@
|
||||
"PDFE.Views.HyperlinkSettingsDialog.txtPrev": "Previous page",
|
||||
"PDFE.Views.HyperlinkSettingsDialog.txtSizeLimit": "This field is limited to 2083 characters",
|
||||
"PDFE.Views.HyperlinkSettingsDialog.txtUrlPlaceholder": "Enter the web address or select a file",
|
||||
"PDFE.Views.HyperlinkSettingsDialog.txtCreateLink": "Create Go to view",
|
||||
"PDFE.Views.HyperlinkSettingsDialog.txtCreateDesc": "Use the scrollbars, mouse, and zoom to select the target view, then press Set link to create the link destination.",
|
||||
"PDFE.Views.HyperlinkSettingsDialog.txtSetLink": "Set link",
|
||||
"PDFE.Views.HyperlinkSettingsDialog.txtPageView": "Go to a page view",
|
||||
"PDFE.Views.ImageSettings.strTransparency": "Opacity",
|
||||
"PDFE.Views.ImageSettings.textAdvanced": "Show advanced settings",
|
||||
"PDFE.Views.ImageSettings.textCrop": "Crop",
|
||||
|
||||
@ -326,7 +326,7 @@ define([
|
||||
me.api.asc_enableKeyEvents(false);
|
||||
},
|
||||
'modal:close': function(dlg) {
|
||||
Common.Utils.ModalWindow.close();
|
||||
dlg && dlg.isVisible() && Common.Utils.ModalWindow.close(); // close can be called after hiding
|
||||
if (!Common.Utils.ModalWindow.isVisible())
|
||||
me.api.asc_enableKeyEvents(true);
|
||||
},
|
||||
|
||||
@ -355,7 +355,7 @@ define([
|
||||
me.api.asc_enableKeyEvents(false);
|
||||
},
|
||||
'modal:close': function(dlg) {
|
||||
Common.Utils.ModalWindow.close();
|
||||
dlg && dlg.isVisible() && Common.Utils.ModalWindow.close(); // close can be called after hiding
|
||||
if (!Common.Utils.ModalWindow.isVisible())
|
||||
me.api.asc_enableKeyEvents(true);
|
||||
},
|
||||
|
||||
@ -263,7 +263,7 @@ define([
|
||||
me.api.asc_enableKeyEvents(false);
|
||||
},
|
||||
'modal:close': function(dlg) {
|
||||
Common.Utils.ModalWindow.close();
|
||||
dlg && dlg.isVisible() && Common.Utils.ModalWindow.close(); // close can be called after hiding
|
||||
if (!Common.Utils.ModalWindow.isVisible())
|
||||
me.api.asc_enableKeyEvents(true);
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user