[DE] Fix content controls highlighting
This commit is contained in:
parent
62f1f3de13
commit
ef7a2da5fd
|
@ -320,6 +320,33 @@ define([
|
|||
}
|
||||
},
|
||||
|
||||
selectByRGB: function(rgb, suppressEvent) {
|
||||
var el = $(this.el);
|
||||
el.find('a.' + this.selectedCls).removeClass(this.selectedCls);
|
||||
|
||||
var color = (typeof(rgb) == 'object') ? rgb.color : rgb;
|
||||
if (/#?[a-fA-F0-9]{6}/.test(color)) {
|
||||
color = /#?([a-fA-F0-9]{6})/.exec(color)[1].toUpperCase();
|
||||
}
|
||||
|
||||
if (/^[a-fA-F0-9]{6}|transparent$/.test(color)) {
|
||||
if (color != this.value || this.options.allowReselect) {
|
||||
var co = (color == 'transparent') ? el.find('a.color-transparent') : el.find('a.color-' + color).first();
|
||||
if (co.length==0)
|
||||
co = el.find('#'+color).first();
|
||||
if (co.length==0)
|
||||
co = el.find('a[color="'+color+'"]').first();
|
||||
if (co.length>0) {
|
||||
co.addClass(this.selectedCls);
|
||||
this.value = color;
|
||||
}
|
||||
if (suppressEvent !== true) {
|
||||
this.fireEvent('select', this, color);
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
updateColors: function(effectcolors, standartcolors, value) {
|
||||
if (effectcolors===undefined || standartcolors===undefined) return;
|
||||
|
||||
|
|
|
@ -365,6 +365,7 @@ define([
|
|||
this.api.asc_registerCallback('asc_onSectionProps', _.bind(this.onSectionProps, this));
|
||||
this.api.asc_registerCallback('asc_onContextMenu', _.bind(this.onContextMenu, this));
|
||||
this.api.asc_registerCallback('asc_onShowParaMarks', _.bind(this.onShowParaMarks, this));
|
||||
this.api.asc_registerCallback('asc_onChangeSdtGlobalSettings',_.bind(this.onChangeSdtGlobalSettings, this));
|
||||
},
|
||||
|
||||
onChangeCompactView: function(view, compact) {
|
||||
|
@ -887,6 +888,19 @@ define([
|
|||
this._onInitEditorStyles(styles);
|
||||
},
|
||||
|
||||
onChangeSdtGlobalSettings: function() {
|
||||
var show = this.api.asc_GetGlobalContentControlShowHighlight();
|
||||
this.toolbar.mnuNoControlsColor.setChecked(!show, true);
|
||||
this.toolbar.mnuControlsColorPicker.clearSelection();
|
||||
if (show){
|
||||
var clr = this.api.asc_GetGlobalContentControlHighlightColor();
|
||||
if (clr) {
|
||||
clr = Common.Utils.ThemeColor.getHexColor(clr.r, clr.g, clr.b);
|
||||
this.toolbar.mnuControlsColorPicker.selectByRGB(clr, true);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
onNewDocument: function(btn, e) {
|
||||
if (this.api)
|
||||
this.api.OpenNewDocument();
|
||||
|
@ -1654,13 +1668,13 @@ define([
|
|||
|
||||
onNoControlsColor: function(item) {
|
||||
this.api.asc_SetGlobalContentControlShowHighlight(!item.isChecked());
|
||||
this.toolbar.mnuControlsColorPicker.clearSelection();
|
||||
if (!item.isChecked())
|
||||
this.api.asc_SetGlobalContentControlHighlightColor(220, 220, 220);
|
||||
},
|
||||
|
||||
onSelectControlsColor: function(picker, color) {
|
||||
var clr = Common.Utils.ThemeColor.getRgbColor(color);
|
||||
if (this.api) {
|
||||
this.toolbar.mnuNoControlsColor.setChecked(true, true);
|
||||
this.api.asc_SetGlobalContentControlShowHighlight(true);
|
||||
this.api.asc_SetGlobalContentControlHighlightColor(clr.get_r(), clr.get_g(), clr.get_b());
|
||||
}
|
||||
|
|
|
@ -228,7 +228,7 @@ define([
|
|||
val = props.get_Color();
|
||||
val = (val) ? Common.Utils.ThemeColor.getHexColor(val.r, val.g, val.b) : '#000000';
|
||||
this.btnColor.setColor(val);
|
||||
this.colors.select(val,true);
|
||||
this.colors.selectByRGB(val,true);
|
||||
|
||||
val = props.get_Lock();
|
||||
(val===undefined) && (val = Asc.c_oAscSdtLockType.Unlocked);
|
||||
|
|
Loading…
Reference in a new issue