[DE] Add list indents dialog
This commit is contained in:
parent
1f1caade16
commit
4522451433
|
@ -425,6 +425,8 @@ define([
|
||||||
view.menuParaTOCSettings.on('click', _.bind(me.onParaTOCSettings, me));
|
view.menuParaTOCSettings.on('click', _.bind(me.onParaTOCSettings, me));
|
||||||
view.menuTableEquation.menu.on('item:click', _.bind(me.convertEquation, me));
|
view.menuTableEquation.menu.on('item:click', _.bind(me.convertEquation, me));
|
||||||
view.menuParagraphEquation.menu.on('item:click', _.bind(me.convertEquation, me));
|
view.menuParagraphEquation.menu.on('item:click', _.bind(me.convertEquation, me));
|
||||||
|
view.menuTableListIndents.on('click', _.bind(me.onListIndents, me));
|
||||||
|
view.menuParaListIndents.on('click', _.bind(me.onListIndents, me));
|
||||||
},
|
},
|
||||||
|
|
||||||
getView: function (name) {
|
getView: function (name) {
|
||||||
|
@ -2308,6 +2310,28 @@ define([
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
onListIndents: function(item, e) {
|
||||||
|
if (this.api && !this.api.asc_IsShowListIndentsSettings()) {
|
||||||
|
this.documentHolder.fireEvent('list:settings', [2]); // multilevel list
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var me = this;
|
||||||
|
me.api && (new DE.Views.ListIndentsDialog({
|
||||||
|
api: me.api,
|
||||||
|
props: item.value.props,
|
||||||
|
isBullet: item.value.format === Asc.c_oAscNumberingFormat.Bullet,
|
||||||
|
handler: function(result, value) {
|
||||||
|
if (result == 'ok') {
|
||||||
|
if (me.api) {
|
||||||
|
me.api.asc_ChangeNumberingLvl(item.value.listId, value, item.value.level);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
me.editComplete();
|
||||||
|
}
|
||||||
|
})).show();
|
||||||
|
},
|
||||||
|
|
||||||
editComplete: function() {
|
editComplete: function() {
|
||||||
this.documentHolder && this.documentHolder.fireEvent('editcomplete', this.documentHolder);
|
this.documentHolder && this.documentHolder.fireEvent('editcomplete', this.documentHolder);
|
||||||
}
|
}
|
||||||
|
|
|
@ -175,6 +175,9 @@ define([
|
||||||
},
|
},
|
||||||
'ViewTab': {
|
'ViewTab': {
|
||||||
'toolbar:setcompact': this.onChangeCompactView.bind(this)
|
'toolbar:setcompact': this.onChangeCompactView.bind(this)
|
||||||
|
},
|
||||||
|
'DocumentHolder': {
|
||||||
|
'list:settings': this.onMarkerSettingsClick.bind(this)
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -57,7 +57,8 @@ define([
|
||||||
'documenteditor/main/app/view/TableSettingsAdvanced',
|
'documenteditor/main/app/view/TableSettingsAdvanced',
|
||||||
'documenteditor/main/app/view/ControlSettingsDialog',
|
'documenteditor/main/app/view/ControlSettingsDialog',
|
||||||
'documenteditor/main/app/view/NumberingValueDialog',
|
'documenteditor/main/app/view/NumberingValueDialog',
|
||||||
'documenteditor/main/app/view/CellsAddDialog'
|
'documenteditor/main/app/view/CellsAddDialog',
|
||||||
|
'documenteditor/main/app/view/ListIndentsDialog'
|
||||||
], function ($, _, Backbone, gateway) { 'use strict';
|
], function ($, _, Backbone, gateway) { 'use strict';
|
||||||
|
|
||||||
DE.Views.DocumentHolder = Backbone.View.extend(_.extend({
|
DE.Views.DocumentHolder = Backbone.View.extend(_.extend({
|
||||||
|
@ -1122,6 +1123,10 @@ define([
|
||||||
caption: me.textContinueNumbering
|
caption: me.textContinueNumbering
|
||||||
});
|
});
|
||||||
|
|
||||||
|
me.menuTableListIndents = new Common.UI.MenuItem({
|
||||||
|
caption: me.textIndents
|
||||||
|
});
|
||||||
|
|
||||||
var menuNumberingTable = new Common.UI.MenuItem({
|
var menuNumberingTable = new Common.UI.MenuItem({
|
||||||
caption : me.bulletsText,
|
caption : me.bulletsText,
|
||||||
menu : new Common.UI.Menu({
|
menu : new Common.UI.Menu({
|
||||||
|
@ -1130,7 +1135,8 @@ define([
|
||||||
items : [
|
items : [
|
||||||
me.menuTableStartNewList,
|
me.menuTableStartNewList,
|
||||||
me.menuTableStartNumberingFrom,
|
me.menuTableStartNumberingFrom,
|
||||||
me.menuTableContinueNumbering
|
me.menuTableContinueNumbering,
|
||||||
|
me.menuTableListIndents
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
@ -1382,6 +1388,7 @@ define([
|
||||||
me.menuTableStartNumberingFrom.value = {format: format, start: start};
|
me.menuTableStartNumberingFrom.value = {format: format, start: start};
|
||||||
me.menuTableStartNewList.setCaption((format == Asc.c_oAscNumberingFormat.Bullet) ? me.textSeparateList : me.textStartNewList);
|
me.menuTableStartNewList.setCaption((format == Asc.c_oAscNumberingFormat.Bullet) ? me.textSeparateList : me.textStartNewList);
|
||||||
me.menuTableContinueNumbering.setCaption((format == Asc.c_oAscNumberingFormat.Bullet) ? me.textJoinList : me.textContinueNumbering);
|
me.menuTableContinueNumbering.setCaption((format == Asc.c_oAscNumberingFormat.Bullet) ? me.textJoinList : me.textContinueNumbering);
|
||||||
|
me.menuTableListIndents.value = {format: format, props: numLvl};
|
||||||
}
|
}
|
||||||
|
|
||||||
// hyperlink properties
|
// hyperlink properties
|
||||||
|
@ -1930,6 +1937,10 @@ define([
|
||||||
caption: me.textContinueNumbering
|
caption: me.textContinueNumbering
|
||||||
});
|
});
|
||||||
|
|
||||||
|
me.menuParaListIndents = new Common.UI.MenuItem({
|
||||||
|
caption: me.textIndents
|
||||||
|
});
|
||||||
|
|
||||||
var menuParaNumberingSeparator = new Common.UI.MenuItem({
|
var menuParaNumberingSeparator = new Common.UI.MenuItem({
|
||||||
caption : '--'
|
caption : '--'
|
||||||
});
|
});
|
||||||
|
@ -2153,8 +2164,10 @@ define([
|
||||||
me.menuParaStartNewList.setVisible(in_list);
|
me.menuParaStartNewList.setVisible(in_list);
|
||||||
me.menuParaStartNumberingFrom.setVisible(in_list);
|
me.menuParaStartNumberingFrom.setVisible(in_list);
|
||||||
me.menuParaContinueNumbering.setVisible(in_list);
|
me.menuParaContinueNumbering.setVisible(in_list);
|
||||||
|
me.menuParaListIndents.setVisible(in_list);
|
||||||
if (in_list) {
|
if (in_list) {
|
||||||
var numLvl = me.api.asc_GetNumberingPr(listId).get_Lvl(me.api.asc_GetCurrentNumberingLvl()),
|
var level = me.api.asc_GetCurrentNumberingLvl(),
|
||||||
|
numLvl = me.api.asc_GetNumberingPr(listId).get_Lvl(level),
|
||||||
format = numLvl.get_Format(),
|
format = numLvl.get_Format(),
|
||||||
start = me.api.asc_GetCalculatedNumberingValue();
|
start = me.api.asc_GetCalculatedNumberingValue();
|
||||||
me.menuParaStartNewList.setVisible(numLvl.get_Start()!=start);
|
me.menuParaStartNewList.setVisible(numLvl.get_Start()!=start);
|
||||||
|
@ -2163,6 +2176,7 @@ define([
|
||||||
me.menuParaStartNumberingFrom.value = {format: format, start: start};
|
me.menuParaStartNumberingFrom.value = {format: format, start: start};
|
||||||
me.menuParaStartNewList.setCaption((format == Asc.c_oAscNumberingFormat.Bullet) ? me.textSeparateList : me.textStartNewList);
|
me.menuParaStartNewList.setCaption((format == Asc.c_oAscNumberingFormat.Bullet) ? me.textSeparateList : me.textStartNewList);
|
||||||
me.menuParaContinueNumbering.setCaption((format == Asc.c_oAscNumberingFormat.Bullet) ? me.textJoinList : me.textContinueNumbering);
|
me.menuParaContinueNumbering.setCaption((format == Asc.c_oAscNumberingFormat.Bullet) ? me.textJoinList : me.textContinueNumbering);
|
||||||
|
me.menuParaListIndents.value = {listId: listId, level: level, format: format, props: numLvl};
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
items: [
|
items: [
|
||||||
|
@ -2214,6 +2228,7 @@ define([
|
||||||
me.menuParaStartNewList,
|
me.menuParaStartNewList,
|
||||||
me.menuParaStartNumberingFrom,
|
me.menuParaStartNumberingFrom,
|
||||||
me.menuParaContinueNumbering,
|
me.menuParaContinueNumbering,
|
||||||
|
me.menuParaListIndents,
|
||||||
menuStyleSeparator,
|
menuStyleSeparator,
|
||||||
menuStyle
|
menuStyle
|
||||||
]
|
]
|
||||||
|
@ -3229,7 +3244,8 @@ define([
|
||||||
currLinearText: 'Current - Linear',
|
currLinearText: 'Current - Linear',
|
||||||
allProfText: 'All - Professional',
|
allProfText: 'All - Professional',
|
||||||
allLinearText: 'All - Linear',
|
allLinearText: 'All - Linear',
|
||||||
eqToInlineText: 'Change to Inline'
|
eqToInlineText: 'Change to Inline',
|
||||||
|
textIndents: 'Adjust list indents'
|
||||||
|
|
||||||
}, DE.Views.DocumentHolder || {}));
|
}, DE.Views.DocumentHolder || {}));
|
||||||
});
|
});
|
212
apps/documenteditor/main/app/view/ListIndentsDialog.js
Normal file
212
apps/documenteditor/main/app/view/ListIndentsDialog.js
Normal file
|
@ -0,0 +1,212 @@
|
||||||
|
/*
|
||||||
|
*
|
||||||
|
* (c) Copyright Ascensio System SIA 2010-2022
|
||||||
|
*
|
||||||
|
* This program is a free software product. You can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||||
|
* version 3 as published by the Free Software Foundation. In accordance with
|
||||||
|
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||||
|
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||||
|
* of any third-party rights.
|
||||||
|
*
|
||||||
|
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||||
|
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||||
|
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||||
|
*
|
||||||
|
* You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha
|
||||||
|
* street, Riga, Latvia, EU, LV-1050.
|
||||||
|
*
|
||||||
|
* The interactive user interfaces in modified source and object code versions
|
||||||
|
* of the Program must display Appropriate Legal Notices, as required under
|
||||||
|
* Section 5 of the GNU AGPL version 3.
|
||||||
|
*
|
||||||
|
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||||
|
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||||
|
* grant you any rights under trademark law for use of our trademarks.
|
||||||
|
*
|
||||||
|
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||||
|
* well as technical writing content are licensed under the terms of the
|
||||||
|
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||||
|
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
/**
|
||||||
|
* ListIndentsDialog.js
|
||||||
|
*
|
||||||
|
* Created by Julia Radzhabova on 10/13/22
|
||||||
|
* Copyright (c) 2022 Ascensio System SIA. All rights reserved.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
define([
|
||||||
|
'common/main/lib/component/Window',
|
||||||
|
'common/main/lib/component/MetricSpinner'
|
||||||
|
], function () { 'use strict';
|
||||||
|
|
||||||
|
DE.Views.ListIndentsDialog = Common.UI.Window.extend(_.extend({
|
||||||
|
options: {
|
||||||
|
width: 305,
|
||||||
|
header: true,
|
||||||
|
style: 'min-width: 216px;',
|
||||||
|
cls: 'modal-dlg',
|
||||||
|
id: 'window-list-indents',
|
||||||
|
buttons: ['ok', 'cancel']
|
||||||
|
},
|
||||||
|
|
||||||
|
initialize : function(options) {
|
||||||
|
_.extend(this.options, {
|
||||||
|
title: this.textTitle
|
||||||
|
}, options || {});
|
||||||
|
|
||||||
|
this.props = options.props;
|
||||||
|
this.isBullet = options.isBullet || false;
|
||||||
|
|
||||||
|
this.template = [
|
||||||
|
'<div class="box" style="height: 85px;">',
|
||||||
|
'<table cols="2" style="width: 100%;">',
|
||||||
|
'<tr>',
|
||||||
|
'<td style="padding-right: 10px;">',
|
||||||
|
'<label class="input-label">' + (this.isBullet ? this.txtPosBullet : this.txtPosNumber) + '</label>',
|
||||||
|
'<div id="id-dlg-indents-align-at" style="margin-bottom: 10px;"></div>',
|
||||||
|
'</td>',
|
||||||
|
'<td>',
|
||||||
|
'<label class="input-label">' + this.txtIndent + '</label>',
|
||||||
|
'<div id="id-dlg-indents-indent" style="margin-bottom: 10px;"></div>',
|
||||||
|
'</td>',
|
||||||
|
'</tr>',
|
||||||
|
'<tr>',
|
||||||
|
'<td colspan="2">',
|
||||||
|
'<label class="input-label">' + (this.isBullet ? this.txtFollowBullet : this.txtFollowNumber) + '</label>',
|
||||||
|
'<div id="id-dlg-indents-follow" class="input-group-nr" style="width: 100%;margin-bottom: 10px;"></div>',
|
||||||
|
'</td>',
|
||||||
|
'</tr>',
|
||||||
|
'</table>',
|
||||||
|
'</div>',
|
||||||
|
'<div class="separator horizontal"></div>'
|
||||||
|
].join('');
|
||||||
|
|
||||||
|
this.options.tpl = _.template(this.template)(this.options);
|
||||||
|
|
||||||
|
this.spinners = [];
|
||||||
|
this._noApply = false;
|
||||||
|
|
||||||
|
Common.UI.Window.prototype.initialize.call(this, this.options);
|
||||||
|
},
|
||||||
|
|
||||||
|
render: function() {
|
||||||
|
Common.UI.Window.prototype.render.call(this);
|
||||||
|
|
||||||
|
var $window = this.getChild();
|
||||||
|
|
||||||
|
this.spnAlign = new Common.UI.MetricSpinner({
|
||||||
|
el: $window.findById('#id-dlg-indents-align-at'),
|
||||||
|
step: .1,
|
||||||
|
width: 130,
|
||||||
|
defaultUnit : "cm",
|
||||||
|
defaultValue : 0,
|
||||||
|
value: '0 cm',
|
||||||
|
maxValue: 55.87,
|
||||||
|
minValue: 0
|
||||||
|
});
|
||||||
|
this.spinners.push(this.spnAlign);
|
||||||
|
this.spnAlign.on('change', _.bind(function(field, newValue, oldValue, eOpts){
|
||||||
|
if (this._changedProps) {
|
||||||
|
this._changedProps.put_NumberPosition(Common.Utils.Metric.fnRecalcToMM(field.getNumberValue()));
|
||||||
|
}
|
||||||
|
}, this));
|
||||||
|
|
||||||
|
this.spnIndents = new Common.UI.MetricSpinner({
|
||||||
|
el: $window.findById('#id-dlg-indents-indent'),
|
||||||
|
step: .1,
|
||||||
|
width: 130,
|
||||||
|
defaultUnit : "cm",
|
||||||
|
defaultValue : 0,
|
||||||
|
value: '0 cm',
|
||||||
|
maxValue: 55.87,
|
||||||
|
minValue: 0
|
||||||
|
});
|
||||||
|
this.spinners.push(this.spnIndents);
|
||||||
|
this.spnIndents.on('change', _.bind(function(field, newValue, oldValue, eOpts){
|
||||||
|
if (this._changedProps) {
|
||||||
|
this._changedProps.put_IndentSize(Common.Utils.Metric.fnRecalcToMM(field.getNumberValue()));
|
||||||
|
}
|
||||||
|
}, this));
|
||||||
|
|
||||||
|
this.cmbFollow = new Common.UI.ComboBox({
|
||||||
|
el : $window.find('#id-dlg-indents-follow'),
|
||||||
|
menuStyle : 'min-width: 100%;',
|
||||||
|
editable : false,
|
||||||
|
cls : 'input-group-nr',
|
||||||
|
data : [
|
||||||
|
{ value: Asc.c_oAscNumberingSuff.Tab, displayValue: this.textTab },
|
||||||
|
{ value: Asc.c_oAscNumberingSuff.Space, displayValue: this.textSpace },
|
||||||
|
{ value: Asc.c_oAscNumberingSuff.None, displayValue: this.txtNone }
|
||||||
|
],
|
||||||
|
takeFocusOnClose: true
|
||||||
|
});
|
||||||
|
this.cmbFollow.on('selected', _.bind(function (combo, record) {
|
||||||
|
if (this._changedProps)
|
||||||
|
this._changedProps.put_Suff(record.value);
|
||||||
|
}, this));
|
||||||
|
|
||||||
|
$window.find('.dlg-btn').on('click', _.bind(this.onBtnClick, this));
|
||||||
|
|
||||||
|
this.updateMetricUnit();
|
||||||
|
this._setDefaults(this.props);
|
||||||
|
},
|
||||||
|
|
||||||
|
getFocusedComponents: function() {
|
||||||
|
return [this.spnAlign, this.spnIndents, this.cmbFollow];
|
||||||
|
},
|
||||||
|
|
||||||
|
getDefaultFocusableComponent: function () {
|
||||||
|
return this.spnAlign;
|
||||||
|
},
|
||||||
|
|
||||||
|
onBtnClick: function(event) {
|
||||||
|
this._handleInput(event.currentTarget.attributes['result'].value);
|
||||||
|
},
|
||||||
|
|
||||||
|
onPrimary: function(event) {
|
||||||
|
this._handleInput('ok');
|
||||||
|
return false;
|
||||||
|
},
|
||||||
|
|
||||||
|
_handleInput: function(state) {
|
||||||
|
this.options.handler && this.options.handler.call(this, state, this._changedProps);
|
||||||
|
this.close();
|
||||||
|
},
|
||||||
|
|
||||||
|
_setDefaults: function (props) {
|
||||||
|
if (props) {
|
||||||
|
this.spnAlign.setValue(Common.Utils.Metric.fnRecalcFromMM(props.get_NumberPosition()), true);
|
||||||
|
this.spnIndents.setValue(Common.Utils.Metric.fnRecalcFromMM(props.get_IndentSize()), true);
|
||||||
|
this.cmbFollow.setValue(props.get_Suff());
|
||||||
|
this.isBullet = (props.get_Format() === Asc.c_oAscNumberingFormat.Bullet);
|
||||||
|
this._changedProps = props;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
updateMetricUnit: function() {
|
||||||
|
if (this.spinners) {
|
||||||
|
for (var i=0; i<this.spinners.length; i++) {
|
||||||
|
var spinner = this.spinners[i];
|
||||||
|
spinner.setDefaultUnit(Common.Utils.Metric.getCurrentMetricName());
|
||||||
|
spinner.setStep(Common.Utils.Metric.getCurrentMetric()==Common.Utils.Metric.c_MetricUnits.pt ? 1 : 0.1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
textTitle: 'List Indents',
|
||||||
|
txtPosBullet: 'Bullet position',
|
||||||
|
txtPosNumber: 'Number position',
|
||||||
|
txtIndent: 'Text indent',
|
||||||
|
txtFollowBullet: 'Follow bullet with',
|
||||||
|
txtFollowNumber: 'Follow number with',
|
||||||
|
textTab: 'Tab character',
|
||||||
|
textSpace: 'Space',
|
||||||
|
txtNone: 'None'
|
||||||
|
|
||||||
|
}, DE.Views.ListIndentsDialog || {}))
|
||||||
|
});
|
|
@ -2155,6 +2155,15 @@
|
||||||
"DE.Views.Links.titleUpdateTOF": "Update Table of Figures",
|
"DE.Views.Links.titleUpdateTOF": "Update Table of Figures",
|
||||||
"DE.Views.Links.txtDontShowTof": "Do Not Show in Table of Contents",
|
"DE.Views.Links.txtDontShowTof": "Do Not Show in Table of Contents",
|
||||||
"DE.Views.Links.txtLevel": "Level",
|
"DE.Views.Links.txtLevel": "Level",
|
||||||
|
"DE.Views.ListIndentsDialog.textTitle": "List Indents",
|
||||||
|
"DE.Views.ListIndentsDialog.txtPosBullet": "Bullet position",
|
||||||
|
"DE.Views.ListIndentsDialog.txtPosNumber": "Number position",
|
||||||
|
"DE.Views.ListIndentsDialog.txtIndent": "Text indent",
|
||||||
|
"DE.Views.ListIndentsDialog.txtFollowBullet": "Follow bullet with",
|
||||||
|
"DE.Views.ListIndentsDialog.txtFollowNumber": "Follow number with",
|
||||||
|
"DE.Views.ListIndentsDialog.textTab": "Tab character",
|
||||||
|
"DE.Views.ListIndentsDialog.textSpace": "Space",
|
||||||
|
"DE.Views.ListIndentsDialog.txtNone": "None",
|
||||||
"DE.Views.ListSettingsDialog.textAuto": "Automatic",
|
"DE.Views.ListSettingsDialog.textAuto": "Automatic",
|
||||||
"DE.Views.ListSettingsDialog.textCenter": "Center",
|
"DE.Views.ListSettingsDialog.textCenter": "Center",
|
||||||
"DE.Views.ListSettingsDialog.textLeft": "Left",
|
"DE.Views.ListSettingsDialog.textLeft": "Left",
|
||||||
|
|
Loading…
Reference in a new issue