diff --git a/apps/common/main/lib/component/ComboBox.js b/apps/common/main/lib/component/ComboBox.js index 3ff726a9a..5b7a7f4cc 100644 --- a/apps/common/main/lib/component/ComboBox.js +++ b/apps/common/main/lib/component/ComboBox.js @@ -252,7 +252,6 @@ define([ this.scroller = new Common.UI.Scroller(_.extend({ el: $('.dropdown-menu', this.cmpEl), minScrollbarLength: 40, - scrollYMarginOffset: 30, includePadding: true, wheelSpeed: 10, alwaysVisibleY: this.scrollAlwaysVisible @@ -277,7 +276,6 @@ define([ this.scroller = new Common.UI.Scroller(_.extend({ el: $('.dropdown-menu', this.cmpEl), minScrollbarLength: 40, - scrollYMarginOffset: 30, includePadding: true, wheelSpeed: 10, alwaysVisibleY: this.scrollAlwaysVisible @@ -642,7 +640,6 @@ define([ this.scroller = new Common.UI.Scroller(_.extend({ el: $('.dropdown-menu', this.cmpEl), minScrollbarLength : 40, - scrollYMarginOffset: 30, includePadding : true, wheelSpeed: 10, alwaysVisibleY: this.scrollAlwaysVisible diff --git a/apps/common/main/resources/less/toolbar.less b/apps/common/main/resources/less/toolbar.less index 8d4ff5bcd..e7db06d36 100644 --- a/apps/common/main/resources/less/toolbar.less +++ b/apps/common/main/resources/less/toolbar.less @@ -530,6 +530,7 @@ .button-normal-icon(btn-func-math, 73, @toolbar-big-icon-size); .button-normal-icon(btn-more, 74, @toolbar-big-icon-size); .button-normal-icon(btn-pagenum, 75, @toolbar-big-icon-size); +.button-normal-icon(btn-caption, 76, @toolbar-big-icon-size); .button-normal-icon(btn-calculation, 80, @toolbar-big-icon-size); .button-normal-icon(btn-scale, 81, @toolbar-big-icon-size); diff --git a/apps/documenteditor/main/app/controller/Links.js b/apps/documenteditor/main/app/controller/Links.js index 1e034c149..f6d37fd4c 100644 --- a/apps/documenteditor/main/app/controller/Links.js +++ b/apps/documenteditor/main/app/controller/Links.js @@ -45,7 +45,8 @@ define([ 'documenteditor/main/app/view/NoteSettingsDialog', 'documenteditor/main/app/view/HyperlinkSettingsDialog', 'documenteditor/main/app/view/TableOfContentsSettings', - 'documenteditor/main/app/view/BookmarksDialog' + 'documenteditor/main/app/view/BookmarksDialog', + 'documenteditor/main/app/view/CaptionDialog' ], function () { 'use strict'; @@ -66,7 +67,8 @@ define([ 'links:update': this.onTableContentsUpdate, 'links:notes': this.onNotesClick, 'links:hyperlink': this.onHyperlinkClick, - 'links:bookmarks': this.onBookmarksClick + 'links:bookmarks': this.onBookmarksClick, + 'links:caption': this.onCaptionClick }, 'DocumentHolder': { 'links:contents': this.onTableContents, @@ -76,7 +78,8 @@ define([ }, onLaunch: function () { this._state = { - prcontrolsdisable:undefined + prcontrolsdisable:undefined, + in_object: false }; Common.Gateway.on('setactionlink', function (url) { console.log('url with actions: ' + url); @@ -125,7 +128,8 @@ define([ header_locked = false, in_header = false, in_equation = false, - in_image = false; + in_image = false, + in_table = false; while (++i < selectedObjects.length) { type = selectedObjects[i].get_ObjectType(); @@ -140,10 +144,12 @@ define([ in_image = true; } else if (type === Asc.c_oAscTypeSelectElement.Math) { in_equation = true; + } else if (type === Asc.c_oAscTypeSelectElement.Table) { + in_table = true; } } - this._state.prcontrolsdisable = paragraph_locked || header_locked; + this._state.in_object = in_image || in_table || in_equation; 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; @@ -332,6 +338,19 @@ define([ })).show(); }, + onCaptionClick: function(btn) { + var me = this; + (new DE.Views.CaptionDialog({ + isObject: this._state.in_object, + handler: function (result, settings) { + if (result == 'ok') { + me.api.asc_AddObjectCaption(settings); + } + Common.NotificationCenter.trigger('edit:complete', me.toolbar); + } + })).show(); + }, + onShowContentControlsActions: function(action, x, y) { var menu = (action==1) ? this.view.contentsUpdateMenu : this.view.contentsMenu, documentHolderView = this.getApplication().getController('DocumentHolder').documentHolder, diff --git a/apps/documenteditor/main/app/template/Toolbar.template b/apps/documenteditor/main/app/template/Toolbar.template index e9d7ae2c0..c50e0c0e7 100644 --- a/apps/documenteditor/main/app/template/Toolbar.template +++ b/apps/documenteditor/main/app/template/Toolbar.template @@ -152,6 +152,7 @@
+
diff --git a/apps/documenteditor/main/app/view/CaptionDialog.js b/apps/documenteditor/main/app/view/CaptionDialog.js new file mode 100644 index 000000000..bfd3817e3 --- /dev/null +++ b/apps/documenteditor/main/app/view/CaptionDialog.js @@ -0,0 +1,461 @@ +/* + * + * (c) Copyright Ascensio System SIA 2010-2019 + * + * 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 + * + */ + +/** + * CaptionDialog.js + * + * Created by Julia Radzhabova on 10.09.2019 + * Copyright (c) 2019 Ascensio System SIA. All rights reserved. + * + */ +define([ + 'common/main/lib/util/utils', + 'common/main/lib/component/MetricSpinner', + 'common/main/lib/component/ComboBox', + 'common/main/lib/view/AdvancedSettingsWindow' +], function () { 'use strict'; + + DE.Views.CaptionDialog = Common.Views.AdvancedSettingsWindow.extend(_.extend({ + options: { + contentWidth: 351, + height: 350 + }, + + initialize : function(options) { + var me = this; + + _.extend(this.options, { + title: this.textTitle, + template: [ + '
', + '
', + '
', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '
', + '', + '
', + '
', + '', + '
', + '
', + '', + '
', + '
', + '', + '', + '', + '
', + '
', + '
', + '', + '
', + '
', + '', + '
', + '
', + '
', + '', + '
', + '
', + '', + '
', + '
', + '', + '
', + '
', + '
', + '
' + ].join('') + }, options); + + this.isObject = options.isObject; + this.handler = options.handler; + this.props = options.props; + + Common.Views.AdvancedSettingsWindow.prototype.initialize.call(this, this.options); + }, + + render: function() { + Common.Views.AdvancedSettingsWindow.prototype.render.call(this); + var me = this; + + this.txtCaption = new Common.UI.InputField({ + el : $('#caption-txt-caption'), + allowBlank : false, + value : '' + }); + var $captionInput = this.txtCaption.$el.find('input'); + $captionInput.on('mouseup', _.bind(this.checkStartPosition, this, 'mouse')); + $captionInput.on('keydown', _.bind(this.checkStartPosition, this, 'key')); + + this.cmbPosition = new Common.UI.ComboBox({ + el: $('#caption-combo-position'), + cls: 'input-group-nr', + menuStyle: 'min-width: 75px;', + editable: false, + disabled: !this.isObject, + data: [ + { displayValue: this.textBefore, value: 1 }, + { displayValue: this.textAfter, value: 0 } + ] + }); + this.cmbPosition.setValue(0); + this.cmbPosition.on('selected', function(combo, record) { + me.props.put_Before(!!record.value); + }); + + var arr = Common.Utils.InternalSettings.get("de-settings-captions"); + if (arr==null || arr==undefined) { + arr = Common.localStorage.getItem("de-settings-captions") || ''; + Common.Utils.InternalSettings.set("de-settings-captions", arr); + } + arr = arr ? JSON.parse(arr) : []; + + // 0 - not removable + this.arrLabel = arr.concat([{ displayValue: this.textEquation, value: this.textEquation, type: 0 }, + { displayValue: this.textFigure, value: this.textFigure, type: 0 }, + { displayValue: this.textTable, value: this.textTable, type: 0 } + ]); + + this.cmbLabel = new Common.UI.ComboBox({ + el: $('#caption-combo-label'), + cls: 'input-group-nr', + menuStyle: 'min-width: 160px;max-height:155px;', + editable: true, + data: this.arrLabel, + alwaysVisibleY: true + }); + this.cmbLabel.on('selected', function(combo, record) { + var value = record.value; + me.props.put_Label(value); + me.props.updateName(); + me.txtCaption.setValue(me.props.get_Name()); + var custom = (record.type==1), + find = _.findWhere(me.arrLabel, {value: value}) ? true : false; + me.btnAdd.setDisabled(find); + me.btnDelete.setDisabled(!custom); + me.currentLabel = value; + me.positionCaption = me.txtCaption.getValue().length; + }); + this.cmbLabel.$el.find('input').on('keyup', _.bind(function() { + var value = this.cmbLabel.getRawValue(), + disabled = _.findWhere(this.arrLabel, {value: value}) ? true : false; + this.btnAdd.setDisabled(disabled); + }, this)); + var curLabel = Common.Utils.InternalSettings.get("de-settings-current-label"), + recLabel, + findIndLabel; + if (curLabel) { + findIndLabel = _.findIndex(this.arrLabel, function (item) { + return item.value === curLabel; + }); + } + if (curLabel && findIndLabel !== -1) { + recLabel = this.cmbLabel.store.at(findIndLabel); + } else { + recLabel = this.cmbLabel.store.at(this.arrLabel.length-1); + } + this.cmbLabel.selectRecord(recLabel); + + this.btnAdd = new Common.UI.Button({ + el: $('#caption-btn-add'), + disabled: true + }); + this.btnAdd.on('click', _.bind(function (e) { + var value = this.cmbLabel.getRawValue(); + if (!value) { + Common.UI.error({ + msg : this.textLabelError + }); + this.cmbLabel.setValue(this.currentLabel); + this.btnAdd.setDisabled(true); + } else { + var rec = { displayValue: value, value: value, type: 1 }; + this.arrLabel.unshift(rec); + this.cmbLabel.setData(this.arrLabel); + this.cmbLabel.setValue(value); + this.cmbLabel.trigger('selected', this.cmbLabel, rec); + this.cmbLabel.scroller.update({alwaysVisibleY: true}); + } + }, this)); + + this.btnDelete = new Common.UI.Button({ + el: $('#caption-btn-delete'), + disabled: true + }); + this.btnDelete.on('click', _.bind(function (e) { + var value = this.cmbLabel.getValue(); + this.arrLabel = _.reject(this.arrLabel, function (item) { + return item.value === value; + }); + this.cmbLabel.setData(this.arrLabel); + this.cmbLabel.setValue(this.arrLabel[0].value); + this.cmbLabel.trigger('selected', this.cmbLabel, this.arrLabel[0]); + }, this)); + + this.chExclude = new Common.UI.CheckBox({ + el: $('#caption-checkbox-exclude'), + labelText: this.textExclude + }); + this.chExclude.on('change', function(field, newValue, oldValue) { + me.props.put_ExcludeLabel(newValue=='checked'); + me.props.updateName(); + me.txtCaption.setValue(me.props.get_Name()); + }); + + this.cmbNumbering = new Common.UI.ComboBox({ + el: $('#caption-combo-numbering'), + cls: 'input-group-nr', + menuStyle: 'min-width: 160px;', + editable: false, + data: [ + { displayValue: '1, 2, 3,...', value: Asc.c_oAscNumberingFormat.Decimal, maskExp: /[0-9]/, defValue: 1 }, + { displayValue: 'a, b, c,...', value: Asc.c_oAscNumberingFormat.LowerLetter, maskExp: /[a-z]/, defValue: 'a' }, + { displayValue: 'A, B, C,...', value: Asc.c_oAscNumberingFormat.UpperLetter, maskExp: /[A-Z]/, defValue: 'A' }, + { displayValue: 'i, ii, iii,...', value: Asc.c_oAscNumberingFormat.LowerRoman, maskExp: /[ivxlcdm]/, defValue: 'i' }, + { displayValue: 'I, II, III,...', value: Asc.c_oAscNumberingFormat.UpperRoman, maskExp: /[IVXLCDM]/, defValue: 'I' } + ] + }); + this.cmbNumbering.setValue(Asc.c_oAscNumberingFormat.Decimal); + this.cmbNumbering.on('selected', function(combo, record) { + me.props.put_Format(record.value); + me.props.updateName(); + me.txtCaption.setValue(me.props.get_Name()); + }); + + this.chChapter = new Common.UI.CheckBox({ + el: $('#caption-checkbox-chapter'), + labelText: this.textChapterInc + }); + this.chChapter.on('change', function(field, newValue, oldValue) { + me.props.put_IncludeChapterNumber(newValue=='checked'); + me.props.updateName(); + me.txtCaption.setValue(me.props.get_Name()); + me.cmbChapter.setDisabled(newValue!=='checked'); + me.cmbSeparator.setDisabled(newValue!=='checked'); + }); + + var _main = DE.getController('Main'); + this._arrLevel = []; + for (var i=0; i<9; i++) { + this._arrLevel.push({displayValue: _main['txtStyle_Heading_' + (i+1)], value: i}); + } + this.cmbChapter = new Common.UI.ComboBox({ + el: $('#caption-combo-chapter'), + cls: 'input-group-nr', + menuStyle: 'min-width: 160px;max-height:135px;', + editable: false, + disabled: true, + data: this._arrLevel + }); + this.cmbChapter.setValue(0); + this.cmbChapter.on('selected', function(combo, record) { + me.props.put_HeadingLvl(record.value); + me.props.updateName(); + me.txtCaption.setValue(me.props.get_Name()); + }); + + this.cmbSeparator = new Common.UI.ComboBox({ + el: $('#caption-combo-separator'), + cls: 'input-group-nr', + menuStyle: 'min-width: 160px;', + editable: false, + disabled: true, + data: [ + { displayValue: '- (' + this.textHyphen + ')', value: '-' }, + { displayValue: '. (' + this.textPeriod + ')', value: '.' }, + { displayValue: ': (' + this.textColon + ')', value: ':' }, + { displayValue: '— (' + this.textLongDash + ')', value: '—' }, + { displayValue: '– (' + this.textDash + ')', value: '–' } + ] + }); + this.cmbSeparator.setValue('-'); + this.cmbSeparator.on('selected', function(combo, record) { + me.props.put_Separator(record.value); + me.props.updateName(); + me.txtCaption.setValue(me.props.get_Name()); + }); + + this.lblExample = this.$window.find('#caption-label-example'); + + this.afterRender(); + }, + + afterRender: function() { + this._setDefaults(this.props); + }, + + show: function() { + Common.Views.AdvancedSettingsWindow.prototype.show.apply(this, arguments); + }, + + close: function() { + var val = _.where(this.arrLabel, {type: 1}), + valJson = JSON.stringify(val); + Common.localStorage.setItem("de-settings-captions", valJson); + Common.Utils.InternalSettings.set("de-settings-captions", valJson); + + Common.Views.AdvancedSettingsWindow.prototype.close.apply(this, arguments); + }, + + _setDefaults: function (props) { + this.props = new Asc.CAscCaptionProperties(); + this.props.put_Before(!!this.cmbPosition.getValue()); + var valueLabel = this.cmbLabel.getValue(); + this.props.put_Label(valueLabel); + var value = this.cmbLabel.getSelectedRecord(); + this.btnDelete.setDisabled(!value || value.type==0); + this.props.put_ExcludeLabel(this.chExclude.getValue()=='checked'); + this.props.put_Format(this.cmbNumbering.getValue()); + this.props.put_IncludeChapterNumber(this.chChapter.getValue()=='checked'); + this.props.put_HeadingLvl(this.cmbChapter.getValue()); + this.props.put_Separator(this.cmbSeparator.getValue()); + this.props.updateName(); + this.txtCaption.setValue(this.props.get_Name()); + this.currentLabel = valueLabel; + this.positionCaption = this.txtCaption.getValue().length; + }, + + getSettings: function () { + this.props.put_Additional(this.txtCaption.getValue().substr(this.positionCaption)); + return this.props ; + }, + + onDlgBtnClick: function(event) { + this._handleInput((typeof(event) == 'object') ? event.currentTarget.attributes['result'].value : event); + }, + + onPrimary: function() { + this._handleInput('ok'); + return false; + }, + + _handleInput: function(state) { + this.handler && this.handler.call(this, state, (state == 'ok') ? this.getSettings() : undefined); + if (state == 'ok') { + Common.Utils.InternalSettings.set("de-settings-current-label", this.cmbLabel.getValue()); + } + this.close(); + }, + + checkStartPosition: function (type, event) { + var me = this, + key = event.key; + if (type === 'mouse' || key === 'ArrowLeft' || key === 'ArrowDown') { + setTimeout(function () { + if (event.target.selectionStart < me.positionCaption + 1) { + event.target.selectionStart = me.positionCaption; + } + }, 0); + } else if (key === 'ArrowUp' || key === 'Home') { + setTimeout(function () { + event.target.selectionStart = me.positionCaption; + }, 0); + } else if (event.target.selectionStart !== event.target.selectionEnd && key === 'ArrowRight') { + if (event.target.selectionEnd > me.positionCaption) { + setTimeout(function () { + event.target.selectionStart = event.target.selectionEnd; + }, 0); + } else { + setTimeout(function () { + event.target.selectionStart = me.positionCaption; + }, 0); + } + } else if (key === 'Backspace') { + if ((event.target.selectionStart === event.target.selectionEnd && event.target.selectionStart < me.positionCaption + 1) || event.target.selectionStart < me.positionCaption - 1) { + event.preventDefault(); + } + } else if (key === 'Delete') { + if (event.target.selectionStart < me.positionCaption - 1) { + event.preventDefault(); + } + } else if (key !== 'End') { + if (event.target.selectionStart !== event.target.selectionEnd && event.target.selectionStart === 0) { + event.preventDefault(); + } + } + }, + + textTitle: 'Insert Caption', + textCaption: 'Caption', + textInsert: 'Insert', + textLabel: 'Label', + textAdd: 'Add label', + textDelete: 'Delete label', + textNumbering: 'Numbering', + textChapterInc: 'Include chapter number', + textChapter: 'Chapter starts with style', + textSeparator: 'Use separator', + textExamples: 'Examples: Table 2-A, Image 1.IV', + textBefore: 'Before', + textAfter: 'After', + textHyphen: 'hyphen', + textPeriod: 'period', + textColon: 'colon', + textLongDash: 'long dash', + textDash: 'dash', + textEquation: 'Equation', + textFigure: 'Figure', + textTable: 'Table', + textExclude: 'Exclude label from caption', + textLabelError: 'Label must not be empty.' + + }, DE.Views.CaptionDialog || {})) +}); \ No newline at end of file diff --git a/apps/documenteditor/main/app/view/DocumentHolder.js b/apps/documenteditor/main/app/view/DocumentHolder.js index 6d3301d82..198369d9d 100644 --- a/apps/documenteditor/main/app/view/DocumentHolder.js +++ b/apps/documenteditor/main/app/view/DocumentHolder.js @@ -1893,6 +1893,19 @@ define([ me.fireEvent('editcomplete', me); }, + onInsertCaption: function() { + var me = this; + (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) { this.api.asc_ContinueNumbering(); this.fireEvent('editcomplete', this); @@ -2037,6 +2050,16 @@ define([ createDelayedElements: function() { var me = this; + var menuInsertCaption = new Common.UI.MenuItem({ + caption : me.txtInsertCaption + }).on('click', _.bind(me.onInsertCaption, me)); + var menuInsertCaptionSeparator = new Common.UI.MenuItem({ caption: '--' }); + + var menuEquationInsertCaption = new Common.UI.MenuItem({ + caption : me.txtInsertCaption + }).on('click', _.bind(me.onInsertCaption, me)); + var menuEquationInsertCaptionSeparator = new Common.UI.MenuItem({ caption: '--' }); + var menuImageAlign = new Common.UI.MenuItem({ caption : me.textAlign, menu : (function(){ @@ -2519,7 +2542,7 @@ define([ if (menuChartEdit.isVisible()) menuChartEdit.setDisabled(islocked || value.imgProps.value.get_SeveralCharts()); - me.pictureMenu.items[17].setVisible(menuChartEdit.isVisible()); + me.pictureMenu.items[19].setVisible(menuChartEdit.isVisible()); me.menuOriginalSize.setDisabled(islocked || value.imgProps.value.get_ImageUrl()===null || value.imgProps.value.get_ImageUrl()===undefined); menuImageAdvanced.setDisabled(islocked); @@ -2572,6 +2595,8 @@ define([ me.menuImageWrap, menuImgRotate, { caption: '--' }, + menuInsertCaption, + menuInsertCaptionSeparator, me.menuImgCrop, me.menuOriginalSize, menuImgReplace, @@ -2586,6 +2611,10 @@ define([ /* table menu*/ + var menuTableInsertCaption = new Common.UI.MenuItem({ + caption : me.txtInsertCaption + }).on('click', _.bind(me.onInsertCaption, me)); + var mnuTableMerge = new Common.UI.MenuItem({ caption : me.mergeCellsText }).on('click', function(item) { @@ -2952,7 +2981,7 @@ define([ var isEquation= (value.mathProps && value.mathProps.value); - for (var i = 8; i < 25; i++) { + for (var i = 8; i < 27; i++) { me.tableMenu.items[i].setVisible(!isEquation); } @@ -3219,6 +3248,8 @@ define([ menuTableCellAlign, menuTableDirection, { caption: '--' }, + menuTableInsertCaption, + { caption: '--' }, menuTableAdvanced, { caption: '--' }, /** coauthoring begin **/ @@ -3668,10 +3699,12 @@ define([ //equation menu var eqlen = 0; if (isEquation) { - eqlen = me.addEquationMenu(true, 13); + eqlen = me.addEquationMenu(true, 15); } else - me.clearEquationMenu(true, 13); + me.clearEquationMenu(true, 15); menuEquationSeparator.setVisible(isEquation && eqlen>0); + menuEquationInsertCaption.setVisible(isEquation); + menuEquationInsertCaptionSeparator.setVisible(isEquation); menuFrameAdvanced.setVisible(value.paraProps.value.get_FramePr() !== undefined); @@ -3734,6 +3767,8 @@ define([ menuParaCopy, menuParaPaste, menuParaPrint, + menuEquationInsertCaptionSeparator, + menuEquationInsertCaption, { caption: '--' }, menuEquationSeparator, menuParaRemoveControl, @@ -4134,7 +4169,8 @@ define([ toDictionaryText: 'Add to Dictionary', txtPrintSelection: 'Print Selection', textCells: 'Cells', - textSeveral: 'Several Rows/Columns' + textSeveral: 'Several Rows/Columns', + txtInsertCaption: 'Insert Caption' }, DE.Views.DocumentHolder || {})); }); \ No newline at end of file diff --git a/apps/documenteditor/main/app/view/Links.js b/apps/documenteditor/main/app/view/Links.js index 11ff7d738..e2ec9b0c5 100644 --- a/apps/documenteditor/main/app/view/Links.js +++ b/apps/documenteditor/main/app/view/Links.js @@ -105,6 +105,10 @@ define([ this.btnBookmarks.on('click', function (b, e) { me.fireEvent('links:bookmarks'); }); + + this.btnCaption.on('click', function (b, e) { + me.fireEvent('links:caption'); + }); } return { @@ -147,6 +151,15 @@ define([ Common.Utils.injectComponent($host.find('#slot-btn-bookmarks'), this.btnBookmarks); this.paragraphControls.push(this.btnBookmarks); + this.btnCaption = new Common.UI.Button({ + cls: 'btn-toolbar x-huge icon-top', + iconCls: 'btn-caption', + caption: this.capBtnCaption, + disabled: true + }); + Common.Utils.injectComponent($host.find('#slot-btn-caption'), this.btnCaption); + this.paragraphControls.push(this.btnCaption); + this._state = {disabled: false}; Common.NotificationCenter.on('app:ready', this.onAppReady.bind(this)); }, @@ -244,6 +257,7 @@ define([ }); me.btnBookmarks.updateHint(me.tipBookmarks); + me.btnCaption.updateHint(me.tipCaption); setEvents.call(me); }); @@ -285,7 +299,9 @@ define([ capBtnInsLink: 'Hyperlink', tipInsertHyperlink: 'Add Hyperlink', capBtnBookmarks: 'Bookmark', - tipBookmarks: 'Create a bookmark' + tipBookmarks: 'Create a bookmark', + capBtnCaption: 'Caption', + tipCaption: 'Insert caption' } }()), DE.Views.Links || {})); }); \ No newline at end of file diff --git a/apps/documenteditor/main/locale/en.json b/apps/documenteditor/main/locale/en.json index c7e18f95b..5c7b05055 100644 --- a/apps/documenteditor/main/locale/en.json +++ b/apps/documenteditor/main/locale/en.json @@ -1003,6 +1003,29 @@ "DE.Views.BookmarksDialog.textSort": "Sort by", "DE.Views.BookmarksDialog.textTitle": "Bookmarks", "DE.Views.BookmarksDialog.txtInvalidName": "Bookmark name can only contain letters, digits and underscores, and should begin with the letter", + "DE.Views.CaptionDialog.textTitle": "Insert Caption", + "DE.Views.CaptionDialog.textCaption": "Caption", + "DE.Views.CaptionDialog.textInsert": "Insert", + "DE.Views.CaptionDialog.textLabel": "Label", + "DE.Views.CaptionDialog.textAdd": "Add label", + "DE.Views.CaptionDialog.textDelete": "Delete label", + "DE.Views.CaptionDialog.textNumbering": "Numbering", + "DE.Views.CaptionDialog.textChapterInc": "Include chapter number", + "DE.Views.CaptionDialog.textChapter": "Chapter starts with style", + "DE.Views.CaptionDialog.textSeparator": "Use separator", + "DE.Views.CaptionDialog.textExamples": "Examples: Table 2-A, Image 1.IV", + "DE.Views.CaptionDialog.textBefore": "Before", + "DE.Views.CaptionDialog.textAfter": "After", + "DE.Views.CaptionDialog.textHyphen": "hyphen", + "DE.Views.CaptionDialog.textPeriod": "period", + "DE.Views.CaptionDialog.textColon": "colon", + "DE.Views.CaptionDialog.textLongDash": "long dash", + "DE.Views.CaptionDialog.textDash": "dash", + "DE.Views.CaptionDialog.textEquation": "Equation", + "DE.Views.CaptionDialog.textFigure": "Figure", + "DE.Views.CaptionDialog.textTable": "Table", + "DE.Views.CaptionDialog.textExclude": "Exclude label from caption", + "DE.Views.CaptionDialog.textLabelError": "Label must not be empty.", "DE.Views.CellsAddDialog.textCol": "Columns", "DE.Views.CellsAddDialog.textDown": "Below the cursor", "DE.Views.CellsAddDialog.textLeft": "To the left", @@ -1269,6 +1292,7 @@ "DE.Views.DocumentHolder.txtUngroup": "Ungroup", "DE.Views.DocumentHolder.updateStyleText": "Update %1 style", "DE.Views.DocumentHolder.vertAlignText": "Vertical Alignment", + "DE.Views.DocumentHolder.txtInsertCaption": "Insert Caption", "DE.Views.DropcapSettingsAdvanced.strBorders": "Borders & Fill", "DE.Views.DropcapSettingsAdvanced.strDropcap": "Drop Cap", "DE.Views.DropcapSettingsAdvanced.strMargins": "Margins",