diff --git a/apps/documenteditor/main/app/controller/LeftMenu.js b/apps/documenteditor/main/app/controller/LeftMenu.js index 2276dedc2..84fd58d81 100644 --- a/apps/documenteditor/main/app/controller/LeftMenu.js +++ b/apps/documenteditor/main/app/controller/LeftMenu.js @@ -97,14 +97,6 @@ define([ 'file:close': this.clickToolbarTab.bind(this, 'other'), 'save:disabled': this.changeToolbarSaveState.bind(this) }, - 'SearchDialog': { - 'hide': _.bind(this.onSearchDlgHide, this), - 'search:back': _.bind(this.onQuerySearch, this, 'back'), - 'search:next': _.bind(this.onQuerySearch, this, 'next'), - 'search:replace': _.bind(this.onQueryReplace, this), - 'search:replaceall': _.bind(this.onQueryReplaceAll, this), - 'search:highlight': _.bind(this.onSearchHighlight, this) - }, 'Common.Views.ReviewChanges': { 'collaboration:chat': _.bind(this.onShowHideChat, this) }, @@ -126,7 +118,6 @@ define([ onLaunch: function() { this.leftMenu = this.createView('LeftMenu').render(); - this.leftMenu.btnSearch.on('toggle', _.bind(this.onMenuSearch, this)); this.leftMenu.btnSearchBar.on('toggle', _.bind(this.onMenuSearchBar, this)); Common.util.Shortcuts.delegateShortcuts({ @@ -149,7 +140,6 @@ define([ setApi: function(api) { this.api = api; - this.api.asc_registerCallback('asc_onReplaceAll', _.bind(this.onApiTextReplaced, this)); this.api.asc_registerCallback('asc_onCoAuthoringDisconnect', _.bind(this.onApiServerDisconnect, this)); Common.NotificationCenter.on('api:disconnect', _.bind(this.onApiServerDisconnect, this)); this.api.asc_registerCallback('asc_onDownloadUrl', _.bind(this.onDownloadUrl, this)); @@ -564,86 +554,6 @@ define([ }, /** coauthoring end **/ - onQuerySearch: function(d, w, opts) { - if (opts.textsearch && opts.textsearch.length) { - if (!this.api.asc_findText(opts.textsearch, d != 'back', opts.matchcase, opts.matchword)) { - var me = this; - Common.UI.info({ - msg: this.textNoTextFound, - callback: function() { - me.dlgSearch.focus(); - } - }); - } - } - }, - - onQueryReplace: function(w, opts) { - if (!_.isEmpty(opts.textsearch)) { - if (!this.api.asc_replaceText(opts.textsearch, opts.textreplace, false, opts.matchcase, opts.matchword)) { - var me = this; - Common.UI.info({ - msg: this.textNoTextFound, - callback: function() { - me.dlgSearch.focus(); - } - }); - } - } - }, - - onQueryReplaceAll: function(w, opts) { - if (!_.isEmpty(opts.textsearch)) { - this.api.asc_replaceText(opts.textsearch, opts.textreplace, true, opts.matchcase, opts.matchword); - } - }, - - onSearchHighlight: function(w, highlight) { - this.api.asc_selectSearchingResults(highlight); - }, - - showSearchDlg: function(show,action) { - if ( !this.dlgSearch ) { - this.dlgSearch = (new Common.UI.SearchDialog({ - matchcase: true, - markresult: {applied: true} - })); - } - - if (show) { - var mode = this.mode.isEdit && !this.viewmode ? (action || undefined) : 'no-replace'; - if (this.dlgSearch.isVisible()) { - this.dlgSearch.setMode(mode); - this.dlgSearch.setSearchText(this.api.asc_GetSelectedText()); - this.dlgSearch.focus(); - } else { - this.dlgSearch.show(mode, this.api.asc_GetSelectedText()); - } - } else this.dlgSearch['hide'](); - }, - - onMenuSearch: function(obj, show) { - this.showSearchDlg(show); - }, - - onSearchDlgHide: function() { - this.leftMenu.btnSearch.toggle(false, true); - this.api.asc_selectSearchingResults(false); - $(this.leftMenu.btnSearch.el).blur(); - this.api.asc_enableKeyEvents(true); - }, - - onApiTextReplaced: function(found,replaced) { - var me = this; - if (found) { - !(found - replaced > 0) ? - Common.UI.info( {msg: Common.Utils.String.format(this.textReplaceSuccess, replaced)} ) : - Common.UI.warning( {msg: Common.Utils.String.format(this.textReplaceSkipped, found-replaced)} ); - } else { - Common.UI.info({msg: this.textNoTextFound}); - } - }, - onApiServerDisconnect: function(enableDownload) { this.mode.isEdit = false; this.leftMenu.close(); @@ -656,18 +566,12 @@ define([ this.leftMenu.btnNavigation.setDisabled(true); this.leftMenu.getMenu('file').setMode({isDisconnected: true, enableDownload: !!enableDownload}); - if ( this.dlgSearch ) { - this.leftMenu.btnSearch.toggle(false, true); - this.dlgSearch['hide'](); - } }, setPreviewMode: function(mode) { if (this.viewmode === mode) return; this.viewmode = mode; - this.dlgSearch && this.dlgSearch.setMode(this.viewmode ? 'no-replace' : 'search'); - this.leftMenu.panelSearch && this.leftMenu.panelSearch.setSearchMode(this.viewmode ? 'no-replace' : 'search'); }, @@ -762,12 +666,6 @@ define([ }, menuFilesShowHide: function(state) { - if ( this.dlgSearch ) { - if ( state == 'show' ) - this.dlgSearch.suspendKeyEvents(); - else - Common.Utils.asyncCall(this.dlgSearch.resumeKeyEvents, this.dlgSearch); - } if (this.api && state == 'hide') this.api.asc_enableKeyEvents(true); }, diff --git a/apps/documenteditor/main/app/template/LeftMenu.template b/apps/documenteditor/main/app/template/LeftMenu.template index f1b280f03..fa0abf7c2 100644 --- a/apps/documenteditor/main/app/template/LeftMenu.template +++ b/apps/documenteditor/main/app/template/LeftMenu.template @@ -1,6 +1,5 @@