/* * * (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 * */ /** * ListSettingsDialog.js * * Created by Julia Radzhabova on 03.12.2019 * Copyright (c) 2019 Ascensio System SIA. All rights reserved. * */ if (Common === undefined) var Common = {}; define([ 'common/main/lib/component/Window', 'common/main/lib/component/MetricSpinner', 'common/main/lib/component/ThemeColorPalette', 'common/main/lib/component/ColorButton', 'common/main/lib/component/ComboBox', 'common/main/lib/view/SymbolTableDialog', 'documenteditor/main/app/view/ListTypesAdvanced' ], function () { 'use strict'; var nMaxRecent = 5; DE.Views.ListSettingsDialog = Common.UI.Window.extend(_.extend({ options: { type: 0, // 0 - markers, 1 - numbers, 2 - multilevel width: 300, height: 460, style: 'min-width: 240px;', cls: 'modal-dlg', split: false, buttons: null }, initialize : function(options) { this.type = options.type || 0; this.extended = true; this.rightPanelWidth = 210; _.extend(this.options, { title: this.txtTitle, height: (this.type===2) ? 451 : (this.type===1 ? 470 : 424), width: (this.type===2) ? 415 + (this.extended ? this.rightPanelWidth : 0) : 300 }, options || {}); this.template = [ '', '', '', '<% if (type == 2) { %>', '', '<% } %>', '', '
', '
', '<% if (type == 2) { %>', '', '', '', '', '', '', '', '', '', '
', '', '
', '
', '', '
', '
', '', '
', '
', '', '
', '
', '', '
', '
', '', '', '', '', '', '
', '', '
', '
', '', '
', '
', '<% } else if (type == 0) {%>', // bullets '', '', '', '', '', '', '', '', '
', '', '
', '
', '', '
', '
', '', '
', '
', '
', '
', '
', '<% } else { %>', // numbering '', '', '', '', '', '', '', '', '
', '', '
', '
', '', '
', '
', '', '
', '
', '', '', '', '', '', '
', '', '
', '
', '
', '
', '
', '', '
', '
', '<% } %>', '', '', '', '', '', '', '', '', '
', '', '
', '
', '
', '
', '', '
', '
', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '
', '', '
', '
', '', '
', '
', '', '
', '
', '
', '
', '', '', '', '
', '
', '
', '
', '
', '', '
', '
', '', '
', '
', '
', '
', '
', '
', '
', '
' ].join(''); this.props = options.props; this.level = options.level || 0; this.api = options.api; this.fontStore = options.fontStore; this.fontName = ''; this.options.tpl = _.template(this.template)(this.options); this.levels = []; this.formatString = { selectionStart: 0, selectionEnd: 0, text: '', lvlIndexes: [] }; this.spinners = []; this.recentBullets = []; this.recentNumTypes = []; this.lang = this.api.asc_GetPossibleNumberingLanguage(); Common.UI.Window.prototype.initialize.call(this, this.options); }, render: function() { Common.UI.Window.prototype.render.call(this); var me = this, $window = this.getChild(); $window.find('.dlg-btn').on('click', _.bind(this.onBtnClick, this)); this.btnColor = new Common.UI.ButtonColored({ parentEl: $window.find('#id-dlg-bullet-color'), cls : 'btn-toolbar', iconCls : 'toolbar__icon btn-fontcolor', hint : this.txtColor, menu: true, additionalItems: [{ id: 'id-dlg-bullet-text-color', caption: this.txtLikeText, checkable: true, toggleGroup: 'list-settings-color', style: 'padding-left: 20px;' }, { id: 'id-dlg-bullet-auto-color', caption: this.textAuto, checkable: true, toggleGroup: 'list-settings-color', style: 'padding-left: 20px;' }, {caption: '--'}], additionalAlign: this.menuAddAlign }); this.btnColor.setMenu(); this.btnColor.on('color:select', _.bind(this.onColorsSelect, this)); this.btnColor.menu.items[0].on('toggle', _.bind(this.onLikeTextColor, this)); this.btnColor.menu.items[1].on('toggle', _.bind(this.onAutoColor, this)); this.colors = this.btnColor.getPicker(); var itemsTemplate = [ '<% _.each(items, function(item) { %>', '
  • ', '<%= item.displayValue %><% if (item.value === Asc.c_oAscNumberingFormat.Bullet) { %><%=item.symbol%><% } %>', '
  • ', '<% }); %>' ]; var template = [ '
    ', '
    ', '
    ', '', '', '
    ' ]); this._arrNumbers = [ { displayValue: '1, 2, 3,...', value: Asc.c_oAscNumberingFormat.Decimal }, { displayValue: 'a, b, c,...', value: Asc.c_oAscNumberingFormat.LowerLetter }, { displayValue: 'A, B, C,...', value: Asc.c_oAscNumberingFormat.UpperLetter }, { displayValue: 'i, ii, iii,...', value: Asc.c_oAscNumberingFormat.LowerRoman }, { displayValue: 'I, II, III,...', value: Asc.c_oAscNumberingFormat.UpperRoman } ]; if (Common.Locale.getDefaultLanguage() === 'ru') { this._arrNumbers = this._arrNumbers.concat([ { displayValue: 'а, б, в,...', value: Asc.c_oAscNumberingFormat.RussianLower }, { displayValue: 'А, Б, В,...', value: Asc.c_oAscNumberingFormat.RussianUpper } ]); } this._arrBullets = [ { displayValue: this.txtSymbol + ': ', value: Asc.c_oAscNumberingFormat.Bullet, symbol: "·", font: 'Symbol' }, { displayValue: this.txtSymbol + ': ', value: Asc.c_oAscNumberingFormat.Bullet, symbol: "o", font: 'Courier New' }, { displayValue: this.txtSymbol + ': ', value: Asc.c_oAscNumberingFormat.Bullet, symbol: "§", font: 'Wingdings' }, { displayValue: this.txtSymbol + ': ', value: Asc.c_oAscNumberingFormat.Bullet, symbol: "v", font: 'Wingdings' }, { displayValue: this.txtSymbol + ': ', value: Asc.c_oAscNumberingFormat.Bullet, symbol: "Ø", font: 'Wingdings' }, { displayValue: this.txtSymbol + ': ', value: Asc.c_oAscNumberingFormat.Bullet, symbol: "ü", font: 'Wingdings' }, { displayValue: this.txtSymbol + ': ', value: Asc.c_oAscNumberingFormat.Bullet, symbol: "¨", font: 'Symbol' }, { displayValue: this.txtSymbol + ': ', value: Asc.c_oAscNumberingFormat.Bullet, symbol: "–", font: 'Arial' } ]; this._itemNoneBullet = { displayValue: this.txtNone, value: Asc.c_oAscNumberingFormat.None }; this._itemNewBullet = { displayValue: this.txtNewBullet, value: -1 }; this._itemMoreTypes = { displayValue: this.txtMoreTypes, value: -2 }; this.loadRecent(); this.cmbFormat = new Common.UI.ComboBoxCustom({ el : $window.find('#id-dlg-numbering-format'), menuStyle : 'min-width: 100%;max-height: 220px;', style : this.type===2 ? "width: 100%;" : "width: 129px;", editable : false, template : _.template(template.join('')), itemsTemplate: _.template(itemsTemplate.join('')), takeFocusOnClose: true, data : [], updateFormControl: function(record) { var formcontrol = $(this.el).find('.form-control'); if (record) { if (record.get('value')==Asc.c_oAscNumberingFormat.Bullet) formcontrol[0].innerHTML = record.get('displayValue') + '' + record.get('symbol') + ''; else formcontrol[0].innerHTML = record.get('displayValue'); } else formcontrol[0].innerHTML = ''; } }); this.cmbFormat.on('selected', _.bind(function (combo, record) { if (this._changedProps) { if (record.value == -1) { var callback = function(result) { me.fillLevelProps(me.levels[me.level]); }; this.addNewBullet(callback); } else if (record.value == -2) { var callback = function(result) { me.fillLevelProps(me.levels[me.level]); }; this.addNewListType(callback); } else { var oldformat = this._changedProps.get_Format(); this._changedProps.put_Format(record.value); if (record.value == Asc.c_oAscNumberingFormat.Bullet) { this.bulletProps.font = record.font ? record.font : undefined; this.bulletProps.symbol = record.symbol; this._changedProps.put_FontFamily(this.bulletProps.font); this._changedProps.put_Text([new Asc.CAscNumberingLvlText()]); this._changedProps.get_Text()[0].put_Value(this.bulletProps.symbol); } else if (oldformat == Asc.c_oAscNumberingFormat.Bullet) { this._changedProps.put_FontFamily(undefined); this._changedProps.put_Text([new Asc.CAscNumberingLvlText()]); this._changedProps.get_Text()[0].put_Type(Asc.c_oAscNumberingLvlTextType.Num); this._changedProps.get_Text()[0].put_Value(this.level); } else if (oldformat == Asc.c_oAscNumberingFormat.None) { if (!this.formatString.lvlIndexes[this.level][this.level]) { var selectionStart = this.txtNumFormat.$el.find('input')[0].selectionStart; this._changedProps.get_Text().splice(selectionStart, 0, new Asc.CAscNumberingLvlText(Asc.c_oAscNumberingLvlTextType.Num, this.level)); } } this.fillLevelProps(this.levels[this.level]); } } if (this.api) { this.api.SetDrawImagePreviewBullet('bulleted-list-preview', this.props, this.level, this.type==2); } }, this)); this.cmbAlign = new Common.UI.ComboBox({ el : $window.find('#id-dlg-bullet-align'), menuStyle : 'min-width: 100%;', editable : false, cls : 'input-group-nr', data : [ { value: AscCommon.align_Left, displayValue: this.textLeft }, { value: AscCommon.align_Center, displayValue: this.textCenter }, { value: AscCommon.align_Right, displayValue: this.textRight } ], takeFocusOnClose: true }); this.cmbAlign.on('selected', _.bind(function (combo, record) { if (this._changedProps) this._changedProps.put_Align(record.value); if (this.api) { this.api.SetDrawImagePreviewBullet('bulleted-list-preview', this.props, this.level, this.type==2); } }, this)); this.cmbSize = new Common.UI.ComboBox({ el : $window.find('#id-dlg-bullet-size'), menuStyle : 'min-width: 100%;max-height: 183px;', editable : false, cls : 'input-group-nr', data : [ { value: -1, displayValue: this.txtLikeText }, { value: 8, displayValue: "8" }, { value: 9, displayValue: "9" }, { value: 10, displayValue: "10" }, { value: 11, displayValue: "11" }, { value: 12, displayValue: "12" }, { value: 14, displayValue: "14" }, { value: 16, displayValue: "16" }, { value: 18, displayValue: "18" }, { value: 20, displayValue: "20" }, { value: 22, displayValue: "22" }, { value: 24, displayValue: "24" }, { value: 26, displayValue: "26" }, { value: 28, displayValue: "28" }, { value: 36, displayValue: "36" }, { value: 48, displayValue: "48" }, { value: 72, displayValue: "72" }, { value: 96, displayValue: "96" } ], takeFocusOnClose: true }); this.cmbSize.on('selected', _.bind(function (combo, record) { if (this._changedProps) { this._changedProps.put_FontSize((record.value>0) ? record.value : undefined); } if (this.api) { this.api.SetDrawImagePreviewBullet('bulleted-list-preview', this.props, this.level, this.type==2); } }, this)); var levels = []; for (var i=0; i<9; i++) levels.push({value: i}); this.levelsList = new Common.UI.ListView({ el: $('#levels-list', this.$window), store: new Common.UI.DataViewStore(levels), tabindex: 1, itemTemplate: _.template('
    <%= (value+1) %>
    ') }); this.levelsList.on('item:select', _.bind(this.onSelectLevel, this)); this.txtNumFormat = new Common.UI.InputField({ el : $window.find('#id-dlg-numbering-format-str'), allowBlank : true, value : '' }); var $formatInput = this.txtNumFormat.$el.find('input'); $formatInput.on('keydown', _.bind(this.onKeyDown, this)); $formatInput.on('keyup', _.bind(this.onKeyUp, this)); $formatInput.on('input', _.bind(this.onFormatInput, this)); var onMouseUp = function (e) { me.checkMousePosition($formatInput[0]); $(document).off('mouseup', onMouseUp); }; var onMouseDown = function (e) { $(document).on('mouseup', onMouseUp); }; $formatInput.on('mousedown', _.bind(onMouseDown, this)); $formatInput.on('contextmenu', function(e) { e.preventDefault(); e.stopPropagation(); return false; }); this.cmbLevel = new Common.UI.ComboBox({ el : $window.find('#id-dlg-numbering-format-lvl'), menuStyle : 'min-width: 100%;', style : "width: 100%;", editable : false, cls : 'input-group-nr', data : [], takeFocusOnClose: true }); this.cmbLevel.on('selected', _.bind(this.onIncludeLevelSelected, this)); this.spnStart = new Common.UI.MetricSpinner({ el: $window.find('#id-dlg-numbering-spin-start'), step: 1, width: '100%', defaultUnit : "", value: 1, maxValue: 16383, minValue: 1, allowDecimal: false }); this.spnStart.on('change', _.bind(function(field, newValue, oldValue, eOpts){ if (this._changedProps) { this._changedProps.put_Start(field.getNumberValue()); this.makeFormatStr(this._changedProps); } if (this.api) { this.api.SetDrawImagePreviewBullet('bulleted-list-preview', this.props, this.level, this.type==2); } }, this)); this.cmbFonts = new Common.UI.ComboBoxFonts({ el : $window.find('#id-dlg-numbering-font-name'), cls : 'input-group-nr', style : 'width: 100%;', menuCls : 'scrollable-menu', menuStyle : 'min-width: 100%;max-height: 270px;', store : new Common.Collections.Fonts(), recent : 0, hint : this.tipFontName, takeFocusOnClose: true }).on('selected', _.bind(this.onFontName, this)); this.btnBold = new Common.UI.Button({ parentEl: $window.find('#id-dlg-numbering-bold'), cls: 'btn-toolbar', iconCls: 'toolbar__icon btn-bold', enableToggle: true, hint: this.textBold }); this.btnBold.on('click', _.bind(this.onBoldClick, this)); this.btnItalic = new Common.UI.Button({ parentEl: $window.find('#id-dlg-numbering-italic'), cls: 'btn-toolbar', iconCls: 'toolbar__icon btn-italic', enableToggle: true, hint: this.textItalic }); this.btnItalic.on('click', _.bind(this.onItalicClick, this)); this.spnAlign = new Common.UI.MetricSpinner({ el: $window.findById('#id-dlg-numbering-align-at'), step: .1, width: '100%', 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.spnTabStop.setMinValue(field.getNumberValue()); this.spnTabStop.setValue(this.spnTabStop.getValue(), true); } if (this.api) { this.api.SetDrawImagePreviewBullet('bulleted-list-preview', this.props, this.level, this.type==2); } }, this)); this.spnIndents = new Common.UI.MetricSpinner({ el: $window.findById('#id-dlg-numbering-indent'), step: .1, width: '100%', 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())); } if (this.api) { this.api.SetDrawImagePreviewBullet('bulleted-list-preview', this.props, this.level, this.type==2); } }, this)); this.cmbFollow = new Common.UI.ComboBox({ el : $window.find('#id-dlg-numbering-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.chTabStop.setDisabled(record.value!==Asc.c_oAscNumberingSuff.Tab); this.spnTabStop.setDisabled(record.value!==Asc.c_oAscNumberingSuff.Tab || this.chTabStop.getValue()!=='checked'); if (this.api) { this.api.SetDrawImagePreviewBullet('bulleted-list-preview', this.props, this.level, this.type==2); } }, this)); this.chRestart = new Common.UI.CheckBox({ el: $window.find('#id-dlg-numbering-restart'), labelText: this.txtRestart }); this.chRestart.on('change', _.bind(function(field, newValue, oldValue, eOpts){ if (this._changedProps) { this._changedProps.put_Restart(field.getValue()=='checked' ? -1 : 0); } }, this)); this.chTabStop = new Common.UI.CheckBox({ el: $window.find('#id-dlg-chk-tabstop'), labelText: this.txtTabStop }); this.chTabStop.on('change', _.bind(function(field, newValue, oldValue, eOpts){ if (this._changedProps) { this._changedProps.put_StopTab(field.getValue()==='checked' ? Common.Utils.Metric.fnRecalcToMM(this.spnTabStop.getNumberValue()) : null); this.spnTabStop.setDisabled(field.getValue()!=='checked' || this.cmbFollow.getValue()!==Asc.c_oAscNumberingSuff.Tab); } if (this.api) { this.api.SetDrawImagePreviewBullet('bulleted-list-preview', this.props, this.level, this.type==2); } }, this)); this.spnTabStop = new Common.UI.MetricSpinner({ el: $window.findById('#id-dlg-num-tabstop'), step: .1, width: '100%', defaultUnit : "cm", defaultValue : 0, value: '0 cm', maxValue: 55.87, minValue: 0 }); this.spinners.push(this.spnTabStop); this.spnTabStop.on('change', _.bind(function(field, newValue, oldValue, eOpts){ if (this._changedProps) { this._changedProps.put_StopTab(Common.Utils.Metric.fnRecalcToMM(field.getNumberValue())); } if (this.api) { this.api.SetDrawImagePreviewBullet('bulleted-list-preview', this.props, this.level, this.type==2); } }, this)); this.panelMore = $window.findById('#id-dlg-panel-more-settings'); this.panelMoreTable = this.panelMore.parent(); this.btnMore = new Common.UI.Button({ parentEl: $window.findById('#id-dlg-btn-more'), cls: 'btn-toolbar bg-white', iconCls: this.extended ? 'caret-double-left' : 'caret-double-right', hint: this.extended ? this.textHide : this.textMore }); this.btnMore.on('click', _.bind(this.onMoreClick, this)); this.on('animate:after', _.bind(this.onAnimateAfter, this)); this.afterRender(); }, getFocusedComponents: function() { return [this.cmbFormat, this.cmbAlign, this.cmbSize, this.btnColor, this.levelsList]; }, getDefaultFocusableComponent: function () { return this.cmbFormat; }, onAnimateAfter: function() { if (this.api) { this.api.SetDrawImagePreviewBullet('bulleted-list-preview', this.props, this.level, this.type==2); } }, afterRender: function() { this.cmbFonts.fillFonts(this.fontStore); this.cmbFonts.selectRecord(this.fontStore.findWhere({name: this.fontName})); this.updateMetricUnit(); this.updateThemeColors(); this._setDefaults(this.props); var me = this; var onApiLevelChange = function(level) { me.levelsList.selectByIndex(level); }; this.api.asc_registerCallback('asc_onPreviewLevelChange', onApiLevelChange); this.on('close', function(obj){ me.api.asc_unregisterCallback('asc_onPreviewLevelChange', onApiLevelChange); }); }, updateMetricUnit: function() { if (this.spinners) { for (var i=0; i item.start && position < item.end) return toEnd ? item.end : item.start; } } } }, checkMousePosition: function(target) { var me = this; setTimeout(function () { if (target.selectionStart===target.selectionEnd) { var res = me.isPosInRange(target.selectionStart); if (res !== undefined) target.selectionStart = target.selectionEnd = res; } else { var res = me.isPosInRange(target.selectionStart); if (res !== undefined) target.selectionStart = res; res = me.isPosInRange(target.selectionEnd, true); if (res !== undefined) target.selectionEnd = res; } me.formatString.selectionStart = target.selectionStart; me.formatString.selectionEnd = target.selectionEnd; }, 0); }, onFormatInput: function(e) { var newValue = $(e.target).val(), oldStr = this.formatString.text, newStr = newValue.slice(this.formatString.selectionStart, newValue.length - (oldStr.length - this.formatString.selectionEnd)), startIdx = this.posToIndex(this.formatString.selectionStart), endIdx = this.posToIndex(this.formatString.selectionEnd); if (this._changedProps) { var text = this._changedProps.get_Text(); var arr = text.slice(0, startIdx); newStr.split('').forEach(function(str){ arr.push(new Asc.CAscNumberingLvlText(Asc.c_oAscNumberingLvlTextType.Text, str)); }); arr = arr.concat(text.slice(endIdx, text.length)); this._changedProps.put_Text(arr); if (this.api) { this.api.SetDrawImagePreviewBullet('bulleted-list-preview', this.props, this.level, this.type==2); } this.makeFormatStr(this._changedProps); if (!this.formatString.lvlIndexes[this.level][this.level]) { this._changedProps.put_Format(Asc.c_oAscNumberingFormat.None); this.cmbFormat.setValue(Asc.c_oAscNumberingFormat.None); } } this.formatString.selectionStart = e.target.selectionStart; this.formatString.selectionEnd = e.target.selectionEnd; }, onKeyDown: function(event) { var me = this, key = event.keyCode, shift = event.shiftKey; if (key === Common.UI.Keys.LEFT) { var res = me.isPosInRange(event.target.selectionStart-1); if (res !== undefined) setTimeout(function () { event.target.selectionStart = res; !shift && (event.target.selectionEnd = res); me.formatString.selectionStart = event.target.selectionStart; me.formatString.selectionEnd = event.target.selectionEnd; }, 0); } else if (key === Common.UI.Keys.RIGHT) { res = me.isPosInRange(event.target.selectionEnd+1, true); if (res !== undefined) setTimeout(function () { event.target.selectionEnd = res; !shift && (event.target.selectionStart = res); me.formatString.selectionStart = event.target.selectionStart; me.formatString.selectionEnd = event.target.selectionEnd; }, 0); } else if (key === Common.UI.Keys.BACKSPACE) { if (event.target.selectionStart === event.target.selectionEnd) { this.formatString.selectionStart = event.target.selectionStart-1; this.formatString.selectionEnd = event.target.selectionEnd; } }else if (key === Common.UI.Keys.DELETE) { if (event.target.selectionStart === event.target.selectionEnd) { this.formatString.selectionStart = event.target.selectionStart; this.formatString.selectionEnd = event.target.selectionEnd+1; } } }, onKeyUp: function(event) { this.formatString.selectionStart = event.target.selectionStart; this.formatString.selectionEnd = event.target.selectionEnd; }, onFontName: function(combo, record) { if (this._changedProps) { this._changedProps.put_FontFamily(record.name ? record.name : undefined); if (this._changedProps.get_Format() === Asc.c_oAscNumberingFormat.Bullet) { this.fillLevelProps(this._changedProps); } } if (this.api) { this.api.SetDrawImagePreviewBullet('bulleted-list-preview', this.props, this.level, this.type==2); } }, onBoldClick: function() { if (this._changedProps) { this._changedProps.put_Bold(this.btnBold.isActive()); } if (this.api) { this.api.SetDrawImagePreviewBullet('bulleted-list-preview', this.props, this.level, this.type==2); } }, onItalicClick: function() { if (this._changedProps) { this._changedProps.put_Italic(this.btnItalic.isActive()); } if (this.api) { this.api.SetDrawImagePreviewBullet('bulleted-list-preview', this.props, this.level, this.type==2); } }, loadRecent: function(){ var sRecents = Common.localStorage.getItem('de-recent-bullets'); if(sRecents !== ''){ sRecents = JSON.parse(sRecents); } if(_.isArray(sRecents)){ this.recentBullets = sRecents; for (var i = 0; i < this.recentBullets.length; ++i){ if(!this.recentBullets[i].symbol){ this.recentBullets.splice(i, 1); i--; } } } sRecents = Common.localStorage.getItem('de-recent-list-formats'); if(sRecents !== ''){ sRecents = JSON.parse(sRecents); } if(_.isArray(sRecents)){ this.recentNumTypes = sRecents; } }, saveRecent: function(){ var sJSON = JSON.stringify(this.recentBullets); Common.localStorage.setItem('de-recent-bullets', sJSON); }, saveRecentNum: function(){ var sJSON = JSON.stringify(this.recentNumTypes); Common.localStorage.setItem('de-recent-list-formats', sJSON); }, checkRecent: function(sSymbol, sFont){ if (!sSymbol) return; sFont = sFont || ''; for(var i = 0; i < this._arrBullets.length; ++i){ if(this._arrBullets[i].symbol === sSymbol && this._arrBullets[i].font === sFont){ return; } } if(this.recentBullets.length === 0){ this.recentBullets.push({symbol: sSymbol, font: sFont}); this.saveRecent(); return; } for (var i = 0; i < this.recentBullets.length; ++i){ if(this.recentBullets[i].symbol === sSymbol && this.recentBullets[i].font === sFont){ this.recentBullets.splice(i, 1); break; } } this.recentBullets.splice(0, 0, {symbol: sSymbol, font: sFont}); if(this.recentBullets.length > nMaxRecent){ this.recentBullets.splice(nMaxRecent, this.recentBullets.length - nMaxRecent); } this.saveRecent(); }, checkRecentNum: function(format){ if (format===null || format===undefined) return; for(var i = 0; i < this._arrNumbers.length; ++i){ if(this._arrNumbers[i].value === format){ return; } } if(this.recentNumTypes.length === 0){ this.recentNumTypes.push(format); this.saveRecentNum(); return; } for (var i = 0; i < this.recentNumTypes.length; ++i){ if(this.recentNumTypes[i] === format){ this.recentNumTypes.splice(i, 1); break; } } this.recentNumTypes.splice(0, 0, format); if(this.recentNumTypes.length > nMaxRecent){ this.recentNumTypes.splice(nMaxRecent, this.recentNumTypes.length - nMaxRecent); } this.saveRecentNum(); }, onMoreClick: function(btn) { if (!this.extended) { this.extended = true; this.panelMore.css({'display': 'block'}); this.panelMoreTable.width(this.panelMore.width()); this.setWidth(this.getWidth() + this.rightPanelWidth); btn.updateHint(this.textHide); btn.setIconCls('icon caret-double-left'); Common.localStorage.setItem("de-hide-multilevel-settings", 0); } else { this.extended = false; this.panelMore.css({'display': 'none'}); this.panelMoreTable.css({'width': 'auto'}); this.setWidth(this.getWidth() - this.rightPanelWidth); btn.updateHint(this.textMore); btn.setIconCls('icon caret-double-right'); Common.localStorage.setItem("de-hide-multilevel-settings", 1); } }, txtTitle: 'List Settings', txtSize: 'Size', txtColor: 'Color', txtBullet: 'Bullet', txtAlign: 'Alignment', textLeft: 'Left', textCenter: 'Center', textRight: 'Right', textAuto: 'Automatic', textPreview: 'Preview', txtType: 'Type', txtLikeText: 'Like a text', textLevel: 'Level', txtNone: 'None', txtNewBullet: 'New bullet', txtSymbol: 'Symbol', txtNumFormatString: 'Number format', txtInclcudeLevel: 'Include level number', txtStart: 'Start at', txtFontName: 'Font', textBold: 'Bold', textItalic: 'Italic', textTab: 'Tab character', textSpace: 'Space', txtAlignAt: 'at', txtIndent: 'Text Indent', txtFollow: 'Follow number with', txtRestart: 'Restart list', txtMoreTypes: 'More types', txtTabStop: 'Add tab stop at', textMore: 'Show more settings', textHide: 'Hide settings', textSelectLevel: 'Select level' }, DE.Views.ListSettingsDialog || {})) });