From 53add1d1d9f83920d1ec587b7682d6fbade901a1 Mon Sep 17 00:00:00 2001 From: JuliaSvinareva Date: Thu, 12 Aug 2021 13:04:40 +0300 Subject: [PATCH 1/3] [DE] Fix form settings template --- .../main/app/template/FormSettings.template | 70 +++++++++---------- 1 file changed, 34 insertions(+), 36 deletions(-) diff --git a/apps/documenteditor/main/app/template/FormSettings.template b/apps/documenteditor/main/app/template/FormSettings.template index e43b4b60e..341658df1 100644 --- a/apps/documenteditor/main/app/template/FormSettings.template +++ b/apps/documenteditor/main/app/template/FormSettings.template @@ -34,11 +34,44 @@
+ + + + + + + +
+ + +
+ + + + +
+ + +
+
+
+ +
+ + +
+ + + + +
+ +
@@ -58,20 +91,10 @@ - +
- - -
- - - - -
- - @@ -89,31 +112,6 @@ - - - - - - - - - - - - -
- -
-
-
-
-
-
-
-
-
-
-
- - - - @@ -112,6 +106,14 @@
From d429cc027a605fcaba217f6e41aeadaad7393b92 Mon Sep 17 00:00:00 2001 From: JuliaSvinareva Date: Thu, 12 Aug 2021 13:23:47 +0300 Subject: [PATCH 2/3] [DE] Make border color visible in all forms --- .../main/app/template/FormSettings.template | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/apps/documenteditor/main/app/template/FormSettings.template b/apps/documenteditor/main/app/template/FormSettings.template index 341658df1..a2762b47e 100644 --- a/apps/documenteditor/main/app/template/FormSettings.template +++ b/apps/documenteditor/main/app/template/FormSettings.template @@ -89,14 +89,8 @@
- -
-
+
+ + + + +
+ +
+
+ + +
From 20cfb07621668b73c869b703a2186e909f2a910c Mon Sep 17 00:00:00 2001 From: JuliaSvinareva Date: Thu, 12 Aug 2021 20:06:16 +0300 Subject: [PATCH 3/3] [DE] Add background color in form settings --- .../main/app/controller/RightMenu.js | 1 + .../main/app/template/FormSettings.template | 6 ++ .../main/app/view/FormSettings.js | 74 ++++++++++++++++++- apps/documenteditor/main/locale/en.json | 1 + 4 files changed, 81 insertions(+), 1 deletion(-) diff --git a/apps/documenteditor/main/app/controller/RightMenu.js b/apps/documenteditor/main/app/controller/RightMenu.js index baac421e7..01f508e3e 100644 --- a/apps/documenteditor/main/app/controller/RightMenu.js +++ b/apps/documenteditor/main/app/controller/RightMenu.js @@ -321,6 +321,7 @@ define([ this.rightmenu.tableSettings.UpdateThemeColors(); this.rightmenu.shapeSettings.UpdateThemeColors(); this.rightmenu.textartSettings.UpdateThemeColors(); + this.rightmenu.formSettings.UpdateThemeColors(); }, updateMetricUnit: function() { diff --git a/apps/documenteditor/main/app/template/FormSettings.template b/apps/documenteditor/main/app/template/FormSettings.template index a2762b47e..b87b2e27e 100644 --- a/apps/documenteditor/main/app/template/FormSettings.template +++ b/apps/documenteditor/main/app/template/FormSettings.template @@ -113,6 +113,12 @@
+ +
+
diff --git a/apps/documenteditor/main/app/view/FormSettings.js b/apps/documenteditor/main/app/view/FormSettings.js index a997eaace..1c6afaef2 100644 --- a/apps/documenteditor/main/app/view/FormSettings.js +++ b/apps/documenteditor/main/app/view/FormSettings.js @@ -659,6 +659,26 @@ define([ } }, + onColorBGSelect: function(btn, color) { + this.BackgroundColor = color; + this._state.BackgroundColor = undefined; + + var props = this._originalProps || new AscCommon.CContentControlPr(); + var formPr = this._originalFormProps || new AscCommon.CSdtFormPr(); + + if (this.api) { + if (color === 'transparent') { + formPr.put_Shd(false); + } else { + formPr.put_Shd(true, Common.Utils.ThemeColor.getRgbColor(color)); + } + props.put_FormPr(formPr); + this.api.asc_SetContentControlProperties(props, this.internalId); + } + + this.fireEvent('editcomplete', this); + }, + onColorPickerSelect: function(btn, color) { this.BorderColor = color; this._state.BorderColor = undefined; @@ -863,6 +883,45 @@ define([ (this.BorderColor != 'transparent') && this.mnuColorPicker.selectByRGB(typeof(this.BorderColor) == 'object' ? this.BorderColor.color : this.BorderColor,true); this._state.BorderColor = this.BorderColor; } + + var shd = formPr.get_Shd(); + if (shd) { + var bgColor = shd.get_Color(); + if (bgColor) { + if (bgColor.get_type() === Asc.c_oAscColor.COLOR_TYPE_SCHEME) { + this.BackgroundColor = {color: Common.Utils.ThemeColor.getHexColor(bgColor.get_r(), bgColor.get_g(), bgColor.get_b()), effectValue: bgColor.get_value() }; + } else { + this.BackgroundColor = Common.Utils.ThemeColor.getHexColor(bgColor.get_r(), bgColor.get_g(), bgColor.get_b()); + } + } else + this.BackgroundColor = 'transparent'; + } else { + this.BackgroundColor = 'transparent'; + } + + type1 = typeof(this.BackgroundColor); + type2 = typeof(this._state.BackgroundColor); + if ( (type1 !== type2) || (type1 === 'object' && + (this.BackgroundColor.effectValue!==this._state.BackgroundColor.effectValue || this._state.BackgroundColor.color.indexOf(this.BackgroundColor.color)<0)) || + (type1 !== 'object' && this._state.BackgroundColor.indexOf(this.BackgroundColor)<0 )) { + + this.btnBGColor.setColor(this.BackgroundColor); + if ( typeof(this.BackgroundColor) == 'object' ) { + var isselected = false; + for (i=0; i<10; i++) { + if ( Common.Utils.ThemeColor.ThemeValues[i] === this.BackgroundColor.effectValue ) { + this.mnuBGColorPicker.select(this.BackgroundColor, true); + isselected = true; + break; + } + } + if (!isselected) this.mnuBGColorPicker.clearSelection(); + } else + this.mnuBGColorPicker.select(this.BackgroundColor,true); + + this._state.BackgroundColor = this.BackgroundColor; + } + } var pictPr = props.get_PictureFormPr(); @@ -980,6 +1039,18 @@ define([ this.btnColor.setMenu(); this.mnuColorPicker = this.btnColor.getPicker(); } + if (!this.btnBGColor) { + this.btnBGColor = new Common.UI.ColorButton({ + parentEl: $('#form-background-color-btn'), + transparent: true, + menu: true + }); + this.lockedControls.push(this.btnBGColor); + this.btnBGColor.on('color:select', _.bind(this.onColorBGSelect, this)); + this.btnBGColor.setMenu(); + this.mnuBGColorPicker = this.btnBGColor.getPicker(); + } + this.mnuBGColorPicker.updateColors(Common.Utils.ThemeColor.getEffectColors(), Common.Utils.ThemeColor.getStandartColors()); }, onHideMenus: function(menu, e, isFromInputControl){ @@ -1090,7 +1161,8 @@ define([ textNever: 'Never', textTooBig: 'Image is Too Big', textTooSmall: 'Image is Too Small', - textScale: 'When to scale' + textScale: 'When to scale', + textBackgroundColor: 'Background Color' }, DE.Views.FormSettings || {})); }); \ No newline at end of file diff --git a/apps/documenteditor/main/locale/en.json b/apps/documenteditor/main/locale/en.json index 9c33f4a6b..280ac3b03 100644 --- a/apps/documenteditor/main/locale/en.json +++ b/apps/documenteditor/main/locale/en.json @@ -1776,6 +1776,7 @@ "DE.Views.FormSettings.textUnlock": "Unlock", "DE.Views.FormSettings.textValue": "Value Options", "DE.Views.FormSettings.textWidth": "Cell width", + "DE.Views.FormSettings.textBackgroundColor": "Background Color", "DE.Views.FormsTab.capBtnCheckBox": "Checkbox", "DE.Views.FormsTab.capBtnComboBox": "Combo Box", "DE.Views.FormsTab.capBtnDropDown": "Dropdown",