Skip to content

Commit

Permalink
Fix contex menu
Browse files Browse the repository at this point in the history
  • Loading branch information
JuliaRadzhabova committed Dec 18, 2024
1 parent d830603 commit 14cfa11
Show file tree
Hide file tree
Showing 6 changed files with 60 additions and 55 deletions.
30 changes: 28 additions & 2 deletions apps/documenteditor/main/app/controller/DocumentHolder.js
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,17 @@ define([

setApi: function(o) {
this.api = o;
this.api && this.documentHolder.setApi(this.api);
if (this.api) {
if (this.mode.isEdit === true) {
this.api.asc_registerCallback('asc_onLockDocumentProps', _.bind(this.onApiLockDocumentProps, this));
this.api.asc_registerCallback('asc_onUnLockDocumentProps', _.bind(this.onApiUnLockDocumentProps, this));
}
this.api.asc_registerCallback('asc_onCoAuthoringDisconnect', _.bind(this.onCoAuthoringDisconnect, this));
Common.NotificationCenter.on('api:disconnect', _.bind(this.onCoAuthoringDisconnect, this));
this.api.asc_registerCallback('asc_onTextLanguage', _.bind(this.onTextLanguage, this));
this.api.asc_registerCallback('asc_onParaStyleName', _.bind(this.onApiParagraphStyleChange, this));
this.documentHolder.setApi(this.api);
}

return this;
},
Expand Down Expand Up @@ -586,7 +596,23 @@ define([
},

onMouseMove: function(moveData) {},


onApiLockDocumentProps: function() {
this._state.lock_doc = true;
},

onApiUnLockDocumentProps: function() {
this._state.lock_doc = false;
},

onTextLanguage: function(langid) {
this.documentHolder._currLang.id = langid;
},

onApiParagraphStyleChange: function(name) {
window.currentStyleName = name;
},

onCoAuthoringDisconnect: function() {
this.mode.isEdit = false;
},
Expand Down
23 changes: 0 additions & 23 deletions apps/documenteditor/main/app/controller/DocumentHolderExt.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,20 +69,13 @@ define([], function () {
this.api.asc_registerCallback('asc_onSpellCheckVariantsFound', _.bind(this.onSpellCheckVariantsFound, this));
this.api.asc_registerCallback('asc_onRulerDblClick', _.bind(this.onRulerDblClick, this));
this.api.asc_registerCallback('asc_ChangeCropState', _.bind(this.onChangeCropState, this));
this.api.asc_registerCallback('asc_onLockDocumentProps', _.bind(this.onApiLockDocumentProps, this));
this.api.asc_registerCallback('asc_onUnLockDocumentProps', _.bind(this.onApiUnLockDocumentProps, this));
this.api.asc_registerCallback('asc_onShowMathTrack', _.bind(this.onShowMathTrack, this));
this.api.asc_registerCallback('asc_onHideMathTrack', _.bind(this.onHideMathTrack, this));
this.api.asc_registerPlaceholderCallback(AscCommon.PlaceholderButtonType.Image, _.bind(this.onInsertImage, this));
this.api.asc_registerPlaceholderCallback(AscCommon.PlaceholderButtonType.ImageUrl, _.bind(this.onInsertImageUrl, this));
this.api.asc_registerCallback('asc_onHideEyedropper', _.bind(this.hideEyedropper, this));
this.api.asc_SetMathInputType(Common.localStorage.getBool("de-equation-input-latex") ? Asc.c_oAscMathInputType.LaTeX : Asc.c_oAscMathInputType.Unicode);
}
this.api.asc_registerCallback('asc_onCoAuthoringDisconnect', _.bind(this.onCoAuthoringDisconnect, this));
Common.NotificationCenter.on('api:disconnect', _.bind(this.onCoAuthoringDisconnect, this));
this.api.asc_registerCallback('asc_onTextLanguage', _.bind(this.onTextLanguage, this));
this.api.asc_registerCallback('asc_onParaStyleName', _.bind(this.onApiParagraphStyleChange, this));

this.api.asc_registerCallback('asc_onShowForeignCursorLabel', _.bind(this.onShowForeignCursorLabel, this));
this.api.asc_registerCallback('asc_onHideForeignCursorLabel', _.bind(this.onHideForeignCursorLabel, this));
this.api.asc_registerCallback('asc_onFocusObject', _.bind(this.onFocusObject, this));
Expand Down Expand Up @@ -1026,10 +1019,6 @@ define([], function () {
}
};

dh.onApiParagraphStyleChange = function(name) {
window.currentStyleName = name;
};

dh.onHideContentControlsActions = function() {
this.listControlMenu && this.listControlMenu.isVisible() && this.listControlMenu.hide();
var controlsContainer = this.documentHolder.cmpEl.find('#calendar-control-container');
Expand Down Expand Up @@ -1341,18 +1330,6 @@ define([], function () {
}
};

dh.onApiLockDocumentProps = function() {
this._state.lock_doc = true;
};

dh.onApiUnLockDocumentProps = function() {
this._state.lock_doc = false;
};

dh.onTextLanguage = function(langid) {
this.documentHolder._currLang.id = langid;
};

dh.onSpellCheckVariantsFound = function() {
var me = this;
var selectedElements = me.api.getSelectedElements(true);
Expand Down
22 changes: 22 additions & 0 deletions apps/presentationeditor/main/app/controller/DocumentHolder.js
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,12 @@ define([
if (me.api) {
me.api.asc_registerCallback('asc_onCountPages', _.bind(me.onApiCountPages, me));
me.api.asc_registerCallback('asc_onStartDemonstration', _.bind(me.onApiStartDemonstration, me));
me.api.asc_registerCallback('asc_onCoAuthoringDisconnect', _.bind(me.onCoAuthoringDisconnect, me));
Common.NotificationCenter.on('api:disconnect', _.bind(me.onCoAuthoringDisconnect, me));
me.api.asc_registerCallback('asc_onTextLanguage', _.bind(me.onTextLanguage, me));
me.api.asc_registerCallback('asc_onUpdateThemeIndex', _.bind(me.onApiUpdateThemeIndex, me));
me.api.asc_registerCallback('asc_onLockDocumentTheme', _.bind(me.onApiLockDocumentTheme, me));
me.api.asc_registerCallback('asc_onUnLockDocumentTheme', _.bind(me.onApiUnLockDocumentTheme, me));
me.documentHolder.slidesCount = me.api.getCountPages();
me.documentHolder.setApi(me.api);
}
Expand Down Expand Up @@ -647,6 +653,22 @@ define([
this.documentHolder.slidesCount = count;
},

onTextLanguage: function(langid) {
this.documentHolder._currLang.id = langid;
},

onApiUpdateThemeIndex: function(v) {
this._state.themeId = v;
},

onApiLockDocumentTheme: function() {
this.documentHolder && (this.documentHolder._state.themeLock = true);
},

onApiUnLockDocumentTheme: function() {
this.documentHolder && (this.documentHolder._state.themeLock = false);
},

onKeyUp: function (e) {
if (e.keyCode == Common.UI.Keys.CTRL && this._needShowSpecPasteMenu && !this._handleZoomWheel && !this.btnSpecialPaste.menu.isVisible() && /area_id/.test(e.target.id)) {
$('button', this.btnSpecialPaste.cmpEl).click();
Expand Down
23 changes: 0 additions & 23 deletions apps/presentationeditor/main/app/controller/DocumentHolderExt.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,16 +92,9 @@ define([], function () {
me.api.asc_registerCallback('asc_onHideEyedropper', _.bind(me.hideEyedropper, me));
me.api.asc_SetMathInputType(Common.localStorage.getBool("pe-equation-input-latex") ? Asc.c_oAscMathInputType.LaTeX : Asc.c_oAscMathInputType.Unicode);
}
me.api.asc_registerCallback('asc_onCoAuthoringDisconnect', _.bind(me.onCoAuthoringDisconnect, me));
Common.NotificationCenter.on('api:disconnect', _.bind(me.onCoAuthoringDisconnect, me));
me.api.asc_registerCallback('asc_onTextLanguage', _.bind(me.onTextLanguage, me));

me.api.asc_registerCallback('asc_onShowForeignCursorLabel', _.bind(me.onShowForeignCursorLabel, me));
me.api.asc_registerCallback('asc_onHideForeignCursorLabel', _.bind(me.onHideForeignCursorLabel, me));
me.api.asc_registerCallback('asc_onFocusObject', _.bind(me.onFocusObject, me));
me.api.asc_registerCallback('asc_onUpdateThemeIndex', _.bind(me.onApiUpdateThemeIndex, me));
me.api.asc_registerCallback('asc_onLockDocumentTheme', _.bind(me.onApiLockDocumentTheme, me));
me.api.asc_registerCallback('asc_onUnLockDocumentTheme', _.bind(me.onApiUnLockDocumentTheme, me));
me.api.asc_registerCallback('onPluginContextMenu', _.bind(me.onPluginContextMenu, me));
}
};
Expand Down Expand Up @@ -711,10 +704,6 @@ define([], function () {
this.slideNumDiv.hide();
};

dh.onTextLanguage = function(langid) {
this.documentHolder._currLang.id = langid;
};

dh.onSpellCheckVariantsFound = function() {
var me = this;
var selectedElements = me.api.getSelectedElements(true);
Expand Down Expand Up @@ -751,18 +740,6 @@ define([], function () {
me._isFromSlideMenu = number;
};

dh.onApiUpdateThemeIndex = function(v) {
this._state.themeId = v;
};

dh.onApiLockDocumentTheme = function() {
this.documentHolder && (this.documentHolder._state.themeLock = true);
};

dh.onApiUnLockDocumentTheme = function() {
this.documentHolder && (this.documentHolder._state.themeLock = false);
};

dh.onShowSpecialPasteOptions = function(specialPasteShowOptions) {
if (this.mode && !this.mode.isEdit) return;

Expand Down
10 changes: 10 additions & 0 deletions apps/spreadsheeteditor/main/app/controller/DocumentHolder.js
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,12 @@ define([

setApi: function(api) {
this.api = api;
if (this.api) {
this.api.asc_registerCallback('asc_onCoAuthoringDisconnect',_.bind(this.onApiCoAuthoringDisconnect, this));
Common.NotificationCenter.on('api:disconnect', _.bind(this.onApiCoAuthoringDisconnect, this));
this.permissions && (this.permissions.isEdit===true) && this.api.asc_registerCallback('asc_onLockDefNameManager', _.bind(this.onLockDefNameManager, this));

}
return this;
},

Expand All @@ -230,6 +236,10 @@ define([
this.permissions.isEdit = false;
},

onLockDefNameManager: function(state) {
this.namedrange_locked = (state == Asc.c_oAscDefinedNameReason.LockDefNameManager);
},

hideCoAuthTips: function() {
if (this.tooltips.coauth.ref) {
$(this.tooltips.coauth.ref).remove();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,11 @@ define([], function () {
// this.api.asc_registerCallback('asc_onShowComment', this.wrapEvents.apiShowComment);
/** coauthoring end **/
this.api.asc_registerCallback('asc_onHyperlinkClick', _.bind(this.onApiHyperlinkClick, this));
this.api.asc_registerCallback('asc_onCoAuthoringDisconnect',_.bind(this.onApiCoAuthoringDisconnect, this));
Common.NotificationCenter.on('api:disconnect', _.bind(this.onApiCoAuthoringDisconnect, this));
this.api.asc_registerCallback('asc_onSelectionChanged', _.bind(this.onSelectionChanged, this));

if (this.permissions.isEdit===true) {
this.api.asc_registerCallback('asc_onSetAFDialog', _.bind(this.onApiAutofilter, this));
this.api.asc_registerCallback('asc_onEditCell', _.bind(this.onApiEditCell, this));
this.api.asc_registerCallback('asc_onLockDefNameManager', _.bind(this.onLockDefNameManager, this));
this.api.asc_registerCallback('asc_onEntriesListMenu', _.bind(this.onEntriesListMenu, this, false)); // Alt + Down
this.api.asc_registerCallback('asc_onValidationListMenu', _.bind(this.onEntriesListMenu, this, true));
this.api.asc_registerCallback('asc_onFormulaCompleteMenu', _.bind(this.onApiFormulaCompleteMenu, this));
Expand Down Expand Up @@ -3642,10 +3639,6 @@ define([], function () {
this.isEditCell = (state != Asc.c_oAscCellEditorState.editEnd);
};

dh.onLockDefNameManager = function(state) {
this.namedrange_locked = (state == Asc.c_oAscDefinedNameReason.LockDefNameManager);
};

dh.onChangeCropState = function(state) {
this.documentHolder.menuImgCrop && this.documentHolder.menuImgCrop.menu.items[0].setChecked(state, true);
};
Expand Down

0 comments on commit 14cfa11

Please sign in to comment.