From 8c4d467b5257689593a0858795a0ae50b138f1b1 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Wed, 20 Nov 2019 17:10:32 +0300 Subject: [PATCH] [DE] Draw/Erase table --- .../documenteditor/main/app/controller/Toolbar.js | 15 +++++++++++++++ apps/documenteditor/main/app/view/Toolbar.js | 8 ++++++-- apps/documenteditor/main/locale/en.json | 2 ++ 3 files changed, 23 insertions(+), 2 deletions(-) diff --git a/apps/documenteditor/main/app/controller/Toolbar.js b/apps/documenteditor/main/app/controller/Toolbar.js index fd627f077..5ca5abd66 100644 --- a/apps/documenteditor/main/app/controller/Toolbar.js +++ b/apps/documenteditor/main/app/controller/Toolbar.js @@ -382,6 +382,8 @@ define([ this.api.asc_registerCallback('asc_onChangeSdtGlobalSettings', _.bind(this.onChangeSdtGlobalSettings, this)); this.api.asc_registerCallback('asc_onTextLanguage', _.bind(this.onTextLanguage, this)); Common.NotificationCenter.on('fonts:change', _.bind(this.onApiChangeFont, this)); + this.api.asc_registerCallback('asc_TableDrawModeCallback', _.bind(this.onTableDraw, this)); + this.api.asc_registerCallback('asc_TableEraseModeCallback', _.bind(this.onTableErase, this)); } else if (this.mode.isRestrictedEdit) { this.api.asc_registerCallback('asc_onFocusObject', _.bind(this.onApiFocusObjectRestrictedEdit, this)); this.api.asc_registerCallback('asc_onCoAuthoringDisconnect', _.bind(this.onApiCoAuthoringDisconnect, this)); @@ -856,6 +858,13 @@ define([ this.modeAlwaysSetStyle = false; }, + onTableDraw: function(v) { + this.toolbar.mnuInsertTable && this.toolbar.mnuInsertTable.items[2].setChecked(!!v, true); + }, + onTableErase: function(v) { + this.toolbar.mnuInsertTable && this.toolbar.mnuInsertTable.items[3].setChecked(!!v, true); + }, + onApiParagraphStyleChange: function(name) { if (this._state.prstyle != name) { var listStyle = this.toolbar.listStyles, @@ -1412,6 +1421,12 @@ define([ Common.NotificationCenter.trigger('edit:complete', me.toolbar); } })).show(); + } else if (item.value == 'draw') { + item.isChecked() && menu.items[3].setChecked(false, true); + this.api.SetTableDrawMode(item.isChecked()); + } else if (item.value == 'erase') { + item.isChecked() && menu.items[2].setChecked(false, true); + this.api.SetTableEraseMode(item.isChecked()); } }, diff --git a/apps/documenteditor/main/app/view/Toolbar.js b/apps/documenteditor/main/app/view/Toolbar.js index 67bf09d39..5c286102b 100644 --- a/apps/documenteditor/main/app/view/Toolbar.js +++ b/apps/documenteditor/main/app/view/Toolbar.js @@ -480,7 +480,9 @@ define([ menu: new Common.UI.Menu({ items: [ {template: _.template('
')}, - {caption: this.mniCustomTable, value: 'custom'} + {caption: this.mniCustomTable, value: 'custom'}, + {caption: this.mniDrawTable, value: 'draw', checkable: true}, + {caption: this.mniEraseTable, value: 'erase', checkable: true} ] }) }); @@ -2318,7 +2320,9 @@ define([ textDateControl: 'Date', capBtnAddComment: 'Add Comment', capBtnInsSymbol: 'Symbol', - tipInsertSymbol: 'Insert symbol' + tipInsertSymbol: 'Insert symbol', + mniDrawTable: 'Draw table', + mniEraseTable: 'Erase table' } })(), DE.Views.Toolbar || {})); }); diff --git a/apps/documenteditor/main/locale/en.json b/apps/documenteditor/main/locale/en.json index bcd5528bc..3b2bac95c 100644 --- a/apps/documenteditor/main/locale/en.json +++ b/apps/documenteditor/main/locale/en.json @@ -2305,6 +2305,8 @@ "DE.Views.Toolbar.textCheckboxControl": "Check box", "DE.Views.Toolbar.textDropdownControl": "Drop-down list", "DE.Views.Toolbar.textDateControl": "Date", + "DE.Views.Toolbar.mniDrawTable": "Draw table", + "DE.Views.Toolbar.mniEraseTable": "Erase table", "DE.Views.WatermarkSettingsDialog.textAuto": "Auto", "DE.Views.WatermarkSettingsDialog.textBold": "Bold", "DE.Views.WatermarkSettingsDialog.textColor": "Text color",