Merge branch 'develop' of https://github.com/ONLYOFFICE/web-apps into develop
This commit is contained in:
commit
9b0341cf0b
|
@ -74,7 +74,7 @@ define([
|
||||||
if ( this.isFolded ) {
|
if ( this.isFolded ) {
|
||||||
if ( $(e.target).parents('.toolbar, #file-menu-panel').length ){
|
if ( $(e.target).parents('.toolbar, #file-menu-panel').length ){
|
||||||
} else {
|
} else {
|
||||||
this.collapse();
|
optsFold.$bar && optsFold.$bar.hasClass('expanded') && this.collapse();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,7 +41,6 @@
|
||||||
|
|
||||||
define([
|
define([
|
||||||
'core',
|
'core',
|
||||||
'common/main/lib/component/Calendar',
|
|
||||||
'documenteditor/main/app/view/Links',
|
'documenteditor/main/app/view/Links',
|
||||||
'documenteditor/main/app/view/NoteSettingsDialog',
|
'documenteditor/main/app/view/NoteSettingsDialog',
|
||||||
'documenteditor/main/app/view/HyperlinkSettingsDialog',
|
'documenteditor/main/app/view/HyperlinkSettingsDialog',
|
||||||
|
@ -96,7 +95,6 @@ define([
|
||||||
Common.NotificationCenter.on('api:disconnect', _.bind(this.onCoAuthoringDisconnect, this));
|
Common.NotificationCenter.on('api:disconnect', _.bind(this.onCoAuthoringDisconnect, this));
|
||||||
this.api.asc_registerCallback('asc_onShowContentControlsActions',_.bind(this.onShowContentControlsActions, this));
|
this.api.asc_registerCallback('asc_onShowContentControlsActions',_.bind(this.onShowContentControlsActions, this));
|
||||||
this.api.asc_registerCallback('asc_onHideContentControlsActions',_.bind(this.onHideContentControlsActions, this));
|
this.api.asc_registerCallback('asc_onHideContentControlsActions',_.bind(this.onHideContentControlsActions, this));
|
||||||
|
|
||||||
}
|
}
|
||||||
return this;
|
return this;
|
||||||
},
|
},
|
||||||
|
@ -402,155 +400,10 @@ define([
|
||||||
onHideContentControlsActions: function() {
|
onHideContentControlsActions: function() {
|
||||||
this.view.contentsMenu && this.view.contentsMenu.hide();
|
this.view.contentsMenu && this.view.contentsMenu.hide();
|
||||||
this.view.contentsUpdateMenu && this.view.contentsUpdateMenu.hide();
|
this.view.contentsUpdateMenu && this.view.contentsUpdateMenu.hide();
|
||||||
this.view.listControlMenu && this.view.listControlMenu.isVisible() && this.view.listControlMenu.hide();
|
|
||||||
var controlsContainer = this.getApplication().getController('DocumentHolder').documentHolder.cmpEl.find('#calendar-control-container');
|
|
||||||
if (controlsContainer.is(':visible'))
|
|
||||||
controlsContainer.hide();
|
|
||||||
},
|
|
||||||
|
|
||||||
onShowDateActions: function(obj, x, y) {
|
|
||||||
var props = obj.pr,
|
|
||||||
specProps = props.get_DateTimePr(),
|
|
||||||
documentHolderView = this.getApplication().getController('DocumentHolder').documentHolder,
|
|
||||||
controlsContainer = documentHolderView.cmpEl.find('#calendar-control-container'),
|
|
||||||
me = this;
|
|
||||||
|
|
||||||
this._state.dateObj = props;
|
|
||||||
|
|
||||||
if (controlsContainer.length < 1) {
|
|
||||||
controlsContainer = $('<div id="calendar-control-container" style="position: absolute;z-index: 1000;"><div id="id-document-calendar-control" style="position: fixed; left: -1000px; top: -1000px;"></div></div>');
|
|
||||||
documentHolderView.cmpEl.append(controlsContainer);
|
|
||||||
}
|
|
||||||
|
|
||||||
Common.UI.Menu.Manager.hideAll();
|
|
||||||
|
|
||||||
controlsContainer.css({left: x, top : y});
|
|
||||||
controlsContainer.show();
|
|
||||||
|
|
||||||
if (!this.cmpCalendar) {
|
|
||||||
this.cmpCalendar = new Common.UI.Calendar({
|
|
||||||
el: documentHolderView.cmpEl.find('#id-document-calendar-control'),
|
|
||||||
enableKeyEvents: true,
|
|
||||||
firstday: 1
|
|
||||||
});
|
|
||||||
this.cmpCalendar.on('date:click', function (cmp, date) {
|
|
||||||
var props = me._state.dateObj,
|
|
||||||
specProps = props.get_DateTimePr(),
|
|
||||||
id = props.get_InternalId();
|
|
||||||
specProps.put_FullDate(new Date(date));
|
|
||||||
me.api.asc_SetContentControlProperties(props, id);
|
|
||||||
controlsContainer.hide();
|
|
||||||
me.api.asc_UncheckContentControlButtons();
|
|
||||||
Common.NotificationCenter.trigger('edit:complete', me.toolbar);
|
|
||||||
});
|
|
||||||
this.cmpCalendar.on('calendar:keydown', function (cmp, e) {
|
|
||||||
if (e.keyCode==Common.UI.Keys.ESC) {
|
|
||||||
controlsContainer.hide();
|
|
||||||
me.api.asc_UncheckContentControlButtons();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
this.cmpCalendar.setDate(new Date(specProps ? specProps.get_FullDate() : undefined));
|
|
||||||
|
|
||||||
// align
|
|
||||||
var offset = controlsContainer.offset(),
|
|
||||||
docW = Common.Utils.innerWidth(),
|
|
||||||
docH = Common.Utils.innerHeight() - 10, // Yep, it's magic number
|
|
||||||
menuW = this.cmpCalendar.cmpEl.outerWidth(),
|
|
||||||
menuH = this.cmpCalendar.cmpEl.outerHeight(),
|
|
||||||
buttonOffset = 22,
|
|
||||||
left = offset.left - menuW,
|
|
||||||
top = offset.top;
|
|
||||||
if (top + menuH > docH) {
|
|
||||||
top = docH - menuH;
|
|
||||||
left -= buttonOffset;
|
|
||||||
}
|
|
||||||
if (top < 0)
|
|
||||||
top = 0;
|
|
||||||
if (left + menuW > docW)
|
|
||||||
left = docW - menuW;
|
|
||||||
this.cmpCalendar.cmpEl.css({left: left, top : top});
|
|
||||||
|
|
||||||
documentHolderView._preventClick = true;
|
|
||||||
},
|
|
||||||
|
|
||||||
onShowListActions: function(obj, x, y) {
|
|
||||||
var type = obj.type,
|
|
||||||
props = obj.pr,
|
|
||||||
specProps = (type == Asc.c_oAscContentControlSpecificType.ComboBox) ? props.get_ComboBoxPr() : props.get_DropDownListPr(),
|
|
||||||
menu = this.view.listControlMenu,
|
|
||||||
documentHolderView = this.getApplication().getController('DocumentHolder').documentHolder,
|
|
||||||
menuContainer = menu ? documentHolderView.cmpEl.find(Common.Utils.String.format('#menu-container-{0}', menu.id)) : null,
|
|
||||||
me = this;
|
|
||||||
|
|
||||||
this._state.listObj = props;
|
|
||||||
|
|
||||||
this._fromShowContentControls = true;
|
|
||||||
Common.UI.Menu.Manager.hideAll();
|
|
||||||
|
|
||||||
if (!menu) {
|
|
||||||
this.view.listControlMenu = menu = new Common.UI.Menu({
|
|
||||||
menuAlign: 'tr-bl',
|
|
||||||
items: []
|
|
||||||
});
|
|
||||||
menu.on('item:click', function(menu, item) {
|
|
||||||
setTimeout(function(){
|
|
||||||
me.api.asc_SelectContentControlListItem(item.value, me._state.listObj.get_InternalId());
|
|
||||||
}, 1);
|
|
||||||
});
|
|
||||||
|
|
||||||
// Prepare menu container
|
|
||||||
if (!menuContainer || menuContainer.length < 1) {
|
|
||||||
menuContainer = $(Common.Utils.String.format('<div id="menu-container-{0}" style="position: absolute; z-index: 10000;"><div class="dropdown-toggle" data-toggle="dropdown"></div></div>', menu.id));
|
|
||||||
documentHolderView.cmpEl.append(menuContainer);
|
|
||||||
}
|
|
||||||
|
|
||||||
menu.render(menuContainer);
|
|
||||||
menu.cmpEl.attr({tabindex: "-1"});
|
|
||||||
menu.on('hide:after', function(){
|
|
||||||
me.view.listControlMenu.removeAll();
|
|
||||||
if (!me._fromShowContentControls)
|
|
||||||
me.api.asc_UncheckContentControlButtons();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
if (specProps) {
|
|
||||||
var count = specProps.get_ItemsCount();
|
|
||||||
for (var i=0; i<count; i++) {
|
|
||||||
menu.addItem(new Common.UI.MenuItem({
|
|
||||||
caption : specProps.get_ItemDisplayText(i),
|
|
||||||
value : specProps.get_ItemValue(i)
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
menuContainer.css({left: x, top : y});
|
|
||||||
menuContainer.attr('data-value', 'prevent-canvas-click');
|
|
||||||
documentHolderView._preventClick = true;
|
|
||||||
menu.show();
|
|
||||||
|
|
||||||
_.delay(function() {
|
|
||||||
menu.cmpEl.focus();
|
|
||||||
}, 10);
|
|
||||||
this._fromShowContentControls = false;
|
|
||||||
},
|
},
|
||||||
|
|
||||||
onShowContentControlsActions: function(obj, x, y) {
|
onShowContentControlsActions: function(obj, x, y) {
|
||||||
var type = obj.type;
|
(obj.type == Asc.c_oAscContentControlSpecificType.TOC) && this.onShowTOCActions(obj, x, y);
|
||||||
switch (type) {
|
|
||||||
case Asc.c_oAscContentControlSpecificType.TOC:
|
|
||||||
this.onShowTOCActions(obj, x, y);
|
|
||||||
break;
|
|
||||||
case Asc.c_oAscContentControlSpecificType.DateTime:
|
|
||||||
this.onShowDateActions(obj, x, y);
|
|
||||||
break;
|
|
||||||
case Asc.c_oAscContentControlSpecificType.Picture:
|
|
||||||
this.api.asc_addImage(obj);
|
|
||||||
break;
|
|
||||||
case Asc.c_oAscContentControlSpecificType.DropDownList:
|
|
||||||
case Asc.c_oAscContentControlSpecificType.ComboBox:
|
|
||||||
this.onShowListActions(obj, x, y);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}, DE.Controllers.Links || {}));
|
}, DE.Controllers.Links || {}));
|
||||||
|
|
|
@ -47,6 +47,7 @@ define([
|
||||||
'gateway',
|
'gateway',
|
||||||
'common/main/lib/util/utils',
|
'common/main/lib/util/utils',
|
||||||
'common/main/lib/component/Menu',
|
'common/main/lib/component/Menu',
|
||||||
|
'common/main/lib/component/Calendar',
|
||||||
'common/main/lib/view/InsertTableDialog',
|
'common/main/lib/view/InsertTableDialog',
|
||||||
'common/main/lib/view/CopyWarningDialog',
|
'common/main/lib/view/CopyWarningDialog',
|
||||||
'documenteditor/main/app/view/DropcapSettingsAdvanced',
|
'documenteditor/main/app/view/DropcapSettingsAdvanced',
|
||||||
|
@ -1535,6 +1536,10 @@ define([
|
||||||
this.api.asc_registerCallback('asc_onFocusObject', _.bind(onFocusObject, this));
|
this.api.asc_registerCallback('asc_onFocusObject', _.bind(onFocusObject, this));
|
||||||
this.api.asc_registerCallback('asc_onShowSpecialPasteOptions', _.bind(onShowSpecialPasteOptions, this));
|
this.api.asc_registerCallback('asc_onShowSpecialPasteOptions', _.bind(onShowSpecialPasteOptions, this));
|
||||||
this.api.asc_registerCallback('asc_onHideSpecialPasteOptions', _.bind(onHideSpecialPasteOptions, this));
|
this.api.asc_registerCallback('asc_onHideSpecialPasteOptions', _.bind(onHideSpecialPasteOptions, this));
|
||||||
|
if (this.mode.isEdit || this.mode.isRestrictedEdit && this.mode.canFillForms) {
|
||||||
|
this.api.asc_registerCallback('asc_onShowContentControlsActions',_.bind(this.onShowContentControlsActions, this));
|
||||||
|
this.api.asc_registerCallback('asc_onHideContentControlsActions',_.bind(this.onHideContentControlsActions, this));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
|
@ -3966,6 +3971,153 @@ define([
|
||||||
this.fireEvent('editcomplete', this);
|
this.fireEvent('editcomplete', this);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
onHideContentControlsActions: function() {
|
||||||
|
this.listControlMenu && this.listControlMenu.isVisible() && this.listControlMenu.hide();
|
||||||
|
var controlsContainer = this.cmpEl.find('#calendar-control-container');
|
||||||
|
if (controlsContainer.is(':visible'))
|
||||||
|
controlsContainer.hide();
|
||||||
|
},
|
||||||
|
|
||||||
|
onShowDateActions: function(obj, x, y) {
|
||||||
|
var props = obj.pr,
|
||||||
|
specProps = props.get_DateTimePr(),
|
||||||
|
controlsContainer = this.cmpEl.find('#calendar-control-container'),
|
||||||
|
me = this;
|
||||||
|
|
||||||
|
this._dateObj = props;
|
||||||
|
|
||||||
|
if (controlsContainer.length < 1) {
|
||||||
|
controlsContainer = $('<div id="calendar-control-container" style="position: absolute;z-index: 1000;"><div id="id-document-calendar-control" style="position: fixed; left: -1000px; top: -1000px;"></div></div>');
|
||||||
|
this.cmpEl.append(controlsContainer);
|
||||||
|
}
|
||||||
|
|
||||||
|
Common.UI.Menu.Manager.hideAll();
|
||||||
|
|
||||||
|
controlsContainer.css({left: x, top : y});
|
||||||
|
controlsContainer.show();
|
||||||
|
|
||||||
|
if (!this.cmpCalendar) {
|
||||||
|
this.cmpCalendar = new Common.UI.Calendar({
|
||||||
|
el: this.cmpEl.find('#id-document-calendar-control'),
|
||||||
|
enableKeyEvents: true,
|
||||||
|
firstday: 1
|
||||||
|
});
|
||||||
|
this.cmpCalendar.on('date:click', function (cmp, date) {
|
||||||
|
var props = me._dateObj,
|
||||||
|
specProps = props.get_DateTimePr(),
|
||||||
|
id = props.get_InternalId();
|
||||||
|
specProps.put_FullDate(new Date(date));
|
||||||
|
me.api.asc_SetContentControlProperties(props, id);
|
||||||
|
controlsContainer.hide();
|
||||||
|
me.api.asc_UncheckContentControlButtons();
|
||||||
|
me.fireEvent('editcomplete', me);
|
||||||
|
});
|
||||||
|
this.cmpCalendar.on('calendar:keydown', function (cmp, e) {
|
||||||
|
if (e.keyCode==Common.UI.Keys.ESC) {
|
||||||
|
controlsContainer.hide();
|
||||||
|
me.api.asc_UncheckContentControlButtons();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
this.cmpCalendar.setDate(new Date(specProps ? specProps.get_FullDate() : undefined));
|
||||||
|
|
||||||
|
// align
|
||||||
|
var offset = controlsContainer.offset(),
|
||||||
|
docW = Common.Utils.innerWidth(),
|
||||||
|
docH = Common.Utils.innerHeight() - 10, // Yep, it's magic number
|
||||||
|
menuW = this.cmpCalendar.cmpEl.outerWidth(),
|
||||||
|
menuH = this.cmpCalendar.cmpEl.outerHeight(),
|
||||||
|
buttonOffset = 22,
|
||||||
|
left = offset.left - menuW,
|
||||||
|
top = offset.top;
|
||||||
|
if (top + menuH > docH) {
|
||||||
|
top = docH - menuH;
|
||||||
|
left -= buttonOffset;
|
||||||
|
}
|
||||||
|
if (top < 0)
|
||||||
|
top = 0;
|
||||||
|
if (left + menuW > docW)
|
||||||
|
left = docW - menuW;
|
||||||
|
this.cmpCalendar.cmpEl.css({left: left, top : top});
|
||||||
|
|
||||||
|
this._preventClick = true;
|
||||||
|
},
|
||||||
|
|
||||||
|
onShowListActions: function(obj, x, y) {
|
||||||
|
var type = obj.type,
|
||||||
|
props = obj.pr,
|
||||||
|
specProps = (type == Asc.c_oAscContentControlSpecificType.ComboBox) ? props.get_ComboBoxPr() : props.get_DropDownListPr(),
|
||||||
|
menu = this.listControlMenu,
|
||||||
|
menuContainer = menu ? this.cmpEl.find(Common.Utils.String.format('#menu-container-{0}', menu.id)) : null,
|
||||||
|
me = this;
|
||||||
|
|
||||||
|
this._listObj = props;
|
||||||
|
|
||||||
|
this._fromShowContentControls = true;
|
||||||
|
Common.UI.Menu.Manager.hideAll();
|
||||||
|
|
||||||
|
if (!menu) {
|
||||||
|
this.listControlMenu = menu = new Common.UI.Menu({
|
||||||
|
menuAlign: 'tr-bl',
|
||||||
|
items: []
|
||||||
|
});
|
||||||
|
menu.on('item:click', function(menu, item) {
|
||||||
|
setTimeout(function(){
|
||||||
|
me.api.asc_SelectContentControlListItem(item.value, me._listObj.get_InternalId());
|
||||||
|
}, 1);
|
||||||
|
});
|
||||||
|
|
||||||
|
// Prepare menu container
|
||||||
|
if (!menuContainer || menuContainer.length < 1) {
|
||||||
|
menuContainer = $(Common.Utils.String.format('<div id="menu-container-{0}" style="position: absolute; z-index: 10000;"><div class="dropdown-toggle" data-toggle="dropdown"></div></div>', menu.id));
|
||||||
|
this.cmpEl.append(menuContainer);
|
||||||
|
}
|
||||||
|
|
||||||
|
menu.render(menuContainer);
|
||||||
|
menu.cmpEl.attr({tabindex: "-1"});
|
||||||
|
menu.on('hide:after', function(){
|
||||||
|
me.listControlMenu.removeAll();
|
||||||
|
if (!me._fromShowContentControls)
|
||||||
|
me.api.asc_UncheckContentControlButtons();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if (specProps) {
|
||||||
|
var count = specProps.get_ItemsCount();
|
||||||
|
for (var i=0; i<count; i++) {
|
||||||
|
menu.addItem(new Common.UI.MenuItem({
|
||||||
|
caption : specProps.get_ItemDisplayText(i),
|
||||||
|
value : specProps.get_ItemValue(i)
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
menuContainer.css({left: x, top : y});
|
||||||
|
menuContainer.attr('data-value', 'prevent-canvas-click');
|
||||||
|
this._preventClick = true;
|
||||||
|
menu.show();
|
||||||
|
|
||||||
|
_.delay(function() {
|
||||||
|
menu.cmpEl.focus();
|
||||||
|
}, 10);
|
||||||
|
this._fromShowContentControls = false;
|
||||||
|
},
|
||||||
|
|
||||||
|
onShowContentControlsActions: function(obj, x, y) {
|
||||||
|
var type = obj.type;
|
||||||
|
switch (type) {
|
||||||
|
case Asc.c_oAscContentControlSpecificType.DateTime:
|
||||||
|
this.onShowDateActions(obj, x, y);
|
||||||
|
break;
|
||||||
|
case Asc.c_oAscContentControlSpecificType.Picture:
|
||||||
|
this.api.asc_addImage(obj);
|
||||||
|
break;
|
||||||
|
case Asc.c_oAscContentControlSpecificType.DropDownList:
|
||||||
|
case Asc.c_oAscContentControlSpecificType.ComboBox:
|
||||||
|
this.onShowListActions(obj, x, y);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
focus: function() {
|
focus: function() {
|
||||||
var me = this;
|
var me = this;
|
||||||
_.defer(function(){ me.cmpEl.focus(); }, 50);
|
_.defer(function(){ me.cmpEl.focus(); }, 50);
|
||||||
|
|
Loading…
Reference in a new issue