From c361d2288fd78aa8f0b18138e93886a93c2d26a2 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Mon, 9 Dec 2024 21:24:15 +0300 Subject: [PATCH 01/12] [PDF] Refactoring context menu --- .../main/app/controller/DocumentHolder.js | 2200 +--------------- .../main/app/controller/DocumentHolderExt.js | 2236 +++++++++++++++++ apps/pdfeditor/main/app_dev.js | 1 + apps/pdfeditor/main/app_pack.js | 1 + 4 files changed, 2257 insertions(+), 2181 deletions(-) create mode 100644 apps/pdfeditor/main/app/controller/DocumentHolderExt.js diff --git a/apps/pdfeditor/main/app/controller/DocumentHolder.js b/apps/pdfeditor/main/app/controller/DocumentHolder.js index a79d866de6..4b17debf32 100644 --- a/apps/pdfeditor/main/app/controller/DocumentHolder.js +++ b/apps/pdfeditor/main/app/controller/DocumentHolder.js @@ -72,15 +72,6 @@ define([ initialize: function() { // - this.addListeners({ - 'DocumentHolder': { - 'createdelayedelements': this.createDelayedElements, - 'equation:callback': this.equationCallback - }, - 'FileMenu': { - 'settings:apply': _.bind(this.applySettings, this) - }, - }); var me = this; @@ -88,7 +79,7 @@ define([ me.usertips = []; me.fastcoauthtips = []; me._isDisabled = false; - me._state = {}; + me._state = {initEditorEvents: true}; me.mode = {}; me.mouseMoveData = null; me.isTooltipHiding = false; @@ -121,7 +112,7 @@ define([ eyedropperColor: null, tipInterval: null, isTipVisible: false - } + }; me.userTooltip = true; me.wrapEvents = { userTipMousover: _.bind(me.userTipMousover, me), @@ -177,42 +168,6 @@ define([ this.api = o; if (this.api) { - this.api.asc_registerCallback('asc_onContextMenu', _.bind(this.onContextMenu, this)); - this.api.asc_registerCallback('asc_onMouseMoveStart', _.bind(this.onMouseMoveStart, this)); - this.api.asc_registerCallback('asc_onMouseMoveEnd', _.bind(this.onMouseMoveEnd, this)); - - //hyperlink - this.api.asc_registerCallback('asc_onHyperlinkClick', _.bind(this.onHyperlinkClick, this)); - this.api.asc_registerCallback('asc_onMouseMove', _.bind(this.onMouseMove, this)); - - if (this.mode.isEdit === true) { - this.api.asc_registerCallback('asc_onHideEyedropper', _.bind(this.hideEyedropper, this)); - this.api.asc_registerCallback('asc_onShowPDFFormsActions', _.bind(this.onShowFormsPDFActions, this)); - this.api.asc_registerCallback('asc_onHidePdfFormsActions', _.bind(this.onHidePdfFormsActions, this)); - this.api.asc_registerCallback('asc_onCountPages', _.bind(this.onCountPages, this)); - if (this.mode.canComments) { - // for text - this.api.asc_registerCallback('asc_onShowAnnotTextPrTrack', _.bind(this.onShowTextBar, this)); - this.api.asc_registerCallback('asc_onHideAnnotTextPrTrack', _.bind(this.onHideTextBar, this)); - this.api.asc_registerCallback('asc_onShowTextSelectTrack', _.bind(this.onShowAnnotBar, this)); - this.api.asc_registerCallback('asc_onHideTextSelectTrack', _.bind(this.onHideAnnotBar, this)); - } - } - if (this.mode.isRestrictedEdit) { - this.api.asc_registerCallback('asc_onShowContentControlsActions', _.bind(this.onShowContentControlsActions, this)); - this.api.asc_registerCallback('asc_onHideContentControlsActions', _.bind(this.onHideContentControlsActions, this)); - Common.Gateway.on('insertimage', _.bind(this.insertImage, this)); - Common.NotificationCenter.on('storage:image-load', _.bind(this.openImageFromStorage, this)); // try to load image from storage - Common.NotificationCenter.on('storage:image-insert', _.bind(this.insertImageFromStorage, this)); // set loaded image to control - } - this.api.asc_registerCallback('asc_onCoAuthoringDisconnect', _.bind(this.onCoAuthoringDisconnect, this)); - Common.NotificationCenter.on('api:disconnect', _.bind(this.onCoAuthoringDisconnect, 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)); - this.api.asc_registerCallback('onPluginContextMenu', _.bind(this.onPluginContextMenu, this)); - this.documentHolder.setApi(this.api); } @@ -230,136 +185,12 @@ define([ }, createPostLoadElements: function() { + this.setEvents(); + this.applyEditorMode(); this.showMathTrackOnLoad && this.onShowMathTrack(this.lastMathTrackBounds); }, - createDelayedElements: function(view, type) { - var me = this, - view = me.documentHolder; - - if (type==='pdf') { - view.menuPDFViewCopy.on('click', _.bind(me.onCutCopyPaste, me)); - view.menuAddComment.on('click', _.bind(me.addComment, me)); - view.menuRemoveComment.on('click', _.bind(me.removeComment, me)); - } else if (type==='forms') { - view.menuPDFFormsUndo.on('click', _.bind(me.onUndo, me)); - view.menuPDFFormsRedo.on('click', _.bind(me.onRedo, me)); - view.menuPDFFormsClear.on('click', _.bind(me.onClear, me)); - view.menuPDFFormsCut.on('click', _.bind(me.onCutCopyPaste, me)); - view.menuPDFFormsCopy.on('click', _.bind(me.onCutCopyPaste, me)); - view.menuPDFFormsPaste.on('click', _.bind(me.onCutCopyPaste, me)); - } else if (type==='edit') { - view.menuPDFEditCopy.on('click', _.bind(me.onCutCopyPaste, me)); - view.menuEditAddComment.on('click', _.bind(me.addComment, me)); - view.menuEditRemoveComment.on('click', _.bind(me.removeComment, me)); -/* - var diagramEditor = this.getApplication().getController('Common.Controllers.ExternalDiagramEditor').getView('Common.Views.ExternalDiagramEditor'); - if (diagramEditor) { - diagramEditor.on('internalmessage', _.bind(function(cmp, message) { - var command = message.data.command; - var data = message.data.data; - if (this.api) { - ( diagramEditor.isEditMode() ) - ? this.api.asc_editChartDrawingObject(data) - : this.api.asc_addChartDrawingObject(data, diagramEditor.getPlaceholder()); - } - }, this)); - diagramEditor.on('hide', _.bind(function(cmp, message) { - if (this.api) { - this.api.asc_onCloseChartFrame(); - this.api.asc_enableKeyEvents(true); - } - var me = this; - setTimeout(function(){ - me.editComplete(); - }, 10); - }, this)); - } - - var oleEditor = this.getApplication().getController('Common.Controllers.ExternalOleEditor').getView('Common.Views.ExternalOleEditor'); - if (oleEditor) { - oleEditor.on('internalmessage', _.bind(function(cmp, message) { - var command = message.data.command; - var data = message.data.data; - if (this.api) { - oleEditor.isEditMode() - ? this.api.asc_editTableOleObject(data) - : this.api.asc_addTableOleObject(data); - } - }, this)); - oleEditor.on('hide', _.bind(function(cmp, message) { - if (this.api) { - this.api.asc_enableKeyEvents(true); - this.api.asc_onCloseChartFrame(); - } - var me = this; - setTimeout(function(){ - me.editComplete(); - }, 10); - }, this)); - } - */ - view.menuParaCopy.on('click', _.bind(me.onCutCopyPaste, me)); - view.menuParaPaste.on('click', _.bind(me.onCutCopyPaste, me)); - view.menuParaCut.on('click', _.bind(me.onCutCopyPaste, me)); - view.menuImgCopy.on('click', _.bind(me.onCutCopyPaste, me)); - view.menuImgPaste.on('click', _.bind(me.onCutCopyPaste, me)); - view.menuImgCut.on('click', _.bind(me.onCutCopyPaste, me)); - view.menuTableCopy.on('click', _.bind(me.onCutCopyPaste, me)); - view.menuTablePaste.on('click', _.bind(me.onCutCopyPaste, me)); - view.menuTableCut.on('click', _.bind(me.onCutCopyPaste, me)); - view.menuAddHyperlinkPara.on('click', _.bind(me.addHyperlink, me)); - 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.menuRemoveHyperlinkPara.on('click', _.bind(me.removeHyperlink, me)); - view.menuRemoveHyperlinkTable.on('click', _.bind(me.removeHyperlink, me)); - // view.menuChartEdit.on('click', _.bind(me.editChartClick, me, undefined)); - view.menuImgSaveAsPicture.on('click', _.bind(me.saveAsPicture, me)); - view.menuTableSaveAsPicture.on('click', _.bind(me.saveAsPicture, me)); - view.menuAddCommentPara.on('click', _.bind(me.addComment, me)); - view.menuAddCommentTable.on('click', _.bind(me.addComment, me)); - view.menuAddCommentImg.on('click', _.bind(me.addComment, me)); - view.mnuTableMerge.on('click', _.bind(me.onTableMerge, me)); - view.mnuTableSplit.on('click', _.bind(me.onTableSplit, me)); - view.menuTableCellAlign.menu.on('item:click', _.bind(me.tableCellsVAlign, me)); - view.menuTableDistRows.on('click', _.bind(me.onTableDistRows, me)); - view.menuTableDistCols.on('click', _.bind(me.onTableDistCols, me)); - view.menuTableAdvanced.on('click', _.bind(me.onTableAdvanced, me)); - view.menuImageAdvanced.on('click', _.bind(me.onImageAdvanced, me)); - view.menuImgOriginalSize.on('click', _.bind(me.onImgOriginalSize, me)); - view.menuImgShapeRotate.menu.items[0].on('click', _.bind(me.onImgRotate, me)); - view.menuImgShapeRotate.menu.items[1].on('click', _.bind(me.onImgRotate, me)); - view.menuImgShapeRotate.menu.items[3].on('click', _.bind(me.onImgFlip, me)); - view.menuImgShapeRotate.menu.items[4].on('click', _.bind(me.onImgFlip, me)); - view.menuImgCrop.menu.on('item:click', _.bind(me.onImgCrop, me)); - view.menuImgResetCrop.on('click', _.bind(me.onImgResetCrop, me)); - view.menuImgEditPoints.on('click', _.bind(me.onImgEditPoints, me)); - view.menuShapeAdvanced.on('click', _.bind(me.onShapeAdvanced, me)); - view.menuParagraphAdvanced.on('click', _.bind(me.onParagraphAdvanced, me)); - // view.menuChartAdvanced.on('click', _.bind(me.onChartAdvanced, me)); - view.mnuGroupImg.on('click', _.bind(me.onGroupImg, me)); - view.mnuUnGroupImg.on('click', _.bind(me.onUnGroupImg, me)); - view.mnuArrangeFront.on('click', _.bind(me.onArrangeFront, me)); - view.mnuArrangeBack.on('click', _.bind(me.onArrangeBack, me)); - view.mnuArrangeForward.on('click', _.bind(me.onArrangeForward, me)); - view.mnuArrangeBackward.on('click', _.bind(me.onArrangeBackward, me)); - view.menuImgShapeAlign.menu.on('item:click', _.bind(me.onImgShapeAlign, me)); - view.menuParagraphVAlign.menu.on('item:click', _.bind(me.onParagraphVAlign, me)); - view.menuParagraphDirection.menu.on('item:click', _.bind(me.onParagraphDirection, me)); - view.menuTableSelectText.menu.on('item:click', _.bind(me.tableSelectText, me)); - view.menuTableInsertText.menu.on('item:click', _.bind(me.tableInsertText, me)); - view.menuTableDeleteText.menu.on('item:click', _.bind(me.tableDeleteText, me)); - view.menuTableEquationSettings.menu.on('item:click', _.bind(me.convertEquation, me)); - view.menuParagraphEquation.menu.on('item:click', _.bind(me.convertEquation, me)); - view.mnuNewPageBefore.on('click', _.bind(me.onNewPage, me)); - view.mnuNewPageAfter.on('click', _.bind(me.onNewPage, me)); - view.mnuDeletePage.on('click', _.bind(me.onDeletePage, me)); - view.mnuRotatePageRight.on('click', _.bind(me.onRotatePage, me, 90)); - view.mnuRotatePageLeft.on('click', _.bind(me.onRotatePage, me, -90)); - view.menuImgReplace.menu.on('item:click', _.bind(me.onImgReplace, me)); - } - }, + createDelayedElements: function(view, type) {}, getView: function (name) { return !name ? @@ -429,7 +260,7 @@ define([ documentHolder.createDelayedElementsPDFEditor(); if (!selectedElements || !_.isArray(selectedElements) || selectedElements.length<1) - return {menu_to_show: documentHolder.editPDFModeMenu, menu_props: {}} + return {menu_to_show: documentHolder.editPDFModeMenu, menu_props: {}}; var me = this, menu_props = {}, @@ -492,17 +323,7 @@ define([ return {menu_to_show: menu_to_show, menu_props: menu_props}; }, - applyEditorMode: function() { - if (this.mode && this.mode.isPDFEdit && !this.documentHolder.editPDFModeMenu) { - this.documentHolder.createDelayedElementsPDFEditor(); - this.api.asc_registerCallback('asc_onShowMathTrack', _.bind(this.onShowMathTrack, this)); - this.api.asc_registerCallback('asc_onHideMathTrack', _.bind(this.onHideMathTrack, this)); - this.api.asc_registerCallback('asc_onDialogAddHyperlink', _.bind(this.onDialogAddHyperlink, this)); - this.api.asc_registerCallback('asc_ChangeCropState', _.bind(this.onChangeCropState, this)); - } - if (this.mode) - this.mode.isPDFEdit ? this.onHideTextBar() : this.onHideMathTrack(); - }, + applyEditorMode: function() {}, fillFormsMenuProps: function(selectedElements) { if (!selectedElements || !_.isArray(selectedElements)) return; @@ -776,133 +597,6 @@ define([ /** coauthoring end **/ }, - onHyperlinkClick: function(url) { - if (url) { - var type = this.api.asc_getUrlType(url); - if (type===AscCommon.c_oAscUrlType.Http || type===AscCommon.c_oAscUrlType.Email) - window.open(url); - else { - var me = this; - setTimeout(function() { - Common.UI.warning({ - msg: me.documentHolder.txtWarnUrl, - buttons: ['yes', 'no'], - primary: 'yes', - callback: function(btn) { - try { - (btn == 'yes') && window.open(url); - } catch (err) { - err && console.log(err.stack); - } - } - }); - }, 1); - } - } - }, - - onDialogAddHyperlink: function() { - var win, props, text; - var me = this; - if (me.api && me.mode.isEdit && !me._isDisabled && !PDFE.getController('LeftMenu').leftMenu.menuFile.isVisible()){ - var handlerDlg = function(dlg, result) { - if (result == 'ok') { - props = dlg.getSettings(); - (text!==false) - ? me.api.add_Hyperlink(props) - : me.api.change_Hyperlink(props); - } - - me.editComplete(); - }; - - text = me.api.can_AddHyperlink(); - - var _arr = []; - for (var i=0; i256) - ToolTip = ToolTip.substr(0, 256) + '...'; - } else if (type==Asc.c_oAscMouseMoveDataTypes.Form) { - ToolTip = moveData.get_FormHelpText(); - if (ToolTip.length>1000) - ToolTip = ToolTip.substr(0, 1000) + '...'; - } else if (type==Asc.c_oAscMouseMoveDataTypes.Eyedropper) { - if (me.eyedropperTip.isTipVisible) { - me.eyedropperTip.isTipVisible = false; - me.eyedropperTip.toolTip.hide(); - } - - var color = moveData.get_EyedropperColor().asc_getColor(), - r = color.get_r(), - g = color.get_g(), - b = color.get_b(), - hex = Common.Utils.ThemeColor.getHexColor(r,g,b); - if (!me.eyedropperTip.eyedropperColor) { - var colorEl = $(document.createElement("div")); - colorEl.addClass('eyedropper-color'); - colorEl.appendTo(document.body); - me.eyedropperTip.eyedropperColor = colorEl; - $('#id_main_view').on('mouseleave', _.bind(me.hideEyedropper, me)); - } - me.eyedropperTip.eyedropperColor.css({ - backgroundColor: '#' + hex, - left: (moveData.get_X() + me._XY[0] + 23) + 'px', - top: (moveData.get_Y() + me._XY[1] - 53) + 'px' - }); - me.eyedropperTip.isVisible = true; - - if (me.eyedropperTip.tipInterval) { - clearInterval(me.eyedropperTip.tipInterval); - } - me.eyedropperTip.tipInterval = setInterval(function () { - clearInterval(me.eyedropperTip.tipInterval); - if (me.eyedropperTip.isVisible) { - ToolTip = '
RGB(' + r + ',' + g + ',' + b + ')
' + - '
' + moveData.get_EyedropperColor().asc_getName() + '
'; - me.eyedropperTip.toolTip.setTitle(ToolTip); - me.eyedropperTip.isTipVisible = true; - me.eyedropperTip.toolTip.show([-10000, -10000]); - me.eyedropperTip.tipWidth = me.eyedropperTip.toolTip.getBSTip().$tip.width(); - showPoint = [moveData.get_X(), moveData.get_Y()]; - showPoint[1] += (me._XY[1] - 57); - showPoint[0] += (me._XY[0] + 58); - if (showPoint[0] + me.eyedropperTip.tipWidth > me._BodyWidth ) { - showPoint[0] = showPoint[0] - me.eyedropperTip.tipWidth - 40; - } - me.eyedropperTip.toolTip.getBSTip().$tip.css({ - top: showPoint[1] + 'px', - left: showPoint[0] + 'px' - }); - } - }, 800); - me.eyedropperTip.isHidden = false; - return; - } - - var recalc = false; - screenTip.isHidden = false; - - ToolTip = Common.Utils.String.htmlEncode(ToolTip); - - if (screenTip.tipType !== type || screenTip.tipLength !== ToolTip.length || screenTip.strTip.indexOf(ToolTip)<0 ) { - screenTip.toolTip.setTitle((type==Asc.c_oAscMouseMoveDataTypes.Hyperlink) ? (ToolTip + '
' + Common.Utils.String.platformKey('Ctrl', me.documentHolder.txtPressLink) + '') : ToolTip); - screenTip.tipLength = ToolTip.length; - screenTip.strTip = ToolTip; - screenTip.tipType = type; - recalc = true; - } - - showPoint = [moveData.get_X(), moveData.get_Y()]; - showPoint[1] += (me._XY[1]-15); - showPoint[0] += (me._XY[0]+5); - - if (!screenTip.isVisible || recalc) { - screenTip.isVisible = true; - screenTip.toolTip.show([-10000, -10000]); - } - - if ( recalc ) { - screenTip.tipHeight = screenTip.toolTip.getBSTip().$tip.height(); - screenTip.tipWidth = screenTip.toolTip.getBSTip().$tip.width(); - } - - recalc = false; - if (showPoint[0] + screenTip.tipWidth > me._BodyWidth ) { - showPoint[0] = me._BodyWidth - screenTip.tipWidth; - recalc = true; - } - if (showPoint[1] - screenTip.tipHeight < 0) { - showPoint[1] = (recalc) ? showPoint[1]+30 : 0; - } else - showPoint[1] -= screenTip.tipHeight; - - screenTip.toolTip.getBSTip().$tip.css({top: showPoint[1] + 'px', left: showPoint[0] + 'px'}); - } - /** coauthoring begin **/ - else if (moveData.get_Type()==Asc.c_oAscMouseMoveDataTypes.LockedObject && me.mode.isEdit && me.isUserVisible(moveData.get_UserId())) { // 2 - locked object - var src; - if (me.usertipcount >= me.usertips.length) { - src = $(document.createElement("div")); - src.addClass('username-tip'); - src.css({height: me._TtHeight + 'px', position: 'absolute', zIndex: '900', visibility: 'visible'}); - $(document.body).append(src); - if (me.userTooltip) { - src.on('mouseover', me.wrapEvents.userTipMousover); - src.on('mouseout', me.wrapEvents.userTipMousout); - } - - me.usertips.push(src); - } - src = me.usertips[me.usertipcount]; - me.usertipcount++; - - ToolTip = me.getUserName(moveData.get_UserId()); - - showPoint = [moveData.get_X()+me._XY[0], moveData.get_Y()+me._XY[1]]; - var maxwidth = showPoint[0]; - showPoint[0] = me._BodyWidth - showPoint[0]; - showPoint[1] -= ((moveData.get_LockedObjectType()==2) ? me._TtHeight : 0); - - if (showPoint[1] > me._XY[1] && showPoint[1]+me._TtHeight < me._XY[1]+me._Height) { - src.text(ToolTip); - src.css({visibility: 'visible', top: showPoint[1] + 'px', right: showPoint[0] + 'px', 'max-width': maxwidth + 'px'}); - } else { - src.css({visibility: 'hidden'}); - } - } - /** coauthoring end **/ - } - }, + onMouseMove: function(moveData) {}, onCoAuthoringDisconnect: function() { this.mode.isEdit = false; @@ -1148,1722 +682,26 @@ define([ this.api && this.api.asc_remove(); }, - onCutCopyPaste: function(item, e) { - var me = this; - if (me.api) { - var res = (item.value == 'cut') ? me.api.Cut() : ((item.value == 'copy') ? me.api.Copy() : me.api.Paste()); - if (!res) { - if (!Common.localStorage.getBool("pdfe-hide-copywarning")) { - (new Common.Views.CopyWarningDialog({ - handler: function(dontshow) { - if (dontshow) Common.localStorage.setItem("pdfe-hide-copywarning", 1); - me.editComplete(); - } - })).show(); - } - } - item.isFromBar && me.api.SetShowTextSelectPanel(false); - } - me.editComplete(); - }, - - onUndo: function () { - this.api && this.api.Undo(); - }, - - onRedo: function () { - this.api && this.api.Redo(); - }, - - onClear: function () { - if (this.api) { - var props = this.api.asc_IsContentControl() ? this.api.asc_GetContentControlProperties() : null; - if (props) { - this.api.asc_ClearContentControl(props.get_InternalId()); - } - } - }, - - onPrintSelection: function(item){ - if (this.api){ - var printopt = new Asc.asc_CAdjustPrint(); - printopt.asc_setPrintType(Asc.c_oAscPrintType.Selection); - var opts = new Asc.asc_CDownloadOptions(null, Common.Utils.isChrome || Common.Utils.isOpera || Common.Utils.isGecko && Common.Utils.firefoxVersion>86); // if isChrome or isOpera == true use asc_onPrintUrl event - opts.asc_setAdvancedOptions(printopt); - this.api.asc_Print(opts); - this.editComplete(); - Common.component.Analytics.trackEvent('DocumentHolder', 'Print Selection'); - } - }, - - onSignatureClick: function(item) { - var datavalue = item.cmpEl.attr('data-value'); - switch (item.value) { - case 0: - Common.NotificationCenter.trigger('protect:sign', datavalue); //guid - break; - case 1: - this.api.asc_ViewCertificate(datavalue); //certificate id - break; - case 2: - var docProtection = this.documentHolder._docProtection; - Common.NotificationCenter.trigger('protect:signature', 'visible', this._isDisabled || docProtection.isReadOnly || docProtection.isFormsOnly || docProtection.isCommentsOnly, datavalue);//guid, can edit settings for requested signature - break; - case 3: - var me = this; - Common.UI.warning({ - title: this.documentHolder.notcriticalErrorTitle, - msg: this.documentHolder.txtRemoveWarning, - buttons: ['ok', 'cancel'], - primary: 'ok', - callback: function(btn) { - if (btn == 'ok') { - me.api.asc_RemoveSignature(datavalue); - } - } - }); - break; - } - }, - - saveAsPicture: function() { - if(this.api) { - this.api.asc_SaveDrawingAsPicture(); - } - }, - - onPluginContextMenu: function(data) { - if (data && data.length>0 && this.documentHolder && this.documentHolder.currentMenu && this.documentHolder.currentMenu.isVisible()){ - this.documentHolder.updateCustomItems(this.documentHolder.currentMenu, data); - } - }, - - onHidePdfFormsActions: function() { - this.listControlMenuPdf && this.listControlMenuPdf.isVisible() && this.listControlMenuPdf.hide(); - var controlsContainer = this.documentHolder.cmpEl.find('#calendar-control-container-pdf'); - if (controlsContainer.is(':visible')) - controlsContainer.hide(); - }, - - onShowFormsPDFActions: function(obj, x, y) { - switch (obj.type) { - case AscPDF.FIELD_TYPES.combobox: - this.onShowListActionsPDF(obj, x, y); - break; - case AscPDF.FIELD_TYPES.text: - this.onShowDateActionsPDF(obj, x, y); - break; - } - }, - - onShowListActionsPDF: function(obj) { - var isForm = true, - cmpEl = this.documentHolder.cmpEl, - menu = this.listControlMenuPdf, - menuContainer = menu ? cmpEl.find(Common.Utils.String.format('#menu-container-{0}', menu.id)) : null, - me = this; - - me._listObjPdf = obj; - this._fromShowContentControls = true; - Common.UI.Menu.Manager.hideAll(); - - if (!menu) { - this.listControlMenuPdf = menu = new Common.UI.Menu({ - maxHeight: 207, - menuAlign: 'tr-bl', - items: [] - }); - menu.on('item:click', function(menu, item) { - setTimeout(function(){ - (item.value!==-1) && me.api.asc_SelectPDFFormListItem(item.value); - }, 1); - }); - - // Prepare menu container - if (!menuContainer || menuContainer.length < 1) { - menuContainer = $(Common.Utils.String.format('', menu.id)); - cmpEl.append(menuContainer); - } - - menu.render(menuContainer); - menu.cmpEl.attr({tabindex: "-1"}); - menu.on('hide:after', function(){ - me.listControlMenuPdf.removeAll(); - if (!me._fromShowContentControls) - me.api.asc_UncheckContentControlButtons(); - }); - } - - var options = obj.getOptions(), - count = options.length; - for (var i=0; i', - '<%= Common.Utils.String.htmlEncode(caption) %>', - '' - ].join('')) - })); - } - if (!isForm && menu.items.length<1) { - menu.addItem(new Common.UI.MenuItem({ - caption : this.documentHolder.txtEmpty, - value : -1 - })); - } - - var pagepos = obj.getPagePos(), - oGlobalCoords = AscPDF.GetGlobalCoordsByPageCoords(pagepos.x + pagepos.w, pagepos.y + pagepos.h, obj.getPage(), true); - - menuContainer.css({left: oGlobalCoords.X, top : oGlobalCoords.Y}); - menuContainer.attr('data-value', 'prevent-canvas-click'); - this._preventClick = true; - menu.show(); - - _.delay(function() { - menu.cmpEl.focus(); - }, 10); - this._fromShowContentControls = false; - }, - - onShowDateActionsPDF: function(obj, x, y) { - var cmpEl = this.documentHolder.cmpEl, - controlsContainer = cmpEl.find('#calendar-control-container-pdf'), - me = this; - - this._dateObjPdf = obj; - - if (controlsContainer.length < 1) { - controlsContainer = $('
'); - cmpEl.append(controlsContainer); - } - - Common.UI.Menu.Manager.hideAll(); - - var pagepos = obj.getPagePos(), - oGlobalCoords = AscPDF.GetGlobalCoordsByPageCoords(pagepos.x + pagepos.w, pagepos.y + pagepos.h, obj.getPage(), true); - - controlsContainer.css({left: oGlobalCoords.X, top : oGlobalCoords.Y}); - controlsContainer.show(); - - if (!this.cmpCalendarPdf) { - this.cmpCalendarPdf = new Common.UI.Calendar({ - el: cmpEl.find('#id-document-calendar-control-pdf'), - enableKeyEvents: true, - firstday: 1 - }); - this.cmpCalendarPdf.on('date:click', function (cmp, date) { - var specProps = new AscCommon.CSdtDatePickerPr(); - specProps.put_FullDate(new Date(date)); - me.api.asc_SetTextFormDatePickerDate(specProps); - controlsContainer.hide(); - }); - this.cmpCalendarPdf.on('calendar:keydown', function (cmp, e) { - if (e.keyCode==Common.UI.Keys.ESC) { - controlsContainer.hide(); - } - }); - $(document).on('mousedown', function(e) { - if (e.target.localName !== 'canvas' && controlsContainer.is(':visible') && controlsContainer.find(e.target).length==0) { - controlsContainer.hide(); - } - }); - - } - var val = this._dateObjPdf ? this._dateObjPdf.asc_GetValue() : undefined; - if (val) { - val = new Date(val); - if (Object.prototype.toString.call(val) !== '[object Date]' || isNaN(val)) - val = undefined; - } - !val && (val = new Date()); - this.cmpCalendarPdf.setDate(val); - - // align - var offset = Common.Utils.getOffset(controlsContainer), - docW = Common.Utils.innerWidth(), - docH = Common.Utils.innerHeight() - 10, // Yep, it's magic number - menuW = this.cmpCalendarPdf.cmpEl.outerWidth(), - menuH = this.cmpCalendarPdf.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.cmpCalendarPdf.cmpEl.css({left: left, top : top}); - - this._preventClick = true; - }, - - onShowContentControlsActions: function(obj, x, y) { - if (this._isDisabled) return; - - var me = this; - switch (obj.type) { - case Asc.c_oAscContentControlSpecificType.DateTime: - this.onShowDateActions(obj, x, y); - break; - case Asc.c_oAscContentControlSpecificType.Picture: - if (obj.pr && obj.pr.get_Lock) { - var lock = obj.pr.get_Lock(); - if (lock == Asc.c_oAscSdtLockType.SdtContentLocked || lock==Asc.c_oAscSdtLockType.ContentLocked) - return; - } - this.onShowImageActions(obj, x, y); - break; - case Asc.c_oAscContentControlSpecificType.DropDownList: - case Asc.c_oAscContentControlSpecificType.ComboBox: - this.onShowListActions(obj, x, y); - break; - } - }, - - onHideContentControlsActions: function() { - this.listControlMenu && this.listControlMenu.isVisible() && this.listControlMenu.hide(); - var controlsContainer = this.documentHolder.cmpEl.find('#calendar-control-container'); - if (controlsContainer.is(':visible')) - controlsContainer.hide(); - }, - - onShowImageActions: function(obj, x, y) { - var cmpEl = this.documentHolder.cmpEl, - menu = this.imageControlMenu, - menuContainer = menu ? cmpEl.find(Common.Utils.String.format('#menu-container-{0}', menu.id)) : null, - me = this; - - this.internalFormObj = obj ? obj.pr : null; - this._fromShowContentControls = true; - Common.UI.Menu.Manager.hideAll(); - - if (!menu) { - this.imageControlMenu = menu = new Common.UI.Menu({ - maxHeight: 207, - menuAlign: 'tl-bl', - items: [ - {caption: this.documentHolder.mniImageFromFile, value: 'file'}, - {caption: this.documentHolder.mniImageFromUrl, value: 'url'}, - {caption: this.documentHolder.mniImageFromStorage, value: 'storage', visible: this.mode.canRequestInsertImage || this.mode.fileChoiceUrl && this.mode.fileChoiceUrl.indexOf("{documentType}")>-1} - ] - }); - menu.on('item:click', function(menu, item) { - setTimeout(function(){ - me.onImageSelect(menu, item); - }, 1); - setTimeout(function(){ - me.api.asc_UncheckContentControlButtons(); - }, 500); - }); - - // Prepare menu container - if (!menuContainer || menuContainer.length < 1) { - menuContainer = $(Common.Utils.String.format('', menu.id)); - cmpEl.append(menuContainer); - } - - menu.render(menuContainer); - menu.cmpEl.attr({tabindex: "-1"}); - menu.on('hide:after', function(){ - if (!me._fromShowContentControls) - me.api.asc_UncheckContentControlButtons(); - }); - } - 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; - }, - - onImageSelect: function(menu, item) { - if (item.value=='url') { - var me = this; - (new Common.Views.ImageFromUrlDialog({ - handler: function(result, value) { - if (result == 'ok') { - if (me.api) { - var checkUrl = value.replace(/ /g, ''); - if (!_.isEmpty(checkUrl)) { - me.setImageUrl(checkUrl); - } - } - } - } - })).show(); - } else if (item.value=='storage') { - Common.NotificationCenter.trigger('storage:image-load', 'control'); - } else { - if (this._isFromFile) return; - this._isFromFile = true; - this.api.asc_addImage(this.internalFormObj); - this._isFromFile = false; - } - }, - - openImageFromStorage: function(type) { - var me = this; - if (this.mode.canRequestInsertImage) { - Common.Gateway.requestInsertImage(type); - } else { - (new Common.Views.SelectFileDlg({ - fileChoiceUrl: this.mode.fileChoiceUrl.replace("{fileExt}", "").replace("{documentType}", "ImagesOnly") - })).on('selectfile', function(obj, file){ - file && (file.c = type); - !file.images && (file.images = [{fileType: file.fileType, url: file.url}]); // SelectFileDlg uses old format for inserting image - file.url = null; - me.insertImage(file); - }).show(); - } - }, - - setImageUrl: function(url, token) { - this.api.asc_SetContentControlPictureUrl(url, this.internalFormObj ? this.internalFormObj.get_InternalId() : null, token); - }, - - insertImage: function(data) { // gateway - if (data && (data.url || data.images)) { - data.url && console.log("Obsolete: The 'url' parameter of the 'insertImage' method is deprecated. Please use 'images' parameter instead."); - - var arr = []; - if (data.images && data.images.length>0) { - for (var i=0; i', menu.id)); - 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) { - if (isForm){ // for dropdown and combobox form control always add placeholder item - var text = props.get_PlaceholderText(); - menu.addItem(new Common.UI.MenuItem({ - caption : (text.trim()!=='') ? text : this.documentHolder.txtEmpty, - value : '', - template : _.template([ - ' opacity: 0.6 <% } %>">', - '<%= Common.Utils.String.htmlEncode(caption) %>', - '' - ].join('')) - })); - } - var count = specProps.get_ItemsCount(); - for (var i=0; i', - '<%= Common.Utils.String.htmlEncode(caption) %>', - '' - ].join('')) - })); - } - if (!isForm && menu.items.length<1) { - menu.addItem(new Common.UI.MenuItem({ - caption : this.documentHolder.txtEmpty, - value : -1 - })); - } - } - - 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; + equationCallback: function(eqObj) { + eqObj && this.api.asc_SetMathProps(eqObj); + this.editComplete(); }, - onShowDateActions: function(obj, x, y) { - var props = obj.pr, - specProps = props.get_DateTimePr(), - cmpEl = this.documentHolder.cmpEl, - controlsContainer = cmpEl.find('#calendar-control-container'), - me = this; - - this._dateObj = props; - - if (controlsContainer.length < 1) { - controlsContainer = $('
'); - 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: cmpEl.find('#id-document-calendar-control'), - enableKeyEvents: true, - firstday: 1 - }); - this.cmpCalendar.on('date:click', function (cmp, date) { - var specProps = me._dateObj.get_DateTimePr(); - specProps.put_FullDate(new Date(date)); - me.api.asc_SetContentControlDatePickerDate(specProps); - controlsContainer.hide(); - me.api.asc_UncheckContentControlButtons(); - }); - this.cmpCalendar.on('calendar:keydown', function (cmp, e) { - if (e.keyCode==Common.UI.Keys.ESC) { - controlsContainer.hide(); - me.api.asc_UncheckContentControlButtons(); - } - }); - $(document).on('mousedown', function(e) { - if (e.target.localName !== 'canvas' && controlsContainer.is(':visible') && controlsContainer.find(e.target).length==0) { - controlsContainer.hide(); - me.api.asc_UncheckContentControlButtons(); - } - }); - - } - var val = specProps ? specProps.get_FullDate() : undefined; - this.cmpCalendar.setDate(val ? new Date(val) : new Date()); - - // align - var offset = Common.Utils.getOffset(controlsContainer), - 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; + onChangeCropState: function(state) { + this.documentHolder.menuImgCrop && this.documentHolder.menuImgCrop.menu.items[0].setChecked(state, true); }, - onShowMathTrack: function(bounds) { - if (this.mode && !(this.mode.isPDFEdit && this.mode.isEdit)) return; - - this.lastMathTrackBounds = bounds; - if (!Common.Controllers.LaunchController.isScriptLoaded()) { - this.showMathTrackOnLoad = true; - return; - } - if (bounds[3] < 0 || Common.Utils.InternalSettings.get('pdfe-equation-toolbar-hide')) { - this.onHideMathTrack(); - return; - } - var me = this, - documentHolder = me.documentHolder, - eqContainer = documentHolder.cmpEl.find('#equation-container'); - - // Prepare menu container - if (eqContainer.length < 1) { - var equationsStore = me.getApplication().getCollection('EquationGroups'), - eqStr = '
'; - - me.getApplication().getController('InsTab').onMathTypes(me.getApplication().getController('Toolbar')._equationTemp); - - me.equationBtns = []; - for (var i = 0; i < equationsStore.length; ++i) { - eqStr += ''; - } - eqStr += '
'; - eqStr += ''; - eqStr += '
'; - eqContainer = $(eqStr); - documentHolder.cmpEl.append(eqContainer); - var onShowBefore = function (menu) { - var index = menu.options.value, - group = equationsStore.at(index); - var equationPicker = new Common.UI.DataViewSimple({ - el: $('#id-document-holder-btn-equation-menu-' + index, menu.cmpEl), - parentMenu: menu, - store: group.get('groupStore'), - scrollAlwaysVisible: true, - showLast: false, - restoreHeight: 450, - itemTemplate: _.template( - '
' + - '
' + - '
') - }); - equationPicker.on('item:click', function(picker, item, record, e) { - if (me.api) { - if (record) - me.api.asc_AddMath(record.get('data').equationType); - } - }); - menu.off('show:before', onShowBefore); - }; - var bringForward = function (menu) { - eqContainer.addClass('has-open-menu'); - }; - var sendBackward = function (menu) { - eqContainer.removeClass('has-open-menu'); - }; - for (var i = 0; i < equationsStore.length; ++i) { - var equationGroup = equationsStore.at(i); - var btn = new Common.UI.Button({ - parentEl: $('#id-document-holder-btn-equation-' + i, documentHolder.cmpEl), - cls : 'btn-toolbar no-caret', - iconCls : 'svgicon ' + equationGroup.get('groupIcon'), - hint : equationGroup.get('groupName'), - menu : new Common.UI.Menu({ - cls: 'menu-shapes', - value: i, - items: [ - { template: _.template('') } - ] - }) - }); - btn.menu.on('show:before', onShowBefore); - btn.menu.on('show:before', bringForward); - btn.menu.on('hide:after', sendBackward); - me.equationBtns.push(btn); - } - - me.equationSettingsBtn = new Common.UI.Button({ - parentEl: $('#id-document-holder-btn-equation-settings', documentHolder.cmpEl), - cls : 'btn-toolbar no-caret', - iconCls : 'toolbar__icon btn-more-vertical', - hint : me.documentHolder.advancedEquationText, - menu : me.documentHolder.createEquationMenu('popuptbeqinput', 'tl-bl') - }); - me.equationSettingsBtn.menu.options.initMenu = function() { - var eq = me.api.asc_GetMathInputType(), - menu = me.equationSettingsBtn.menu, - isEqToolbarHide = Common.Utils.InternalSettings.get('pdfe-equation-toolbar-hide'); - - menu.items[5].setChecked(eq===Asc.c_oAscMathInputType.Unicode); - menu.items[6].setChecked(eq===Asc.c_oAscMathInputType.LaTeX); - menu.items[8].options.isToolbarHide = isEqToolbarHide; - menu.items[8].setCaption(isEqToolbarHide ? me.documentHolder.showEqToolbar : me.documentHolder.hideEqToolbar, true); - }; - me.equationSettingsBtn.menu.on('item:click', _.bind(me.convertEquation, me)); - me.equationSettingsBtn.menu.on('show:before', function(menu) { - bringForward(); - menu.options.initMenu(); - }); - me.equationSettingsBtn.menu.on('hide:after', sendBackward); - } - - var showPoint = [(bounds[0] + bounds[2])/2 - eqContainer.outerWidth()/2, bounds[1] - eqContainer.outerHeight() - 10]; - (showPoint[0]<0) && (showPoint[0] = 0); - if (showPoint[1]<0) { - showPoint[1] = bounds[3] + 10; - } - showPoint[1] = Math.min(me._Height - eqContainer.outerHeight(), Math.max(0, showPoint[1])); - eqContainer.css({left: showPoint[0], top : showPoint[1]}); - - if (_.isUndefined(me._XY)) { - me._XY = [ - Common.Utils.getOffset(documentHolder.cmpEl).left - $(window).scrollLeft(), - Common.Utils.getOffset(documentHolder.cmpEl).top - $(window).scrollTop() - ]; - me._Width = documentHolder.cmpEl.width(); - me._Height = documentHolder.cmpEl.height(); - me._BodyWidth = $('body').width(); - } + onDialogAddHyperlink: function() {}, - var diffDown = me._Height - showPoint[1] - eqContainer.outerHeight(), - diffUp = me._XY[1] + showPoint[1], - menuAlign = (diffDown < 220 && diffDown < diffUp*0.9) ? 'bl-tl' : 'tl-bl'; - if (Common.UI.isRTL()) { - menuAlign = menuAlign === 'bl-tl' ? 'br-tr' : 'tr-br'; - } - me.equationBtns.forEach(function(item){ - item && (item.menu.menuAlign = menuAlign); - }); - me.equationSettingsBtn.menu.menuAlign = menuAlign; - if (eqContainer.is(':visible')) { - if (me.equationSettingsBtn.menu.isVisible()) { - me.equationSettingsBtn.menu.options.initMenu(); - me.equationSettingsBtn.menu.alignPosition(); - } - } else { - eqContainer.show(); - } - me.disableEquationBar(); - }, + onShowMathTrack: function() {}, - onHideMathTrack: function() { - if (!this.documentHolder || !this.documentHolder.cmpEl) return; - if (!Common.Controllers.LaunchController.isScriptLoaded()) { - this.showMathTrackOnLoad = false; - return; - } - var eqContainer = this.documentHolder.cmpEl.find('#equation-container'); - if (eqContainer.is(':visible')) { - eqContainer.hide(); - } - }, + onHideMathTrack: function() {}, - disableEquationBar: function() { - var eqContainer = this.documentHolder.cmpEl.find('#equation-container'), - disabled = this._isDisabled || this._state.equationLocked; + onHideTextBar: function() {}, - if (eqContainer.length>0 && eqContainer.is(':visible')) { - this.equationBtns.forEach(function(item){ - item && item.setDisabled(!!disabled); - }); - this.equationSettingsBtn.setDisabled(!!disabled); - } - }, + disableEquationBar: function() {}, - convertEquation: function(menu, item, e) { - if (this.api) { - if (item.options.type=='input') { - this.api.asc_SetMathInputType(item.value); - Common.localStorage.setBool("pdfe-equation-input-latex", item.value === Asc.c_oAscMathInputType.LaTeX) - } else if (item.options.type=='view') - this.api.asc_ConvertMathView(item.value.linear, item.value.all); - else if(item.options.type=='hide') { - item.options.isToolbarHide = !item.options.isToolbarHide; - Common.Utils.InternalSettings.set('pdfe-equation-toolbar-hide', item.options.isToolbarHide); - Common.localStorage.setBool('pdfe-equation-toolbar-hide', item.options.isToolbarHide); - if(item.options.isToolbarHide) this.onHideMathTrack(); - else this.onShowMathTrack(this.lastMathTrackBounds); - } - } - }, - - equationCallback: function(eqObj) { - eqObj && this.api.asc_SetMathProps(eqObj); - this.editComplete(); - }, - - onChangeCropState: function(state) { - this.documentHolder.menuImgCrop && this.documentHolder.menuImgCrop.menu.items[0].setChecked(state, true); - }, - - addHyperlink: function(item){ - var win, me = this; - if (me.api) { - var _arr = []; - for (var i=0; i 0){ - var elType, elValue; - for (var i = selectedElements.length - 1; i >= 0; i--) { - elType = selectedElements[i].get_ObjectType(); - elValue = selectedElements[i].get_ObjectValue(); - - if (Asc.c_oAscTypeSelectElement.Table == elType) { - (new PDFE.Views.TableSettingsAdvanced( - { - tableProps: elValue, - slideSize: {width: me.api.get_PageWidth(), height: me.api.get_PageHeight()}, - handler: function(result, value) { - if (result == 'ok') { - if (me.api) { - me.api.tblApply(value.tableProps); - } - } - me.editComplete(); - Common.component.Analytics.trackEvent('DocumentHolder', 'Table Settings Advanced'); - } - })).show(); - break; - } - } - } - } - }, - - onImageAdvanced: function(item) { - var me = this; - if (me.api){ - var selectedElements = me.api.getSelectedElements(); - if (selectedElements && selectedElements.length>0){ - var elType, elValue; - - for (var i = selectedElements.length - 1; i >= 0; i--) { - elType = selectedElements[i].get_ObjectType(); - elValue = selectedElements[i].get_ObjectValue(); - - if (Asc.c_oAscTypeSelectElement.Image == elType) { - var imgsizeOriginal; - - if (!me.documentHolder.menuImgOriginalSize.isDisabled()) { - imgsizeOriginal = me.api.get_OriginalSizeImage(); - if (imgsizeOriginal) - imgsizeOriginal = {width:imgsizeOriginal.get_ImageWidth(), height:imgsizeOriginal.get_ImageHeight()}; - } - - (new PDFE.Views.ImageSettingsAdvanced( - { - imageProps: elValue, - sizeOriginal: imgsizeOriginal, - slideSize: {width: me.api.get_PageWidth(), height: me.api.get_PageHeight()}, - handler: function(result, value) { - if (result == 'ok') { - if (me.api) { - me.api.ImgApply(value.imageProps); - } - } - me.editComplete(); - Common.component.Analytics.trackEvent('DocumentHolder', 'Image Settings Advanced'); - } - })).show(); - break; - } - } - } - } - }, - - onImgOriginalSize: function(item){ - var me = this; - if (me.api){ - var originalImageSize = me.api.get_OriginalSizeImage(); - - if (originalImageSize) { - var properties = new Asc.asc_CImgProperty(); - - properties.put_Width(originalImageSize.get_ImageWidth()); - properties.put_Height(originalImageSize.get_ImageHeight()); - properties.put_ResetCrop(true); - properties.put_Rot(0); - me.api.ImgApply(properties); - } - - me.editComplete(); - Common.component.Analytics.trackEvent('DocumentHolder', 'Set Image Original Size'); - } - }, - - onImgRotate: function(item) { - var properties = new Asc.asc_CShapeProperty(); - properties.asc_putRotAdd((item.value==1 ? 90 : 270) * 3.14159265358979 / 180); - this.api.ShapeApply(properties); - this.editComplete(); - }, - - onImgFlip: function(item) { - var properties = new Asc.asc_CShapeProperty(); - if (item.value==1) - properties.asc_putFlipHInvert(true); - else - properties.asc_putFlipVInvert(true); - this.api.ShapeApply(properties); - this.editComplete(); - }, - - onImgCrop: function(menu, item) { - if (item.value == 1) { - this.api.asc_cropFill(); - } else if (item.value == 2) { - this.api.asc_cropFit(); - } else { - item.checked ? this.api.asc_startEditCrop() : this.api.asc_endEditCrop(); - } - this.editComplete(); - }, - - onImgResetCrop: function() { - if (this.api) { - var properties = new Asc.asc_CImgProperty(); - properties.put_ResetCrop(true); - } - this.api.ImgApply(properties); - this.editComplete(); - }, - - onImgEditPoints: function(item) { - this.api && this.api.asc_editPointsGeometry(); - }, - - onShapeAdvanced: function(item) { - var me = this; - if (me.api){ - var selectedElements = me.api.getSelectedElements(); - if (selectedElements && selectedElements.length>0){ - var elType, elValue; - for (var i = selectedElements.length - 1; i >= 0; i--) { - elType = selectedElements[i].get_ObjectType(); - elValue = selectedElements[i].get_ObjectValue(); - if (Asc.c_oAscTypeSelectElement.Shape == elType) { - (new PDFE.Views.ShapeSettingsAdvanced( - { - shapeProps: elValue, - slideSize: {width: me.api.get_PageWidth(), height: me.api.get_PageHeight()}, - handler: function(result, value) { - if (result == 'ok') { - if (me.api) { - me.api.ShapeApply(value.shapeProps); - } - } - me.editComplete(); - Common.component.Analytics.trackEvent('DocumentHolder', 'Image Shape Advanced'); - } - })).show(); - break; - } - } - } - } - }, - - onParagraphAdvanced: function(item) { - var me = this; - if (me.api){ - var selectedElements = me.api.getSelectedElements(); - - if (selectedElements && selectedElements.length > 0){ - var elType, elValue; - for (var i = selectedElements.length - 1; i >= 0; i--) { - elType = selectedElements[i].get_ObjectType(); - elValue = selectedElements[i].get_ObjectValue(); - - if (Asc.c_oAscTypeSelectElement.Paragraph == elType) { - (new PDFE.Views.ParagraphSettingsAdvanced( - { - paragraphProps: elValue, - api: me.api, - handler: function(result, value) { - if (result == 'ok') { - if (me.api) { - me.api.paraApply(value.paragraphProps); - } - } - me.editComplete(); - Common.component.Analytics.trackEvent('DocumentHolder', 'Image Paragraph Advanced'); - } - })).show(); - break; - } - } - } - } - }, - - onGroupImg: function(item) { - this.api && this.api.groupShapes(); - this.editComplete(); - Common.component.Analytics.trackEvent('DocumentHolder', 'Group Image'); - }, - - onUnGroupImg: function(item) { - this.api && this.api.unGroupShapes(); - this.editComplete(); - Common.component.Analytics.trackEvent('DocumentHolder', 'UnGroup Image'); - }, - - onArrangeFront: function(item) { - this.api && this.api.shapes_bringToFront(); - this.editComplete(); - Common.component.Analytics.trackEvent('DocumentHolder', 'Bring To Front'); - }, - - onArrangeBack: function(item) { - this.api && this.api.shapes_bringToBack(); - this.editComplete(); - Common.component.Analytics.trackEvent('DocumentHolder', 'Bring To Back'); - }, - - onArrangeForward: function(item) { - this.api && this.api.shapes_bringForward(); - this.editComplete(); - Common.component.Analytics.trackEvent('DocumentHolder', 'Send Forward'); - }, - - onArrangeBackward: function(item) { - this.api && this.api.shapes_bringBackward(); - this.editComplete(); - Common.component.Analytics.trackEvent('DocumentHolder', 'Send Backward'); - }, - - onImgShapeAlign: function (menu, item) { - var me = this; - if (me.api) { - var value = me.api.asc_getSelectedDrawingObjectsCount()<2 || Common.Utils.InternalSettings.get("pdfe-align-to-slide"); - value = value ? Asc.c_oAscObjectsAlignType.Page : Asc.c_oAscObjectsAlignType.Selected; - if (item.value < 6) { - me.api.put_ShapesAlign(item.value, value); - Common.component.Analytics.trackEvent('DocumentHolder', 'Shape Align'); - } else if (item.value == 6) { - me.api.DistributeHorizontally(value); - Common.component.Analytics.trackEvent('DocumentHolder', 'Distribute Horizontally'); - } else if (item.value == 7){ - me.api.DistributeVertically(value); - Common.component.Analytics.trackEvent('DocumentHolder', 'Distribute Vertically'); - } - me.editComplete(); - } - }, - - onParagraphVAlign: function (menu, item) { - var me = this; - if (me.api) { - var properties = new Asc.asc_CShapeProperty(); - properties.put_VerticalTextAlign(item.value); - - me.api.ShapeApply(properties); - } - - me.editComplete(); - Common.component.Analytics.trackEvent('DocumentHolder', 'Text Vertical Align'); - }, - - onParagraphDirection: function(menu, item) { - var me = this; - if (me.api) { - var properties = new Asc.asc_CShapeProperty(); - properties.put_Vert(item.options.direction); - me.api.ShapeApply(properties); - } - me.editComplete(); - Common.component.Analytics.trackEvent('DocumentHolder', 'Text Direction'); - }, - - tableSelectText: function(menu, item) { - if (this.api) { - switch (item.value) { - case 0: - this.api.selectRow(); - break; - case 1: - this.api.selectColumn(); - break; - case 2: - this.api.selectCell(); - break; - case 3: - this.api.selectTable(); - break; - } - } - }, - - tableInsertText: function(menu, item) { - if (this.api) { - switch (item.value) { - case 0: - this.api.addColumnLeft(); - break; - case 1: - this.api.addColumnRight(); - break; - case 2: - this.api.addRowAbove(); - break; - case 3: - this.api.addRowBelow(); - break; - } - } - }, - - tableDeleteText: function(menu, item) { - if (this.api) { - switch (item.value) { - case 0: - this.api.remRow(); - break; - case 1: - this.api.remColumn(); - break; - case 2: - this.api.remTable(); - break; - } - } - }, - - onShowTextBar: function(bounds) { - if (this.mode && !(!this.mode.isPDFEdit && this.mode.isEdit)) return; - - if (_.isUndefined(this._XY)) { - this._XY = [ - Common.Utils.getOffset(this.documentHolder.cmpEl).left - $(window).scrollLeft(), - Common.Utils.getOffset(this.documentHolder.cmpEl).top - $(window).scrollTop() - ]; - this._Width = this.documentHolder.cmpEl.width(); - this._Height = this.documentHolder.cmpEl.height(); - this._BodyWidth = $('body').width(); - } - - this.lastTextBarBounds = bounds; - if (bounds[3] < 0 || bounds[1] > this._Height) { - this.onHideTextBar(); - return; - } - var me = this, - documentHolder = me.documentHolder, - textContainer = documentHolder.cmpEl.find('#text-bar-container'); - - // Prepare menu container - if (textContainer.length < 1) { - me.textBarBtns = []; - textContainer = documentHolder.createTextBar(me.textBarBtns); - documentHolder.cmpEl.append(textContainer); - documentHolder.cmbFontSize.options.menuAlignEl = documentHolder.cmbFontName.options.menuAlignEl = documentHolder.cmpEl; - - var bringForward = function (menu) { - textContainer.addClass('has-open-menu'); - }; - var sendBackward = function (menu) { - textContainer.removeClass('has-open-menu'); - }; - me.textBarBtns.forEach(function(item){ - if (item && item.menu) { - item.menu.on('show:before', bringForward); - item.menu.on('hide:after', sendBackward); - } - }); - // annotation text bar - this.api.asc_registerCallback('asc_onFontSize', _.bind(this.onApiFontSize, this)); - this.api.asc_registerCallback('asc_onBold', _.bind(this.onApiBold, this)); - this.api.asc_registerCallback('asc_onItalic', _.bind(this.onApiItalic, this)); - this.api.asc_registerCallback('asc_onUnderline', _.bind(this.onApiUnderline, this)); - this.api.asc_registerCallback('asc_onStrikeout', _.bind(this.onApiStrikeout, this)); - this.api.asc_registerCallback('asc_onVerticalAlign', _.bind(this.onApiVerticalAlign, this)); - Common.NotificationCenter.on('fonts:change', _.bind(this.onApiChangeFont, this)); - this.api.asc_registerCallback('asc_onTextColor', _.bind(this.onApiTextColor, this)); - - documentHolder.btnBold.on('click', _.bind(this.onBold, this)); - documentHolder.btnItalic.on('click', _.bind(this.onItalic, this)); - documentHolder.btnTextUnderline.on('click', _.bind(this.onTextUnderline, this)); - documentHolder.btnTextStrikeout.on('click', _.bind(this.onTextStrikeout, this)); - documentHolder.btnSuperscript.on('click', _.bind(this.onSuperscript, this)); - documentHolder.btnSubscript.on('click', _.bind(this.onSubscript, this)); - documentHolder.btnFontColor.on('click', _.bind(this.onBtnFontColor, this)); - documentHolder.btnFontColor.on('color:select', _.bind(this.onSelectFontColor, this)); - documentHolder.cmbFontSize.on('selected', _.bind(this.onFontSizeSelect, this)); - documentHolder.cmbFontSize.on('changed:before', _.bind(this.onFontSizeChanged, this, true)); - documentHolder.cmbFontSize.on('changed:after', _.bind(this.onFontSizeChanged, this, false)); - documentHolder.cmbFontSize.on('show:after', _.bind(this.onComboOpen, this, true)); - documentHolder.cmbFontSize.on('hide:after', _.bind(this.onHideMenus, this)); - documentHolder.cmbFontSize.on('combo:blur', _.bind(this.onComboBlur, this)); - documentHolder.cmbFontSize.on('combo:focusin', _.bind(this.onComboOpen, this, false)); - documentHolder.cmbFontName.on('selected', _.bind(this.onFontNameSelect, this)); - documentHolder.cmbFontName.on('show:after', _.bind(this.onComboOpen, this, true)); - documentHolder.cmbFontName.on('hide:after', _.bind(this.onHideMenus, this)); - documentHolder.cmbFontName.on('combo:blur', _.bind(this.onComboBlur, this)); - documentHolder.cmbFontName.on('combo:focusin', _.bind(this.onComboOpen, this, false)); - - this.api.UpdateInterfaceState(); - } - - var showPoint = [(bounds[0] + bounds[2])/2 - textContainer.outerWidth()/2, bounds[1] - textContainer.outerHeight() - 10]; - (showPoint[0]<0) && (showPoint[0] = 0); - if (showPoint[1]<0) { - showPoint[1] = (bounds[3] > me._Height) ? 0 : bounds[3] + 10; - } - showPoint[1] = Math.min(me._Height - textContainer.outerHeight(), Math.max(0, showPoint[1])); - textContainer.css({left: showPoint[0], top : showPoint[1]}); - - var diffDown = me._Height - showPoint[1] - textContainer.outerHeight(), - diffUp = me._XY[1] + showPoint[1], - menuAlign = (diffDown < 220 && diffDown < diffUp*0.9) ? 'bl-tl' : 'tl-bl'; - if (Common.UI.isRTL()) { - menuAlign = menuAlign === 'bl-tl' ? 'br-tr' : 'tr-br'; - } - me.textBarBtns.forEach(function(item){ - item && item.menu && (item.menu.menuAlign = menuAlign); - }); - if (!textContainer.is(':visible')) { - textContainer.show(); - } - me.disableTextBar(); - }, - - onHideTextBar: function() { - if (!this.documentHolder || !this.documentHolder.cmpEl) return; - var textContainer = this.documentHolder.cmpEl.find('#text-bar-container'); - if (textContainer.is(':visible')) { - textContainer.hide(); - } - }, - - disableTextBar: function() { - var textContainer = this.documentHolder.cmpEl.find('#text-bar-container'), - disabled = this._isDisabled; - - if (textContainer.length>0 && textContainer.is(':visible')) { - this.textBarBtns.forEach(function(item){ - item && item.setDisabled(!!disabled); - }); - } - }, - - onApiChangeFont: function(font) { - if (!this.mode.isPDFAnnotate || !this.mode.isEdit) return; - this._state.fontname = font; - !Common.Utils.ModalWindow.isVisible() && this.documentHolder.cmbFontName.onApiChangeFont(font); - }, - - onApiFontSize: function(size) { - if (!this.mode.isPDFAnnotate || !this.mode.isEdit) return; - if (this._state.fontsize !== size) { - this.documentHolder.cmbFontSize.setValue(size); - this._state.fontsize = size; - } - }, - - onApiBold: function(on) { - if (!this.mode.isPDFAnnotate || !this.mode.isEdit) return; - if (this._state.bold !== on) { - this.documentHolder.btnBold.toggle(on === true, true); - this._state.bold = on; - } - }, - - onApiItalic: function(on) { - if (!this.mode.isPDFAnnotate || !this.mode.isEdit) return; - if (this._state.italic !== on) { - this.documentHolder.btnItalic.toggle(on === true, true); - this._state.italic = on; - } - }, - - onApiUnderline: function(on) { - if (!this.mode.isPDFAnnotate || !this.mode.isEdit) return; - if (this._state.underline !== on) { - this.documentHolder.btnTextUnderline.toggle(on === true, true); - this._state.underline = on; - } - }, - - onApiStrikeout: function(on) { - if (!this.mode.isPDFAnnotate || !this.mode.isEdit) return; - if (this._state.strike !== on) { - this.documentHolder.btnTextStrikeout.toggle(on === true, true); - this._state.strike = on; - } - }, - - onApiVerticalAlign: function(typeBaseline) { - if (!this.mode.isPDFAnnotate || !this.mode.isEdit) return; - if (this._state.valign !== typeBaseline) { - this.documentHolder.btnSuperscript.toggle(typeBaseline==Asc.vertalign_SuperScript, true); - this.documentHolder.btnSubscript.toggle(typeBaseline==Asc.vertalign_SubScript, true); - this._state.valign = typeBaseline; - } - }, - - onApiTextColor: function(color) { - if (!this.mode.isPDFAnnotate || !this.mode.isEdit) return; - var clr; - var picker = this.documentHolder.mnuFontColorPicker; - - if (color) { - if (color.get_type() == Asc.c_oAscColor.COLOR_TYPE_SCHEME) { - clr = {color: Common.Utils.ThemeColor.getHexColor(color.get_r(), color.get_g(), color.get_b()), effectValue: color.get_value() }; - } else - clr = Common.Utils.ThemeColor.getHexColor(color.get_r(), color.get_g(), color.get_b()); - } - - var type1 = typeof(clr), - type2 = typeof(this._state.clrtext); - - if ((type1 !== type2) || (type1 == 'object' && - (clr.effectValue !== this._state.clrtext.effectValue || this._state.clrtext.color.indexOf(clr.color) < 0)) || - (type1 != 'object' && this._state.clrtext.indexOf(clr) < 0)) { - - Common.Utils.ThemeColor.selectPickerColorByEffect(clr, picker); - this._state.clrtext = clr; - } - this._state.clrtext_asccolor = color; - }, - - onBold: function(btn, e) { - this._state.bold = undefined; - if (this.api) - this.api.put_TextPrBold(btn.pressed); - - Common.NotificationCenter.trigger('edit:complete', this.documentHolder); - }, - - onItalic: function(btn, e) { - this._state.italic = undefined; - if (this.api) - this.api.put_TextPrItalic(btn.pressed); - - Common.NotificationCenter.trigger('edit:complete', this.documentHolder); - }, - - onTextUnderline: function(btn, e) { - this._state.underline = undefined; - if (this.api) - this.api.put_TextPrUnderline(btn.pressed); - - Common.NotificationCenter.trigger('edit:complete', this.documentHolder); - }, - - onTextStrikeout: function(btn, e) { - this._state.strike = undefined; - if (this.api) - this.api.put_TextPrStrikeout(btn.pressed); - - Common.NotificationCenter.trigger('edit:complete', this.documentHolder); - }, - - onSuperscript: function(btn, e) { - if (!this.documentHolder.btnSubscript.pressed) { - this._state.valign = undefined; - if (this.api) - this.api.put_TextPrBaseline(btn.pressed ? Asc.vertalign_SuperScript : Asc.vertalign_Baseline); - - Common.NotificationCenter.trigger('edit:complete', this.documentHolder); - } - }, - - onSubscript: function(btn, e) { - if (!this.documentHolder.btnSuperscript.pressed) { - this._state.valign = undefined; - if (this.api) - this.api.put_TextPrBaseline(btn.pressed ? Asc.vertalign_SubScript : Asc.vertalign_Baseline); - - Common.NotificationCenter.trigger('edit:complete', this.documentHolder); - } - }, - - onSelectFontColor: function(btn, color) { - this._state.clrtext = this._state.clrtext_asccolor = undefined; - - this.documentHolder.btnFontColor.currentColor = color; - this.documentHolder.btnFontColor.setColor((typeof(color) == 'object') ? color.color : color); - - this.documentHolder.mnuFontColorPicker.currentColor = color; - if (this.api) - this.api.put_TextColor(Common.Utils.ThemeColor.getRgbColor(color)); - }, - - onBtnFontColor: function() { - this.documentHolder.mnuFontColorPicker.trigger('select', this.documentHolder.mnuFontColorPicker, this.documentHolder.mnuFontColorPicker.currentColor || this.documentHolder.btnFontColor.currentColor); - }, - - onComboBlur: function() { - Common.NotificationCenter.trigger('edit:complete', this.documentHolder); - }, - - onHideMenus: function(e){ - Common.NotificationCenter.trigger('edit:complete', this.documentHolder); - }, - - onFontNameSelect: function(combo, record) { - if (this.api) { - if (record.isNewFont) { - !Common.Utils.ModalWindow.isVisible() && - Common.UI.warning({ - width: 500, - msg: this.documentHolder.confirmAddFontName, - buttons: ['yes', 'no'], - primary: 'yes', - callback: _.bind(function(btn) { - if (btn == 'yes') { - this.api.put_TextPrFontName(record.name); - } else { - this.documentHolder.cmbFontName.setValue(this.api.get_TextProps().get_TextPr().get_FontFamily().get_Name()); - } - Common.NotificationCenter.trigger('edit:complete', this.documentHolder); - }, this) - }); - } else { - this.api.put_TextPrFontName(record.name); - } - } - Common.NotificationCenter.trigger('edit:complete', this.documentHolder); - }, - - onComboOpen: function(needfocus, combo, e, params) { - if (params && params.fromKeyDown) return; - _.delay(function() { - var input = $('input', combo.cmpEl).select(); - if (needfocus) input.focus(); - else if (!combo.isMenuOpen()) input.one('mouseup', function (e) { e.preventDefault(); }); - }, 10); - }, - - onFontSizeSelect: function(combo, record) { - this._state.fontsize = undefined; - if (this.api) - this.api.put_TextPrFontSize(record.value); - - Common.NotificationCenter.trigger('edit:complete', this.documentHolder); - }, - - onFontSizeChanged: function(before, combo, record, e) { - var value, - me = this; - - if (before) { - var item = combo.store.findWhere({ - displayValue: record.value - }); - - if (!item) { - value = /^\+?(\d*(\.|,).?\d+)$|^\+?(\d+(\.|,)?\d*)$/.exec(record.value); - - if (!value) { - value = this._getApiTextSize(); - setTimeout(function(){ - Common.UI.warning({ - msg: me.documentHolder.textFontSizeErr, - callback: function() { - _.defer(function(btn) { - $('input', combo.cmpEl).focus(); - }) - } - }); - }, 1); - combo.setRawValue(value); - e.preventDefault(); - return false; - } - } - } else { - value = Common.Utils.String.parseFloat(record.value); - value = value > 300 ? 300 : - value < 1 ? 1 : Math.floor((value+0.4)*2)/2; - - combo.setRawValue(value); - - this._state.fontsize = undefined; - if (this.api) { - this.api.put_TextPrFontSize(value); - } - - Common.NotificationCenter.trigger('edit:complete', this.documentHolder); - } - }, - - _getApiTextSize: function () { - var out_value = 12, - textPr = this.api.get_TextProps(); - - if (textPr && textPr.get_TextPr) { - out_value = textPr.get_TextPr().get_FontSize(); - } - - return out_value; - }, - - onCountPages: function(count) { - this.documentHolder && (this.documentHolder._pagesCount = count); - }, - - onNewPage: function(item) { - this.api && this.api.asc_AddPage(item.value); - - Common.NotificationCenter.trigger('edit:complete', this.documentHolder); - }, - - onDeletePage: function() { - this.api && this.api.asc_RemovePage(); - - Common.NotificationCenter.trigger('edit:complete', this.documentHolder); - }, - - onRotatePage: function(angle, item) { - this.api && this.api.asc_RotatePage(angle); - - Common.NotificationCenter.trigger('edit:complete', this.documentHolder); - }, - - onShowAnnotBar: function(bounds, mouseOnTop) { - if (this.mode && !this.mode.isEdit) return; - - if (_.isUndefined(this._XY)) { - this._XY = [ - Common.Utils.getOffset(this.documentHolder.cmpEl).left - $(window).scrollLeft(), - Common.Utils.getOffset(this.documentHolder.cmpEl).top - $(window).scrollTop() - ]; - this._Width = this.documentHolder.cmpEl.width(); - this._Height = this.documentHolder.cmpEl.height(); - this._BodyWidth = $('body').width(); - } - - this.lastAnnotBarBounds = bounds; - (mouseOnTop!==undefined) && (this.lastAnnotBarOnTop = mouseOnTop); - if (bounds[3] < 0 || bounds[1] > this._Height || !Common.Utils.InternalSettings.get('pdfe-settings-annot-bar')) { - this.onHideAnnotBar(); - return; - } - var me = this, - documentHolder = me.documentHolder, - textContainer = documentHolder.cmpEl.find('#annot-bar-container'); - - // Prepare menu container - if (textContainer.length < 1) { - me.annotBarBtns = []; - textContainer = documentHolder.createAnnotBar(me.annotBarBtns); - documentHolder.cmpEl.append(textContainer); - - var bringForward = function (menu) { - textContainer.addClass('has-open-menu'); - }; - var sendBackward = function (menu) { - textContainer.removeClass('has-open-menu'); - }; - me.annotBarBtns.forEach(function(item){ - if (item && item.menu) { - item.menu.on('show:before', bringForward); - item.menu.on('hide:after', sendBackward); - } - }); - // annotation text bar - documentHolder.btnCopy.on('click', _.bind(this.onCutCopyPaste, this, {value: 'copy', isFromBar: true})); - documentHolder.btnAddComment.on('click', _.bind(this.addComment, this, {isFromBar: true})); - if (me.mode.isEditTextSupport && (me.mode.isPDFAnnotate && me.mode.canPDFEdit || me.mode.isPDFEdit)) - documentHolder.btnEditText.on('click', _.bind(this.editText, this)); - else - documentHolder.btnEditText.cmpEl.parent().hide().prev('.separator').hide(); - - this.api.UpdateInterfaceState(); - } - - var showPoint = [(bounds[0] + bounds[2])/2 - textContainer.outerWidth()/2, me.lastAnnotBarOnTop ? bounds[1] - textContainer.outerHeight() - 10 : bounds[3] + 10]; - (showPoint[0]<0) && (showPoint[0] = 0); - showPoint[1] = Math.min(me._Height - textContainer.outerHeight(), Math.max(0, showPoint[1])); - textContainer.css({left: showPoint[0], top : showPoint[1]}); - - var diffDown = me._Height - showPoint[1] - textContainer.outerHeight(), - diffUp = me._XY[1] + showPoint[1], - menuAlign = (diffDown < 220 && diffDown < diffUp*0.9) ? 'bl-tl' : 'tl-bl'; - if (Common.UI.isRTL()) { - menuAlign = menuAlign === 'bl-tl' ? 'br-tr' : 'tr-br'; - } - me.annotBarBtns.forEach(function(item){ - item && item.menu && (item.menu.menuAlign = menuAlign); - }); - if (!textContainer.is(':visible')) { - textContainer.show(); - } - me.disableAnnotBar(); - }, - - onHideAnnotBar: function() { - if (!this.documentHolder || !this.documentHolder.cmpEl) return; - var textContainer = this.documentHolder.cmpEl.find('#annot-bar-container'); - if (textContainer.is(':visible')) { - textContainer.hide(); - } - }, - - disableAnnotBar: function() { - var textContainer = this.documentHolder.cmpEl.find('#annot-bar-container'), - disabled = this._isDisabled; - - if (textContainer.length>0 && textContainer.is(':visible')) { - this.annotBarBtns.forEach(function(item){ - item && item.setDisabled(!!disabled); - }); - this.documentHolder.btnCopy && this.documentHolder.btnCopy.setDisabled(!this.api.can_CopyCut() || !!disabled); - } - }, + onHideAnnotBar: function() {}, editText: function() { this.mode && !this.mode.isPDFEdit && Common.NotificationCenter.trigger('pdf:mode-apply', 'edit'); diff --git a/apps/pdfeditor/main/app/controller/DocumentHolderExt.js b/apps/pdfeditor/main/app/controller/DocumentHolderExt.js new file mode 100644 index 0000000000..9c9ff9823b --- /dev/null +++ b/apps/pdfeditor/main/app/controller/DocumentHolderExt.js @@ -0,0 +1,2236 @@ +/* + * (c) Copyright Ascensio System SIA 2010-2024 + * + * This program is a free software product. You can redistribute it and/or + * modify it under the terms of the GNU Affero General Public License (AGPL) + * version 3 as published by the Free Software Foundation. In accordance with + * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect + * that Ascensio System SIA expressly excludes the warranty of non-infringement + * of any third-party rights. + * + * This program is distributed WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For + * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html + * + * You can contact Ascensio System SIA at 20A-6 Ernesta Birznieka-Upish + * street, Riga, Latvia, EU, LV-1050. + * + * The interactive user interfaces in modified source and object code versions + * of the Program must display Appropriate Legal Notices, as required under + * Section 5 of the GNU AGPL version 3. + * + * Pursuant to Section 7(b) of the License you must retain the original Product + * logo when distributing the program. Pursuant to Section 7(e) we decline to + * grant you any rights under trademark law for use of our trademarks. + * + * All the Product's GUI elements, including illustrations and icon sets, as + * well as technical writing content are licensed under the terms of the + * Creative Commons Attribution-ShareAlike 4.0 International. See the License + * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode + * + */ +/** + * DocumentHolderExt.js + * + * DocumentHolder controller + * + * Created on 12/09/24 + * + */ + +define([], function () { + 'use strict'; + + if (window.PDFE && window.PDFE.Controllers && window.PDFE.Controllers.DocumentHolder) { + let dh = window.PDFE.Controllers.DocumentHolder.prototype; + + dh.setEvents = function() { + this.addListeners({ + 'DocumentHolder': { + 'createdelayedelements': this.createDelayedElements, + 'equation:callback': this.equationCallback + }, + 'FileMenu': { + 'settings:apply': _.bind(this.applySettings, this) + } + }); + + if (this.api) { + this.api.asc_registerCallback('asc_onContextMenu', _.bind(this.onContextMenu, this)); + this.api.asc_registerCallback('asc_onMouseMoveStart', _.bind(this.onMouseMoveStart, this)); + this.api.asc_registerCallback('asc_onMouseMoveEnd', _.bind(this.onMouseMoveEnd, this)); + + //hyperlink + this.api.asc_registerCallback('asc_onHyperlinkClick', _.bind(this.onHyperlinkClick, this)); + this.api.asc_registerCallback('asc_onMouseMove', _.bind(this.onMouseMove, this)); + + if (this.mode.isEdit === true) { + this.api.asc_registerCallback('asc_onHideEyedropper', _.bind(this.hideEyedropper, this)); + this.api.asc_registerCallback('asc_onShowPDFFormsActions', _.bind(this.onShowFormsPDFActions, this)); + this.api.asc_registerCallback('asc_onHidePdfFormsActions', _.bind(this.onHidePdfFormsActions, this)); + this.api.asc_registerCallback('asc_onCountPages', _.bind(this.onCountPages, this)); + if (this.mode.canComments) { + // for text + this.api.asc_registerCallback('asc_onShowAnnotTextPrTrack', _.bind(this.onShowTextBar, this)); + this.api.asc_registerCallback('asc_onHideAnnotTextPrTrack', _.bind(this.onHideTextBar, this)); + this.api.asc_registerCallback('asc_onShowTextSelectTrack', _.bind(this.onShowAnnotBar, this)); + this.api.asc_registerCallback('asc_onHideTextSelectTrack', _.bind(this.onHideAnnotBar, this)); + } + } + if (this.mode.isRestrictedEdit) { + this.api.asc_registerCallback('asc_onShowContentControlsActions', _.bind(this.onShowContentControlsActions, this)); + this.api.asc_registerCallback('asc_onHideContentControlsActions', _.bind(this.onHideContentControlsActions, this)); + Common.Gateway.on('insertimage', _.bind(this.insertImage, this)); + Common.NotificationCenter.on('storage:image-load', _.bind(this.openImageFromStorage, this)); // try to load image from storage + Common.NotificationCenter.on('storage:image-insert', _.bind(this.insertImageFromStorage, this)); // set loaded image to control + } + this.api.asc_registerCallback('asc_onCoAuthoringDisconnect', _.bind(this.onCoAuthoringDisconnect, this)); + Common.NotificationCenter.on('api:disconnect', _.bind(this.onCoAuthoringDisconnect, 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)); + this.api.asc_registerCallback('onPluginContextMenu', _.bind(this.onPluginContextMenu, this)); + } + }; + + dh.createDelayedElements = function(view, type) { + var me = this, + view = me.documentHolder; + + if (type==='pdf') { + view.menuPDFViewCopy.on('click', _.bind(me.onCutCopyPaste, me)); + view.menuAddComment.on('click', _.bind(me.addComment, me)); + view.menuRemoveComment.on('click', _.bind(me.removeComment, me)); + } else if (type==='forms') { + view.menuPDFFormsUndo.on('click', _.bind(me.onUndo, me)); + view.menuPDFFormsRedo.on('click', _.bind(me.onRedo, me)); + view.menuPDFFormsClear.on('click', _.bind(me.onClear, me)); + view.menuPDFFormsCut.on('click', _.bind(me.onCutCopyPaste, me)); + view.menuPDFFormsCopy.on('click', _.bind(me.onCutCopyPaste, me)); + view.menuPDFFormsPaste.on('click', _.bind(me.onCutCopyPaste, me)); + } else if (type==='edit') { + view.menuPDFEditCopy.on('click', _.bind(me.onCutCopyPaste, me)); + view.menuEditAddComment.on('click', _.bind(me.addComment, me)); + view.menuEditRemoveComment.on('click', _.bind(me.removeComment, me)); + /* + var diagramEditor = this.getApplication().getController('Common.Controllers.ExternalDiagramEditor').getView('Common.Views.ExternalDiagramEditor'); + if (diagramEditor) { + diagramEditor.on('internalmessage', _.bind(function(cmp, message) { + var command = message.data.command; + var data = message.data.data; + if (this.api) { + ( diagramEditor.isEditMode() ) + ? this.api.asc_editChartDrawingObject(data) + : this.api.asc_addChartDrawingObject(data, diagramEditor.getPlaceholder()); + } + }, this)); + diagramEditor.on('hide', _.bind(function(cmp, message) { + if (this.api) { + this.api.asc_onCloseChartFrame(); + this.api.asc_enableKeyEvents(true); + } + var me = this; + setTimeout(function(){ + me.editComplete(); + }, 10); + }, this)); + } + + var oleEditor = this.getApplication().getController('Common.Controllers.ExternalOleEditor').getView('Common.Views.ExternalOleEditor'); + if (oleEditor) { + oleEditor.on('internalmessage', _.bind(function(cmp, message) { + var command = message.data.command; + var data = message.data.data; + if (this.api) { + oleEditor.isEditMode() + ? this.api.asc_editTableOleObject(data) + : this.api.asc_addTableOleObject(data); + } + }, this)); + oleEditor.on('hide', _.bind(function(cmp, message) { + if (this.api) { + this.api.asc_enableKeyEvents(true); + this.api.asc_onCloseChartFrame(); + } + var me = this; + setTimeout(function(){ + me.editComplete(); + }, 10); + }, this)); + } + */ + view.menuParaCopy.on('click', _.bind(me.onCutCopyPaste, me)); + view.menuParaPaste.on('click', _.bind(me.onCutCopyPaste, me)); + view.menuParaCut.on('click', _.bind(me.onCutCopyPaste, me)); + view.menuImgCopy.on('click', _.bind(me.onCutCopyPaste, me)); + view.menuImgPaste.on('click', _.bind(me.onCutCopyPaste, me)); + view.menuImgCut.on('click', _.bind(me.onCutCopyPaste, me)); + view.menuTableCopy.on('click', _.bind(me.onCutCopyPaste, me)); + view.menuTablePaste.on('click', _.bind(me.onCutCopyPaste, me)); + view.menuTableCut.on('click', _.bind(me.onCutCopyPaste, me)); + view.menuAddHyperlinkPara.on('click', _.bind(me.addHyperlink, me)); + 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.menuRemoveHyperlinkPara.on('click', _.bind(me.removeHyperlink, me)); + view.menuRemoveHyperlinkTable.on('click', _.bind(me.removeHyperlink, me)); + // view.menuChartEdit.on('click', _.bind(me.editChartClick, me, undefined)); + view.menuImgSaveAsPicture.on('click', _.bind(me.saveAsPicture, me)); + view.menuTableSaveAsPicture.on('click', _.bind(me.saveAsPicture, me)); + view.menuAddCommentPara.on('click', _.bind(me.addComment, me)); + view.menuAddCommentTable.on('click', _.bind(me.addComment, me)); + view.menuAddCommentImg.on('click', _.bind(me.addComment, me)); + view.mnuTableMerge.on('click', _.bind(me.onTableMerge, me)); + view.mnuTableSplit.on('click', _.bind(me.onTableSplit, me)); + view.menuTableCellAlign.menu.on('item:click', _.bind(me.tableCellsVAlign, me)); + view.menuTableDistRows.on('click', _.bind(me.onTableDistRows, me)); + view.menuTableDistCols.on('click', _.bind(me.onTableDistCols, me)); + view.menuTableAdvanced.on('click', _.bind(me.onTableAdvanced, me)); + view.menuImageAdvanced.on('click', _.bind(me.onImageAdvanced, me)); + view.menuImgOriginalSize.on('click', _.bind(me.onImgOriginalSize, me)); + view.menuImgShapeRotate.menu.items[0].on('click', _.bind(me.onImgRotate, me)); + view.menuImgShapeRotate.menu.items[1].on('click', _.bind(me.onImgRotate, me)); + view.menuImgShapeRotate.menu.items[3].on('click', _.bind(me.onImgFlip, me)); + view.menuImgShapeRotate.menu.items[4].on('click', _.bind(me.onImgFlip, me)); + view.menuImgCrop.menu.on('item:click', _.bind(me.onImgCrop, me)); + view.menuImgResetCrop.on('click', _.bind(me.onImgResetCrop, me)); + view.menuImgEditPoints.on('click', _.bind(me.onImgEditPoints, me)); + view.menuShapeAdvanced.on('click', _.bind(me.onShapeAdvanced, me)); + view.menuParagraphAdvanced.on('click', _.bind(me.onParagraphAdvanced, me)); + // view.menuChartAdvanced.on('click', _.bind(me.onChartAdvanced, me)); + view.mnuGroupImg.on('click', _.bind(me.onGroupImg, me)); + view.mnuUnGroupImg.on('click', _.bind(me.onUnGroupImg, me)); + view.mnuArrangeFront.on('click', _.bind(me.onArrangeFront, me)); + view.mnuArrangeBack.on('click', _.bind(me.onArrangeBack, me)); + view.mnuArrangeForward.on('click', _.bind(me.onArrangeForward, me)); + view.mnuArrangeBackward.on('click', _.bind(me.onArrangeBackward, me)); + view.menuImgShapeAlign.menu.on('item:click', _.bind(me.onImgShapeAlign, me)); + view.menuParagraphVAlign.menu.on('item:click', _.bind(me.onParagraphVAlign, me)); + view.menuParagraphDirection.menu.on('item:click', _.bind(me.onParagraphDirection, me)); + view.menuTableSelectText.menu.on('item:click', _.bind(me.tableSelectText, me)); + view.menuTableInsertText.menu.on('item:click', _.bind(me.tableInsertText, me)); + view.menuTableDeleteText.menu.on('item:click', _.bind(me.tableDeleteText, me)); + view.menuTableEquationSettings.menu.on('item:click', _.bind(me.convertEquation, me)); + view.menuParagraphEquation.menu.on('item:click', _.bind(me.convertEquation, me)); + view.mnuNewPageBefore.on('click', _.bind(me.onNewPage, me)); + view.mnuNewPageAfter.on('click', _.bind(me.onNewPage, me)); + view.mnuDeletePage.on('click', _.bind(me.onDeletePage, me)); + view.mnuRotatePageRight.on('click', _.bind(me.onRotatePage, me, 90)); + view.mnuRotatePageLeft.on('click', _.bind(me.onRotatePage, me, -90)); + view.menuImgReplace.menu.on('item:click', _.bind(me.onImgReplace, me)); + } + }; + + dh.applyEditorMode = function() { + if (this.mode && this.mode.isPDFEdit && this._state.initEditorEvents && Common.Controllers.LaunchController.isScriptLoaded()) { + // this.documentHolder.createDelayedElementsPDFEditor(); + this._state.initEditorEvents = false; + this.api.asc_registerCallback('asc_onShowMathTrack', _.bind(this.onShowMathTrack, this)); + this.api.asc_registerCallback('asc_onHideMathTrack', _.bind(this.onHideMathTrack, this)); + this.api.asc_registerCallback('asc_onDialogAddHyperlink', _.bind(this.onDialogAddHyperlink, this)); + this.api.asc_registerCallback('asc_ChangeCropState', _.bind(this.onChangeCropState, this)); + } + if (this.mode) + this.mode.isPDFEdit ? this.onHideTextBar() : this.onHideMathTrack(); + }; + + dh.onShowTextBar = function(bounds) { + if (this.mode && !(!this.mode.isPDFEdit && this.mode.isEdit)) return; + + if (_.isUndefined(this._XY)) { + this._XY = [ + Common.Utils.getOffset(this.documentHolder.cmpEl).left - $(window).scrollLeft(), + Common.Utils.getOffset(this.documentHolder.cmpEl).top - $(window).scrollTop() + ]; + this._Width = this.documentHolder.cmpEl.width(); + this._Height = this.documentHolder.cmpEl.height(); + this._BodyWidth = $('body').width(); + } + + this.lastTextBarBounds = bounds; + if (bounds[3] < 0 || bounds[1] > this._Height) { + this.onHideTextBar(); + return; + } + var me = this, + documentHolder = me.documentHolder, + textContainer = documentHolder.cmpEl.find('#text-bar-container'); + + // Prepare menu container + if (textContainer.length < 1) { + me.textBarBtns = []; + textContainer = documentHolder.createTextBar(me.textBarBtns); + documentHolder.cmpEl.append(textContainer); + documentHolder.cmbFontSize.options.menuAlignEl = documentHolder.cmbFontName.options.menuAlignEl = documentHolder.cmpEl; + + var bringForward = function (menu) { + textContainer.addClass('has-open-menu'); + }; + var sendBackward = function (menu) { + textContainer.removeClass('has-open-menu'); + }; + me.textBarBtns.forEach(function(item){ + if (item && item.menu) { + item.menu.on('show:before', bringForward); + item.menu.on('hide:after', sendBackward); + } + }); + // annotation text bar + this.api.asc_registerCallback('asc_onFontSize', _.bind(this.onApiFontSize, this)); + this.api.asc_registerCallback('asc_onBold', _.bind(this.onApiBold, this)); + this.api.asc_registerCallback('asc_onItalic', _.bind(this.onApiItalic, this)); + this.api.asc_registerCallback('asc_onUnderline', _.bind(this.onApiUnderline, this)); + this.api.asc_registerCallback('asc_onStrikeout', _.bind(this.onApiStrikeout, this)); + this.api.asc_registerCallback('asc_onVerticalAlign', _.bind(this.onApiVerticalAlign, this)); + Common.NotificationCenter.on('fonts:change', _.bind(this.onApiChangeFont, this)); + this.api.asc_registerCallback('asc_onTextColor', _.bind(this.onApiTextColor, this)); + + documentHolder.btnBold.on('click', _.bind(this.onBold, this)); + documentHolder.btnItalic.on('click', _.bind(this.onItalic, this)); + documentHolder.btnTextUnderline.on('click', _.bind(this.onTextUnderline, this)); + documentHolder.btnTextStrikeout.on('click', _.bind(this.onTextStrikeout, this)); + documentHolder.btnSuperscript.on('click', _.bind(this.onSuperscript, this)); + documentHolder.btnSubscript.on('click', _.bind(this.onSubscript, this)); + documentHolder.btnFontColor.on('click', _.bind(this.onBtnFontColor, this)); + documentHolder.btnFontColor.on('color:select', _.bind(this.onSelectFontColor, this)); + documentHolder.cmbFontSize.on('selected', _.bind(this.onFontSizeSelect, this)); + documentHolder.cmbFontSize.on('changed:before', _.bind(this.onFontSizeChanged, this, true)); + documentHolder.cmbFontSize.on('changed:after', _.bind(this.onFontSizeChanged, this, false)); + documentHolder.cmbFontSize.on('show:after', _.bind(this.onComboOpen, this, true)); + documentHolder.cmbFontSize.on('hide:after', _.bind(this.onHideMenus, this)); + documentHolder.cmbFontSize.on('combo:blur', _.bind(this.onComboBlur, this)); + documentHolder.cmbFontSize.on('combo:focusin', _.bind(this.onComboOpen, this, false)); + documentHolder.cmbFontName.on('selected', _.bind(this.onFontNameSelect, this)); + documentHolder.cmbFontName.on('show:after', _.bind(this.onComboOpen, this, true)); + documentHolder.cmbFontName.on('hide:after', _.bind(this.onHideMenus, this)); + documentHolder.cmbFontName.on('combo:blur', _.bind(this.onComboBlur, this)); + documentHolder.cmbFontName.on('combo:focusin', _.bind(this.onComboOpen, this, false)); + + this.api.UpdateInterfaceState(); + } + + var showPoint = [(bounds[0] + bounds[2])/2 - textContainer.outerWidth()/2, bounds[1] - textContainer.outerHeight() - 10]; + (showPoint[0]<0) && (showPoint[0] = 0); + if (showPoint[1]<0) { + showPoint[1] = (bounds[3] > me._Height) ? 0 : bounds[3] + 10; + } + showPoint[1] = Math.min(me._Height - textContainer.outerHeight(), Math.max(0, showPoint[1])); + textContainer.css({left: showPoint[0], top : showPoint[1]}); + + var diffDown = me._Height - showPoint[1] - textContainer.outerHeight(), + diffUp = me._XY[1] + showPoint[1], + menuAlign = (diffDown < 220 && diffDown < diffUp*0.9) ? 'bl-tl' : 'tl-bl'; + if (Common.UI.isRTL()) { + menuAlign = menuAlign === 'bl-tl' ? 'br-tr' : 'tr-br'; + } + me.textBarBtns.forEach(function(item){ + item && item.menu && (item.menu.menuAlign = menuAlign); + }); + if (!textContainer.is(':visible')) { + textContainer.show(); + } + me.disableTextBar(); + }; + + dh.onHideTextBar = function() { + if (!this.documentHolder || !this.documentHolder.cmpEl) return; + var textContainer = this.documentHolder.cmpEl.find('#text-bar-container'); + if (textContainer.is(':visible')) { + textContainer.hide(); + } + }; + + dh.disableTextBar = function() { + var textContainer = this.documentHolder.cmpEl.find('#text-bar-container'), + disabled = this._isDisabled; + + if (textContainer.length>0 && textContainer.is(':visible')) { + this.textBarBtns.forEach(function(item){ + item && item.setDisabled(!!disabled); + }); + } + }; + + dh.onApiChangeFont = function(font) { + if (!this.mode.isPDFAnnotate || !this.mode.isEdit) return; + this._state.fontname = font; + !Common.Utils.ModalWindow.isVisible() && this.documentHolder.cmbFontName.onApiChangeFont(font); + }; + + dh.onApiFontSize = function(size) { + if (!this.mode.isPDFAnnotate || !this.mode.isEdit) return; + if (this._state.fontsize !== size) { + this.documentHolder.cmbFontSize.setValue(size); + this._state.fontsize = size; + } + }; + + dh.onApiBold = function(on) { + if (!this.mode.isPDFAnnotate || !this.mode.isEdit) return; + if (this._state.bold !== on) { + this.documentHolder.btnBold.toggle(on === true, true); + this._state.bold = on; + } + }; + + dh.onApiItalic = function(on) { + if (!this.mode.isPDFAnnotate || !this.mode.isEdit) return; + if (this._state.italic !== on) { + this.documentHolder.btnItalic.toggle(on === true, true); + this._state.italic = on; + } + }; + + dh.onApiUnderline = function(on) { + if (!this.mode.isPDFAnnotate || !this.mode.isEdit) return; + if (this._state.underline !== on) { + this.documentHolder.btnTextUnderline.toggle(on === true, true); + this._state.underline = on; + } + }; + + dh.onApiStrikeout = function(on) { + if (!this.mode.isPDFAnnotate || !this.mode.isEdit) return; + if (this._state.strike !== on) { + this.documentHolder.btnTextStrikeout.toggle(on === true, true); + this._state.strike = on; + } + }; + + dh.onApiVerticalAlign = function(typeBaseline) { + if (!this.mode.isPDFAnnotate || !this.mode.isEdit) return; + if (this._state.valign !== typeBaseline) { + this.documentHolder.btnSuperscript.toggle(typeBaseline==Asc.vertalign_SuperScript, true); + this.documentHolder.btnSubscript.toggle(typeBaseline==Asc.vertalign_SubScript, true); + this._state.valign = typeBaseline; + } + }; + + dh.onApiTextColor = function(color) { + if (!this.mode.isPDFAnnotate || !this.mode.isEdit) return; + var clr; + var picker = this.documentHolder.mnuFontColorPicker; + + if (color) { + if (color.get_type() == Asc.c_oAscColor.COLOR_TYPE_SCHEME) { + clr = {color: Common.Utils.ThemeColor.getHexColor(color.get_r(), color.get_g(), color.get_b()), effectValue: color.get_value() }; + } else + clr = Common.Utils.ThemeColor.getHexColor(color.get_r(), color.get_g(), color.get_b()); + } + + var type1 = typeof(clr), + type2 = typeof(this._state.clrtext); + + if ((type1 !== type2) || (type1 == 'object' && + (clr.effectValue !== this._state.clrtext.effectValue || this._state.clrtext.color.indexOf(clr.color) < 0)) || + (type1 != 'object' && this._state.clrtext.indexOf(clr) < 0)) { + + Common.Utils.ThemeColor.selectPickerColorByEffect(clr, picker); + this._state.clrtext = clr; + } + this._state.clrtext_asccolor = color; + }; + + dh.onBold = function(btn, e) { + this._state.bold = undefined; + if (this.api) + this.api.put_TextPrBold(btn.pressed); + + Common.NotificationCenter.trigger('edit:complete', this.documentHolder); + }; + + dh.onItalic = function(btn, e) { + this._state.italic = undefined; + if (this.api) + this.api.put_TextPrItalic(btn.pressed); + + Common.NotificationCenter.trigger('edit:complete', this.documentHolder); + }; + + dh.onTextUnderline = function(btn, e) { + this._state.underline = undefined; + if (this.api) + this.api.put_TextPrUnderline(btn.pressed); + + Common.NotificationCenter.trigger('edit:complete', this.documentHolder); + }; + + dh.onTextStrikeout = function(btn, e) { + this._state.strike = undefined; + if (this.api) + this.api.put_TextPrStrikeout(btn.pressed); + + Common.NotificationCenter.trigger('edit:complete', this.documentHolder); + }; + + dh.onSuperscript = function(btn, e) { + if (!this.documentHolder.btnSubscript.pressed) { + this._state.valign = undefined; + if (this.api) + this.api.put_TextPrBaseline(btn.pressed ? Asc.vertalign_SuperScript : Asc.vertalign_Baseline); + + Common.NotificationCenter.trigger('edit:complete', this.documentHolder); + } + }; + + dh.onSubscript = function(btn, e) { + if (!this.documentHolder.btnSuperscript.pressed) { + this._state.valign = undefined; + if (this.api) + this.api.put_TextPrBaseline(btn.pressed ? Asc.vertalign_SubScript : Asc.vertalign_Baseline); + + Common.NotificationCenter.trigger('edit:complete', this.documentHolder); + } + }; + + dh.onSelectFontColor = function(btn, color) { + this._state.clrtext = this._state.clrtext_asccolor = undefined; + + this.documentHolder.btnFontColor.currentColor = color; + this.documentHolder.btnFontColor.setColor((typeof(color) == 'object') ? color.color : color); + + this.documentHolder.mnuFontColorPicker.currentColor = color; + if (this.api) + this.api.put_TextColor(Common.Utils.ThemeColor.getRgbColor(color)); + }; + + dh.onBtnFontColor = function() { + this.documentHolder.mnuFontColorPicker.trigger('select', this.documentHolder.mnuFontColorPicker, this.documentHolder.mnuFontColorPicker.currentColor || this.documentHolder.btnFontColor.currentColor); + }; + + dh.onComboBlur = function() { + Common.NotificationCenter.trigger('edit:complete', this.documentHolder); + }; + + dh.onHideMenus = function(e){ + Common.NotificationCenter.trigger('edit:complete', this.documentHolder); + }; + + dh.onFontNameSelect = function(combo, record) { + if (this.api) { + if (record.isNewFont) { + !Common.Utils.ModalWindow.isVisible() && + Common.UI.warning({ + width: 500, + msg: this.documentHolder.confirmAddFontName, + buttons: ['yes', 'no'], + primary: 'yes', + callback: _.bind(function(btn) { + if (btn == 'yes') { + this.api.put_TextPrFontName(record.name); + } else { + this.documentHolder.cmbFontName.setValue(this.api.get_TextProps().get_TextPr().get_FontFamily().get_Name()); + } + Common.NotificationCenter.trigger('edit:complete', this.documentHolder); + }, this) + }); + } else { + this.api.put_TextPrFontName(record.name); + } + } + Common.NotificationCenter.trigger('edit:complete', this.documentHolder); + }; + + dh.onComboOpen = function(needfocus, combo, e, params) { + if (params && params.fromKeyDown) return; + _.delay(function() { + var input = $('input', combo.cmpEl).select(); + if (needfocus) input.focus(); + else if (!combo.isMenuOpen()) input.one('mouseup', function (e) { e.preventDefault(); }); + }, 10); + }; + + dh.onFontSizeSelect = function(combo, record) { + this._state.fontsize = undefined; + if (this.api) + this.api.put_TextPrFontSize(record.value); + + Common.NotificationCenter.trigger('edit:complete', this.documentHolder); + }; + + dh.onFontSizeChanged = function(before, combo, record, e) { + var value, + me = this; + + if (before) { + var item = combo.store.findWhere({ + displayValue: record.value + }); + + if (!item) { + value = /^\+?(\d*(\.|,).?\d+)$|^\+?(\d+(\.|,)?\d*)$/.exec(record.value); + + if (!value) { + value = this._getApiTextSize(); + setTimeout(function(){ + Common.UI.warning({ + msg: me.documentHolder.textFontSizeErr, + callback: function() { + _.defer(function(btn) { + $('input', combo.cmpEl).focus(); + }) + } + }); + }, 1); + combo.setRawValue(value); + e.preventDefault(); + return false; + } + } + } else { + value = Common.Utils.String.parseFloat(record.value); + value = value > 300 ? 300 : + value < 1 ? 1 : Math.floor((value+0.4)*2)/2; + + combo.setRawValue(value); + + this._state.fontsize = undefined; + if (this.api) { + this.api.put_TextPrFontSize(value); + } + + Common.NotificationCenter.trigger('edit:complete', this.documentHolder); + } + }; + + dh._getApiTextSize = function () { + var out_value = 12, + textPr = this.api.get_TextProps(); + + if (textPr && textPr.get_TextPr) { + out_value = textPr.get_TextPr().get_FontSize(); + } + + return out_value; + }; + + dh.onShowAnnotBar = function(bounds, mouseOnTop) { + if (this.mode && !this.mode.isEdit) return; + + if (_.isUndefined(this._XY)) { + this._XY = [ + Common.Utils.getOffset(this.documentHolder.cmpEl).left - $(window).scrollLeft(), + Common.Utils.getOffset(this.documentHolder.cmpEl).top - $(window).scrollTop() + ]; + this._Width = this.documentHolder.cmpEl.width(); + this._Height = this.documentHolder.cmpEl.height(); + this._BodyWidth = $('body').width(); + } + + this.lastAnnotBarBounds = bounds; + (mouseOnTop!==undefined) && (this.lastAnnotBarOnTop = mouseOnTop); + if (bounds[3] < 0 || bounds[1] > this._Height || !Common.Utils.InternalSettings.get('pdfe-settings-annot-bar')) { + this.onHideAnnotBar(); + return; + } + var me = this, + documentHolder = me.documentHolder, + textContainer = documentHolder.cmpEl.find('#annot-bar-container'); + + // Prepare menu container + if (textContainer.length < 1) { + me.annotBarBtns = []; + textContainer = documentHolder.createAnnotBar(me.annotBarBtns); + documentHolder.cmpEl.append(textContainer); + + var bringForward = function (menu) { + textContainer.addClass('has-open-menu'); + }; + var sendBackward = function (menu) { + textContainer.removeClass('has-open-menu'); + }; + me.annotBarBtns.forEach(function(item){ + if (item && item.menu) { + item.menu.on('show:before', bringForward); + item.menu.on('hide:after', sendBackward); + } + }); + // annotation text bar + documentHolder.btnCopy.on('click', _.bind(this.onCutCopyPaste, this, {value: 'copy', isFromBar: true})); + documentHolder.btnAddComment.on('click', _.bind(this.addComment, this, {isFromBar: true})); + if (me.mode.isEditTextSupport && (me.mode.isPDFAnnotate && me.mode.canPDFEdit || me.mode.isPDFEdit)) + documentHolder.btnEditText.on('click', _.bind(this.editText, this)); + else + documentHolder.btnEditText.cmpEl.parent().hide().prev('.separator').hide(); + + this.api.UpdateInterfaceState(); + } + + var showPoint = [(bounds[0] + bounds[2])/2 - textContainer.outerWidth()/2, me.lastAnnotBarOnTop ? bounds[1] - textContainer.outerHeight() - 10 : bounds[3] + 10]; + (showPoint[0]<0) && (showPoint[0] = 0); + showPoint[1] = Math.min(me._Height - textContainer.outerHeight(), Math.max(0, showPoint[1])); + textContainer.css({left: showPoint[0], top : showPoint[1]}); + + var diffDown = me._Height - showPoint[1] - textContainer.outerHeight(), + diffUp = me._XY[1] + showPoint[1], + menuAlign = (diffDown < 220 && diffDown < diffUp*0.9) ? 'bl-tl' : 'tl-bl'; + if (Common.UI.isRTL()) { + menuAlign = menuAlign === 'bl-tl' ? 'br-tr' : 'tr-br'; + } + me.annotBarBtns.forEach(function(item){ + item && item.menu && (item.menu.menuAlign = menuAlign); + }); + if (!textContainer.is(':visible')) { + textContainer.show(); + } + me.disableAnnotBar(); + }; + + dh.onHideAnnotBar = function() { + if (!this.documentHolder || !this.documentHolder.cmpEl) return; + var textContainer = this.documentHolder.cmpEl.find('#annot-bar-container'); + if (textContainer.is(':visible')) { + textContainer.hide(); + } + }; + + dh.disableAnnotBar = function() { + var textContainer = this.documentHolder.cmpEl.find('#annot-bar-container'), + disabled = this._isDisabled; + + if (textContainer.length>0 && textContainer.is(':visible')) { + this.annotBarBtns.forEach(function(item){ + item && item.setDisabled(!!disabled); + }); + this.documentHolder.btnCopy && this.documentHolder.btnCopy.setDisabled(!this.api.can_CopyCut() || !!disabled); + } + }; + + dh.onShowMathTrack = function(bounds) { + if (this.mode && !(this.mode.isPDFEdit && this.mode.isEdit)) return; + + this.lastMathTrackBounds = bounds; + if (!Common.Controllers.LaunchController.isScriptLoaded()) { + this.showMathTrackOnLoad = true; + return; + } + if (bounds[3] < 0 || Common.Utils.InternalSettings.get('pdfe-equation-toolbar-hide')) { + this.onHideMathTrack(); + return; + } + var me = this, + documentHolder = me.documentHolder, + eqContainer = documentHolder.cmpEl.find('#equation-container'); + + // Prepare menu container + if (eqContainer.length < 1) { + var equationsStore = me.getApplication().getCollection('EquationGroups'), + eqStr = '
'; + + me.getApplication().getController('InsTab').onMathTypes(me.getApplication().getController('Toolbar')._equationTemp); + + me.equationBtns = []; + for (var i = 0; i < equationsStore.length; ++i) { + eqStr += ''; + } + eqStr += '
'; + eqStr += ''; + eqStr += '
'; + eqContainer = $(eqStr); + documentHolder.cmpEl.append(eqContainer); + var onShowBefore = function (menu) { + var index = menu.options.value, + group = equationsStore.at(index); + var equationPicker = new Common.UI.DataViewSimple({ + el: $('#id-document-holder-btn-equation-menu-' + index, menu.cmpEl), + parentMenu: menu, + store: group.get('groupStore'), + scrollAlwaysVisible: true, + showLast: false, + restoreHeight: 450, + itemTemplate: _.template( + '
' + + '
' + + '
') + }); + equationPicker.on('item:click', function(picker, item, record, e) { + if (me.api) { + if (record) + me.api.asc_AddMath(record.get('data').equationType); + } + }); + menu.off('show:before', onShowBefore); + }; + var bringForward = function (menu) { + eqContainer.addClass('has-open-menu'); + }; + var sendBackward = function (menu) { + eqContainer.removeClass('has-open-menu'); + }; + for (var i = 0; i < equationsStore.length; ++i) { + var equationGroup = equationsStore.at(i); + var btn = new Common.UI.Button({ + parentEl: $('#id-document-holder-btn-equation-' + i, documentHolder.cmpEl), + cls : 'btn-toolbar no-caret', + iconCls : 'svgicon ' + equationGroup.get('groupIcon'), + hint : equationGroup.get('groupName'), + menu : new Common.UI.Menu({ + cls: 'menu-shapes', + value: i, + items: [ + { template: _.template('') } + ] + }) + }); + btn.menu.on('show:before', onShowBefore); + btn.menu.on('show:before', bringForward); + btn.menu.on('hide:after', sendBackward); + me.equationBtns.push(btn); + } + + me.equationSettingsBtn = new Common.UI.Button({ + parentEl: $('#id-document-holder-btn-equation-settings', documentHolder.cmpEl), + cls : 'btn-toolbar no-caret', + iconCls : 'toolbar__icon btn-more-vertical', + hint : me.documentHolder.advancedEquationText, + menu : me.documentHolder.createEquationMenu('popuptbeqinput', 'tl-bl') + }); + me.equationSettingsBtn.menu.options.initMenu = function() { + var eq = me.api.asc_GetMathInputType(), + menu = me.equationSettingsBtn.menu, + isEqToolbarHide = Common.Utils.InternalSettings.get('pdfe-equation-toolbar-hide'); + + menu.items[5].setChecked(eq===Asc.c_oAscMathInputType.Unicode); + menu.items[6].setChecked(eq===Asc.c_oAscMathInputType.LaTeX); + menu.items[8].options.isToolbarHide = isEqToolbarHide; + menu.items[8].setCaption(isEqToolbarHide ? me.documentHolder.showEqToolbar : me.documentHolder.hideEqToolbar, true); + }; + me.equationSettingsBtn.menu.on('item:click', _.bind(me.convertEquation, me)); + me.equationSettingsBtn.menu.on('show:before', function(menu) { + bringForward(); + menu.options.initMenu(); + }); + me.equationSettingsBtn.menu.on('hide:after', sendBackward); + } + + var showPoint = [(bounds[0] + bounds[2])/2 - eqContainer.outerWidth()/2, bounds[1] - eqContainer.outerHeight() - 10]; + (showPoint[0]<0) && (showPoint[0] = 0); + if (showPoint[1]<0) { + showPoint[1] = bounds[3] + 10; + } + showPoint[1] = Math.min(me._Height - eqContainer.outerHeight(), Math.max(0, showPoint[1])); + eqContainer.css({left: showPoint[0], top : showPoint[1]}); + + if (_.isUndefined(me._XY)) { + me._XY = [ + Common.Utils.getOffset(documentHolder.cmpEl).left - $(window).scrollLeft(), + Common.Utils.getOffset(documentHolder.cmpEl).top - $(window).scrollTop() + ]; + me._Width = documentHolder.cmpEl.width(); + me._Height = documentHolder.cmpEl.height(); + me._BodyWidth = $('body').width(); + } + + var diffDown = me._Height - showPoint[1] - eqContainer.outerHeight(), + diffUp = me._XY[1] + showPoint[1], + menuAlign = (diffDown < 220 && diffDown < diffUp*0.9) ? 'bl-tl' : 'tl-bl'; + if (Common.UI.isRTL()) { + menuAlign = menuAlign === 'bl-tl' ? 'br-tr' : 'tr-br'; + } + me.equationBtns.forEach(function(item){ + item && (item.menu.menuAlign = menuAlign); + }); + me.equationSettingsBtn.menu.menuAlign = menuAlign; + if (eqContainer.is(':visible')) { + if (me.equationSettingsBtn.menu.isVisible()) { + me.equationSettingsBtn.menu.options.initMenu(); + me.equationSettingsBtn.menu.alignPosition(); + } + } else { + eqContainer.show(); + } + me.disableEquationBar(); + }; + + dh.onHideMathTrack = function() { + if (!this.documentHolder || !this.documentHolder.cmpEl) return; + if (!Common.Controllers.LaunchController.isScriptLoaded()) { + this.showMathTrackOnLoad = false; + return; + } + var eqContainer = this.documentHolder.cmpEl.find('#equation-container'); + if (eqContainer.is(':visible')) { + eqContainer.hide(); + } + }; + + dh.disableEquationBar = function() { + var eqContainer = this.documentHolder.cmpEl.find('#equation-container'), + disabled = this._isDisabled || this._state.equationLocked; + + if (eqContainer.length>0 && eqContainer.is(':visible')) { + this.equationBtns.forEach(function(item){ + item && item.setDisabled(!!disabled); + }); + this.equationSettingsBtn.setDisabled(!!disabled); + } + }; + + dh.convertEquation = function(menu, item, e) { + if (this.api) { + if (item.options.type=='input') { + this.api.asc_SetMathInputType(item.value); + Common.localStorage.setBool("pdfe-equation-input-latex", item.value === Asc.c_oAscMathInputType.LaTeX) + } else if (item.options.type=='view') + this.api.asc_ConvertMathView(item.value.linear, item.value.all); + else if(item.options.type=='hide') { + item.options.isToolbarHide = !item.options.isToolbarHide; + Common.Utils.InternalSettings.set('pdfe-equation-toolbar-hide', item.options.isToolbarHide); + Common.localStorage.setBool('pdfe-equation-toolbar-hide', item.options.isToolbarHide); + if(item.options.isToolbarHide) this.onHideMathTrack(); + else this.onShowMathTrack(this.lastMathTrackBounds); + } + } + }; + + dh.onMouseMove = function(moveData) { + var me = this, + cmpEl = me.documentHolder.cmpEl, + screenTip = me.screenTip; + if (me._XY === undefined) { + me._XY = [ + Common.Utils.getOffset(cmpEl).left - $(window).scrollLeft(), + Common.Utils.getOffset(cmpEl).top - $(window).scrollTop() + ]; + me._Height = cmpEl.height(); + me._Width = cmpEl.width(); + me._BodyWidth = $('body').width(); + } + + if (moveData) { + var showPoint, ToolTip, + type = moveData.get_Type(); + + if (type==Asc.c_oAscMouseMoveDataTypes.Hyperlink || type==Asc.c_oAscMouseMoveDataTypes.Eyedropper || type==Asc.c_oAscMouseMoveDataTypes.Form) { + if (me.isTooltipHiding) { + me.mouseMoveData = moveData; + return; + } + + if (type==Asc.c_oAscMouseMoveDataTypes.Hyperlink) { + var hyperProps = moveData.get_Hyperlink(); + if (!hyperProps) return; + ToolTip = (_.isEmpty(hyperProps.get_ToolTip())) ? hyperProps.get_Value() : hyperProps.get_ToolTip(); + if (ToolTip.length>256) + ToolTip = ToolTip.substr(0, 256) + '...'; + } else if (type==Asc.c_oAscMouseMoveDataTypes.Form) { + ToolTip = moveData.get_FormHelpText(); + if (ToolTip.length>1000) + ToolTip = ToolTip.substr(0, 1000) + '...'; + } else if (type==Asc.c_oAscMouseMoveDataTypes.Eyedropper) { + if (me.eyedropperTip.isTipVisible) { + me.eyedropperTip.isTipVisible = false; + me.eyedropperTip.toolTip.hide(); + } + + var color = moveData.get_EyedropperColor().asc_getColor(), + r = color.get_r(), + g = color.get_g(), + b = color.get_b(), + hex = Common.Utils.ThemeColor.getHexColor(r,g,b); + if (!me.eyedropperTip.eyedropperColor) { + var colorEl = $(document.createElement("div")); + colorEl.addClass('eyedropper-color'); + colorEl.appendTo(document.body); + me.eyedropperTip.eyedropperColor = colorEl; + $('#id_main_view').on('mouseleave', _.bind(me.hideEyedropper, me)); + } + me.eyedropperTip.eyedropperColor.css({ + backgroundColor: '#' + hex, + left: (moveData.get_X() + me._XY[0] + 23) + 'px', + top: (moveData.get_Y() + me._XY[1] - 53) + 'px' + }); + me.eyedropperTip.isVisible = true; + + if (me.eyedropperTip.tipInterval) { + clearInterval(me.eyedropperTip.tipInterval); + } + me.eyedropperTip.tipInterval = setInterval(function () { + clearInterval(me.eyedropperTip.tipInterval); + if (me.eyedropperTip.isVisible) { + ToolTip = '
RGB(' + r + ',' + g + ',' + b + ')
' + + '
' + moveData.get_EyedropperColor().asc_getName() + '
'; + me.eyedropperTip.toolTip.setTitle(ToolTip); + me.eyedropperTip.isTipVisible = true; + me.eyedropperTip.toolTip.show([-10000, -10000]); + me.eyedropperTip.tipWidth = me.eyedropperTip.toolTip.getBSTip().$tip.width(); + showPoint = [moveData.get_X(), moveData.get_Y()]; + showPoint[1] += (me._XY[1] - 57); + showPoint[0] += (me._XY[0] + 58); + if (showPoint[0] + me.eyedropperTip.tipWidth > me._BodyWidth ) { + showPoint[0] = showPoint[0] - me.eyedropperTip.tipWidth - 40; + } + me.eyedropperTip.toolTip.getBSTip().$tip.css({ + top: showPoint[1] + 'px', + left: showPoint[0] + 'px' + }); + } + }, 800); + me.eyedropperTip.isHidden = false; + return; + } + + var recalc = false; + screenTip.isHidden = false; + + ToolTip = Common.Utils.String.htmlEncode(ToolTip); + + if (screenTip.tipType !== type || screenTip.tipLength !== ToolTip.length || screenTip.strTip.indexOf(ToolTip)<0 ) { + screenTip.toolTip.setTitle((type==Asc.c_oAscMouseMoveDataTypes.Hyperlink) ? (ToolTip + '
' + Common.Utils.String.platformKey('Ctrl', me.documentHolder.txtPressLink) + '') : ToolTip); + screenTip.tipLength = ToolTip.length; + screenTip.strTip = ToolTip; + screenTip.tipType = type; + recalc = true; + } + + showPoint = [moveData.get_X(), moveData.get_Y()]; + showPoint[1] += (me._XY[1]-15); + showPoint[0] += (me._XY[0]+5); + + if (!screenTip.isVisible || recalc) { + screenTip.isVisible = true; + screenTip.toolTip.show([-10000, -10000]); + } + + if ( recalc ) { + screenTip.tipHeight = screenTip.toolTip.getBSTip().$tip.height(); + screenTip.tipWidth = screenTip.toolTip.getBSTip().$tip.width(); + } + + recalc = false; + if (showPoint[0] + screenTip.tipWidth > me._BodyWidth ) { + showPoint[0] = me._BodyWidth - screenTip.tipWidth; + recalc = true; + } + if (showPoint[1] - screenTip.tipHeight < 0) { + showPoint[1] = (recalc) ? showPoint[1]+30 : 0; + } else + showPoint[1] -= screenTip.tipHeight; + + screenTip.toolTip.getBSTip().$tip.css({top: showPoint[1] + 'px', left: showPoint[0] + 'px'}); + } + /** coauthoring begin **/ + else if (moveData.get_Type()==Asc.c_oAscMouseMoveDataTypes.LockedObject && me.mode.isEdit && me.isUserVisible(moveData.get_UserId())) { // 2 - locked object + var src; + if (me.usertipcount >= me.usertips.length) { + src = $(document.createElement("div")); + src.addClass('username-tip'); + src.css({height: me._TtHeight + 'px', position: 'absolute', zIndex: '900', visibility: 'visible'}); + $(document.body).append(src); + if (me.userTooltip) { + src.on('mouseover', me.wrapEvents.userTipMousover); + src.on('mouseout', me.wrapEvents.userTipMousout); + } + + me.usertips.push(src); + } + src = me.usertips[me.usertipcount]; + me.usertipcount++; + + ToolTip = me.getUserName(moveData.get_UserId()); + + showPoint = [moveData.get_X()+me._XY[0], moveData.get_Y()+me._XY[1]]; + var maxwidth = showPoint[0]; + showPoint[0] = me._BodyWidth - showPoint[0]; + showPoint[1] -= ((moveData.get_LockedObjectType()==2) ? me._TtHeight : 0); + + if (showPoint[1] > me._XY[1] && showPoint[1]+me._TtHeight < me._XY[1]+me._Height) { + src.text(ToolTip); + src.css({visibility: 'visible', top: showPoint[1] + 'px', right: showPoint[0] + 'px', 'max-width': maxwidth + 'px'}); + } else { + src.css({visibility: 'hidden'}); + } + } + /** coauthoring end **/ + } + }; + + dh.onCutCopyPaste = function(item, e) { + var me = this; + if (me.api) { + var res = (item.value == 'cut') ? me.api.Cut() : ((item.value == 'copy') ? me.api.Copy() : me.api.Paste()); + if (!res) { + if (!Common.localStorage.getBool("pdfe-hide-copywarning")) { + (new Common.Views.CopyWarningDialog({ + handler: function(dontshow) { + if (dontshow) Common.localStorage.setItem("pdfe-hide-copywarning", 1); + me.editComplete(); + } + })).show(); + } + } + item.isFromBar && me.api.SetShowTextSelectPanel(false); + } + me.editComplete(); + }; + + dh.onUndo = function () { + this.api && this.api.Undo(); + }; + + dh.onRedo = function () { + this.api && this.api.Redo(); + }; + + dh.onClear = function () { + if (this.api) { + var props = this.api.asc_IsContentControl() ? this.api.asc_GetContentControlProperties() : null; + if (props) { + this.api.asc_ClearContentControl(props.get_InternalId()); + } + } + }; + + dh.onPrintSelection = function(item){ + if (this.api){ + var printopt = new Asc.asc_CAdjustPrint(); + printopt.asc_setPrintType(Asc.c_oAscPrintType.Selection); + var opts = new Asc.asc_CDownloadOptions(null, Common.Utils.isChrome || Common.Utils.isOpera || Common.Utils.isGecko && Common.Utils.firefoxVersion>86); // if isChrome or isOpera == true use asc_onPrintUrl event + opts.asc_setAdvancedOptions(printopt); + this.api.asc_Print(opts); + this.editComplete(); + Common.component.Analytics.trackEvent('DocumentHolder', 'Print Selection'); + } + }; + + dh.onSignatureClick = function(item) { + var datavalue = item.cmpEl.attr('data-value'); + switch (item.value) { + case 0: + Common.NotificationCenter.trigger('protect:sign', datavalue); //guid + break; + case 1: + this.api.asc_ViewCertificate(datavalue); //certificate id + break; + case 2: + var docProtection = this.documentHolder._docProtection; + Common.NotificationCenter.trigger('protect:signature', 'visible', this._isDisabled || docProtection.isReadOnly || docProtection.isFormsOnly || docProtection.isCommentsOnly, datavalue);//guid, can edit settings for requested signature + break; + case 3: + var me = this; + Common.UI.warning({ + title: this.documentHolder.notcriticalErrorTitle, + msg: this.documentHolder.txtRemoveWarning, + buttons: ['ok', 'cancel'], + primary: 'ok', + callback: function(btn) { + if (btn == 'ok') { + me.api.asc_RemoveSignature(datavalue); + } + } + }); + break; + } + }; + + dh.saveAsPicture = function() { + if(this.api) { + this.api.asc_SaveDrawingAsPicture(); + } + }; + + dh.onPluginContextMenu = function(data) { + if (data && data.length>0 && this.documentHolder && this.documentHolder.currentMenu && this.documentHolder.currentMenu.isVisible()){ + this.documentHolder.updateCustomItems(this.documentHolder.currentMenu, data); + } + }; + + dh.onHidePdfFormsActions = function() { + this.listControlMenuPdf && this.listControlMenuPdf.isVisible() && this.listControlMenuPdf.hide(); + var controlsContainer = this.documentHolder.cmpEl.find('#calendar-control-container-pdf'); + if (controlsContainer.is(':visible')) + controlsContainer.hide(); + }; + + dh.onShowFormsPDFActions = function(obj, x, y) { + switch (obj.type) { + case AscPDF.FIELD_TYPES.combobox: + this.onShowListActionsPDF(obj, x, y); + break; + case AscPDF.FIELD_TYPES.text: + this.onShowDateActionsPDF(obj, x, y); + break; + } + }; + + dh.onShowListActionsPDF = function(obj) { + var isForm = true, + cmpEl = this.documentHolder.cmpEl, + menu = this.listControlMenuPdf, + menuContainer = menu ? cmpEl.find(Common.Utils.String.format('#menu-container-{0}', menu.id)) : null, + me = this; + + me._listObjPdf = obj; + this._fromShowContentControls = true; + Common.UI.Menu.Manager.hideAll(); + + if (!menu) { + this.listControlMenuPdf = menu = new Common.UI.Menu({ + maxHeight: 207, + menuAlign: 'tr-bl', + items: [] + }); + menu.on('item:click', function(menu, item) { + setTimeout(function(){ + (item.value!==-1) && me.api.asc_SelectPDFFormListItem(item.value); + }, 1); + }); + + // Prepare menu container + if (!menuContainer || menuContainer.length < 1) { + menuContainer = $(Common.Utils.String.format('', menu.id)); + cmpEl.append(menuContainer); + } + + menu.render(menuContainer); + menu.cmpEl.attr({tabindex: "-1"}); + menu.on('hide:after', function(){ + me.listControlMenuPdf.removeAll(); + if (!me._fromShowContentControls) + me.api.asc_UncheckContentControlButtons(); + }); + } + + var options = obj.getOptions(), + count = options.length; + for (var i=0; i', + '<%= Common.Utils.String.htmlEncode(caption) %>', + '' + ].join('')) + })); + } + if (!isForm && menu.items.length<1) { + menu.addItem(new Common.UI.MenuItem({ + caption : this.documentHolder.txtEmpty, + value : -1 + })); + } + + var pagepos = obj.getPagePos(), + oGlobalCoords = AscPDF.GetGlobalCoordsByPageCoords(pagepos.x + pagepos.w, pagepos.y + pagepos.h, obj.getPage(), true); + + menuContainer.css({left: oGlobalCoords.X, top : oGlobalCoords.Y}); + menuContainer.attr('data-value', 'prevent-canvas-click'); + this._preventClick = true; + menu.show(); + + _.delay(function() { + menu.cmpEl.focus(); + }, 10); + this._fromShowContentControls = false; + }; + + dh.onShowDateActionsPDF = function(obj, x, y) { + var cmpEl = this.documentHolder.cmpEl, + controlsContainer = cmpEl.find('#calendar-control-container-pdf'), + me = this; + + this._dateObjPdf = obj; + + if (controlsContainer.length < 1) { + controlsContainer = $('
'); + cmpEl.append(controlsContainer); + } + + Common.UI.Menu.Manager.hideAll(); + + var pagepos = obj.getPagePos(), + oGlobalCoords = AscPDF.GetGlobalCoordsByPageCoords(pagepos.x + pagepos.w, pagepos.y + pagepos.h, obj.getPage(), true); + + controlsContainer.css({left: oGlobalCoords.X, top : oGlobalCoords.Y}); + controlsContainer.show(); + + if (!this.cmpCalendarPdf) { + this.cmpCalendarPdf = new Common.UI.Calendar({ + el: cmpEl.find('#id-document-calendar-control-pdf'), + enableKeyEvents: true, + firstday: 1 + }); + this.cmpCalendarPdf.on('date:click', function (cmp, date) { + var specProps = new AscCommon.CSdtDatePickerPr(); + specProps.put_FullDate(new Date(date)); + me.api.asc_SetTextFormDatePickerDate(specProps); + controlsContainer.hide(); + }); + this.cmpCalendarPdf.on('calendar:keydown', function (cmp, e) { + if (e.keyCode==Common.UI.Keys.ESC) { + controlsContainer.hide(); + } + }); + $(document).on('mousedown', function(e) { + if (e.target.localName !== 'canvas' && controlsContainer.is(':visible') && controlsContainer.find(e.target).length==0) { + controlsContainer.hide(); + } + }); + + } + var val = this._dateObjPdf ? this._dateObjPdf.asc_GetValue() : undefined; + if (val) { + val = new Date(val); + if (Object.prototype.toString.call(val) !== '[object Date]' || isNaN(val)) + val = undefined; + } + !val && (val = new Date()); + this.cmpCalendarPdf.setDate(val); + + // align + var offset = Common.Utils.getOffset(controlsContainer), + docW = Common.Utils.innerWidth(), + docH = Common.Utils.innerHeight() - 10, // Yep, it's magic number + menuW = this.cmpCalendarPdf.cmpEl.outerWidth(), + menuH = this.cmpCalendarPdf.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.cmpCalendarPdf.cmpEl.css({left: left, top : top}); + + this._preventClick = true; + }; + + dh.onShowContentControlsActions = function(obj, x, y) { + if (this._isDisabled) return; + + var me = this; + switch (obj.type) { + case Asc.c_oAscContentControlSpecificType.DateTime: + this.onShowDateActions(obj, x, y); + break; + case Asc.c_oAscContentControlSpecificType.Picture: + if (obj.pr && obj.pr.get_Lock) { + var lock = obj.pr.get_Lock(); + if (lock == Asc.c_oAscSdtLockType.SdtContentLocked || lock==Asc.c_oAscSdtLockType.ContentLocked) + return; + } + this.onShowImageActions(obj, x, y); + break; + case Asc.c_oAscContentControlSpecificType.DropDownList: + case Asc.c_oAscContentControlSpecificType.ComboBox: + this.onShowListActions(obj, x, y); + break; + } + }; + + dh.onHideContentControlsActions = function() { + this.listControlMenu && this.listControlMenu.isVisible() && this.listControlMenu.hide(); + var controlsContainer = this.documentHolder.cmpEl.find('#calendar-control-container'); + if (controlsContainer.is(':visible')) + controlsContainer.hide(); + }; + + dh.onShowImageActions = function(obj, x, y) { + var cmpEl = this.documentHolder.cmpEl, + menu = this.imageControlMenu, + menuContainer = menu ? cmpEl.find(Common.Utils.String.format('#menu-container-{0}', menu.id)) : null, + me = this; + + this.internalFormObj = obj ? obj.pr : null; + this._fromShowContentControls = true; + Common.UI.Menu.Manager.hideAll(); + + if (!menu) { + this.imageControlMenu = menu = new Common.UI.Menu({ + maxHeight: 207, + menuAlign: 'tl-bl', + items: [ + {caption: this.documentHolder.mniImageFromFile, value: 'file'}, + {caption: this.documentHolder.mniImageFromUrl, value: 'url'}, + {caption: this.documentHolder.mniImageFromStorage, value: 'storage', visible: this.mode.canRequestInsertImage || this.mode.fileChoiceUrl && this.mode.fileChoiceUrl.indexOf("{documentType}")>-1} + ] + }); + menu.on('item:click', function(menu, item) { + setTimeout(function(){ + me.onImageSelect(menu, item); + }, 1); + setTimeout(function(){ + me.api.asc_UncheckContentControlButtons(); + }, 500); + }); + + // Prepare menu container + if (!menuContainer || menuContainer.length < 1) { + menuContainer = $(Common.Utils.String.format('', menu.id)); + cmpEl.append(menuContainer); + } + + menu.render(menuContainer); + menu.cmpEl.attr({tabindex: "-1"}); + menu.on('hide:after', function(){ + if (!me._fromShowContentControls) + me.api.asc_UncheckContentControlButtons(); + }); + } + 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; + }; + + dh.onImageSelect = function(menu, item) { + if (item.value=='url') { + var me = this; + (new Common.Views.ImageFromUrlDialog({ + handler: function(result, value) { + if (result == 'ok') { + if (me.api) { + var checkUrl = value.replace(/ /g, ''); + if (!_.isEmpty(checkUrl)) { + me.setImageUrl(checkUrl); + } + } + } + } + })).show(); + } else if (item.value=='storage') { + Common.NotificationCenter.trigger('storage:image-load', 'control'); + } else { + if (this._isFromFile) return; + this._isFromFile = true; + this.api.asc_addImage(this.internalFormObj); + this._isFromFile = false; + } + }; + + dh.openImageFromStorage = function(type) { + var me = this; + if (this.mode.canRequestInsertImage) { + Common.Gateway.requestInsertImage(type); + } else { + (new Common.Views.SelectFileDlg({ + fileChoiceUrl: this.mode.fileChoiceUrl.replace("{fileExt}", "").replace("{documentType}", "ImagesOnly") + })).on('selectfile', function(obj, file){ + file && (file.c = type); + !file.images && (file.images = [{fileType: file.fileType, url: file.url}]); // SelectFileDlg uses old format for inserting image + file.url = null; + me.insertImage(file); + }).show(); + } + }; + + dh.setImageUrl = function(url, token) { + this.api.asc_SetContentControlPictureUrl(url, this.internalFormObj ? this.internalFormObj.get_InternalId() : null, token); + }; + + dh.insertImage = function(data) { // gateway + if (data && (data.url || data.images)) { + data.url && console.log("Obsolete: The 'url' parameter of the 'insertImage' method is deprecated. Please use 'images' parameter instead."); + + var arr = []; + if (data.images && data.images.length>0) { + for (var i=0; i', menu.id)); + 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) { + if (isForm){ // for dropdown and combobox form control always add placeholder item + var text = props.get_PlaceholderText(); + menu.addItem(new Common.UI.MenuItem({ + caption : (text.trim()!=='') ? text : this.documentHolder.txtEmpty, + value : '', + template : _.template([ + ' opacity: 0.6 <% } %>">', + '<%= Common.Utils.String.htmlEncode(caption) %>', + '' + ].join('')) + })); + } + var count = specProps.get_ItemsCount(); + for (var i=0; i', + '<%= Common.Utils.String.htmlEncode(caption) %>', + '' + ].join('')) + })); + } + if (!isForm && menu.items.length<1) { + menu.addItem(new Common.UI.MenuItem({ + caption : this.documentHolder.txtEmpty, + value : -1 + })); + } + } + + 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; + }; + + dh.onShowDateActions = function(obj, x, y) { + var props = obj.pr, + specProps = props.get_DateTimePr(), + cmpEl = this.documentHolder.cmpEl, + controlsContainer = cmpEl.find('#calendar-control-container'), + me = this; + + this._dateObj = props; + + if (controlsContainer.length < 1) { + controlsContainer = $('
'); + 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: cmpEl.find('#id-document-calendar-control'), + enableKeyEvents: true, + firstday: 1 + }); + this.cmpCalendar.on('date:click', function (cmp, date) { + var specProps = me._dateObj.get_DateTimePr(); + specProps.put_FullDate(new Date(date)); + me.api.asc_SetContentControlDatePickerDate(specProps); + controlsContainer.hide(); + me.api.asc_UncheckContentControlButtons(); + }); + this.cmpCalendar.on('calendar:keydown', function (cmp, e) { + if (e.keyCode==Common.UI.Keys.ESC) { + controlsContainer.hide(); + me.api.asc_UncheckContentControlButtons(); + } + }); + $(document).on('mousedown', function(e) { + if (e.target.localName !== 'canvas' && controlsContainer.is(':visible') && controlsContainer.find(e.target).length==0) { + controlsContainer.hide(); + me.api.asc_UncheckContentControlButtons(); + } + }); + + } + var val = specProps ? specProps.get_FullDate() : undefined; + this.cmpCalendar.setDate(val ? new Date(val) : new Date()); + + // align + var offset = Common.Utils.getOffset(controlsContainer), + 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; + }; + + dh.addHyperlink = function(item){ + var win, me = this; + if (me.api) { + var _arr = []; + for (var i=0; i 0){ + var elType, elValue; + for (var i = selectedElements.length - 1; i >= 0; i--) { + elType = selectedElements[i].get_ObjectType(); + elValue = selectedElements[i].get_ObjectValue(); + + if (Asc.c_oAscTypeSelectElement.Table == elType) { + (new PDFE.Views.TableSettingsAdvanced( + { + tableProps: elValue, + slideSize: {width: me.api.get_PageWidth(), height: me.api.get_PageHeight()}, + handler: function(result, value) { + if (result == 'ok') { + if (me.api) { + me.api.tblApply(value.tableProps); + } + } + me.editComplete(); + Common.component.Analytics.trackEvent('DocumentHolder', 'Table Settings Advanced'); + } + })).show(); + break; + } + } + } + } + }; + + dh.onImageAdvanced = function(item) { + var me = this; + if (me.api){ + var selectedElements = me.api.getSelectedElements(); + if (selectedElements && selectedElements.length>0){ + var elType, elValue; + + for (var i = selectedElements.length - 1; i >= 0; i--) { + elType = selectedElements[i].get_ObjectType(); + elValue = selectedElements[i].get_ObjectValue(); + + if (Asc.c_oAscTypeSelectElement.Image == elType) { + var imgsizeOriginal; + + if (!me.documentHolder.menuImgOriginalSize.isDisabled()) { + imgsizeOriginal = me.api.get_OriginalSizeImage(); + if (imgsizeOriginal) + imgsizeOriginal = {width:imgsizeOriginal.get_ImageWidth(), height:imgsizeOriginal.get_ImageHeight()}; + } + + (new PDFE.Views.ImageSettingsAdvanced( + { + imageProps: elValue, + sizeOriginal: imgsizeOriginal, + slideSize: {width: me.api.get_PageWidth(), height: me.api.get_PageHeight()}, + handler: function(result, value) { + if (result == 'ok') { + if (me.api) { + me.api.ImgApply(value.imageProps); + } + } + me.editComplete(); + Common.component.Analytics.trackEvent('DocumentHolder', 'Image Settings Advanced'); + } + })).show(); + break; + } + } + } + } + }; + + dh.onImgOriginalSize = function(item){ + var me = this; + if (me.api){ + var originalImageSize = me.api.get_OriginalSizeImage(); + + if (originalImageSize) { + var properties = new Asc.asc_CImgProperty(); + + properties.put_Width(originalImageSize.get_ImageWidth()); + properties.put_Height(originalImageSize.get_ImageHeight()); + properties.put_ResetCrop(true); + properties.put_Rot(0); + me.api.ImgApply(properties); + } + + me.editComplete(); + Common.component.Analytics.trackEvent('DocumentHolder', 'Set Image Original Size'); + } + }; + + dh.onImgRotate = function(item) { + var properties = new Asc.asc_CShapeProperty(); + properties.asc_putRotAdd((item.value==1 ? 90 : 270) * 3.14159265358979 / 180); + this.api.ShapeApply(properties); + this.editComplete(); + }; + + dh.onImgFlip = function(item) { + var properties = new Asc.asc_CShapeProperty(); + if (item.value==1) + properties.asc_putFlipHInvert(true); + else + properties.asc_putFlipVInvert(true); + this.api.ShapeApply(properties); + this.editComplete(); + }; + + dh.onImgCrop = function(menu, item) { + if (item.value == 1) { + this.api.asc_cropFill(); + } else if (item.value == 2) { + this.api.asc_cropFit(); + } else { + item.checked ? this.api.asc_startEditCrop() : this.api.asc_endEditCrop(); + } + this.editComplete(); + }; + + dh.onImgResetCrop = function() { + if (this.api) { + var properties = new Asc.asc_CImgProperty(); + properties.put_ResetCrop(true); + } + this.api.ImgApply(properties); + this.editComplete(); + }; + + dh.onImgEditPoints = function(item) { + this.api && this.api.asc_editPointsGeometry(); + }; + + dh.onShapeAdvanced = function(item) { + var me = this; + if (me.api){ + var selectedElements = me.api.getSelectedElements(); + if (selectedElements && selectedElements.length>0){ + var elType, elValue; + for (var i = selectedElements.length - 1; i >= 0; i--) { + elType = selectedElements[i].get_ObjectType(); + elValue = selectedElements[i].get_ObjectValue(); + if (Asc.c_oAscTypeSelectElement.Shape == elType) { + (new PDFE.Views.ShapeSettingsAdvanced( + { + shapeProps: elValue, + slideSize: {width: me.api.get_PageWidth(), height: me.api.get_PageHeight()}, + handler: function(result, value) { + if (result == 'ok') { + if (me.api) { + me.api.ShapeApply(value.shapeProps); + } + } + me.editComplete(); + Common.component.Analytics.trackEvent('DocumentHolder', 'Image Shape Advanced'); + } + })).show(); + break; + } + } + } + } + }; + + dh.onParagraphAdvanced = function(item) { + var me = this; + if (me.api){ + var selectedElements = me.api.getSelectedElements(); + + if (selectedElements && selectedElements.length > 0){ + var elType, elValue; + for (var i = selectedElements.length - 1; i >= 0; i--) { + elType = selectedElements[i].get_ObjectType(); + elValue = selectedElements[i].get_ObjectValue(); + + if (Asc.c_oAscTypeSelectElement.Paragraph == elType) { + (new PDFE.Views.ParagraphSettingsAdvanced( + { + paragraphProps: elValue, + api: me.api, + handler: function(result, value) { + if (result == 'ok') { + if (me.api) { + me.api.paraApply(value.paragraphProps); + } + } + me.editComplete(); + Common.component.Analytics.trackEvent('DocumentHolder', 'Image Paragraph Advanced'); + } + })).show(); + break; + } + } + } + } + }; + + dh.onGroupImg = function(item) { + this.api && this.api.groupShapes(); + this.editComplete(); + Common.component.Analytics.trackEvent('DocumentHolder', 'Group Image'); + }; + + dh.onUnGroupImg = function(item) { + this.api && this.api.unGroupShapes(); + this.editComplete(); + Common.component.Analytics.trackEvent('DocumentHolder', 'UnGroup Image'); + }; + + dh.onArrangeFront = function(item) { + this.api && this.api.shapes_bringToFront(); + this.editComplete(); + Common.component.Analytics.trackEvent('DocumentHolder', 'Bring To Front'); + }; + + dh.onArrangeBack = function(item) { + this.api && this.api.shapes_bringToBack(); + this.editComplete(); + Common.component.Analytics.trackEvent('DocumentHolder', 'Bring To Back'); + }; + + dh.onArrangeForward = function(item) { + this.api && this.api.shapes_bringForward(); + this.editComplete(); + Common.component.Analytics.trackEvent('DocumentHolder', 'Send Forward'); + }; + + dh.onArrangeBackward = function(item) { + this.api && this.api.shapes_bringBackward(); + this.editComplete(); + Common.component.Analytics.trackEvent('DocumentHolder', 'Send Backward'); + }; + + dh.onImgShapeAlign = function (menu, item) { + var me = this; + if (me.api) { + var value = me.api.asc_getSelectedDrawingObjectsCount()<2 || Common.Utils.InternalSettings.get("pdfe-align-to-slide"); + value = value ? Asc.c_oAscObjectsAlignType.Page : Asc.c_oAscObjectsAlignType.Selected; + if (item.value < 6) { + me.api.put_ShapesAlign(item.value, value); + Common.component.Analytics.trackEvent('DocumentHolder', 'Shape Align'); + } else if (item.value == 6) { + me.api.DistributeHorizontally(value); + Common.component.Analytics.trackEvent('DocumentHolder', 'Distribute Horizontally'); + } else if (item.value == 7){ + me.api.DistributeVertically(value); + Common.component.Analytics.trackEvent('DocumentHolder', 'Distribute Vertically'); + } + me.editComplete(); + } + }; + + dh.onParagraphVAlign = function (menu, item) { + var me = this; + if (me.api) { + var properties = new Asc.asc_CShapeProperty(); + properties.put_VerticalTextAlign(item.value); + + me.api.ShapeApply(properties); + } + + me.editComplete(); + Common.component.Analytics.trackEvent('DocumentHolder', 'Text Vertical Align'); + }; + + dh.onParagraphDirection = function(menu, item) { + var me = this; + if (me.api) { + var properties = new Asc.asc_CShapeProperty(); + properties.put_Vert(item.options.direction); + me.api.ShapeApply(properties); + } + me.editComplete(); + Common.component.Analytics.trackEvent('DocumentHolder', 'Text Direction'); + }; + + dh.tableSelectText = function(menu, item) { + if (this.api) { + switch (item.value) { + case 0: + this.api.selectRow(); + break; + case 1: + this.api.selectColumn(); + break; + case 2: + this.api.selectCell(); + break; + case 3: + this.api.selectTable(); + break; + } + } + }; + + dh.tableInsertText = function(menu, item) { + if (this.api) { + switch (item.value) { + case 0: + this.api.addColumnLeft(); + break; + case 1: + this.api.addColumnRight(); + break; + case 2: + this.api.addRowAbove(); + break; + case 3: + this.api.addRowBelow(); + break; + } + } + }; + + dh.tableDeleteText = function(menu, item) { + if (this.api) { + switch (item.value) { + case 0: + this.api.remRow(); + break; + case 1: + this.api.remColumn(); + break; + case 2: + this.api.remTable(); + break; + } + } + }; + + dh.onCountPages = function(count) { + this.documentHolder && (this.documentHolder._pagesCount = count); + }; + + dh.onNewPage = function(item) { + this.api && this.api.asc_AddPage(item.value); + + Common.NotificationCenter.trigger('edit:complete', this.documentHolder); + }; + + dh.onDeletePage = function() { + this.api && this.api.asc_RemovePage(); + + Common.NotificationCenter.trigger('edit:complete', this.documentHolder); + }; + + dh.onRotatePage = function(angle, item) { + this.api && this.api.asc_RotatePage(angle); + + Common.NotificationCenter.trigger('edit:complete', this.documentHolder); + }; + + dh.onHyperlinkClick = function(url) { + if (url) { + var type = this.api.asc_getUrlType(url); + if (type===AscCommon.c_oAscUrlType.Http || type===AscCommon.c_oAscUrlType.Email) + window.open(url); + else { + var me = this; + setTimeout(function() { + Common.UI.warning({ + msg: me.documentHolder.txtWarnUrl, + buttons: ['yes', 'no'], + primary: 'yes', + callback: function(btn) { + try { + (btn == 'yes') && window.open(url); + } catch (err) { + err && console.log(err.stack); + } + } + }); + }, 1); + } + } + }; + + dh.onDialogAddHyperlink = function() { + var win, props, text; + var me = this; + if (me.api && me.mode.isEdit && !me._isDisabled && !PDFE.getController('LeftMenu').leftMenu.menuFile.isVisible()){ + var handlerDlg = function(dlg, result) { + if (result == 'ok') { + props = dlg.getSettings(); + (text!==false) + ? me.api.add_Hyperlink(props) + : me.api.change_Hyperlink(props); + } + + me.editComplete(); + }; + + text = me.api.can_AddHyperlink(); + + var _arr = []; + for (var i=0; i Date: Tue, 10 Dec 2024 11:33:52 +0300 Subject: [PATCH 02/12] [PDF] Show annotation bar --- .../main/app/controller/DocumentHolder.js | 1 + .../main/app/controller/DocumentHolderExt.js | 90 +++++ apps/pdfeditor/main/app/controller/Main.js | 2 + .../pdfeditor/main/app/view/DocumentHolder.js | 264 +------------ .../main/app/view/DocumentHolderExt.js | 350 ++++++++++++++++++ .../main/resources/less/toolbar.less | 6 +- 6 files changed, 449 insertions(+), 264 deletions(-) diff --git a/apps/pdfeditor/main/app/controller/DocumentHolder.js b/apps/pdfeditor/main/app/controller/DocumentHolder.js index 4b17debf32..a7f4f0f435 100644 --- a/apps/pdfeditor/main/app/controller/DocumentHolder.js +++ b/apps/pdfeditor/main/app/controller/DocumentHolder.js @@ -88,6 +88,7 @@ define([ me.lastTextBarBounds = []; me.lastAnnotBarBounds = []; me.lastAnnotBarOnTop = true; + me.lastAnnotSelBarOnTop = true; me.screenTip = { toolTip: new Common.UI.Tooltip({ diff --git a/apps/pdfeditor/main/app/controller/DocumentHolderExt.js b/apps/pdfeditor/main/app/controller/DocumentHolderExt.js index 9c9ff9823b..698296e0b6 100644 --- a/apps/pdfeditor/main/app/controller/DocumentHolderExt.js +++ b/apps/pdfeditor/main/app/controller/DocumentHolderExt.js @@ -75,6 +75,8 @@ define([], function () { this.api.asc_registerCallback('asc_onHideAnnotTextPrTrack', _.bind(this.onHideTextBar, this)); this.api.asc_registerCallback('asc_onShowTextSelectTrack', _.bind(this.onShowAnnotBar, this)); this.api.asc_registerCallback('asc_onHideTextSelectTrack', _.bind(this.onHideAnnotBar, this)); + this.api.asc_registerCallback('asc_onShowAnnotSelectTrack', _.bind(this.onShowAnnotSelectBar, this)); + this.api.asc_registerCallback('asc_onHideAnnotSelectTrack', _.bind(this.onHideAnnotSelectBar, this)); } } if (this.mode.isRestrictedEdit) { @@ -697,6 +699,94 @@ define([], function () { } }; + dh.onShowAnnotSelectBar = function(bounds, mouseOnTop) { + if (this.mode && !this.mode.isEdit) return; + + if (_.isUndefined(this._XY)) { + this._XY = [ + Common.Utils.getOffset(this.documentHolder.cmpEl).left - $(window).scrollLeft(), + Common.Utils.getOffset(this.documentHolder.cmpEl).top - $(window).scrollTop() + ]; + this._Width = this.documentHolder.cmpEl.width(); + this._Height = this.documentHolder.cmpEl.height(); + this._BodyWidth = $('body').width(); + } + + this.lastAnnotSelBarBounds = bounds; + (mouseOnTop!==undefined) && (this.lastAnnotSelBarOnTop = mouseOnTop); + if (bounds[3] < 0 || bounds[1] > this._Height || !Common.Utils.InternalSettings.get('pdfe-settings-annot-sel-bar')) { + this.onHideAnnotSelectBar(); + return; + } + var me = this, + documentHolder = me.documentHolder, + textContainer = documentHolder.cmpEl.find('#annot-sel-bar-container'); + + // Prepare menu container + if (textContainer.length < 1) { + me.annotSelectBarBtns = []; + textContainer = documentHolder.createAnnotSelectBar(me.annotSelectBarBtns); + documentHolder.cmpEl.append(textContainer); + + var bringForward = function (menu) { + textContainer.addClass('has-open-menu'); + }; + var sendBackward = function (menu) { + textContainer.removeClass('has-open-menu'); + }; + me.annotSelectBarBtns.forEach(function(item){ + if (item && item.menu) { + item.menu.on('show:before', bringForward); + item.menu.on('hide:after', sendBackward); + } + }); + // annotation text bar + documentHolder.btnRemAnnot.on('click', _.bind(this.removeComment, this)); + documentHolder.btnAddAnnotComment.on('click', _.bind(this.addComment, this, {isFromBar: true})); + + this.api.UpdateInterfaceState(); + } + + var showPoint = [(bounds[0] + bounds[2])/2 - textContainer.outerWidth()/2, me.lastAnnotBarOnTop ? bounds[1] - textContainer.outerHeight() - 10 : bounds[3] + 10]; + (showPoint[0]<0) && (showPoint[0] = 0); + showPoint[1] = Math.min(me._Height - textContainer.outerHeight(), Math.max(0, showPoint[1])); + textContainer.css({left: showPoint[0], top : showPoint[1]}); + + var diffDown = me._Height - showPoint[1] - textContainer.outerHeight(), + diffUp = me._XY[1] + showPoint[1], + menuAlign = (diffDown < 220 && diffDown < diffUp*0.9) ? 'bl-tl' : 'tl-bl'; + if (Common.UI.isRTL()) { + menuAlign = menuAlign === 'bl-tl' ? 'br-tr' : 'tr-br'; + } + me.annotSelectBarBtns.forEach(function(item){ + item && item.menu && (item.menu.menuAlign = menuAlign); + }); + if (!textContainer.is(':visible')) { + textContainer.show(); + } + me.disableAnnotBar(); + }; + + dh.onHideAnnotSelectBar = function() { + if (!this.documentHolder || !this.documentHolder.cmpEl) return; + var textContainer = this.documentHolder.cmpEl.find('#annot-sel-bar-container'); + if (textContainer.is(':visible')) { + textContainer.hide(); + } + }; + + dh.disableAnnotSelectBar = function() { + var textContainer = this.documentHolder.cmpEl.find('#annot-sel-bar-container'), + disabled = this._isDisabled; + + if (textContainer.length>0 && textContainer.is(':visible')) { + this.annotBarBtns.forEach(function(item){ + item && item.setDisabled(!!disabled); + }); + this.documentHolder.btnCopy && this.documentHolder.btnCopy.setDisabled(!this.api.can_CopyCut() || !!disabled); + } + }; + dh.onShowMathTrack = function(bounds) { if (this.mode && !(this.mode.isPDFEdit && this.mode.isEdit)) return; diff --git a/apps/pdfeditor/main/app/controller/Main.js b/apps/pdfeditor/main/app/controller/Main.js index 689b3db150..c103895eb4 100644 --- a/apps/pdfeditor/main/app/controller/Main.js +++ b/apps/pdfeditor/main/app/controller/Main.js @@ -1072,6 +1072,8 @@ define([ Common.Utils.InternalSettings.set("pdfe-settings-show-alt-hints", value); value = Common.localStorage.getBool("pdfe-settings-annot-bar", true); Common.Utils.InternalSettings.set("pdfe-settings-annot-bar", value); + value = Common.localStorage.getBool("pdfe-settings-annot-sel-bar", true); + Common.Utils.InternalSettings.set("pdfe-settings-annot-sel-bar", value); /** coauthoring begin **/ me.onPdfModeCoAuthApply(); diff --git a/apps/pdfeditor/main/app/view/DocumentHolder.js b/apps/pdfeditor/main/app/view/DocumentHolder.js index 8cb3a8ea03..bc89efa808 100644 --- a/apps/pdfeditor/main/app/view/DocumentHolder.js +++ b/apps/pdfeditor/main/app/view/DocumentHolder.js @@ -147,269 +147,9 @@ define([ }); }, - createTextBar: function(textBarBtns) { - var container = $('
' + - '
' + - '
' + - '
' + - '
' + - '
' + - '
' + - '
' + - '
' + - '
' + - '
'), - toolbarController = PDFE.getController('Toolbar'), - toolbar = toolbarController.getView('Toolbar'); + createTextBar: function(textBarBtns) {}, - this.cmbFontName = new Common.UI.ComboBoxFonts({ - el: $('#text-bar-fonts', container), - cls : 'input-group-nr', - style : 'width: 100px;', - menuCls : 'scrollable-menu menu-absolute', - menuStyle : 'min-width: 100%;max-height: 270px;', - restoreMenuHeightAndTop: 220, - store : new Common.Collections.Fonts(), - hint : toolbar.tipFontName - }); - textBarBtns.push(this.cmbFontName); - toolbarController.fillFontsStore(this.cmbFontName); - - this.cmbFontSize = new Common.UI.ComboBox({ - el: $('#text-bar-font-size', container), - cls: 'input-group-nr', - style: 'width: 45px;', - menuCls : 'scrollable-menu menu-absolute', - menuStyle: 'min-width: 45px;max-height: 270px;', - restoreMenuHeightAndTop: 220, - hint: toolbar.tipFontSize, - data: [ - {value: 8, displayValue: "8"}, - {value: 9, displayValue: "9"}, - {value: 10, displayValue: "10"}, - {value: 11, displayValue: "11"}, - {value: 12, displayValue: "12"}, - {value: 14, displayValue: "14"}, - {value: 16, displayValue: "16"}, - {value: 18, displayValue: "18"}, - {value: 20, displayValue: "20"}, - {value: 22, displayValue: "22"}, - {value: 24, displayValue: "24"}, - {value: 26, displayValue: "26"}, - {value: 28, displayValue: "28"}, - {value: 36, displayValue: "36"}, - {value: 48, displayValue: "48"}, - {value: 72, displayValue: "72"}, - {value: 96, displayValue: "96"} - ] - }); - this.cmbFontSize.setValue(''); - textBarBtns.push(this.cmbFontSize); - - this.btnBold = new Common.UI.Button({ - parentEl: $('#text-bar-bold', container), - cls: 'btn-toolbar', - iconCls: 'toolbar__icon btn-bold', - enableToggle: true, - hint: toolbar.textBold - }); - textBarBtns.push(this.btnBold); - - this.btnItalic = new Common.UI.Button({ - parentEl: $('#text-bar-italic', container), - cls: 'btn-toolbar', - iconCls: 'toolbar__icon btn-italic', - enableToggle: true, - hint: toolbar.textItalic - }); - textBarBtns.push(this.btnItalic); - - this.btnTextUnderline = new Common.UI.Button({ - parentEl: $('#text-bar-underline', container), - cls : 'btn-toolbar', - iconCls : 'toolbar__icon btn-underline', - enableToggle: true, - hint: toolbar.textUnderline - }); - textBarBtns.push(this.btnTextUnderline); - - this.btnTextStrikeout = new Common.UI.Button({ - parentEl: $('#text-bar-strikeout', container), - cls: 'btn-toolbar', - iconCls: 'toolbar__icon btn-strikeout', - enableToggle: true, - hint: toolbar.textStrikeout - }); - textBarBtns.push(this.btnTextStrikeout); - - this.btnSuperscript = new Common.UI.Button({ - parentEl: $('#text-bar-super', container), - cls: 'btn-toolbar', - iconCls: 'toolbar__icon btn-superscript', - enableToggle: true, - toggleGroup: 'superscriptGroup', - hint: toolbar.textSuperscript - }); - textBarBtns.push(this.btnSuperscript); - - this.btnSubscript = new Common.UI.Button({ - parentEl: $('#text-bar-sub', container), - cls: 'btn-toolbar', - iconCls: 'toolbar__icon btn-subscript', - enableToggle: true, - toggleGroup: 'superscriptGroup', - hint: toolbar.textSubscript - }); - textBarBtns.push(this.btnSubscript); - - var config = Common.UI.simpleColorsConfig; - this.btnFontColor = new Common.UI.ButtonColored({ - parentEl: $('#text-bar-textcolor', container), - cls: 'btn-toolbar', - iconCls: 'toolbar__icon btn-fontcolor', - split: true, - menu: true, - colors: config.colors, - color: '000000', - dynamiccolors: config.dynamiccolors, - themecolors: config.themecolors, - effects: config.effects, - columns: config.columns, - paletteCls: config.cls, - paletteWidth: config.paletteWidth, - hint: toolbar.tipFontColor - }); - textBarBtns.push(this.btnFontColor); - this.btnFontColor.setMenu(); - this.mnuFontColorPicker = this.btnFontColor.getPicker(); - this.btnFontColor.currentColor = this.btnFontColor.color; - - return container; - }, - - createAnnotBar: function(annotBarBtns) { - var container = $('
' + - '
' + - '
' + - '
' + - '
' + - '
' + - '
' + - '
' + - '
' + - '
'), - toolbarController = PDFE.getController('Toolbar'), - toolbar = toolbarController.getView('Toolbar'); - - this.btnCopy = new Common.UI.Button({ - parentEl: $('#annot-bar-copy', container), - cls: 'btn-toolbar', - iconCls: 'toolbar__icon btn-copy', - hint: toolbar.tipCopy - }); - annotBarBtns.push(this.btnCopy); - - this.btnAddComment = new Common.UI.Button({ - parentEl: $('#annot-bar-add-comment', container), - cls: 'btn-toolbar', - iconCls: 'toolbar__icon btn-add-comment', - hint: toolbar.tipAddComment - }); - annotBarBtns.push(this.btnAddComment); - - var config = Common.UI.simpleColorsConfig; - this.btnUnderline = new Common.UI.ButtonColored({ - parentEl: $('#annot-bar-underline', container), - cls : 'btn-toolbar', - iconCls : 'toolbar__icon btn-underline', - enableToggle: true, - allowDepress: true, - split: true, - menu: true, - hideColorLine: true, - colors: config.colors, - color: '3D8A44', - dynamiccolors: config.dynamiccolors, - themecolors: config.themecolors, - effects: config.effects, - columns: config.columns, - paletteCls: config.cls, - paletteWidth: config.paletteWidth, - storageSuffix: '-draw', - hint: toolbar.textUnderline, - type: AscPDF.ANNOTATIONS_TYPES.Underline - }); - annotBarBtns.push(this.btnUnderline); - this.btnUnderline.setMenu(); - this.mnuUnderlineColorPicker = this.btnUnderline.getPicker(); - this.btnUnderline.currentColor = this.btnUnderline.color; - - this.btnStrikeout = new Common.UI.ButtonColored({ - parentEl: $('#annot-bar-strikeout', container), - cls: 'btn-toolbar', - iconCls: 'toolbar__icon btn-strikeout', - enableToggle: true, - allowDepress: true, - split: true, - menu: true, - hideColorLine: true, - colors: config.colors, - color: 'D43230', - dynamiccolors: config.dynamiccolors, - themecolors: config.themecolors, - effects: config.effects, - columns: config.columns, - paletteCls: config.cls, - paletteWidth: config.paletteWidth, - storageSuffix: '-draw', - hint: toolbar.textStrikeout, - type: AscPDF.ANNOTATIONS_TYPES.Strikeout - }); - annotBarBtns.push(this.btnStrikeout); - this.btnStrikeout.setMenu(); - this.mnuStrikeoutColorPicker = this.btnStrikeout.getPicker(); - this.btnStrikeout.currentColor = this.btnStrikeout.color; - - this.btnHighlight = new Common.UI.ButtonColored({ - parentEl: $('#annot-bar-highlight', container), - cls: 'btn-toolbar', - iconCls: 'toolbar__icon btn-highlight', - enableToggle: true, - allowDepress: true, - split: true, - menu: true, - colors: [ - 'FFFC54', '72F54A', '74F9FD', 'EB51F7', 'A900F9', 'EF8B3A', '7272FF', 'FF63A4', '1DFF92', '03DA18', - '249B01', 'C504D2', '0633D1', 'FFF7A0', 'FF0303', 'FFFFFF', 'D3D3D4', '969696', '606060', '000000' - ], - color: 'FFFC54', - dynamiccolors: config.dynamiccolors, - themecolors: config.themecolors, - effects: config.effects, - columns: config.columns, - paletteCls: config.cls, - paletteWidth: config.paletteWidth, - storageSuffix: '-draw', - hint: toolbar.textHighlight, - type: AscPDF.ANNOTATIONS_TYPES.Highlight - }); - annotBarBtns.push(this.btnHighlight); - this.btnHighlight.setMenu(); - this.mnuHighlightColorPicker = this.btnHighlight.getPicker(); - this.btnHighlight.currentColor = this.btnHighlight.color; - - this.btnEditText = new Common.UI.Button({ - parentEl: $('#annot-bar-edit-text', container), - cls: 'btn-toolbar', - iconCls: 'toolbar__icon btn-magic-wand', - caption: this.textRecognize, - hint: this.tipRecognize - }); - annotBarBtns.push(this.btnEditText); - this.fireEvent('annotbar:create', [this.btnStrikeout, this.mnuStrikeoutColorPicker, this.btnUnderline, this.mnuUnderlineColorPicker, this.btnHighlight, this.mnuHighlightColorPicker]); - - return container; - }, + createAnnotBar: function(annotBarBtns) {}, focus: function() { var me = this; diff --git a/apps/pdfeditor/main/app/view/DocumentHolderExt.js b/apps/pdfeditor/main/app/view/DocumentHolderExt.js index d328c52246..1d7eee6490 100644 --- a/apps/pdfeditor/main/app/view/DocumentHolderExt.js +++ b/apps/pdfeditor/main/app/view/DocumentHolderExt.js @@ -1265,5 +1265,355 @@ define([], function () { this.fireEvent('createdelayedelements', [this, 'forms']); }; + dh.createTextBar = function(textBarBtns) { + var container = $('
' + + '
' + + '
' + + '
' + + '
' + + '
' + + '
' + + '
' + + '
' + + '
' + + '
'), + toolbarController = PDFE.getController('Toolbar'), + toolbar = toolbarController.getView('Toolbar'); + + this.cmbFontName = new Common.UI.ComboBoxFonts({ + el: $('#text-bar-fonts', container), + cls : 'input-group-nr', + style : 'width: 100px;', + menuCls : 'scrollable-menu menu-absolute', + menuStyle : 'min-width: 100%;max-height: 270px;', + restoreMenuHeightAndTop: 220, + store : new Common.Collections.Fonts(), + hint : toolbar.tipFontName + }); + textBarBtns.push(this.cmbFontName); + toolbarController.fillFontsStore(this.cmbFontName); + + this.cmbFontSize = new Common.UI.ComboBox({ + el: $('#text-bar-font-size', container), + cls: 'input-group-nr', + style: 'width: 45px;', + menuCls : 'scrollable-menu menu-absolute', + menuStyle: 'min-width: 45px;max-height: 270px;', + restoreMenuHeightAndTop: 220, + hint: toolbar.tipFontSize, + data: [ + {value: 8, displayValue: "8"}, + {value: 9, displayValue: "9"}, + {value: 10, displayValue: "10"}, + {value: 11, displayValue: "11"}, + {value: 12, displayValue: "12"}, + {value: 14, displayValue: "14"}, + {value: 16, displayValue: "16"}, + {value: 18, displayValue: "18"}, + {value: 20, displayValue: "20"}, + {value: 22, displayValue: "22"}, + {value: 24, displayValue: "24"}, + {value: 26, displayValue: "26"}, + {value: 28, displayValue: "28"}, + {value: 36, displayValue: "36"}, + {value: 48, displayValue: "48"}, + {value: 72, displayValue: "72"}, + {value: 96, displayValue: "96"} + ] + }); + this.cmbFontSize.setValue(''); + textBarBtns.push(this.cmbFontSize); + + this.btnBold = new Common.UI.Button({ + parentEl: $('#text-bar-bold', container), + cls: 'btn-toolbar', + iconCls: 'toolbar__icon btn-bold', + enableToggle: true, + hint: toolbar.textBold + }); + textBarBtns.push(this.btnBold); + + this.btnItalic = new Common.UI.Button({ + parentEl: $('#text-bar-italic', container), + cls: 'btn-toolbar', + iconCls: 'toolbar__icon btn-italic', + enableToggle: true, + hint: toolbar.textItalic + }); + textBarBtns.push(this.btnItalic); + + this.btnTextUnderline = new Common.UI.Button({ + parentEl: $('#text-bar-underline', container), + cls : 'btn-toolbar', + iconCls : 'toolbar__icon btn-underline', + enableToggle: true, + hint: toolbar.textUnderline + }); + textBarBtns.push(this.btnTextUnderline); + + this.btnTextStrikeout = new Common.UI.Button({ + parentEl: $('#text-bar-strikeout', container), + cls: 'btn-toolbar', + iconCls: 'toolbar__icon btn-strikeout', + enableToggle: true, + hint: toolbar.textStrikeout + }); + textBarBtns.push(this.btnTextStrikeout); + + this.btnSuperscript = new Common.UI.Button({ + parentEl: $('#text-bar-super', container), + cls: 'btn-toolbar', + iconCls: 'toolbar__icon btn-superscript', + enableToggle: true, + toggleGroup: 'superscriptGroup', + hint: toolbar.textSuperscript + }); + textBarBtns.push(this.btnSuperscript); + + this.btnSubscript = new Common.UI.Button({ + parentEl: $('#text-bar-sub', container), + cls: 'btn-toolbar', + iconCls: 'toolbar__icon btn-subscript', + enableToggle: true, + toggleGroup: 'superscriptGroup', + hint: toolbar.textSubscript + }); + textBarBtns.push(this.btnSubscript); + + var config = Common.UI.simpleColorsConfig; + this.btnFontColor = new Common.UI.ButtonColored({ + parentEl: $('#text-bar-textcolor', container), + cls: 'btn-toolbar', + iconCls: 'toolbar__icon btn-fontcolor', + split: true, + menu: true, + colors: config.colors, + color: '000000', + dynamiccolors: config.dynamiccolors, + themecolors: config.themecolors, + effects: config.effects, + columns: config.columns, + paletteCls: config.cls, + paletteWidth: config.paletteWidth, + hint: toolbar.tipFontColor + }); + textBarBtns.push(this.btnFontColor); + this.btnFontColor.setMenu(); + this.mnuFontColorPicker = this.btnFontColor.getPicker(); + this.btnFontColor.currentColor = this.btnFontColor.color; + + return container; + }; + + dh.createAnnotBar = function(annotBarBtns) { + var container = $('
' + + '
' + + '
' + + '
' + + '
' + + '
' + + '
' + + '
' + + '
' + + '
'), + toolbarController = PDFE.getController('Toolbar'), + toolbar = toolbarController.getView('Toolbar'); + + this.btnCopy = new Common.UI.Button({ + parentEl: $('#annot-bar-copy', container), + cls: 'btn-toolbar', + iconCls: 'toolbar__icon btn-copy', + hint: toolbar.tipCopy + }); + annotBarBtns.push(this.btnCopy); + + this.btnAddComment = new Common.UI.Button({ + parentEl: $('#annot-bar-add-comment', container), + cls: 'btn-toolbar', + iconCls: 'toolbar__icon btn-add-comment', + hint: toolbar.tipAddComment + }); + annotBarBtns.push(this.btnAddComment); + + var config = Common.UI.simpleColorsConfig; + this.btnUnderline = new Common.UI.ButtonColored({ + parentEl: $('#annot-bar-underline', container), + cls : 'btn-toolbar', + iconCls : 'toolbar__icon btn-underline', + enableToggle: true, + allowDepress: true, + split: true, + menu: true, + hideColorLine: true, + colors: config.colors, + color: '3D8A44', + dynamiccolors: config.dynamiccolors, + themecolors: config.themecolors, + effects: config.effects, + columns: config.columns, + paletteCls: config.cls, + paletteWidth: config.paletteWidth, + storageSuffix: '-draw', + hint: toolbar.textUnderline, + type: AscPDF.ANNOTATIONS_TYPES.Underline + }); + annotBarBtns.push(this.btnUnderline); + this.btnUnderline.setMenu(); + this.mnuUnderlineColorPicker = this.btnUnderline.getPicker(); + this.btnUnderline.currentColor = this.btnUnderline.color; + + this.btnStrikeout = new Common.UI.ButtonColored({ + parentEl: $('#annot-bar-strikeout', container), + cls: 'btn-toolbar', + iconCls: 'toolbar__icon btn-strikeout', + enableToggle: true, + allowDepress: true, + split: true, + menu: true, + hideColorLine: true, + colors: config.colors, + color: 'D43230', + dynamiccolors: config.dynamiccolors, + themecolors: config.themecolors, + effects: config.effects, + columns: config.columns, + paletteCls: config.cls, + paletteWidth: config.paletteWidth, + storageSuffix: '-draw', + hint: toolbar.textStrikeout, + type: AscPDF.ANNOTATIONS_TYPES.Strikeout + }); + annotBarBtns.push(this.btnStrikeout); + this.btnStrikeout.setMenu(); + this.mnuStrikeoutColorPicker = this.btnStrikeout.getPicker(); + this.btnStrikeout.currentColor = this.btnStrikeout.color; + + this.btnHighlight = new Common.UI.ButtonColored({ + parentEl: $('#annot-bar-highlight', container), + cls: 'btn-toolbar', + iconCls: 'toolbar__icon btn-highlight', + enableToggle: true, + allowDepress: true, + split: true, + menu: true, + colors: [ + 'FFFC54', '72F54A', '74F9FD', 'EB51F7', 'A900F9', 'EF8B3A', '7272FF', 'FF63A4', '1DFF92', '03DA18', + '249B01', 'C504D2', '0633D1', 'FFF7A0', 'FF0303', 'FFFFFF', 'D3D3D4', '969696', '606060', '000000' + ], + color: 'FFFC54', + dynamiccolors: config.dynamiccolors, + themecolors: config.themecolors, + effects: config.effects, + columns: config.columns, + paletteCls: config.cls, + paletteWidth: config.paletteWidth, + storageSuffix: '-draw', + hint: toolbar.textHighlight, + type: AscPDF.ANNOTATIONS_TYPES.Highlight + }); + annotBarBtns.push(this.btnHighlight); + this.btnHighlight.setMenu(); + this.mnuHighlightColorPicker = this.btnHighlight.getPicker(); + this.btnHighlight.currentColor = this.btnHighlight.color; + + this.btnEditText = new Common.UI.Button({ + parentEl: $('#annot-bar-edit-text', container), + cls: 'btn-toolbar', + iconCls: 'toolbar__icon btn-magic-wand', + caption: this.textRecognize, + hint: this.tipRecognize + }); + annotBarBtns.push(this.btnEditText); + this.fireEvent('annotbar:create', [this.btnStrikeout, this.mnuStrikeoutColorPicker, this.btnUnderline, this.mnuUnderlineColorPicker, this.btnHighlight, this.mnuHighlightColorPicker]); + + return container; + }; + + dh.createAnnotSelectBar = function(annotSelectBarBtns) { + var container = $('
' + + '
' + + '
' + + '
' + + '
' + + '
'), + toolbarController = PDFE.getController('Toolbar'), + toolbar = toolbarController.getView('Toolbar'); + + this.btnRemAnnot = new Common.UI.Button({ + parentEl: $('#annot-sel-bar-remove', container), + cls: 'btn-toolbar', + iconCls: 'toolbar__icon btn-cc-remove', + hint: toolbar.removeCommentText + }); + annotSelectBarBtns.push(this.btnRemAnnot); + + this.btnAddAnnotComment = new Common.UI.Button({ + parentEl: $('#annot-sel-bar-add-comment', container), + cls: 'btn-toolbar', + iconCls: 'toolbar__icon btn-add-comment', + hint: toolbar.tipAddComment + }); + annotSelectBarBtns.push(this.btnAddAnnotComment); + + var config = Common.UI.simpleColorsConfig; + + this.btnStrokeHighlightColor = new Common.UI.ButtonColored({ + parentEl: $('#annot-bar-highlight', container), + cls: 'btn-toolbar', + iconCls: 'toolbar__icon btn-highlight', + enableToggle: true, + allowDepress: true, + split: true, + menu: true, + colors: [ + 'FFFC54', '72F54A', '74F9FD', 'EB51F7', 'A900F9', 'EF8B3A', '7272FF', 'FF63A4', '1DFF92', '03DA18', + '249B01', 'C504D2', '0633D1', 'FFF7A0', 'FF0303', 'FFFFFF', 'D3D3D4', '969696', '606060', '000000' + ], + color: 'FFFC54', + dynamiccolors: config.dynamiccolors, + themecolors: config.themecolors, + effects: config.effects, + columns: config.columns, + paletteCls: config.cls, + paletteWidth: config.paletteWidth, + storageSuffix: '-draw', + hint: toolbar.textHighlight, + type: AscPDF.ANNOTATIONS_TYPES.Highlight + }); + annotSelectBarBtns.push(this.btnStrokeHighlightColor); + this.btnStrokeHighlightColor.setMenu(); + this.mnuStrokeHighlightColorPicker = this.btnStrokeHighlightColor.getPicker(); + this.btnStrokeHighlightColor.currentColor = this.btnStrokeHighlightColor.color; + + this.btnStrokeColor = new Common.UI.ButtonColored({ + parentEl: $('#annot-bar-highlight', container), + cls: 'btn-toolbar', + iconCls: 'toolbar__icon btn-highlight', + enableToggle: true, + allowDepress: true, + split: true, + menu: true, + colors: [ + 'FFFC54', '72F54A', '74F9FD', 'EB51F7', 'A900F9', 'EF8B3A', '7272FF', 'FF63A4', '1DFF92', '03DA18', + '249B01', 'C504D2', '0633D1', 'FFF7A0', 'FF0303', 'FFFFFF', 'D3D3D4', '969696', '606060', '000000' + ], + color: 'FFFC54', + dynamiccolors: config.dynamiccolors, + themecolors: config.themecolors, + effects: config.effects, + columns: config.columns, + paletteCls: config.cls, + paletteWidth: config.paletteWidth, + storageSuffix: '-draw', + hint: toolbar.textHighlight, + type: AscPDF.ANNOTATIONS_TYPES.Highlight + }); + annotSelectBarBtns.push(this.btnStrokeColor); + this.btnStrokeColor.setMenu(); + this.mnuStrokeColorPicker = this.btnStrokeColor.getPicker(); + this.btnStrokeColor.currentColor = this.btnStrokeColor.color; + + return container; + }; } }); \ No newline at end of file diff --git a/apps/pdfeditor/main/resources/less/toolbar.less b/apps/pdfeditor/main/resources/less/toolbar.less index 874d25b2b9..a0dc0ca390 100644 --- a/apps/pdfeditor/main/resources/less/toolbar.less +++ b/apps/pdfeditor/main/resources/less/toolbar.less @@ -121,7 +121,8 @@ #equation-container, #text-bar-container, -#annot-bar-container { +#annot-bar-container, +#annot-sel-bar-container { position: absolute; z-index: @zindex-dropdown - 20; background-color: @background-toolbar-ie; @@ -157,7 +158,8 @@ } #text-bar-container, -#annot-bar-container { +#annot-bar-container, +#annot-sel-bar-container { padding: 4px 6px; :not(.btn-group.split) .btn-toolbar, .btn-group.split { From f11ef19cfdc79f62e861585b42bc4c286959194c Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Tue, 10 Dec 2024 19:30:04 +0300 Subject: [PATCH 03/12] [PDF] Change annotation color --- .../main/app/controller/DocumentHolderExt.js | 31 ++++++++++++++++++- .../main/app/view/DocumentHolderExt.js | 27 +++++----------- apps/pdfeditor/main/locale/en.json | 1 + 3 files changed, 39 insertions(+), 20 deletions(-) diff --git a/apps/pdfeditor/main/app/controller/DocumentHolderExt.js b/apps/pdfeditor/main/app/controller/DocumentHolderExt.js index 698296e0b6..1299d7ad71 100644 --- a/apps/pdfeditor/main/app/controller/DocumentHolderExt.js +++ b/apps/pdfeditor/main/app/controller/DocumentHolderExt.js @@ -743,10 +743,29 @@ define([], function () { // annotation text bar documentHolder.btnRemAnnot.on('click', _.bind(this.removeComment, this)); documentHolder.btnAddAnnotComment.on('click', _.bind(this.addComment, this, {isFromBar: true})); - + documentHolder.mnuStrokeHighlightColorPicker.on('select', _.bind(this.onSelectStrokeColor, this, documentHolder.btnStrokeHighlightColor)); + documentHolder.mnuStrokeColorPicker.on('select', _.bind(this.onSelectStrokeColor, this, documentHolder.btnStrokeColor)); this.api.UpdateInterfaceState(); } + var selectedElements = this.api.getSelectedElements(), + annotType = AscPDF.ANNOTATIONS_TYPES.Highlight; + if (selectedElements && _.isArray(selectedElements)){ + _.each(selectedElements, function(el, i) { + if (selectedElements[i].get_ObjectType() == Asc.c_oAscTypeSelectElement.Annot) { + annotType = selectedElements[i].get_ObjectValue().asc_getType(); + } + }); + } + documentHolder.btnStrokeHighlightColor.setVisible(annotType === AscPDF.ANNOTATIONS_TYPES.Highlight); + documentHolder.btnStrokeColor.setVisible(annotType !== AscPDF.ANNOTATIONS_TYPES.Highlight); + var color = this.api.asc_GetStrokeColor(), + btn = annotType === AscPDF.ANNOTATIONS_TYPES.Highlight ? documentHolder.btnStrokeHighlightColor : documentHolder.btnStrokeColor; + color = Common.Utils.ThemeColor.getHexColor(color['r'], color['g'], color['b']); + btn.currentColor = color; + btn.setColor(btn.currentColor); + btn.getPicker().select(btn.currentColor, true); + var showPoint = [(bounds[0] + bounds[2])/2 - textContainer.outerWidth()/2, me.lastAnnotBarOnTop ? bounds[1] - textContainer.outerHeight() - 10 : bounds[3] + 10]; (showPoint[0]<0) && (showPoint[0] = 0); showPoint[1] = Math.min(me._Height - textContainer.outerHeight(), Math.max(0, showPoint[1])); @@ -2322,5 +2341,15 @@ define([], function () { /** coauthoring end **/ }; + dh.onSelectStrokeColor = function(btn, picker, color) { + btn.currentColor = color; + btn.setColor(btn.currentColor); + picker.select(btn.currentColor, true); + var r = color[0] + color[1], + g = color[2] + color[3], + b = color[4] + color[5]; + this.api.asc_SetStrokeColor(parseInt(r, 16), parseInt(g, 16), parseInt(b, 16)); + }; + } }); \ No newline at end of file diff --git a/apps/pdfeditor/main/app/view/DocumentHolderExt.js b/apps/pdfeditor/main/app/view/DocumentHolderExt.js index 1d7eee6490..2764d33e93 100644 --- a/apps/pdfeditor/main/app/view/DocumentHolderExt.js +++ b/apps/pdfeditor/main/app/view/DocumentHolderExt.js @@ -1531,7 +1531,8 @@ define([], function () { dh.createAnnotSelectBar = function(annotSelectBarBtns) { var container = $('
' + - '
' + + '
' + + '
' + '
' + '
' + '
' + @@ -1556,14 +1557,10 @@ define([], function () { annotSelectBarBtns.push(this.btnAddAnnotComment); var config = Common.UI.simpleColorsConfig; - this.btnStrokeHighlightColor = new Common.UI.ButtonColored({ - parentEl: $('#annot-bar-highlight', container), + parentEl: $('#annot-sel-bar-highlight', container), cls: 'btn-toolbar', iconCls: 'toolbar__icon btn-highlight', - enableToggle: true, - allowDepress: true, - split: true, menu: true, colors: [ 'FFFC54', '72F54A', '74F9FD', 'EB51F7', 'A900F9', 'EF8B3A', '7272FF', 'FF63A4', '1DFF92', '03DA18', @@ -1577,8 +1574,7 @@ define([], function () { paletteCls: config.cls, paletteWidth: config.paletteWidth, storageSuffix: '-draw', - hint: toolbar.textHighlight, - type: AscPDF.ANNOTATIONS_TYPES.Highlight + hint: this.textColor }); annotSelectBarBtns.push(this.btnStrokeHighlightColor); this.btnStrokeHighlightColor.setMenu(); @@ -1586,18 +1582,12 @@ define([], function () { this.btnStrokeHighlightColor.currentColor = this.btnStrokeHighlightColor.color; this.btnStrokeColor = new Common.UI.ButtonColored({ - parentEl: $('#annot-bar-highlight', container), + parentEl: $('#annot-sel-bar-stroke', container), cls: 'btn-toolbar', iconCls: 'toolbar__icon btn-highlight', - enableToggle: true, - allowDepress: true, - split: true, menu: true, - colors: [ - 'FFFC54', '72F54A', '74F9FD', 'EB51F7', 'A900F9', 'EF8B3A', '7272FF', 'FF63A4', '1DFF92', '03DA18', - '249B01', 'C504D2', '0633D1', 'FFF7A0', 'FF0303', 'FFFFFF', 'D3D3D4', '969696', '606060', '000000' - ], - color: 'FFFC54', + colors: config.colors, + color: '3D8A44', dynamiccolors: config.dynamiccolors, themecolors: config.themecolors, effects: config.effects, @@ -1605,8 +1595,7 @@ define([], function () { paletteCls: config.cls, paletteWidth: config.paletteWidth, storageSuffix: '-draw', - hint: toolbar.textHighlight, - type: AscPDF.ANNOTATIONS_TYPES.Highlight + hint: this.textColor }); annotSelectBarBtns.push(this.btnStrokeColor); this.btnStrokeColor.setMenu(); diff --git a/apps/pdfeditor/main/locale/en.json b/apps/pdfeditor/main/locale/en.json index a57297d4ad..000bb564ff 100644 --- a/apps/pdfeditor/main/locale/en.json +++ b/apps/pdfeditor/main/locale/en.json @@ -1239,6 +1239,7 @@ "PDFE.Views.DocumentHolder.txtWarnUrl": "Clicking this link can be harmful to your device and data.
Are you sure you want to continue?", "PDFE.Views.DocumentHolder.unicodeText": "Unicode", "PDFE.Views.DocumentHolder.vertAlignText": "Vertical alignment", + "PDFE.Views.DocumentHolder.textColor": "Color", "PDFE.Views.FileMenu.ariaFileMenu": "File menu", "PDFE.Views.FileMenu.btnBackCaption": "Open File Location", "PDFE.Views.FileMenu.btnCloseEditor": "Close File", From 1a678626a6d2305f4872efeb88329129b8b4a8fa Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Tue, 10 Dec 2024 19:49:23 +0300 Subject: [PATCH 04/12] Fix bug --- apps/pdfeditor/main/app/controller/DocumentHolderExt.js | 7 +++---- apps/pdfeditor/main/app/view/DocumentHolderExt.js | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/apps/pdfeditor/main/app/controller/DocumentHolderExt.js b/apps/pdfeditor/main/app/controller/DocumentHolderExt.js index 1299d7ad71..91396e0db1 100644 --- a/apps/pdfeditor/main/app/controller/DocumentHolderExt.js +++ b/apps/pdfeditor/main/app/controller/DocumentHolderExt.js @@ -766,7 +766,7 @@ define([], function () { btn.setColor(btn.currentColor); btn.getPicker().select(btn.currentColor, true); - var showPoint = [(bounds[0] + bounds[2])/2 - textContainer.outerWidth()/2, me.lastAnnotBarOnTop ? bounds[1] - textContainer.outerHeight() - 10 : bounds[3] + 10]; + var showPoint = [(bounds[0] + bounds[2])/2 - textContainer.outerWidth()/2, me.lastAnnotSelBarOnTop ? bounds[1] - textContainer.outerHeight() - 10 : bounds[3] + 10]; (showPoint[0]<0) && (showPoint[0] = 0); showPoint[1] = Math.min(me._Height - textContainer.outerHeight(), Math.max(0, showPoint[1])); textContainer.css({left: showPoint[0], top : showPoint[1]}); @@ -783,7 +783,7 @@ define([], function () { if (!textContainer.is(':visible')) { textContainer.show(); } - me.disableAnnotBar(); + me.disableAnnotSelectBar(); }; dh.onHideAnnotSelectBar = function() { @@ -799,10 +799,9 @@ define([], function () { disabled = this._isDisabled; if (textContainer.length>0 && textContainer.is(':visible')) { - this.annotBarBtns.forEach(function(item){ + this.annotSelectBarBtns.forEach(function(item){ item && item.setDisabled(!!disabled); }); - this.documentHolder.btnCopy && this.documentHolder.btnCopy.setDisabled(!this.api.can_CopyCut() || !!disabled); } }; diff --git a/apps/pdfeditor/main/app/view/DocumentHolderExt.js b/apps/pdfeditor/main/app/view/DocumentHolderExt.js index 2764d33e93..52749b134d 100644 --- a/apps/pdfeditor/main/app/view/DocumentHolderExt.js +++ b/apps/pdfeditor/main/app/view/DocumentHolderExt.js @@ -1544,7 +1544,7 @@ define([], function () { parentEl: $('#annot-sel-bar-remove', container), cls: 'btn-toolbar', iconCls: 'toolbar__icon btn-cc-remove', - hint: toolbar.removeCommentText + hint: this.removeCommentText }); annotSelectBarBtns.push(this.btnRemAnnot); From a76359cd5b82ad1f31af694b5a46ad19a8f9238e Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Tue, 10 Dec 2024 21:30:16 +0300 Subject: [PATCH 05/12] [PDF] Change style of the color button --- apps/common/main/lib/component/ColorButton.js | 14 ++++++----- apps/common/main/resources/less/buttons.less | 23 +++++++++++++++++++ apps/documenteditor/main/app/view/Toolbar.js | 2 +- .../main/app/view/DocumentHolderExt.js | 14 ++++++----- apps/pdfeditor/main/app/view/Toolbar.js | 4 ++-- .../main/resources/less/toolbar.less | 4 ++-- 6 files changed, 44 insertions(+), 17 deletions(-) diff --git a/apps/common/main/lib/component/ColorButton.js b/apps/common/main/lib/component/ColorButton.js index fa5ba6d22f..d4903fb22e 100644 --- a/apps/common/main/lib/component/ColorButton.js +++ b/apps/common/main/lib/component/ColorButton.js @@ -42,13 +42,15 @@ define([ render: function(parentEl) { Common.UI.Button.prototype.render.call(this, parentEl); - if (/huge/.test(this.options.cls) && this.options.split === true && !this.options.hideColorLine) { + // options.colorLine: true/false/'line'/'box' + var colorLineCls = this.options.colorLine==='box' ? 'btn-color-value-box' : 'btn-color-value-line'; + if (/huge/.test(this.options.cls) && this.options.split === true && (this.options.colorLine!==false)) { var btnEl = $('button', this.cmpEl), btnMenuEl = $(btnEl[1]); - btnMenuEl && btnMenuEl.append( $('
')); - } else if (!this.options.hideColorLine) - $('button:first-child', this.cmpEl).append( $('
')); - this.colorEl = this.cmpEl.find('.btn-color-value-line'); + btnMenuEl && btnMenuEl.append( $('
')); + } else if ((this.options.colorLine!==false)) + $('button:first-child', this.cmpEl).append( $('
')); + this.colorEl = this.cmpEl.find('.' + colorLineCls); if (this.options.auto) this.autocolor = (typeof this.options.auto == 'object') ? this.options.auto.color || '000000' : '000000'; @@ -178,7 +180,7 @@ define([ if (this.colorEl) { this.colorEl.css({'background-color': (color=='transparent') ? color : ((typeof(color) == 'object') ? '#'+color.color : '#'+color)}); - this.colorEl.toggleClass('bordered', color=='transparent'); + this.colorEl.toggleClass('bordered', color=='transparent' || this.options.colorLine==='box'); } }, diff --git a/apps/common/main/resources/less/buttons.less b/apps/common/main/resources/less/buttons.less index ea0527b237..ffbe23dc03 100644 --- a/apps/common/main/resources/less/buttons.less +++ b/apps/common/main/resources/less/buttons.less @@ -543,6 +543,29 @@ top: 4px; } } + .btn-color-value-box { + pointer-events: none; + position: absolute; + left: 3px; + bottom: 3px; + width: 14px; + height: 14px; + background-color: red; + .rtl & { + left: auto; + right: 3px; + } + &.bordered { + border: @scaled-one-px-value-ie solid @border-color-shading-ie; + border: @scaled-one-px-value solid @border-color-shading; + } + } + + &.no-icon { + .icon { + visibility: hidden; + } + } &.no-caret { .inner-box-caret { diff --git a/apps/documenteditor/main/app/view/Toolbar.js b/apps/documenteditor/main/app/view/Toolbar.js index 243adf2eea..1ebbc5842d 100644 --- a/apps/documenteditor/main/app/view/Toolbar.js +++ b/apps/documenteditor/main/app/view/Toolbar.js @@ -1628,7 +1628,7 @@ define([ caption: me.capBtnPageColor, menu: true, eyeDropper: false, - hideColorLine: true, + colorLine: false, additionalItemsBefore: [ me.mnuPageNoFill = new Common.UI.MenuItem({ caption: me.strMenuNoFill, diff --git a/apps/pdfeditor/main/app/view/DocumentHolderExt.js b/apps/pdfeditor/main/app/view/DocumentHolderExt.js index 52749b134d..a2ee4fb751 100644 --- a/apps/pdfeditor/main/app/view/DocumentHolderExt.js +++ b/apps/pdfeditor/main/app/view/DocumentHolderExt.js @@ -1444,7 +1444,7 @@ define([], function () { allowDepress: true, split: true, menu: true, - hideColorLine: true, + colorLine: false, colors: config.colors, color: '3D8A44', dynamiccolors: config.dynamiccolors, @@ -1470,7 +1470,7 @@ define([], function () { allowDepress: true, split: true, menu: true, - hideColorLine: true, + colorLine: false, colors: config.colors, color: 'D43230', dynamiccolors: config.dynamiccolors, @@ -1559,9 +1559,10 @@ define([], function () { var config = Common.UI.simpleColorsConfig; this.btnStrokeHighlightColor = new Common.UI.ButtonColored({ parentEl: $('#annot-sel-bar-highlight', container), - cls: 'btn-toolbar', - iconCls: 'toolbar__icon btn-highlight', + cls: 'btn-toolbar no-caret no-icon', + iconCls: 'toolbar__icon', menu: true, + colorLine: 'box', colors: [ 'FFFC54', '72F54A', '74F9FD', 'EB51F7', 'A900F9', 'EF8B3A', '7272FF', 'FF63A4', '1DFF92', '03DA18', '249B01', 'C504D2', '0633D1', 'FFF7A0', 'FF0303', 'FFFFFF', 'D3D3D4', '969696', '606060', '000000' @@ -1583,9 +1584,10 @@ define([], function () { this.btnStrokeColor = new Common.UI.ButtonColored({ parentEl: $('#annot-sel-bar-stroke', container), - cls: 'btn-toolbar', - iconCls: 'toolbar__icon btn-highlight', + cls: 'btn-toolbar no-caret no-icon', + iconCls: 'toolbar__icon', menu: true, + colorLine: 'box', colors: config.colors, color: '3D8A44', dynamiccolors: config.dynamiccolors, diff --git a/apps/pdfeditor/main/app/view/Toolbar.js b/apps/pdfeditor/main/app/view/Toolbar.js index 783baf26c8..307c99d979 100644 --- a/apps/pdfeditor/main/app/view/Toolbar.js +++ b/apps/pdfeditor/main/app/view/Toolbar.js @@ -847,7 +847,7 @@ define([ allowDepress: true, split: true, menu: true, - hideColorLine: true, + colorLine: false, dataHint: '1', dataHintDirection: 'top', dataHintOffset: '0, -16', @@ -865,7 +865,7 @@ define([ allowDepress: true, split: true, menu: true, - hideColorLine: true, + colorLine: false, dataHint: '1', dataHintDirection: 'bottom', dataHintOffset: '0, -16', diff --git a/apps/pdfeditor/main/resources/less/toolbar.less b/apps/pdfeditor/main/resources/less/toolbar.less index a0dc0ca390..a06361f219 100644 --- a/apps/pdfeditor/main/resources/less/toolbar.less +++ b/apps/pdfeditor/main/resources/less/toolbar.less @@ -161,8 +161,8 @@ #annot-bar-container, #annot-sel-bar-container { padding: 4px 6px; - :not(.btn-group.split) .btn-toolbar, - .btn-group.split { + .btn-toolbar, + .btn-group { display: flex; justify-content: center; align-items: center; From ff716f2b7c4c4f78b9b78caa5d367f857836130f Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Tue, 10 Dec 2024 21:50:23 +0300 Subject: [PATCH 06/12] Refactoring --- .../main/app/controller/DocumentHolder.js | 141 +----------------- .../main/app/controller/DocumentHolderExt.js | 141 ++++++++++++++++++ 2 files changed, 144 insertions(+), 138 deletions(-) diff --git a/apps/pdfeditor/main/app/controller/DocumentHolder.js b/apps/pdfeditor/main/app/controller/DocumentHolder.js index a7f4f0f435..85d6229415 100644 --- a/apps/pdfeditor/main/app/controller/DocumentHolder.js +++ b/apps/pdfeditor/main/app/controller/DocumentHolder.js @@ -237,131 +237,13 @@ define([ } }, - fillViewMenuProps: function(selectedElements) { - // if (!selectedElements || !_.isArray(selectedElements)) return; - - var documentHolder = this.documentHolder; - if (!documentHolder.viewPDFModeMenu) - documentHolder.createDelayedElementsPDFViewer(); - - var menu_props = {}; - selectedElements && _.each(selectedElements, function(element, index) { - if (Asc.c_oAscTypeSelectElement.Annot == element.get_ObjectType()) { - menu_props.annotProps = {}; - menu_props.annotProps.value = element.get_ObjectValue(); - } - }); - - return {menu_to_show: documentHolder.viewPDFModeMenu, menu_props: menu_props}; - }, + fillViewMenuProps: function(selectedElements) {}, - fillPDFEditMenuProps: function(selectedElements) { - var documentHolder = this.documentHolder; - if (!documentHolder.editPDFModeMenu) - documentHolder.createDelayedElementsPDFEditor(); - - if (!selectedElements || !_.isArray(selectedElements) || selectedElements.length<1) - return {menu_to_show: documentHolder.editPDFModeMenu, menu_props: {}}; - - var me = this, - menu_props = {}, - menu_to_show = null; - _.each(selectedElements, function(element, index) { - var elType = element.get_ObjectType(), - elValue = element.get_ObjectValue(); - - if (Asc.c_oAscTypeSelectElement.Image == elType) { - menu_to_show = documentHolder.pictureMenu; - menu_props.imgProps = {}; - menu_props.imgProps.value = elValue; - menu_props.imgProps.locked = (elValue) ? elValue.get_Locked() : false; - } else if (Asc.c_oAscTypeSelectElement.Table == elType) { - menu_to_show = documentHolder.tableMenu; - menu_props.tableProps = {}; - menu_props.tableProps.value = elValue; - menu_props.tableProps.locked = (elValue) ? elValue.get_Locked() : false; - } else if (Asc.c_oAscTypeSelectElement.Hyperlink == elType) { - menu_props.hyperProps = {}; - menu_props.hyperProps.value = elValue; - } else if (Asc.c_oAscTypeSelectElement.Shape == elType) { // shape - menu_props.shapeProps = {}; - menu_props.shapeProps.value = elValue; - menu_props.shapeProps.locked = (elValue) ? elValue.get_Locked() : false; - if (elValue.get_FromChart()) - menu_props.shapeProps.isChart = true; - if (menu_props.paraProps && menu_props.paraProps.value && elValue.asc_getCanEditText()) // text in shape, need to show paragraph menu with vertical align - menu_to_show = documentHolder.textMenu; - else - menu_to_show = documentHolder.pictureMenu; - } - // else if (Asc.c_oAscTypeSelectElement.Chart == elType) { - // menu_to_show = documentHolder.pictureMenu; - // menu_props.chartProps = {}; - // menu_props.chartProps.value = elValue; - // menu_props.chartProps.locked = (elValue) ? elValue.get_Locked() : false; - // } - else if (Asc.c_oAscTypeSelectElement.Paragraph == elType) { - menu_props.paraProps = {}; - menu_props.paraProps.value = elValue; - menu_props.paraProps.locked = (elValue) ? elValue.get_Locked() : false; - if (menu_props.shapeProps && menu_props.shapeProps.value && menu_props.shapeProps.value.asc_getCanEditText()) // text in shape, need to show paragraph menu with vertical align - menu_to_show = documentHolder.textMenu; - } else if (Asc.c_oAscTypeSelectElement.Math == elType) { - menu_props.mathProps = {}; - menu_props.mathProps.value = elValue; - documentHolder._currentMathObj = elValue; - } else if (Asc.c_oAscTypeSelectElement.Annot == elType) { - menu_to_show = documentHolder.editPDFModeMenu; - menu_props.annotProps = {}; - menu_props.annotProps.value = elValue; - } - }); - if (menu_to_show === null) { - if (!_.isUndefined(menu_props.paraProps)) - menu_to_show = documentHolder.textMenu; - } - - return {menu_to_show: menu_to_show, menu_props: menu_props}; - }, + fillPDFEditMenuProps: function(selectedElements) {}, applyEditorMode: function() {}, - fillFormsMenuProps: function(selectedElements) { - if (!selectedElements || !_.isArray(selectedElements)) return; - - var documentHolder = this.documentHolder; - if (!documentHolder.formsPDFMenu) - documentHolder.createDelayedElementsPDFForms(); - - var menu_props = {}, - noobject = true; - for (var i = 0; i Date: Tue, 10 Dec 2024 22:10:18 +0300 Subject: [PATCH 07/12] Refactoring --- apps/pdfeditor/main/app/controller/DocumentHolderExt.js | 2 +- apps/visioeditor/main/app/controller/DocumentHolder.js | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/apps/pdfeditor/main/app/controller/DocumentHolderExt.js b/apps/pdfeditor/main/app/controller/DocumentHolderExt.js index 281c4c506b..84a899afbf 100644 --- a/apps/pdfeditor/main/app/controller/DocumentHolderExt.js +++ b/apps/pdfeditor/main/app/controller/DocumentHolderExt.js @@ -866,7 +866,7 @@ define([], function () { }); // annotation text bar documentHolder.btnRemAnnot.on('click', _.bind(this.removeComment, this)); - documentHolder.btnAddAnnotComment.on('click', _.bind(this.addComment, this, {isFromBar: true})); + documentHolder.btnAddAnnotComment.on('click', _.bind(this.addComment, this, {isFromSelBar: true})); documentHolder.mnuStrokeHighlightColorPicker.on('select', _.bind(this.onSelectStrokeColor, this, documentHolder.btnStrokeHighlightColor)); documentHolder.mnuStrokeColorPicker.on('select', _.bind(this.onSelectStrokeColor, this, documentHolder.btnStrokeColor)); this.api.UpdateInterfaceState(); diff --git a/apps/visioeditor/main/app/controller/DocumentHolder.js b/apps/visioeditor/main/app/controller/DocumentHolder.js index 9235ec7bc4..2bdc2f678e 100644 --- a/apps/visioeditor/main/app/controller/DocumentHolder.js +++ b/apps/visioeditor/main/app/controller/DocumentHolder.js @@ -526,7 +526,6 @@ define([ })).show(); } } - item.isFromBar && me.api.SetShowTextSelectPanel(false); } me.editComplete(); }, From f5e069b17334dac6dd59ed4c1056caf56a8a1dec Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Wed, 11 Dec 2024 16:50:27 +0300 Subject: [PATCH 08/12] [Forms] Fix ie styles --- apps/common/forms/resources/less/common.less | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/apps/common/forms/resources/less/common.less b/apps/common/forms/resources/less/common.less index 98139cd78b..f529826a41 100644 --- a/apps/common/forms/resources/less/common.less +++ b/apps/common/forms/resources/less/common.less @@ -59,10 +59,6 @@ @import "../../../../common/main/resources/less/advanced-settings-window.less"; @import "../../../../common/main/resources/less/searchdialog.less"; -@toolbarBorderColor: @border-toolbar-ie; -@toolbarBorderColor: @border-toolbar; -@toolbarTopColor: @background-toolbar-ie; -@toolbarTopColor: @background-toolbar; @toolbarFontSize: 12px; @iconSpriteCommonPath: "../../../../common/forms/resources/img/glyphicons.png"; @@ -112,7 +108,7 @@ min-width: 340px; z-index: 100; background-color: @background-toolbar-ie; - background-color: @toolbarTopColor; + background-color: @background-toolbar; display: flex; align-items: center; @@ -124,7 +120,8 @@ width: 100%; height: 40px; - .box-inner-shadow(0 -1px 0 @toolbarBorderColor); + .box-inner-shadow(0 -1px 0 @border-toolbar-ie); + .box-inner-shadow(0 -1px 0 @border-toolbar); } .group { From c1cad8d7a67ec54cd8d74b6adde732715601cf65 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Wed, 11 Dec 2024 16:52:09 +0300 Subject: [PATCH 09/12] Add file types for visio --- apps/api/documents/api.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/api/documents/api.js b/apps/api/documents/api.js index 5f958e7ccd..aee333978b 100644 --- a/apps/api/documents/api.js +++ b/apps/api/documents/api.js @@ -480,7 +480,7 @@ if (typeof _config.document.fileType === 'string' && _config.document.fileType != '') { _config.document.fileType = _config.document.fileType.toLowerCase(); - var type = /^(?:(xls|xlsx|ods|csv|gsheet|xlsm|xlt|xltm|xltx|fods|ots|xlsb|sxc|et|ett|numbers)|(pps|ppsx|ppt|pptx|odp|gslides|pot|potm|potx|ppsm|pptm|fodp|otp|sxi|dps|dpt|key)|(pdf|djvu|xps|oxps)|(doc|docx|odt|gdoc|txt|rtf|mht|htm|html|mhtml|epub|docm|dot|dotm|dotx|fodt|ott|fb2|xml|oform|docxf|sxw|stw|wps|wpt|pages)|(vsdx))$/ + var type = /^(?:(xls|xlsx|ods|csv|gsheet|xlsm|xlt|xltm|xltx|fods|ots|xlsb|sxc|et|ett|numbers)|(pps|ppsx|ppt|pptx|odp|gslides|pot|potm|potx|ppsm|pptm|fodp|otp|sxi|dps|dpt|key)|(pdf|djvu|xps|oxps)|(doc|docx|odt|gdoc|txt|rtf|mht|htm|html|mhtml|epub|docm|dot|dotm|dotx|fodt|ott|fb2|xml|oform|docxf|sxw|stw|wps|wpt|pages)|(vsdx|vssx|vstx|vsdm|vssm|vstm))$/ .exec(_config.document.fileType); if (!type) { window.alert("The \"document.fileType\" parameter for the config object is invalid. Please correct it."); @@ -1033,7 +1033,7 @@ isForm = false; if (config.document) { if (typeof config.document.fileType === 'string') - type = /^(?:(pdf)|(djvu|xps|oxps)|(xls|xlsx|ods|csv|xlst|xlsy|gsheet|xlsm|xlt|xltm|xltx|fods|ots|xlsb|numbers)|(pps|ppsx|ppt|pptx|odp|pptt|ppty|gslides|pot|potm|potx|ppsm|pptm|fodp|otp|key)|(oform|docxf)|(vsdx))$/ + type = /^(?:(pdf)|(djvu|xps|oxps)|(xls|xlsx|ods|csv|xlst|xlsy|gsheet|xlsm|xlt|xltm|xltx|fods|ots|xlsb|numbers)|(pps|ppsx|ppt|pptx|odp|pptt|ppty|gslides|pot|potm|potx|ppsm|pptm|fodp|otp|key)|(oform|docxf)|(vsdx|vssx|vstx|vsdm|vssm|vstm))$/ .exec(config.document.fileType); if (config.document.permissions) From 53c7a4d5cd31798b083f986f5db083e7e65ccc42 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Wed, 11 Dec 2024 18:43:02 +0300 Subject: [PATCH 10/12] [PDF] Fix disconnect --- apps/pdfeditor/main/app/controller/DocumentHolder.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/apps/pdfeditor/main/app/controller/DocumentHolder.js b/apps/pdfeditor/main/app/controller/DocumentHolder.js index 85d6229415..5fbca9b3c5 100644 --- a/apps/pdfeditor/main/app/controller/DocumentHolder.js +++ b/apps/pdfeditor/main/app/controller/DocumentHolder.js @@ -573,6 +573,8 @@ define([ onHideAnnotBar: function() {}, + onHideAnnotSelectBar: function() {}, + editText: function() { this.mode && !this.mode.isPDFEdit && Common.NotificationCenter.trigger('pdf:mode-apply', 'edit'); this.api && this.api.asc_EditPage(); @@ -582,6 +584,7 @@ define([ this.onHideMathTrack(); this.onHideTextBar(); this.onHideAnnotBar(); + this.onHideAnnotSelectBar(); }, editComplete: function() { From f459a9acb518479ea038012210aebad129a6f08d Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Wed, 11 Dec 2024 18:44:20 +0300 Subject: [PATCH 11/12] Update translation --- apps/pdfeditor/main/locale/ar.json | 3 ++- apps/pdfeditor/main/locale/az.json | 3 ++- apps/pdfeditor/main/locale/be.json | 3 ++- apps/pdfeditor/main/locale/bg.json | 3 ++- apps/pdfeditor/main/locale/ca.json | 3 ++- apps/pdfeditor/main/locale/cs.json | 3 ++- apps/pdfeditor/main/locale/da.json | 3 ++- apps/pdfeditor/main/locale/de.json | 3 ++- apps/pdfeditor/main/locale/el.json | 3 ++- apps/pdfeditor/main/locale/es.json | 3 ++- apps/pdfeditor/main/locale/eu.json | 3 ++- apps/pdfeditor/main/locale/fi.json | 3 ++- apps/pdfeditor/main/locale/fr.json | 3 ++- apps/pdfeditor/main/locale/gl.json | 3 ++- apps/pdfeditor/main/locale/he.json | 3 ++- apps/pdfeditor/main/locale/hu.json | 3 ++- apps/pdfeditor/main/locale/hy.json | 3 ++- apps/pdfeditor/main/locale/id.json | 3 ++- apps/pdfeditor/main/locale/it.json | 3 ++- apps/pdfeditor/main/locale/ja.json | 3 ++- apps/pdfeditor/main/locale/ko.json | 3 ++- apps/pdfeditor/main/locale/lo.json | 3 ++- apps/pdfeditor/main/locale/lv.json | 3 ++- apps/pdfeditor/main/locale/ms.json | 3 ++- apps/pdfeditor/main/locale/nl.json | 3 ++- apps/pdfeditor/main/locale/pl.json | 3 ++- apps/pdfeditor/main/locale/pt-pt.json | 3 ++- apps/pdfeditor/main/locale/pt.json | 3 ++- apps/pdfeditor/main/locale/ro.json | 3 ++- apps/pdfeditor/main/locale/ru.json | 3 ++- apps/pdfeditor/main/locale/si.json | 3 ++- apps/pdfeditor/main/locale/sk.json | 3 ++- apps/pdfeditor/main/locale/sl.json | 3 ++- apps/pdfeditor/main/locale/sr-cyrl.json | 3 ++- apps/pdfeditor/main/locale/sr.json | 3 ++- apps/pdfeditor/main/locale/sv.json | 3 ++- apps/pdfeditor/main/locale/tr.json | 3 ++- apps/pdfeditor/main/locale/uk.json | 3 ++- apps/pdfeditor/main/locale/zh-tw.json | 3 ++- apps/pdfeditor/main/locale/zh.json | 3 ++- 40 files changed, 80 insertions(+), 40 deletions(-) diff --git a/apps/pdfeditor/main/locale/ar.json b/apps/pdfeditor/main/locale/ar.json index 9b1e65c5f3..52ef7160d7 100644 --- a/apps/pdfeditor/main/locale/ar.json +++ b/apps/pdfeditor/main/locale/ar.json @@ -2025,5 +2025,6 @@ "PDFE.Views.ViewTab.tipFitToPage": "ملائم للصفحة", "PDFE.Views.ViewTab.tipFitToWidth": "ملائم للعرض", "PDFE.Views.ViewTab.tipHeadings": "العناوين", - "PDFE.Views.ViewTab.tipInterfaceTheme": "سمة الواجهة" + "PDFE.Views.ViewTab.tipInterfaceTheme": "سمة الواجهة", + "PDFE.Views.DocumentHolder.textColor": "Color" } \ No newline at end of file diff --git a/apps/pdfeditor/main/locale/az.json b/apps/pdfeditor/main/locale/az.json index d25c280974..3e2182f49c 100644 --- a/apps/pdfeditor/main/locale/az.json +++ b/apps/pdfeditor/main/locale/az.json @@ -2025,5 +2025,6 @@ "PDFE.Views.ViewTab.tipFitToPage": "Səhifəyə uyğun tənzimlə", "PDFE.Views.ViewTab.tipFitToWidth": "Enə uyğun tənzimlə", "PDFE.Views.ViewTab.tipHeadings": "Başlıqlar", - "PDFE.Views.ViewTab.tipInterfaceTheme": "İnterfeys mövzusu" + "PDFE.Views.ViewTab.tipInterfaceTheme": "İnterfeys mövzusu", + "PDFE.Views.DocumentHolder.textColor": "Color" } \ No newline at end of file diff --git a/apps/pdfeditor/main/locale/be.json b/apps/pdfeditor/main/locale/be.json index e2e31b4672..87c86bc645 100644 --- a/apps/pdfeditor/main/locale/be.json +++ b/apps/pdfeditor/main/locale/be.json @@ -2025,5 +2025,6 @@ "PDFE.Views.ViewTab.tipFitToPage": "Па памеры старонкі", "PDFE.Views.ViewTab.tipFitToWidth": "Па шырыні", "PDFE.Views.ViewTab.tipHeadings": "Загалоўкі", - "PDFE.Views.ViewTab.tipInterfaceTheme": "Тэма інтэрфейсу" + "PDFE.Views.ViewTab.tipInterfaceTheme": "Тэма інтэрфейсу", + "PDFE.Views.DocumentHolder.textColor": "Color" } \ No newline at end of file diff --git a/apps/pdfeditor/main/locale/bg.json b/apps/pdfeditor/main/locale/bg.json index ff317f409f..5cbb6e675b 100644 --- a/apps/pdfeditor/main/locale/bg.json +++ b/apps/pdfeditor/main/locale/bg.json @@ -2025,5 +2025,6 @@ "PDFE.Views.ViewTab.tipFitToPage": "Побиране в страницата", "PDFE.Views.ViewTab.tipFitToWidth": "Поставя се в ширина", "PDFE.Views.ViewTab.tipHeadings": "Заглавия", - "PDFE.Views.ViewTab.tipInterfaceTheme": "Тема на интерфейса" + "PDFE.Views.ViewTab.tipInterfaceTheme": "Тема на интерфейса", + "PDFE.Views.DocumentHolder.textColor": "Color" } \ No newline at end of file diff --git a/apps/pdfeditor/main/locale/ca.json b/apps/pdfeditor/main/locale/ca.json index 76719623c1..0aab236937 100644 --- a/apps/pdfeditor/main/locale/ca.json +++ b/apps/pdfeditor/main/locale/ca.json @@ -2025,5 +2025,6 @@ "PDFE.Views.ViewTab.tipFitToPage": "Ajusta-ho a la pàgina", "PDFE.Views.ViewTab.tipFitToWidth": "Ajusta-ho a l'amplària", "PDFE.Views.ViewTab.tipHeadings": "Capçaleres", - "PDFE.Views.ViewTab.tipInterfaceTheme": "Tema de la interfície" + "PDFE.Views.ViewTab.tipInterfaceTheme": "Tema de la interfície", + "PDFE.Views.DocumentHolder.textColor": "Color" } \ No newline at end of file diff --git a/apps/pdfeditor/main/locale/cs.json b/apps/pdfeditor/main/locale/cs.json index 29516e7fe3..40ca71dd26 100644 --- a/apps/pdfeditor/main/locale/cs.json +++ b/apps/pdfeditor/main/locale/cs.json @@ -2025,5 +2025,6 @@ "PDFE.Views.ViewTab.tipFitToPage": "Přízpůsobit stránce", "PDFE.Views.ViewTab.tipFitToWidth": "Přizpůsobit šířce", "PDFE.Views.ViewTab.tipHeadings": "Nadpisy", - "PDFE.Views.ViewTab.tipInterfaceTheme": "Vzhled uživatelského rozhraní" + "PDFE.Views.ViewTab.tipInterfaceTheme": "Vzhled uživatelského rozhraní", + "PDFE.Views.DocumentHolder.textColor": "Color" } \ No newline at end of file diff --git a/apps/pdfeditor/main/locale/da.json b/apps/pdfeditor/main/locale/da.json index b59db49cb5..8e9fdc1992 100644 --- a/apps/pdfeditor/main/locale/da.json +++ b/apps/pdfeditor/main/locale/da.json @@ -2025,5 +2025,6 @@ "PDFE.Views.ViewTab.tipFitToPage": "Tilpas til side", "PDFE.Views.ViewTab.tipFitToWidth": "Tilpas til bredde", "PDFE.Views.ViewTab.tipHeadings": "Overskrifter", - "PDFE.Views.ViewTab.tipInterfaceTheme": "Interface tema" + "PDFE.Views.ViewTab.tipInterfaceTheme": "Interface tema", + "PDFE.Views.DocumentHolder.textColor": "Color" } \ No newline at end of file diff --git a/apps/pdfeditor/main/locale/de.json b/apps/pdfeditor/main/locale/de.json index 01410f5145..af79e7ece5 100644 --- a/apps/pdfeditor/main/locale/de.json +++ b/apps/pdfeditor/main/locale/de.json @@ -2025,5 +2025,6 @@ "PDFE.Views.ViewTab.tipFitToPage": "Seite anpassen", "PDFE.Views.ViewTab.tipFitToWidth": "Breite anpassen", "PDFE.Views.ViewTab.tipHeadings": "Überschriften", - "PDFE.Views.ViewTab.tipInterfaceTheme": "Thema der Benutzeroberfläche" + "PDFE.Views.ViewTab.tipInterfaceTheme": "Thema der Benutzeroberfläche", + "PDFE.Views.DocumentHolder.textColor": "Color" } \ No newline at end of file diff --git a/apps/pdfeditor/main/locale/el.json b/apps/pdfeditor/main/locale/el.json index 369c9d2b39..0c9b823d1c 100644 --- a/apps/pdfeditor/main/locale/el.json +++ b/apps/pdfeditor/main/locale/el.json @@ -2025,5 +2025,6 @@ "PDFE.Views.ViewTab.tipFitToPage": "Προσαρμογή στη σελίδα", "PDFE.Views.ViewTab.tipFitToWidth": "Προσαρμογή στο πλάτος", "PDFE.Views.ViewTab.tipHeadings": "Κεφαλίδες", - "PDFE.Views.ViewTab.tipInterfaceTheme": "Θέμα διεπαφής" + "PDFE.Views.ViewTab.tipInterfaceTheme": "Θέμα διεπαφής", + "PDFE.Views.DocumentHolder.textColor": "Color" } \ No newline at end of file diff --git a/apps/pdfeditor/main/locale/es.json b/apps/pdfeditor/main/locale/es.json index 599905a792..be4940265b 100644 --- a/apps/pdfeditor/main/locale/es.json +++ b/apps/pdfeditor/main/locale/es.json @@ -2025,5 +2025,6 @@ "PDFE.Views.ViewTab.tipFitToPage": "Ajustar a la página", "PDFE.Views.ViewTab.tipFitToWidth": "Ajustar al ancho", "PDFE.Views.ViewTab.tipHeadings": "Encabezados", - "PDFE.Views.ViewTab.tipInterfaceTheme": "Tema de la interfaz" + "PDFE.Views.ViewTab.tipInterfaceTheme": "Tema de la interfaz", + "PDFE.Views.DocumentHolder.textColor": "Color" } \ No newline at end of file diff --git a/apps/pdfeditor/main/locale/eu.json b/apps/pdfeditor/main/locale/eu.json index 785de7d97f..ac71b288a3 100644 --- a/apps/pdfeditor/main/locale/eu.json +++ b/apps/pdfeditor/main/locale/eu.json @@ -2025,5 +2025,6 @@ "PDFE.Views.ViewTab.tipFitToPage": "Doitu orrira", "PDFE.Views.ViewTab.tipFitToWidth": "Doitu zabalerara", "PDFE.Views.ViewTab.tipHeadings": "Izenburuak", - "PDFE.Views.ViewTab.tipInterfaceTheme": "Interfazearen gaia" + "PDFE.Views.ViewTab.tipInterfaceTheme": "Interfazearen gaia", + "PDFE.Views.DocumentHolder.textColor": "Color" } \ No newline at end of file diff --git a/apps/pdfeditor/main/locale/fi.json b/apps/pdfeditor/main/locale/fi.json index a926c797a7..40437a39ce 100644 --- a/apps/pdfeditor/main/locale/fi.json +++ b/apps/pdfeditor/main/locale/fi.json @@ -2025,5 +2025,6 @@ "PDFE.Views.ViewTab.tipFitToPage": "Sovita sivulle", "PDFE.Views.ViewTab.tipFitToWidth": "Sovita leveyden mukaan", "PDFE.Views.ViewTab.tipHeadings": "Headings", - "PDFE.Views.ViewTab.tipInterfaceTheme": "Käyttöliittymän teema" + "PDFE.Views.ViewTab.tipInterfaceTheme": "Käyttöliittymän teema", + "PDFE.Views.DocumentHolder.textColor": "Color" } \ No newline at end of file diff --git a/apps/pdfeditor/main/locale/fr.json b/apps/pdfeditor/main/locale/fr.json index 7bf4dcabfa..d439f9b509 100644 --- a/apps/pdfeditor/main/locale/fr.json +++ b/apps/pdfeditor/main/locale/fr.json @@ -2025,5 +2025,6 @@ "PDFE.Views.ViewTab.tipFitToPage": "Ajuster à la page", "PDFE.Views.ViewTab.tipFitToWidth": "Ajuster à la largeur", "PDFE.Views.ViewTab.tipHeadings": "Titres", - "PDFE.Views.ViewTab.tipInterfaceTheme": "Thème d’interface" + "PDFE.Views.ViewTab.tipInterfaceTheme": "Thème d’interface", + "PDFE.Views.DocumentHolder.textColor": "Color" } \ No newline at end of file diff --git a/apps/pdfeditor/main/locale/gl.json b/apps/pdfeditor/main/locale/gl.json index 91f0f579ba..1676cb50d9 100644 --- a/apps/pdfeditor/main/locale/gl.json +++ b/apps/pdfeditor/main/locale/gl.json @@ -2025,5 +2025,6 @@ "PDFE.Views.ViewTab.tipFitToPage": "Axustar á páxina", "PDFE.Views.ViewTab.tipFitToWidth": "Axustar á anchura", "PDFE.Views.ViewTab.tipHeadings": "Títulos", - "PDFE.Views.ViewTab.tipInterfaceTheme": "Tema da interface" + "PDFE.Views.ViewTab.tipInterfaceTheme": "Tema da interface", + "PDFE.Views.DocumentHolder.textColor": "Color" } \ No newline at end of file diff --git a/apps/pdfeditor/main/locale/he.json b/apps/pdfeditor/main/locale/he.json index 6f22a5c607..e1fea5dc37 100644 --- a/apps/pdfeditor/main/locale/he.json +++ b/apps/pdfeditor/main/locale/he.json @@ -2025,5 +2025,6 @@ "PDFE.Views.ViewTab.tipFitToPage": "מתאים לדף", "PDFE.Views.ViewTab.tipFitToWidth": "מתאים לרוחב", "PDFE.Views.ViewTab.tipHeadings": "כותרות", - "PDFE.Views.ViewTab.tipInterfaceTheme": "ערכת נושא" + "PDFE.Views.ViewTab.tipInterfaceTheme": "ערכת נושא", + "PDFE.Views.DocumentHolder.textColor": "Color" } \ No newline at end of file diff --git a/apps/pdfeditor/main/locale/hu.json b/apps/pdfeditor/main/locale/hu.json index 5126555ac4..ca11f4398b 100644 --- a/apps/pdfeditor/main/locale/hu.json +++ b/apps/pdfeditor/main/locale/hu.json @@ -2025,5 +2025,6 @@ "PDFE.Views.ViewTab.tipFitToPage": "Oldalhoz igazít", "PDFE.Views.ViewTab.tipFitToWidth": "Szélességhez igazít", "PDFE.Views.ViewTab.tipHeadings": "Címsorok", - "PDFE.Views.ViewTab.tipInterfaceTheme": "Felhasználói felület témája" + "PDFE.Views.ViewTab.tipInterfaceTheme": "Felhasználói felület témája", + "PDFE.Views.DocumentHolder.textColor": "Color" } \ No newline at end of file diff --git a/apps/pdfeditor/main/locale/hy.json b/apps/pdfeditor/main/locale/hy.json index b5e60d3e20..3884740a44 100644 --- a/apps/pdfeditor/main/locale/hy.json +++ b/apps/pdfeditor/main/locale/hy.json @@ -2025,5 +2025,6 @@ "PDFE.Views.ViewTab.tipFitToPage": "Հարմարեցնել էջին", "PDFE.Views.ViewTab.tipFitToWidth": "Հարմարեցնել լայնությանը", "PDFE.Views.ViewTab.tipHeadings": "Գլխագրեր", - "PDFE.Views.ViewTab.tipInterfaceTheme": "Ինտերֆեյսի թեմա" + "PDFE.Views.ViewTab.tipInterfaceTheme": "Ինտերֆեյսի թեմա", + "PDFE.Views.DocumentHolder.textColor": "Color" } \ No newline at end of file diff --git a/apps/pdfeditor/main/locale/id.json b/apps/pdfeditor/main/locale/id.json index e7009c1c25..b88d728696 100644 --- a/apps/pdfeditor/main/locale/id.json +++ b/apps/pdfeditor/main/locale/id.json @@ -2025,5 +2025,6 @@ "PDFE.Views.ViewTab.tipFitToPage": "Sesuaikan Halaman", "PDFE.Views.ViewTab.tipFitToWidth": "Sesuaikan Lebar", "PDFE.Views.ViewTab.tipHeadings": "Tajuk", - "PDFE.Views.ViewTab.tipInterfaceTheme": "Tema antarmuka" + "PDFE.Views.ViewTab.tipInterfaceTheme": "Tema antarmuka", + "PDFE.Views.DocumentHolder.textColor": "Color" } \ No newline at end of file diff --git a/apps/pdfeditor/main/locale/it.json b/apps/pdfeditor/main/locale/it.json index d0d28de709..e2cf23c27a 100644 --- a/apps/pdfeditor/main/locale/it.json +++ b/apps/pdfeditor/main/locale/it.json @@ -2025,5 +2025,6 @@ "PDFE.Views.ViewTab.tipFitToPage": "Adatta alla pagina", "PDFE.Views.ViewTab.tipFitToWidth": "Adatta alla larghezza", "PDFE.Views.ViewTab.tipHeadings": "Intestazioni", - "PDFE.Views.ViewTab.tipInterfaceTheme": "Tema dell'interfaccia" + "PDFE.Views.ViewTab.tipInterfaceTheme": "Tema dell'interfaccia", + "PDFE.Views.DocumentHolder.textColor": "Color" } \ No newline at end of file diff --git a/apps/pdfeditor/main/locale/ja.json b/apps/pdfeditor/main/locale/ja.json index 1336b329d1..4771c631ee 100644 --- a/apps/pdfeditor/main/locale/ja.json +++ b/apps/pdfeditor/main/locale/ja.json @@ -2025,5 +2025,6 @@ "PDFE.Views.ViewTab.tipFitToPage": "ページに合わせる", "PDFE.Views.ViewTab.tipFitToWidth": "幅に合わせる", "PDFE.Views.ViewTab.tipHeadings": "見出し", - "PDFE.Views.ViewTab.tipInterfaceTheme": "インターフェイスのテーマ" + "PDFE.Views.ViewTab.tipInterfaceTheme": "インターフェイスのテーマ", + "PDFE.Views.DocumentHolder.textColor": "Color" } \ No newline at end of file diff --git a/apps/pdfeditor/main/locale/ko.json b/apps/pdfeditor/main/locale/ko.json index 3905238640..368da89458 100644 --- a/apps/pdfeditor/main/locale/ko.json +++ b/apps/pdfeditor/main/locale/ko.json @@ -2025,5 +2025,6 @@ "PDFE.Views.ViewTab.tipFitToPage": "페이지에 맞춤", "PDFE.Views.ViewTab.tipFitToWidth": "너비에 맞춤", "PDFE.Views.ViewTab.tipHeadings": "제목", - "PDFE.Views.ViewTab.tipInterfaceTheme": "인터페이스 테마" + "PDFE.Views.ViewTab.tipInterfaceTheme": "인터페이스 테마", + "PDFE.Views.DocumentHolder.textColor": "Color" } \ No newline at end of file diff --git a/apps/pdfeditor/main/locale/lo.json b/apps/pdfeditor/main/locale/lo.json index 2f4bd54ae8..be2af42246 100644 --- a/apps/pdfeditor/main/locale/lo.json +++ b/apps/pdfeditor/main/locale/lo.json @@ -2025,5 +2025,6 @@ "PDFE.Views.ViewTab.tipFitToPage": "ພໍດີຂອບ", "PDFE.Views.ViewTab.tipFitToWidth": "ຄວາມກວ້າງພໍດີ", "PDFE.Views.ViewTab.tipHeadings": "ຫົວເລື່ອງ", - "PDFE.Views.ViewTab.tipInterfaceTheme": "ຮູບແບບການສະແດງຜົນ" + "PDFE.Views.ViewTab.tipInterfaceTheme": "ຮູບແບບການສະແດງຜົນ", + "PDFE.Views.DocumentHolder.textColor": "Color" } \ No newline at end of file diff --git a/apps/pdfeditor/main/locale/lv.json b/apps/pdfeditor/main/locale/lv.json index aad3020ae4..0eea496429 100644 --- a/apps/pdfeditor/main/locale/lv.json +++ b/apps/pdfeditor/main/locale/lv.json @@ -2025,5 +2025,6 @@ "PDFE.Views.ViewTab.tipFitToPage": "Saskaņot ar lapu", "PDFE.Views.ViewTab.tipFitToWidth": "Saskaņot ar platumu", "PDFE.Views.ViewTab.tipHeadings": "Virsraksti", - "PDFE.Views.ViewTab.tipInterfaceTheme": "Interfeisa tēma" + "PDFE.Views.ViewTab.tipInterfaceTheme": "Interfeisa tēma", + "PDFE.Views.DocumentHolder.textColor": "Color" } \ No newline at end of file diff --git a/apps/pdfeditor/main/locale/ms.json b/apps/pdfeditor/main/locale/ms.json index 1b644f66eb..760a692704 100644 --- a/apps/pdfeditor/main/locale/ms.json +++ b/apps/pdfeditor/main/locale/ms.json @@ -2025,5 +2025,6 @@ "PDFE.Views.ViewTab.tipFitToPage": "Muat kepada Halaman", "PDFE.Views.ViewTab.tipFitToWidth": "Muat kepada Kelebaran", "PDFE.Views.ViewTab.tipHeadings": "Pengepala", - "PDFE.Views.ViewTab.tipInterfaceTheme": "Tema antara muka" + "PDFE.Views.ViewTab.tipInterfaceTheme": "Tema antara muka", + "PDFE.Views.DocumentHolder.textColor": "Color" } \ No newline at end of file diff --git a/apps/pdfeditor/main/locale/nl.json b/apps/pdfeditor/main/locale/nl.json index d8bcd8eedd..2145bd0e91 100644 --- a/apps/pdfeditor/main/locale/nl.json +++ b/apps/pdfeditor/main/locale/nl.json @@ -2025,5 +2025,6 @@ "PDFE.Views.ViewTab.tipFitToPage": "Aan pagina aanpassen", "PDFE.Views.ViewTab.tipFitToWidth": "Aan breedte aanpassen", "PDFE.Views.ViewTab.tipHeadings": "Koppen", - "PDFE.Views.ViewTab.tipInterfaceTheme": "Interfacethema" + "PDFE.Views.ViewTab.tipInterfaceTheme": "Interfacethema", + "PDFE.Views.DocumentHolder.textColor": "Color" } \ No newline at end of file diff --git a/apps/pdfeditor/main/locale/pl.json b/apps/pdfeditor/main/locale/pl.json index 9810dba4af..114c840605 100644 --- a/apps/pdfeditor/main/locale/pl.json +++ b/apps/pdfeditor/main/locale/pl.json @@ -2025,5 +2025,6 @@ "PDFE.Views.ViewTab.tipFitToPage": "Dopasuj do strony", "PDFE.Views.ViewTab.tipFitToWidth": "Dopasuj do szerokości", "PDFE.Views.ViewTab.tipHeadings": "Nagłówki", - "PDFE.Views.ViewTab.tipInterfaceTheme": "Motyw interfejsu" + "PDFE.Views.ViewTab.tipInterfaceTheme": "Motyw interfejsu", + "PDFE.Views.DocumentHolder.textColor": "Color" } \ No newline at end of file diff --git a/apps/pdfeditor/main/locale/pt-pt.json b/apps/pdfeditor/main/locale/pt-pt.json index edcc9fe04b..8415640809 100644 --- a/apps/pdfeditor/main/locale/pt-pt.json +++ b/apps/pdfeditor/main/locale/pt-pt.json @@ -2025,5 +2025,6 @@ "PDFE.Views.ViewTab.tipFitToPage": "Ajustar à página", "PDFE.Views.ViewTab.tipFitToWidth": "Ajustar à largura", "PDFE.Views.ViewTab.tipHeadings": "Títulos", - "PDFE.Views.ViewTab.tipInterfaceTheme": "Tema da interface" + "PDFE.Views.ViewTab.tipInterfaceTheme": "Tema da interface", + "PDFE.Views.DocumentHolder.textColor": "Color" } \ No newline at end of file diff --git a/apps/pdfeditor/main/locale/pt.json b/apps/pdfeditor/main/locale/pt.json index 56ff3177cb..a5c7be94ef 100644 --- a/apps/pdfeditor/main/locale/pt.json +++ b/apps/pdfeditor/main/locale/pt.json @@ -2025,5 +2025,6 @@ "PDFE.Views.ViewTab.tipFitToPage": "Ajustar a página", "PDFE.Views.ViewTab.tipFitToWidth": "Ajustar à Largura", "PDFE.Views.ViewTab.tipHeadings": "Títulos", - "PDFE.Views.ViewTab.tipInterfaceTheme": "Tema de interface" + "PDFE.Views.ViewTab.tipInterfaceTheme": "Tema de interface", + "PDFE.Views.DocumentHolder.textColor": "Color" } \ No newline at end of file diff --git a/apps/pdfeditor/main/locale/ro.json b/apps/pdfeditor/main/locale/ro.json index dddd0afe98..3e71ce85d5 100644 --- a/apps/pdfeditor/main/locale/ro.json +++ b/apps/pdfeditor/main/locale/ro.json @@ -2025,5 +2025,6 @@ "PDFE.Views.ViewTab.tipFitToPage": "Portivire la pagina", "PDFE.Views.ViewTab.tipFitToWidth": "Potrivire lățime", "PDFE.Views.ViewTab.tipHeadings": "Titluri", - "PDFE.Views.ViewTab.tipInterfaceTheme": "Tema de interfață" + "PDFE.Views.ViewTab.tipInterfaceTheme": "Tema de interfață", + "PDFE.Views.DocumentHolder.textColor": "Color" } \ No newline at end of file diff --git a/apps/pdfeditor/main/locale/ru.json b/apps/pdfeditor/main/locale/ru.json index e7071bcfbc..4faf850f86 100644 --- a/apps/pdfeditor/main/locale/ru.json +++ b/apps/pdfeditor/main/locale/ru.json @@ -2025,5 +2025,6 @@ "PDFE.Views.ViewTab.tipFitToPage": "По размеру страницы", "PDFE.Views.ViewTab.tipFitToWidth": "По ширине", "PDFE.Views.ViewTab.tipHeadings": "Заголовки", - "PDFE.Views.ViewTab.tipInterfaceTheme": "Тема интерфейса" + "PDFE.Views.ViewTab.tipInterfaceTheme": "Тема интерфейса", + "PDFE.Views.DocumentHolder.textColor": "Color" } \ No newline at end of file diff --git a/apps/pdfeditor/main/locale/si.json b/apps/pdfeditor/main/locale/si.json index 48f01a61c4..d36cc780f3 100644 --- a/apps/pdfeditor/main/locale/si.json +++ b/apps/pdfeditor/main/locale/si.json @@ -2025,5 +2025,6 @@ "PDFE.Views.ViewTab.tipFitToPage": "පිටුවට ගළපන්න", "PDFE.Views.ViewTab.tipFitToWidth": "පළලට ගළපන්න", "PDFE.Views.ViewTab.tipHeadings": "ශ්‍රීර්ෂනාම", - "PDFE.Views.ViewTab.tipInterfaceTheme": "අතුරුමුහුණතේ තේමාව" + "PDFE.Views.ViewTab.tipInterfaceTheme": "අතුරුමුහුණතේ තේමාව", + "PDFE.Views.DocumentHolder.textColor": "Color" } \ No newline at end of file diff --git a/apps/pdfeditor/main/locale/sk.json b/apps/pdfeditor/main/locale/sk.json index 19ff57c278..6e79c72bd7 100644 --- a/apps/pdfeditor/main/locale/sk.json +++ b/apps/pdfeditor/main/locale/sk.json @@ -2025,5 +2025,6 @@ "PDFE.Views.ViewTab.tipFitToPage": "Prispôsobiť na stranu", "PDFE.Views.ViewTab.tipFitToWidth": "Prispôsobiť na šírku", "PDFE.Views.ViewTab.tipHeadings": "Nadpisy", - "PDFE.Views.ViewTab.tipInterfaceTheme": "Vzhľad prostredia" + "PDFE.Views.ViewTab.tipInterfaceTheme": "Vzhľad prostredia", + "PDFE.Views.DocumentHolder.textColor": "Color" } \ No newline at end of file diff --git a/apps/pdfeditor/main/locale/sl.json b/apps/pdfeditor/main/locale/sl.json index b17397e229..5b5a2a3842 100644 --- a/apps/pdfeditor/main/locale/sl.json +++ b/apps/pdfeditor/main/locale/sl.json @@ -2025,5 +2025,6 @@ "PDFE.Views.ViewTab.tipFitToPage": "Prilagodi stran", "PDFE.Views.ViewTab.tipFitToWidth": "Prilagodi širino", "PDFE.Views.ViewTab.tipHeadings": "Naslovi", - "PDFE.Views.ViewTab.tipInterfaceTheme": "Interface theme" + "PDFE.Views.ViewTab.tipInterfaceTheme": "Interface theme", + "PDFE.Views.DocumentHolder.textColor": "Color" } \ No newline at end of file diff --git a/apps/pdfeditor/main/locale/sr-cyrl.json b/apps/pdfeditor/main/locale/sr-cyrl.json index c5a98bff0e..8d3da2d00f 100644 --- a/apps/pdfeditor/main/locale/sr-cyrl.json +++ b/apps/pdfeditor/main/locale/sr-cyrl.json @@ -2025,5 +2025,6 @@ "PDFE.Views.ViewTab.tipFitToPage": "Прилагоди страници", "PDFE.Views.ViewTab.tipFitToWidth": "Прилагоди ширини", "PDFE.Views.ViewTab.tipHeadings": "Наслови", - "PDFE.Views.ViewTab.tipInterfaceTheme": "Тема интерфејса" + "PDFE.Views.ViewTab.tipInterfaceTheme": "Тема интерфејса", + "PDFE.Views.DocumentHolder.textColor": "Color" } \ No newline at end of file diff --git a/apps/pdfeditor/main/locale/sr.json b/apps/pdfeditor/main/locale/sr.json index 17b4b8da62..fce308cb86 100644 --- a/apps/pdfeditor/main/locale/sr.json +++ b/apps/pdfeditor/main/locale/sr.json @@ -2025,5 +2025,6 @@ "PDFE.Views.ViewTab.tipFitToPage": "Prilagodi strani", "PDFE.Views.ViewTab.tipFitToWidth": "Prilagodi Širinu ", "PDFE.Views.ViewTab.tipHeadings": "Naslovi", - "PDFE.Views.ViewTab.tipInterfaceTheme": "Tema interfejsa" + "PDFE.Views.ViewTab.tipInterfaceTheme": "Tema interfejsa", + "PDFE.Views.DocumentHolder.textColor": "Color" } \ No newline at end of file diff --git a/apps/pdfeditor/main/locale/sv.json b/apps/pdfeditor/main/locale/sv.json index 45cd41b643..a86363ade4 100644 --- a/apps/pdfeditor/main/locale/sv.json +++ b/apps/pdfeditor/main/locale/sv.json @@ -2025,5 +2025,6 @@ "PDFE.Views.ViewTab.tipFitToPage": "Anpassa till sida", "PDFE.Views.ViewTab.tipFitToWidth": "Anpassa till bredd", "PDFE.Views.ViewTab.tipHeadings": "Rubriker", - "PDFE.Views.ViewTab.tipInterfaceTheme": "Gränssnittstema" + "PDFE.Views.ViewTab.tipInterfaceTheme": "Gränssnittstema", + "PDFE.Views.DocumentHolder.textColor": "Color" } \ No newline at end of file diff --git a/apps/pdfeditor/main/locale/tr.json b/apps/pdfeditor/main/locale/tr.json index f232bd72c7..1496351a64 100644 --- a/apps/pdfeditor/main/locale/tr.json +++ b/apps/pdfeditor/main/locale/tr.json @@ -2025,5 +2025,6 @@ "PDFE.Views.ViewTab.tipFitToPage": "Sayfaya Sığdır", "PDFE.Views.ViewTab.tipFitToWidth": "Genişliğe Sığdır", "PDFE.Views.ViewTab.tipHeadings": "Başlıklar", - "PDFE.Views.ViewTab.tipInterfaceTheme": "Arayüz teması" + "PDFE.Views.ViewTab.tipInterfaceTheme": "Arayüz teması", + "PDFE.Views.DocumentHolder.textColor": "Color" } \ No newline at end of file diff --git a/apps/pdfeditor/main/locale/uk.json b/apps/pdfeditor/main/locale/uk.json index 8e5647ced4..976e649ba7 100644 --- a/apps/pdfeditor/main/locale/uk.json +++ b/apps/pdfeditor/main/locale/uk.json @@ -2025,5 +2025,6 @@ "PDFE.Views.ViewTab.tipFitToPage": "За розміром сторінки", "PDFE.Views.ViewTab.tipFitToWidth": "По ширині", "PDFE.Views.ViewTab.tipHeadings": "Заголовки", - "PDFE.Views.ViewTab.tipInterfaceTheme": "Тема інтерфейсу" + "PDFE.Views.ViewTab.tipInterfaceTheme": "Тема інтерфейсу", + "PDFE.Views.DocumentHolder.textColor": "Color" } \ No newline at end of file diff --git a/apps/pdfeditor/main/locale/zh-tw.json b/apps/pdfeditor/main/locale/zh-tw.json index 9827161454..62f672e7f5 100644 --- a/apps/pdfeditor/main/locale/zh-tw.json +++ b/apps/pdfeditor/main/locale/zh-tw.json @@ -2025,5 +2025,6 @@ "PDFE.Views.ViewTab.tipFitToPage": "調整至頁面", "PDFE.Views.ViewTab.tipFitToWidth": "調整至寬度", "PDFE.Views.ViewTab.tipHeadings": "頁首", - "PDFE.Views.ViewTab.tipInterfaceTheme": "介面主題" + "PDFE.Views.ViewTab.tipInterfaceTheme": "介面主題", + "PDFE.Views.DocumentHolder.textColor": "Color" } \ No newline at end of file diff --git a/apps/pdfeditor/main/locale/zh.json b/apps/pdfeditor/main/locale/zh.json index 839389fc7d..2180859e49 100644 --- a/apps/pdfeditor/main/locale/zh.json +++ b/apps/pdfeditor/main/locale/zh.json @@ -2025,5 +2025,6 @@ "PDFE.Views.ViewTab.tipFitToPage": "适合页面", "PDFE.Views.ViewTab.tipFitToWidth": "适合宽度", "PDFE.Views.ViewTab.tipHeadings": "标题", - "PDFE.Views.ViewTab.tipInterfaceTheme": "界面主题" + "PDFE.Views.ViewTab.tipInterfaceTheme": "界面主题", + "PDFE.Views.DocumentHolder.textColor": "Color" } \ No newline at end of file From 77fc6a265c3bbd302460534a0786f45a08c4dde7 Mon Sep 17 00:00:00 2001 From: Dmitry-Ilyushechkin Date: Wed, 11 Dec 2024 13:49:00 +0300 Subject: [PATCH 12/12] Adding transparency settings for image --- .../main/app/template/ImageSettings.template | 18 ++++ .../main/app/view/ImageSettings.js | 86 ++++++++++++++++++ apps/documenteditor/main/locale/en.json | 1 + .../main/resources/less/rightmenu.less | 4 + .../main/app/template/ImageSettings.template | 18 ++++ apps/pdfeditor/main/app/view/ImageSettings.js | 86 ++++++++++++++++++ apps/pdfeditor/main/locale/en.json | 1 + .../main/resources/less/rightmenu.less | 4 + .../main/app/template/ImageSettings.template | 18 ++++ .../main/app/view/ImageSettings.js | 86 ++++++++++++++++++ apps/presentationeditor/main/locale/en.json | 1 + .../main/resources/less/rightmenu.less | 4 + .../main/app/template/ImageSettings.template | 18 ++++ .../main/app/view/ImageSettings.js | 88 ++++++++++++++++++- apps/spreadsheeteditor/main/locale/en.json | 1 + .../main/resources/less/rightmenu.less | 4 + 16 files changed, 437 insertions(+), 1 deletion(-) diff --git a/apps/documenteditor/main/app/template/ImageSettings.template b/apps/documenteditor/main/app/template/ImageSettings.template index 3337014ffe..c66cb77652 100644 --- a/apps/documenteditor/main/app/template/ImageSettings.template +++ b/apps/documenteditor/main/app/template/ImageSettings.template @@ -37,6 +37,24 @@
+ + +
+ +
+ +
+ +
+
+
+ + + + +
+ + diff --git a/apps/documenteditor/main/app/view/ImageSettings.js b/apps/documenteditor/main/app/view/ImageSettings.js index 1f37fabc66..5242546eb4 100644 --- a/apps/documenteditor/main/app/view/ImageSettings.js +++ b/apps/documenteditor/main/app/view/ImageSettings.js @@ -310,6 +310,37 @@ define([ this.btnResetCrop.on('click', _.bind(this.onResetCrop, this)); this.lockedControls.push(this.btnResetCrop); + this.numTransparency = new Common.UI.MetricSpinner({ + el: $('#image-spin-transparency'), + step: 1, + width: 62, + value: '100 %', + defaultUnit : "%", + maxValue: 100, + minValue: 0, + dataHint: '1', + dataHintDirection: 'bottom', + dataHintOffset: 'big', + ariaLabel: this.strTransparency + }); + this.numTransparency.on('change', _.bind(this.onNumTransparencyChange, this)); + this.numTransparency.on('inputleave', function(){ this.fireEvent('editcomplete', this);}); + this.lockedControls.push(this.numTransparency); + + this.sldrTransparency = new Common.UI.SingleSlider({ + el: $('#image-slider-transparency'), + width: 75, + minValue: 0, + maxValue: 100, + value: 100 + }); + this.sldrTransparency.on('change', _.bind(this.onTransparencyChange, this)); + this.sldrTransparency.on('changecomplete', _.bind(this.onTransparencyChangeComplete, this)); + this.lockedControls.push(this.sldrTransparency); + + this.lblTransparencyStart = $(this.el).find('#image-lbl-transparency-start'); + this.lblTransparencyEnd = $(this.el).find('#image-lbl-transparency-end'); + this.btnSelectImage = new Common.UI.Button({ parentEl: $('#image-button-replace'), cls: 'btn-text-menu-default', @@ -448,6 +479,8 @@ define([ this.btnRotate90.setDisabled(value || this._locked); this.btnFlipV.setDisabled(value || this._locked); this.btnFlipH.setDisabled(value || this._locked); + this.numTransparency.setDisabled(value || this._locked); + this.sldrTransparency.setDisabled(value || this._locked); if (this._state.isOleObject) { var plugin = DE.getCollection('Common.Collections.Plugins').findWhere({guid: pluginGuid}); @@ -455,6 +488,19 @@ define([ } else { this.btnSelectImage.setDisabled(pluginGuid===null || this._locked); } + + var transparency = props.asc_getTransparent(); + if (Math.abs(this._state.Transparency - transparency) > 0.001 || + Math.abs(this.numTransparency.getNumberValue() - transparency) > 0.001 || + (this._state.Transparency === null || transparency === null) && + (this._state.Transparency !== transparency || this.numTransparency.getNumberValue() !== transparency)) { + + if (transparency !== undefined) { + this.sldrTransparency.setValue((transparency === null) ? 100 : transparency / 255 * 100, true); + this.numTransparency.setValue(this.sldrTransparency.getValue(), true); + } + this._state.Transparency = transparency; + } } }, @@ -692,6 +738,46 @@ define([ } }, + onNumTransparencyChange: function(field, newValue, oldValue, eOpts){ + this.sldrTransparency.setValue(field.getNumberValue(), true); + if (this.api) { + var num = field.getNumberValue(); + var properties = new Asc.asc_CImgProperty(); + properties.asc_putTransparent(num * 2.55); + this.api.ImgApply(properties); + } + }, + + onTransparencyChange: function(field, newValue, oldValue){ + this._sliderChanged = newValue; + this.numTransparency.setValue(newValue, true); + + if (this._sendUndoPoint) { + this.api.setStartPointHistory(); + this._sendUndoPoint = false; + this.updateslider = setInterval(_.bind(this._transparencyApplyFunc, this), 100); + } + }, + + onTransparencyChangeComplete: function(field, newValue, oldValue){ + clearInterval(this.updateslider); + this._sliderChanged = newValue; + if (!this._sendUndoPoint) { + this.api.setEndPointHistory(); + this._transparencyApplyFunc(); + } + this._sendUndoPoint = true; + }, + + _transparencyApplyFunc: function() { + if (this._sliderChanged!==undefined) { + var properties = new Asc.asc_CImgProperty(); + properties.asc_putTransparent(this._sliderChanged * 2.55); + this.api.ImgApply(properties); + this._sliderChanged = undefined; + } + }, + setLocked: function (locked) { this._locked = locked; }, diff --git a/apps/documenteditor/main/locale/en.json b/apps/documenteditor/main/locale/en.json index 84d73ebff8..e065d54582 100644 --- a/apps/documenteditor/main/locale/en.json +++ b/apps/documenteditor/main/locale/en.json @@ -2534,6 +2534,7 @@ "DE.Views.ImageSettings.txtThrough": "Through", "DE.Views.ImageSettings.txtTight": "Tight", "DE.Views.ImageSettings.txtTopAndBottom": "Top and bottom", + "DE.Views.ImageSettings.strTransparency": "Opacity", "DE.Views.ImageSettingsAdvanced.strMargins": "Text padding", "DE.Views.ImageSettingsAdvanced.textAbsoluteWH": "Absolute", "DE.Views.ImageSettingsAdvanced.textAlignment": "Alignment", diff --git a/apps/documenteditor/main/resources/less/rightmenu.less b/apps/documenteditor/main/resources/less/rightmenu.less index 8241fcafb8..8260663b49 100644 --- a/apps/documenteditor/main/resources/less/rightmenu.less +++ b/apps/documenteditor/main/resources/less/rightmenu.less @@ -136,6 +136,10 @@ #image-button-90, #image-button-flipv { display: inline-block; } + + #image-spin-transparency { + display: inline-block; + } } &#id-header-settings { diff --git a/apps/pdfeditor/main/app/template/ImageSettings.template b/apps/pdfeditor/main/app/template/ImageSettings.template index 964eb9c055..937571fafc 100644 --- a/apps/pdfeditor/main/app/template/ImageSettings.template +++ b/apps/pdfeditor/main/app/template/ImageSettings.template @@ -37,6 +37,24 @@
+ + +
+ +
+ +
+ +
+
+
+ + + + +
+ + diff --git a/apps/pdfeditor/main/app/view/ImageSettings.js b/apps/pdfeditor/main/app/view/ImageSettings.js index cd0b4af80d..d03b904dd9 100644 --- a/apps/pdfeditor/main/app/view/ImageSettings.js +++ b/apps/pdfeditor/main/app/view/ImageSettings.js @@ -231,6 +231,37 @@ define([ this.btnResetCrop.on('click', _.bind(this.onResetCrop, this)); this.lockedControls.push(this.btnResetCrop); + this.numTransparency = new Common.UI.MetricSpinner({ + el: $('#image-spin-transparency'), + step: 1, + width: 62, + value: '100 %', + defaultUnit : "%", + maxValue: 100, + minValue: 0, + dataHint: '1', + dataHintDirection: 'bottom', + dataHintOffset: 'big', + ariaLabel: this.strTransparency + }); + this.numTransparency.on('change', _.bind(this.onNumTransparencyChange, this)); + this.numTransparency.on('inputleave', function(){ this.fireEvent('editcomplete', this);}); + this.lockedControls.push(this.numTransparency); + + this.sldrTransparency = new Common.UI.SingleSlider({ + el: $('#image-slider-transparency'), + width: 75, + minValue: 0, + maxValue: 100, + value: 100 + }); + this.sldrTransparency.on('change', _.bind(this.onTransparencyChange, this)); + this.sldrTransparency.on('changecomplete', _.bind(this.onTransparencyChangeComplete, this)); + this.lockedControls.push(this.sldrTransparency); + + this.lblTransparencyStart = $(this.el).find('#image-lbl-transparency-start'); + this.lblTransparencyEnd = $(this.el).find('#image-lbl-transparency-end'); + this.btnRotate270 = new Common.UI.Button({ parentEl: $('#image-button-270', this.$el), cls: 'btn-toolbar', @@ -371,6 +402,8 @@ define([ this.btnRotate90.setDisabled(value || this._locked); this.btnFlipV.setDisabled(value || this._locked); this.btnFlipH.setDisabled(value || this._locked); + this.numTransparency.setDisabled(value || this._locked); + this.sldrTransparency.setDisabled(value || this._locked); if (this._state.isOleObject) { var plugin = PDFE.getCollection('Common.Collections.Plugins').findWhere({guid: pluginGuid}); @@ -378,6 +411,19 @@ define([ } else { this.btnSelectImage.setDisabled(pluginGuid===null || this._locked); } + + var transparency = props.asc_getTransparent(); + if (Math.abs(this._state.Transparency - transparency) > 0.001 || + Math.abs(this.numTransparency.getNumberValue() - transparency) > 0.001 || + (this._state.Transparency === null || transparency === null) && + (this._state.Transparency !== transparency || this.numTransparency.getNumberValue() !== transparency)) { + + if (transparency !== undefined) { + this.sldrTransparency.setValue((transparency === null) ? 100 : transparency / 255 * 100, true); + this.numTransparency.setValue(this.sldrTransparency.getValue(), true); + } + this._state.Transparency = transparency; + } } }, @@ -538,6 +584,46 @@ define([ } }, + onNumTransparencyChange: function(field, newValue, oldValue, eOpts){ + this.sldrTransparency.setValue(field.getNumberValue(), true); + if (this.api) { + var num = field.getNumberValue(); + var properties = new Asc.asc_CImgProperty(); + properties.asc_putTransparent(num * 2.55); + this.api.ImgApply(properties) + } + }, + + onTransparencyChange: function(field, newValue, oldValue){ + this._sliderChanged = newValue; + this.numTransparency.setValue(newValue, true); + + if (this._sendUndoPoint) { + this.api.setStartPointHistory(); + this._sendUndoPoint = false; + this.updateslider = setInterval(_.bind(this._transparencyApplyFunc, this), 100); + } + }, + + onTransparencyChangeComplete: function(field, newValue, oldValue){ + clearInterval(this.updateslider); + this._sliderChanged = newValue; + if (!this._sendUndoPoint) { + this.api.setEndPointHistory(); + this._transparencyApplyFunc(); + } + this._sendUndoPoint = true; + }, + + _transparencyApplyFunc: function() { + if (this._sliderChanged!==undefined) { + var properties = new Asc.asc_CImgProperty(); + properties.asc_putTransparent(this._sliderChanged * 2.55); + this.api.ImgApply(properties) + this._sliderChanged = undefined; + } + }, + setLocked: function (locked) { this._locked = locked; }, diff --git a/apps/pdfeditor/main/locale/en.json b/apps/pdfeditor/main/locale/en.json index a57297d4ad..7055549efe 100644 --- a/apps/pdfeditor/main/locale/en.json +++ b/apps/pdfeditor/main/locale/en.json @@ -1411,6 +1411,7 @@ "PDFE.Views.ImageSettings.textRotation": "Rotation", "PDFE.Views.ImageSettings.textSize": "Size", "PDFE.Views.ImageSettings.textWidth": "Width", + "PDFE.Views.ImageSettings.strTransparency": "Opacity", "PDFE.Views.ImageSettingsAdvanced.textAlt": "Alternative text", "PDFE.Views.ImageSettingsAdvanced.textAltDescription": "Description", "PDFE.Views.ImageSettingsAdvanced.textAltTip": "The alternative text-based representation of the visual object information, which will be read to the people with vision or cognitive impairments to help them better understand what information there is in the image, shape, chart, or table.", diff --git a/apps/pdfeditor/main/resources/less/rightmenu.less b/apps/pdfeditor/main/resources/less/rightmenu.less index ece76084c6..9378cbc38e 100644 --- a/apps/pdfeditor/main/resources/less/rightmenu.less +++ b/apps/pdfeditor/main/resources/less/rightmenu.less @@ -51,6 +51,10 @@ #image-button-90, #image-button-flipv { display: inline-block; } + + #image-spin-transparency { + display: inline-block; + } } &#id-table-settings { diff --git a/apps/presentationeditor/main/app/template/ImageSettings.template b/apps/presentationeditor/main/app/template/ImageSettings.template index 6d0b795e6d..c89fdaeff9 100644 --- a/apps/presentationeditor/main/app/template/ImageSettings.template +++ b/apps/presentationeditor/main/app/template/ImageSettings.template @@ -37,6 +37,24 @@
+ + +
+ +
+ +
+ +
+
+
+ + + + +
+ + diff --git a/apps/presentationeditor/main/app/view/ImageSettings.js b/apps/presentationeditor/main/app/view/ImageSettings.js index f38d113738..3089e63e66 100644 --- a/apps/presentationeditor/main/app/view/ImageSettings.js +++ b/apps/presentationeditor/main/app/view/ImageSettings.js @@ -232,6 +232,37 @@ define([ this.btnResetCrop.on('click', _.bind(this.onResetCrop, this)); this.lockedControls.push(this.btnResetCrop); + this.numTransparency = new Common.UI.MetricSpinner({ + el: $('#image-spin-transparency'), + step: 1, + width: 62, + value: '100 %', + defaultUnit : "%", + maxValue: 100, + minValue: 0, + dataHint: '1', + dataHintDirection: 'bottom', + dataHintOffset: 'big', + ariaLabel: this.strTransparency + }); + this.numTransparency.on('change', _.bind(this.onNumTransparencyChange, this)); + this.numTransparency.on('inputleave', function(){ this.fireEvent('editcomplete', this);}); + this.lockedControls.push(this.numTransparency); + + this.sldrTransparency = new Common.UI.SingleSlider({ + el: $('#image-slider-transparency'), + width: 75, + minValue: 0, + maxValue: 100, + value: 100 + }); + this.sldrTransparency.on('change', _.bind(this.onTransparencyChange, this)); + this.sldrTransparency.on('changecomplete', _.bind(this.onTransparencyChangeComplete, this)); + this.lockedControls.push(this.sldrTransparency); + + this.lblTransparencyStart = $(this.el).find('#image-lbl-transparency-start'); + this.lblTransparencyEnd = $(this.el).find('#image-lbl-transparency-end'); + this.btnRotate270 = new Common.UI.Button({ parentEl: $('#image-button-270', this.$el), cls: 'btn-toolbar', @@ -374,6 +405,8 @@ define([ this.btnRotate90.setDisabled(value || this._locked); this.btnFlipV.setDisabled(value || this._locked); this.btnFlipH.setDisabled(value || this._locked); + this.numTransparency.setDisabled(value || this._locked); + this.sldrTransparency.setDisabled(value || this._locked); if (this._state.isOleObject) { var plugin = PE.getCollection('Common.Collections.Plugins').findWhere({guid: pluginGuid}); @@ -381,6 +414,19 @@ define([ } else { this.btnSelectImage.setDisabled(pluginGuid===null || this._locked); } + + var transparency = props.asc_getTransparent(); + if (Math.abs(this._state.Transparency - transparency) > 0.001 || + Math.abs(this.numTransparency.getNumberValue() - transparency) > 0.001 || + (this._state.Transparency === null || transparency === null) && + (this._state.Transparency !== transparency || this.numTransparency.getNumberValue() !== transparency)) { + + if (transparency !== undefined) { + this.sldrTransparency.setValue((transparency === null) ? 100 : transparency / 255 * 100, true); + this.numTransparency.setValue(this.sldrTransparency.getValue(), true); + } + this._state.Transparency = transparency; + } } }, @@ -541,6 +587,46 @@ define([ } }, + onNumTransparencyChange: function(field, newValue, oldValue, eOpts){ + this.sldrTransparency.setValue(field.getNumberValue(), true); + if (this.api) { + var num = field.getNumberValue(); + var properties = new Asc.asc_CImgProperty(); + properties.asc_putTransparent(num * 2.55); + this.api.ImgApply(properties) + } + }, + + onTransparencyChange: function(field, newValue, oldValue){ + this._sliderChanged = newValue; + this.numTransparency.setValue(newValue, true); + + if (this._sendUndoPoint) { + this.api.setStartPointHistory(); + this._sendUndoPoint = false; + this.updateslider = setInterval(_.bind(this._transparencyApplyFunc, this), 100); + } + }, + + onTransparencyChangeComplete: function(field, newValue, oldValue){ + clearInterval(this.updateslider); + this._sliderChanged = newValue; + if (!this._sendUndoPoint) { + this.api.setEndPointHistory(); + this._transparencyApplyFunc(); + } + this._sendUndoPoint = true; + }, + + _transparencyApplyFunc: function() { + if (this._sliderChanged!==undefined) { + var properties = new Asc.asc_CImgProperty(); + properties.asc_putTransparent(this._sliderChanged * 2.55); + this.api.ImgApply(properties) + this._sliderChanged = undefined; + } + }, + setLocked: function (locked) { this._locked = locked; }, diff --git a/apps/presentationeditor/main/locale/en.json b/apps/presentationeditor/main/locale/en.json index 386aab52f5..b132bf3978 100644 --- a/apps/presentationeditor/main/locale/en.json +++ b/apps/presentationeditor/main/locale/en.json @@ -2230,6 +2230,7 @@ "PE.Views.ImageSettings.textRotation": "Rotation", "PE.Views.ImageSettings.textSize": "Size", "PE.Views.ImageSettings.textWidth": "Width", + "PE.Views.ImageSettings.strTransparency": "Opacity", "PE.Views.ImageSettingsAdvanced.textAlt": "Alternative text", "PE.Views.ImageSettingsAdvanced.textAltDescription": "Description", "PE.Views.ImageSettingsAdvanced.textAltTip": "The alternative text-based representation of the visual object information, which will be read to the people with vision or cognitive impairments to help them better understand what information there is in the image, shape, chart, or table.", diff --git a/apps/presentationeditor/main/resources/less/rightmenu.less b/apps/presentationeditor/main/resources/less/rightmenu.less index f215e2b876..b945b5cfb9 100644 --- a/apps/presentationeditor/main/resources/less/rightmenu.less +++ b/apps/presentationeditor/main/resources/less/rightmenu.less @@ -81,6 +81,10 @@ #image-button-90, #image-button-flipv { display: inline-block; } + + #image-spin-transparency { + display: inline-block; + } } &#id-table-settings { diff --git a/apps/spreadsheeteditor/main/app/template/ImageSettings.template b/apps/spreadsheeteditor/main/app/template/ImageSettings.template index 8f80ba7771..33ec3c16d4 100644 --- a/apps/spreadsheeteditor/main/app/template/ImageSettings.template +++ b/apps/spreadsheeteditor/main/app/template/ImageSettings.template @@ -39,6 +39,24 @@
+ + +
+ +
+ +
+ +
+
+
+ + + + +
+ + diff --git a/apps/spreadsheeteditor/main/app/view/ImageSettings.js b/apps/spreadsheeteditor/main/app/view/ImageSettings.js index b7c50a8283..ab774c8e7c 100644 --- a/apps/spreadsheeteditor/main/app/view/ImageSettings.js +++ b/apps/spreadsheeteditor/main/app/view/ImageSettings.js @@ -291,6 +291,37 @@ define([ this.btnResetCrop.on('click', _.bind(this.onResetCrop, this)); this.lockedControls.push(this.btnResetCrop); + this.numTransparency = new Common.UI.MetricSpinner({ + el: $('#image-spin-transparency'), + step: 1, + width: 62, + value: '100 %', + defaultUnit : "%", + maxValue: 100, + minValue: 0, + dataHint: '1', + dataHintDirection: 'bottom', + dataHintOffset: 'big', + ariaLabel: this.strTransparency + }); + this.numTransparency.on('change', _.bind(this.onNumTransparencyChange, this)); + this.numTransparency.on('inputleave', function(){ this.fireEvent('editcomplete', this);}); + this.lockedControls.push(this.numTransparency); + + this.sldrTransparency = new Common.UI.SingleSlider({ + el: $('#image-slider-transparency'), + width: 75, + minValue: 0, + maxValue: 100, + value: 100 + }); + this.sldrTransparency.on('change', _.bind(this.onTransparencyChange, this)); + this.sldrTransparency.on('changecomplete', _.bind(this.onTransparencyChangeComplete, this)); + this.lockedControls.push(this.sldrTransparency); + + this.lblTransparencyStart = $(this.el).find('#image-lbl-transparency-start'); + this.lblTransparencyEnd = $(this.el).find('#image-lbl-transparency-end'); + this.btnRotate270 = new Common.UI.Button({ parentEl: $('#image-button-270', me.$el), cls: 'btn-toolbar', @@ -474,6 +505,8 @@ define([ this.btnRotate90.setDisabled(value || this._locked); this.btnFlipV.setDisabled(value || this._locked); this.btnFlipH.setDisabled(value || this._locked); + this.numTransparency.setDisabled(value || this._locked); + this.sldrTransparency.setDisabled(value || this._locked); if (this._state.isOleObject) { var plugin = SSE.getCollection('Common.Collections.Plugins').findWhere({guid: pluginGuid}); @@ -481,6 +514,19 @@ define([ } else { this.btnSelectImage.setDisabled(pluginGuid===null || this._locked); } + + var transparency = props.asc_getTransparent(); + if (Math.abs(this._state.Transparency - transparency) > 0.001 || + Math.abs(this.numTransparency.getNumberValue() - transparency) > 0.001 || + (this._state.Transparency === null || transparency === null) && + (this._state.Transparency !== transparency || this.numTransparency.getNumberValue() !== transparency)) { + + if (transparency !== undefined) { + this.sldrTransparency.setValue((transparency === null) ? 100 : transparency / 255 * 100, true); + this.numTransparency.setValue(this.sldrTransparency.getValue(), true); + } + this._state.Transparency = transparency; + } } }, @@ -627,11 +673,51 @@ define([ if (this.api) { var properties = new Asc.asc_CImgProperty(); properties.put_ResetCrop(true); - this.api.asc_setGraphicObjectProps(properties);; + this.api.asc_setGraphicObjectProps(properties); Common.NotificationCenter.trigger('edit:complete', this); } }, + onNumTransparencyChange: function(field, newValue, oldValue, eOpts){ + this.sldrTransparency.setValue(field.getNumberValue(), true); + if (this.api) { + var num = field.getNumberValue(); + var properties = new Asc.asc_CImgProperty(); + properties.asc_putTransparent(num * 2.55); + this.api.asc_setGraphicObjectProps(properties); + } + }, + + onTransparencyChange: function(field, newValue, oldValue){ + this._sliderChanged = newValue; + this.numTransparency.setValue(newValue, true); + + if (this._sendUndoPoint) { + this.api.setStartPointHistory(); + this._sendUndoPoint = false; + this.updateslider = setInterval(_.bind(this._transparencyApplyFunc, this), 100); + } + }, + + onTransparencyChangeComplete: function(field, newValue, oldValue){ + clearInterval(this.updateslider); + this._sliderChanged = newValue; + if (!this._sendUndoPoint) { + this.api.setEndPointHistory(); + this._transparencyApplyFunc(); + } + this._sendUndoPoint = true; + }, + + _transparencyApplyFunc: function() { + if (this._sliderChanged!==undefined) { + var properties = new Asc.asc_CImgProperty(); + properties.asc_putTransparent(this._sliderChanged * 2.55); + this.api.asc_setGraphicObjectProps(properties); + this._sliderChanged = undefined; + } + }, + setLocked: function (locked) { this._locked = locked; }, diff --git a/apps/spreadsheeteditor/main/locale/en.json b/apps/spreadsheeteditor/main/locale/en.json index 569fb4bc4e..541a6e873b 100644 --- a/apps/spreadsheeteditor/main/locale/en.json +++ b/apps/spreadsheeteditor/main/locale/en.json @@ -3164,6 +3164,7 @@ "SSE.Views.ImageSettings.textRotation": "Rotation", "SSE.Views.ImageSettings.textSize": "Size", "SSE.Views.ImageSettings.textWidth": "Width", + "SSE.Views.ImageSettings.strTransparency": "Opacity", "SSE.Views.ImageSettingsAdvanced.textAbsolute": "Don't move or size with cells", "SSE.Views.ImageSettingsAdvanced.textAlt": "Alternative text", "SSE.Views.ImageSettingsAdvanced.textAltDescription": "Description", diff --git a/apps/spreadsheeteditor/main/resources/less/rightmenu.less b/apps/spreadsheeteditor/main/resources/less/rightmenu.less index 73c03ef1f0..56aecb6ad0 100644 --- a/apps/spreadsheeteditor/main/resources/less/rightmenu.less +++ b/apps/spreadsheeteditor/main/resources/less/rightmenu.less @@ -97,6 +97,10 @@ #image-button-90, #image-button-flipv { display: inline-block; } + + #image-spin-transparency { + display: inline-block; + } } &#id-chart-settings {