For Bug 54910

This commit is contained in:
SergeyEzhin 2022-01-18 22:09:05 +04:00
parent 3a887a330e
commit 2c9e34c1be
2 changed files with 69 additions and 60 deletions

View file

@ -213,7 +213,7 @@ class ContextMenu extends ContextMenuController {
initMenuItems() { initMenuItems() {
if ( !Common.EditorApi ) return []; if ( !Common.EditorApi ) return [];
const { isEdit, canFillForms } = this.props; const { isEdit, canFillForms, isDisconnected } = this.props;
if (isEdit && EditorUIController.ContextMenu) { if (isEdit && EditorUIController.ContextMenu) {
return EditorUIController.ContextMenu.mapMenuItems(this); return EditorUIController.ContextMenu.mapMenuItems(this);
@ -259,32 +259,34 @@ class ContextMenu extends ContextMenuController {
}); });
} }
if ( canFillForms && canCopy && !locked ) { if(!isDisconnected) {
itemsIcon.push({ if ( canFillForms && canCopy && !locked ) {
event: 'cut', itemsIcon.push({
icon: 'icon-cut' event: 'cut',
}); icon: 'icon-cut'
} });
}
if ( canFillForms && !locked ) { if ( canFillForms && !locked ) {
itemsIcon.push({ itemsIcon.push({
event: 'paste', event: 'paste',
icon: 'icon-paste' icon: 'icon-paste'
}); });
} }
if ( canViewComments && this.isComments ) { if ( canViewComments && this.isComments ) {
itemsText.push({ itemsText.push({
caption: _t.menuViewComment, caption: _t.menuViewComment,
event: 'viewcomment' event: 'viewcomment'
}); });
} }
if (api.can_AddQuotedComment() !== false && canCoAuthoring && canComments && !locked && !(!isText && isObject)) { if (api.can_AddQuotedComment() !== false && canCoAuthoring && canComments && !locked && !(!isText && isObject)) {
itemsText.push({ itemsText.push({
caption: _t.menuAddComment, caption: _t.menuAddComment,
event: 'addcomment' event: 'addcomment'
}); });
}
} }
if ( isLink ) { if ( isLink ) {

View file

@ -407,6 +407,7 @@ class MainController extends Component {
onLicenseChanged (params) { onLicenseChanged (params) {
const appOptions = this.props.storeAppOptions; const appOptions = this.props.storeAppOptions;
const licType = params.asc_getLicenseType(); const licType = params.asc_getLicenseType();
if (licType !== undefined && (appOptions.canEdit || appOptions.isRestrictedEdit) && appOptions.config.mode !== 'view' && if (licType !== undefined && (appOptions.canEdit || appOptions.isRestrictedEdit) && appOptions.config.mode !== 'view' &&
(licType === Asc.c_oLicenseResult.Connections || licType === Asc.c_oLicenseResult.UsersCount || licType === Asc.c_oLicenseResult.ConnectionsOS || licType === Asc.c_oLicenseResult.UsersCountOS (licType === Asc.c_oLicenseResult.Connections || licType === Asc.c_oLicenseResult.UsersCount || licType === Asc.c_oLicenseResult.ConnectionsOS || licType === Asc.c_oLicenseResult.UsersCountOS
|| licType === Asc.c_oLicenseResult.SuccessLimit && (appOptions.trialMode & Asc.c_oLicenseMode.Limited) !== 0)) || licType === Asc.c_oLicenseResult.SuccessLimit && (appOptions.trialMode & Asc.c_oLicenseMode.Limited) !== 0))
@ -557,28 +558,32 @@ class MainController extends Component {
storeDocumentSettings.changeDocSize(w, h); storeDocumentSettings.changeDocSize(w, h);
}); });
this.api.asc_registerCallback('asc_onShowContentControlsActions', (obj, x, y) => { const storeAppOptions = this.props.storeAppOptions;
switch (obj.type) {
case Asc.c_oAscContentControlSpecificType.DateTime: if (storeAppOptions.isEdit || storeAppOptions.isRestrictedEdit && storeAppOptions.canFillForms) {
this.onShowDateActions(obj, x, y); this.api.asc_registerCallback('asc_onShowContentControlsActions', (obj, x, y) => {
break; switch (obj.type) {
case Asc.c_oAscContentControlSpecificType.Picture: case Asc.c_oAscContentControlSpecificType.DateTime:
if (obj.pr && obj.pr.get_Lock) { this.onShowDateActions(obj, x, y);
let lock = obj.pr.get_Lock(); break;
if (lock == Asc.c_oAscSdtLockType.SdtContentLocked || lock == Asc.c_oAscSdtLockType.ContentLocked) case Asc.c_oAscContentControlSpecificType.Picture:
return; if (obj.pr && obj.pr.get_Lock) {
} let lock = obj.pr.get_Lock();
this.api.asc_addImage(obj); if (lock == Asc.c_oAscSdtLockType.SdtContentLocked || lock == Asc.c_oAscSdtLockType.ContentLocked)
setTimeout(() => { return;
this.api.asc_UncheckContentControlButtons(); }
}, 500); this.api.asc_addImage(obj);
break; setTimeout(() => {
case Asc.c_oAscContentControlSpecificType.DropDownList: this.api.asc_UncheckContentControlButtons();
case Asc.c_oAscContentControlSpecificType.ComboBox: }, 500);
this.onShowListActions(obj, x, y); break;
break; case Asc.c_oAscContentControlSpecificType.DropDownList:
} case Asc.c_oAscContentControlSpecificType.ComboBox:
}); this.onShowListActions(obj, x, y);
break;
}
});
}
const storeTextSettings = this.props.storeTextSettings; const storeTextSettings = this.props.storeTextSettings;
storeTextSettings.resetFontsRecent(LocalStorage.getItem('dde-settings-recent-fonts')); storeTextSettings.resetFontsRecent(LocalStorage.getItem('dde-settings-recent-fonts'));
@ -705,19 +710,20 @@ class MainController extends Component {
onShowDateActions(obj, x, y) { onShowDateActions(obj, x, y) {
const { t } = this.props; const { t } = this.props;
const boxSdk = $$('#editor_sdk');
let props = obj.pr, let props = obj.pr,
specProps = props.get_DateTimePr(), specProps = props.get_DateTimePr(),
isPhone = Device.isPhone; isPhone = Device.isPhone,
controlsContainer = boxSdk.find('#calendar-target-element'),
_dateObj = props;
this.controlsContainer = this.boxSdk.find('#calendar-target-element'); if (controlsContainer.length < 1) {
this._dateObj = props; controlsContainer = $$('<div id="calendar-target-element" style="position: absolute;"></div>');
boxSdk.append(controlsContainer);
if (this.controlsContainer.length < 1) {
this.controlsContainer = $$('<div id="calendar-target-element" style="position: absolute;"></div>');
this.boxSdk.append(this.controlsContainer);
} }
this.controlsContainer.css({left: `${x}px`, top: `${y}px`}); controlsContainer.css({left: `${x}px`, top: `${y}px`});
this.cmpCalendar = f7.calendar.create({ this.cmpCalendar = f7.calendar.create({
inputEl: '#calendar-target-element', inputEl: '#calendar-target-element',
@ -730,7 +736,7 @@ class MainController extends Component {
on: { on: {
change: (calendar, value) => { change: (calendar, value) => {
if(calendar.initialized && value[0]) { if(calendar.initialized && value[0]) {
let specProps = this._dateObj.get_DateTimePr(); let specProps = _dateObj.get_DateTimePr();
specProps.put_FullDate(new Date(value[0])); specProps.put_FullDate(new Date(value[0]));
this.api.asc_SetContentControlDatePickerDate(specProps); this.api.asc_SetContentControlDatePickerDate(specProps);
calendar.close(); calendar.close();
@ -747,14 +753,15 @@ class MainController extends Component {
onShowListActions(obj, x, y) { onShowListActions(obj, x, y) {
if(!Device.isPhone) { if(!Device.isPhone) {
this.dropdownListTarget = this.boxSdk.find('#dropdown-list-target'); const boxSdk = $$('#editor_sdk');
let dropdownListTarget = boxSdk.find('#dropdown-list-target');
if (this.dropdownListTarget.length < 1) { if (dropdownListTarget.length < 1) {
this.dropdownListTarget = $$('<div id="dropdown-list-target" style="position: absolute;"></div>'); dropdownListTarget = $$('<div id="dropdown-list-target" style="position: absolute;"></div>');
this.boxSdk.append(this.dropdownListTarget); boxSdk.append(dropdownListTarget);
} }
this.dropdownListTarget.css({left: `${x}px`, top: `${y}px`}); dropdownListTarget.css({left: `${x}px`, top: `${y}px`});
} }
Common.Notifications.trigger('openDropdownList', obj); Common.Notifications.trigger('openDropdownList', obj);