[DE] Caption dialog: consider current object
This commit is contained in:
parent
03f75be8b9
commit
c20fa58d8a
|
@ -78,14 +78,15 @@ define([
|
||||||
},
|
},
|
||||||
'DocumentHolder': {
|
'DocumentHolder': {
|
||||||
'links:contents': this.onTableContents,
|
'links:contents': this.onTableContents,
|
||||||
'links:update': this.onTableContentsUpdate
|
'links:update': this.onTableContentsUpdate,
|
||||||
|
'links:caption': this.onCaptionClick
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
onLaunch: function () {
|
onLaunch: function () {
|
||||||
this._state = {
|
this._state = {
|
||||||
prcontrolsdisable:undefined,
|
prcontrolsdisable:undefined,
|
||||||
in_object: false
|
in_object: undefined
|
||||||
};
|
};
|
||||||
Common.Gateway.on('setactionlink', function (url) {
|
Common.Gateway.on('setactionlink', function (url) {
|
||||||
console.log('url with actions: ' + url);
|
console.log('url with actions: ' + url);
|
||||||
|
@ -137,7 +138,8 @@ define([
|
||||||
in_equation = false,
|
in_equation = false,
|
||||||
in_image = false,
|
in_image = false,
|
||||||
in_table = false,
|
in_table = false,
|
||||||
frame_pr = null;
|
frame_pr = null,
|
||||||
|
object_type;
|
||||||
|
|
||||||
while (++i < selectedObjects.length) {
|
while (++i < selectedObjects.length) {
|
||||||
type = selectedObjects[i].get_ObjectType();
|
type = selectedObjects[i].get_ObjectType();
|
||||||
|
@ -151,14 +153,17 @@ define([
|
||||||
in_header = true;
|
in_header = true;
|
||||||
} else if (type === Asc.c_oAscTypeSelectElement.Image) {
|
} else if (type === Asc.c_oAscTypeSelectElement.Image) {
|
||||||
in_image = true;
|
in_image = true;
|
||||||
|
object_type = type;
|
||||||
} else if (type === Asc.c_oAscTypeSelectElement.Math) {
|
} else if (type === Asc.c_oAscTypeSelectElement.Math) {
|
||||||
in_equation = true;
|
in_equation = true;
|
||||||
|
object_type = type;
|
||||||
} else if (type === Asc.c_oAscTypeSelectElement.Table) {
|
} else if (type === Asc.c_oAscTypeSelectElement.Table) {
|
||||||
in_table = true;
|
in_table = true;
|
||||||
|
object_type = type;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this._state.prcontrolsdisable = paragraph_locked || header_locked;
|
this._state.prcontrolsdisable = paragraph_locked || header_locked;
|
||||||
this._state.in_object = in_image || in_table || in_equation;
|
this._state.in_object = object_type;
|
||||||
|
|
||||||
var control_props = this.api.asc_IsContentControl() ? this.api.asc_GetContentControlProperties() : null,
|
var control_props = this.api.asc_IsContentControl() ? this.api.asc_GetContentControlProperties() : null,
|
||||||
control_plain = (control_props) ? (control_props.get_ContentControlType()==Asc.c_oAscSdtLevelType.Inline) : false,
|
control_plain = (control_props) ? (control_props.get_ContentControlType()==Asc.c_oAscSdtLevelType.Inline) : false,
|
||||||
|
@ -411,7 +416,7 @@ define([
|
||||||
onCaptionClick: function(btn) {
|
onCaptionClick: function(btn) {
|
||||||
var me = this;
|
var me = this;
|
||||||
(new DE.Views.CaptionDialog({
|
(new DE.Views.CaptionDialog({
|
||||||
isObject: this._state.in_object,
|
objectType: this._state.in_object,
|
||||||
handler: function (result, settings) {
|
handler: function (result, settings) {
|
||||||
if (result == 'ok') {
|
if (result == 'ok') {
|
||||||
me.api.asc_AddObjectCaption(settings);
|
me.api.asc_AddObjectCaption(settings);
|
||||||
|
|
|
@ -126,7 +126,7 @@ define([
|
||||||
].join('')
|
].join('')
|
||||||
}, options);
|
}, options);
|
||||||
|
|
||||||
this.isObject = options.isObject;
|
this.objectType = options.objectType;
|
||||||
this.handler = options.handler;
|
this.handler = options.handler;
|
||||||
this.props = options.props;
|
this.props = options.props;
|
||||||
|
|
||||||
|
@ -151,7 +151,7 @@ define([
|
||||||
cls: 'input-group-nr',
|
cls: 'input-group-nr',
|
||||||
menuStyle: 'min-width: 75px;',
|
menuStyle: 'min-width: 75px;',
|
||||||
editable: false,
|
editable: false,
|
||||||
disabled: !this.isObject,
|
disabled: (this.objectType===undefined),
|
||||||
takeFocusOnClose: true,
|
takeFocusOnClose: true,
|
||||||
data: [
|
data: [
|
||||||
{ displayValue: this.textBefore, value: 1 },
|
{ displayValue: this.textBefore, value: 1 },
|
||||||
|
@ -206,7 +206,13 @@ define([
|
||||||
if (curLabel && findIndLabel !== -1) {
|
if (curLabel && findIndLabel !== -1) {
|
||||||
recLabel = this.cmbLabel.store.at(findIndLabel);
|
recLabel = this.cmbLabel.store.at(findIndLabel);
|
||||||
} else {
|
} else {
|
||||||
recLabel = this.cmbLabel.store.at(this.arrLabel.length-1);
|
var index = this.arrLabel.length-1;
|
||||||
|
if (this.objectType === Asc.c_oAscTypeSelectElement.Math) {
|
||||||
|
index = this.arrLabel.length-3;
|
||||||
|
} else if (this.objectType === Asc.c_oAscTypeSelectElement.Image) {
|
||||||
|
index = this.arrLabel.length-2;
|
||||||
|
}
|
||||||
|
recLabel = this.cmbLabel.store.at(index);
|
||||||
}
|
}
|
||||||
this.cmbLabel.selectRecord(recLabel);
|
this.cmbLabel.selectRecord(recLabel);
|
||||||
|
|
||||||
|
|
|
@ -1887,16 +1887,7 @@ define([
|
||||||
},
|
},
|
||||||
|
|
||||||
onInsertCaption: function() {
|
onInsertCaption: function() {
|
||||||
var me = this;
|
this.fireEvent('links:caption');
|
||||||
(new DE.Views.CaptionDialog({
|
|
||||||
isObject: true,
|
|
||||||
handler: function (result, settings) {
|
|
||||||
if (result == 'ok') {
|
|
||||||
me.api.asc_AddObjectCaption(settings);
|
|
||||||
}
|
|
||||||
me.fireEvent('editcomplete', me);
|
|
||||||
}
|
|
||||||
})).show();
|
|
||||||
},
|
},
|
||||||
|
|
||||||
onContinueNumbering: function(item, e) {
|
onContinueNumbering: function(item, e) {
|
||||||
|
|
Loading…
Reference in a new issue