From b1bca1b0ba623371d39db91019de0b5ea3449666 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Fri, 8 Apr 2022 00:28:59 +0300 Subject: [PATCH 01/16] [PE] Load bullet from image --- .../main/lib/view/ListSettingsDialog.js | 145 ++++++++++++++++-- .../main/app/controller/Toolbar.js | 1 + 2 files changed, 137 insertions(+), 9 deletions(-) diff --git a/apps/common/main/lib/view/ListSettingsDialog.js b/apps/common/main/lib/view/ListSettingsDialog.js index 96afdac6a..e473dde36 100644 --- a/apps/common/main/lib/view/ListSettingsDialog.js +++ b/apps/common/main/lib/view/ListSettingsDialog.js @@ -86,6 +86,15 @@ define([ '', '', '', + '', + '', + '', + '', + '', + '
', + '', + '', + '', '', '', '', @@ -106,7 +115,7 @@ define([ '', '', '', - '', + '', '', '', '', @@ -123,6 +132,9 @@ define([ this.props = options.props; this.options.tpl = _.template(this.template)(this.options); this.color = '000000'; + this.storage = !!options.storage; + this.api = options.api; + this.isImageLoaded = false; Common.UI.Window.prototype.initialize.call(this, this.options); }, @@ -210,13 +222,16 @@ define([ { displayValue: this.txtSymbol + ': ', value: 0, symbol: "ü", font: 'Wingdings' }, { displayValue: this.txtSymbol + ': ', value: 0, symbol: "w", font: 'Wingdings' }, { displayValue: this.txtSymbol + ': ', value: 0, symbol: "–", font: 'Arial' }, - { displayValue: this.txtNewBullet, value: 1 } + { displayValue: this.txtNewBullet, value: 1 }, + { displayValue: this.txtNewImage, value: 2 } ], updateFormControl: function(record) { var formcontrol = $(this.el).find('.form-control'); if (record) { if (record.get('value')==0) formcontrol[0].innerHTML = record.get('displayValue') + '' + record.get('symbol') + ''; + else if (record.get('value')==2) + formcontrol[0].innerHTML = me.txtImage; else formcontrol[0].innerHTML = record.get('displayValue'); } else @@ -227,6 +242,8 @@ define([ this.cmbBulletFormat.selectRecord(rec); this.bulletProps = {symbol: rec.get('symbol'), font: rec.get('font')}; this.cmbBulletFormat.on('selected', _.bind(function (combo, record) { + this.imageControls.toggleClass('hidden', record.value !== 2); + this.colorControls.toggleClass('hidden', record.value === 2); if (record.value === 1) { var me = this, props = me.bulletProps, @@ -258,6 +275,9 @@ define([ }); win.show(); win.on('symbol:dblclick', handler); + } else if (record.value == 2) { // image + // need to set previous image or disable Ok button + this.isImageLoaded = false; } else if (record.value == -1) { if (this._changedProps) this._changedProps.asc_putListType(0, record.value); @@ -271,6 +291,7 @@ define([ this._changedProps.asc_putSymbol(this.bulletProps.symbol); } } + this.btnOk.setDisabled(record.value === 2 && !this.isImageLoaded); }, this)); this.spnSize = new Common.UI.MetricSpinner({ @@ -314,7 +335,32 @@ define([ } }); - me.numberingControls = $window.find('.numbering'); + this.btnSelectImage = new Common.UI.Button({ + parentEl: $('#id-dlg-list-image'), + cls: 'btn-text-menu-default', + caption: this.textSelect, + style: 'width: 100%;', + menu: new Common.UI.Menu({ + style: 'min-width: 100px;', + maxHeight: 200, + additionalAlign: this.menuAddAlign, + items: [ + {caption: this.textFromFile, value: 0}, + {caption: this.textFromUrl, value: 1}, + {caption: this.textFromStorage, value: 2} + ] + }) + }); + this.btnSelectImage.menu.on('item:click', _.bind(this.onImageSelect, this)); + this.btnSelectImage.menu.items[2].setVisible(this.storage); + + this.btnOk = new Common.UI.Button({ + el: $window.find('.primary') + }); + + me.numberingControls = $window.find('tr.numbering'); + me.imageControls = $window.find('tr.image'); + me.colorControls = $window.find('tr.color'); var el = $window.find('table tr:first() td:first()'); el.width(Math.max($window.find('.numbering .text').width(), el.width())); @@ -323,12 +369,36 @@ define([ }, getFocusedComponents: function() { - return [this.cmbNumFormat, this.cmbBulletFormat, this.spnSize, this.spnStart, this.btnColor]; + return [this.cmbNumFormat, this.cmbBulletFormat, this.btnSelectImage, this.spnSize, this.spnStart, this.btnColor]; }, afterRender: function() { this.updateThemeColors(); this._setDefaults(this.props); + + var me = this; + var onApiImageLoaded = function() { + me.isImageLoaded = true; + me.btnOk.setDisabled(false); + }; + this.api.asc_registerCallback('asc_onBulletImageLoaded', onApiImageLoaded); + + var insertImageFromStorage = function(data) { + if (data && data._urls && data.c=='bullet') { + if (me._changedProps) + me._changedProps.asc_putImageUrl(data._urls[0], data.token); + else if (me.originalType == AscFormat.BULLET_TYPE_BULLET_NONE) { + me._changedImageProps = new Asc.asc_CBullet(); + me._changedImageProps.asc_putImageUrl(data._urls[0], data.token); + } + } + }; + Common.NotificationCenter.on('storage:image-insert', insertImageFromStorage); + + this.on('close', function(obj){ + me.api.asc_unregisterCallback('asc_onBulletImageLoaded', onApiImageLoaded); + Common.NotificationCenter.off('storage:image-insert', insertImageFromStorage); + }); }, updateThemeColors: function() { @@ -347,9 +417,13 @@ define([ }, ShowHideElem: function(value) { + var isImage = value==0 && this.cmbBulletFormat.getValue()===2; this.numberingControls.toggleClass('hidden', value==0); + this.imageControls.toggleClass('hidden', !isImage); + this.colorControls.toggleClass('hidden', isImage); this.cmbNumFormat.setVisible(value==1); this.cmbBulletFormat.setVisible(value==0); + this.btnOk.setDisabled(isImage && !this.isImageLoaded); var me = this; _.delay(function(){ if (value) @@ -362,18 +436,29 @@ define([ _handleInput: function(state) { if (this.options.handler) { + if (state == 'ok' && this.btnOk.isDisabled()) { + return; + } var type = this.btnBullet.pressed ? 0 : 1; if (this.originalType == AscFormat.BULLET_TYPE_BULLET_NONE) { - this._changedProps = new Asc.asc_CBullet(); - this._changedProps.asc_putColor(Common.Utils.ThemeColor.getRgbColor(this.color)); - this._changedProps.asc_putSize(this.spnSize.getNumberValue()); + if (type==0 && this.cmbBulletFormat.getValue()==2 && this._changedImageProps) {//image + this._changedProps = this._changedImageProps; + this._changedProps.asc_putSize(this.spnSize.getNumberValue()); + } else { + this._changedProps = new Asc.asc_CBullet(); + this._changedProps.asc_putColor(Common.Utils.ThemeColor.getRgbColor(this.color)); + this._changedProps.asc_putSize(this.spnSize.getNumberValue()); + } } if (this.originalType == AscFormat.BULLET_TYPE_BULLET_NONE || - this.originalType == AscFormat.BULLET_TYPE_BULLET_CHAR && type==1 || this.originalType == AscFormat.BULLET_TYPE_BULLET_AUTONUM && type==0) { // changed list type + (this.originalType == AscFormat.BULLET_TYPE_BULLET_CHAR || this.originalType == AscFormat.BULLET_TYPE_BULLET_BLIP) && type==1 || + this.originalType == AscFormat.BULLET_TYPE_BULLET_AUTONUM && type==0) { // changed list type if (type==0) {//markers if (this.cmbBulletFormat.getValue()==-1) { this._changedProps.asc_putListType(0, -1); + } else if (this.cmbBulletFormat.getValue()==2) { + } else { this._changedProps.asc_putFont(this.bulletProps.font); this._changedProps.asc_putSymbol(this.bulletProps.symbol); @@ -446,6 +531,11 @@ define([ this.cmbBulletFormat.setValue(''); this._changedProps = bullet; type = 0; + } else if (this.originalType == AscFormat.BULLET_TYPE_BULLET_BLIP) { + this.cmbBulletFormat.selectRecord(this.cmbBulletFormat.store.findWhere({value: 2})); + this._changedProps = bullet; + this.isImageLoaded = true; + type = 0; } else if (this.originalType == AscFormat.BULLET_TYPE_BULLET_AUTONUM) { var autonum = bullet.asc_getAutoNumType(); this.cmbNumFormat.setValue(autonum, ''); @@ -468,6 +558,36 @@ define([ this.ShowHideElem(type); }, + onImageSelect: function(menu, item) { + if (item.value==1) { + var me = this; + (new Common.Views.ImageFromUrlDialog({ + handler: function(result, value) { + if (result == 'ok') { + var checkUrl = value.replace(/ /g, ''); + if (!_.isEmpty(checkUrl)) { + if (me._changedProps) + me._changedProps.asc_putImageUrl(checkUrl); + else if (me.originalType == AscFormat.BULLET_TYPE_BULLET_NONE) { + me._changedImageProps = new Asc.asc_CBullet(); + me._changedImageProps.asc_putImageUrl(checkUrl); + } + } + } + } + })).show(); + } else if (item.value==2) { + Common.NotificationCenter.trigger('storage:image-load', 'bullet'); + } else { + if (this._changedProps) + this._changedProps.asc_showFileDialog(); + else if (this.originalType == AscFormat.BULLET_TYPE_BULLET_NONE) { + this._changedImageProps = new Asc.asc_CBullet(); + this._changedImageProps.asc_showFileDialog(); + } + } + }, + txtTitle: 'List Settings', txtSize: 'Size', txtColor: 'Color', @@ -478,6 +598,13 @@ define([ txtType: 'Type', txtNone: 'None', txtNewBullet: 'New bullet', - txtSymbol: 'Symbol' + txtSymbol: 'Symbol', + txtNewImage: 'New image', + txtImage: 'Image', + txtImport: 'Import', + textSelect: 'Select From', + textFromUrl: 'From URL', + textFromFile: 'From File', + textFromStorage: 'From Storage' }, Common.Views.ListSettingsDialog || {})) }); \ No newline at end of file diff --git a/apps/presentationeditor/main/app/controller/Toolbar.js b/apps/presentationeditor/main/app/controller/Toolbar.js index c3c8b631a..24a347103 100644 --- a/apps/presentationeditor/main/app/controller/Toolbar.js +++ b/apps/presentationeditor/main/app/controller/Toolbar.js @@ -1247,6 +1247,7 @@ define([ api: me.api, props: props, type: type, + storage: me.mode.canRequestInsertImage || me.mode.fileChoiceUrl && me.mode.fileChoiceUrl.indexOf("{documentType}")>-1, interfaceLang: me.toolbar.mode.lang, handler: function(result, value) { if (result == 'ok') { From dd95cc20eb7dfc6a11c6a4c13cea746cf0f5dcc0 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Mon, 11 Apr 2022 19:49:58 +0300 Subject: [PATCH 02/16] [PE] Refactoring bulleted list --- .../main/lib/view/ListSettingsDialog.js | 132 ++++++++++-------- 1 file changed, 71 insertions(+), 61 deletions(-) diff --git a/apps/common/main/lib/view/ListSettingsDialog.js b/apps/common/main/lib/view/ListSettingsDialog.js index e473dde36..02934a0ac 100644 --- a/apps/common/main/lib/view/ListSettingsDialog.js +++ b/apps/common/main/lib/view/ListSettingsDialog.js @@ -50,6 +50,13 @@ define([ 'common/main/lib/view/SymbolTableDialog' ], function () { 'use strict'; + var _BulletTypes = {}; + _BulletTypes.none = -1; + _BulletTypes.symbol = 0; + _BulletTypes.image = 2; + _BulletTypes.newSymbol = 1; + _BulletTypes.newImage = -2; + Common.Views.ListSettingsDialog = Common.UI.Window.extend(_.extend({ options: { type: 0, // 0 - markers, 1 - numbers @@ -134,7 +141,6 @@ define([ this.color = '000000'; this.storage = !!options.storage; this.api = options.api; - this.isImageLoaded = false; Common.UI.Window.prototype.initialize.call(this, this.options); }, @@ -213,24 +219,26 @@ define([ template : _.template(template.join('')), itemsTemplate: _.template(itemsTemplate.join('')), data : [ - { displayValue: this.txtNone, value: -1 }, - { displayValue: this.txtSymbol + ': ', value: 0, symbol: "•", font: 'Arial' }, - { displayValue: this.txtSymbol + ': ', value: 0, symbol: "o", font: 'Courier New' }, - { displayValue: this.txtSymbol + ': ', value: 0, symbol: "§", font: 'Wingdings' }, - { displayValue: this.txtSymbol + ': ', value: 0, symbol: "v", font: 'Wingdings' }, - { displayValue: this.txtSymbol + ': ', value: 0, symbol: "Ø", font: 'Wingdings' }, - { displayValue: this.txtSymbol + ': ', value: 0, symbol: "ü", font: 'Wingdings' }, - { displayValue: this.txtSymbol + ': ', value: 0, symbol: "w", font: 'Wingdings' }, - { displayValue: this.txtSymbol + ': ', value: 0, symbol: "–", font: 'Arial' }, - { displayValue: this.txtNewBullet, value: 1 }, - { displayValue: this.txtNewImage, value: 2 } + { displayValue: this.txtNone, value: _BulletTypes.none }, + { displayValue: this.txtSymbol + ': ', value: _BulletTypes.symbol, symbol: "•", font: 'Arial' }, + { displayValue: this.txtSymbol + ': ', value: _BulletTypes.symbol, symbol: "o", font: 'Courier New' }, + { displayValue: this.txtSymbol + ': ', value: _BulletTypes.symbol, symbol: "§", font: 'Wingdings' }, + { displayValue: this.txtSymbol + ': ', value: _BulletTypes.symbol, symbol: "v", font: 'Wingdings' }, + { displayValue: this.txtSymbol + ': ', value: _BulletTypes.symbol, symbol: "Ø", font: 'Wingdings' }, + { displayValue: this.txtSymbol + ': ', value: _BulletTypes.symbol, symbol: "ü", font: 'Wingdings' }, + { displayValue: this.txtSymbol + ': ', value: _BulletTypes.symbol, symbol: "w", font: 'Wingdings' }, + { displayValue: this.txtSymbol + ': ', value: _BulletTypes.symbol, symbol: "–", font: 'Arial' }, + { displayValue: this.txtNewBullet, value: _BulletTypes.newSymbol }, + { displayValue: this.txtNewImage, value: _BulletTypes.newImage } ], updateFormControl: function(record) { var formcontrol = $(this.el).find('.form-control'); if (record) { - if (record.get('value')==0) + if (record.get('value')===_BulletTypes.symbol) formcontrol[0].innerHTML = record.get('displayValue') + '' + record.get('symbol') + ''; - else if (record.get('value')==2) + else if (record.get('value')===_BulletTypes.image) + formcontrol[0].innerHTML = me.txtImage; + else if (record.get('value')===_BulletTypes.newImage) formcontrol[0].innerHTML = me.txtImage; else formcontrol[0].innerHTML = record.get('displayValue'); @@ -242,9 +250,9 @@ define([ this.cmbBulletFormat.selectRecord(rec); this.bulletProps = {symbol: rec.get('symbol'), font: rec.get('font')}; this.cmbBulletFormat.on('selected', _.bind(function (combo, record) { - this.imageControls.toggleClass('hidden', record.value !== 2); - this.colorControls.toggleClass('hidden', record.value === 2); - if (record.value === 1) { + this.imageControls.toggleClass('hidden', !(record.value === _BulletTypes.image || record.value === _BulletTypes.newImage)); + this.colorControls.toggleClass('hidden', record.value === _BulletTypes.image || record.value === _BulletTypes.newImage); + if (record.value === _BulletTypes.newSymbol) { var me = this, props = me.bulletProps, handler = function(dlg, result, settings) { @@ -259,10 +267,14 @@ define([ } } var store = combo.store; - if (!store.findWhere({value: 0, symbol: props.symbol, font: props.font})) - store.add({ displayValue: me.txtSymbol + ': ', value: 0, symbol: props.symbol, font: props.font }, {at: store.length-1}); + if (!store.findWhere({value: _BulletTypes.symbol, symbol: props.symbol, font: props.font})) { + var idx = store.indexOf(store.findWhere({value: _BulletTypes.image})); + if (idx<0) + idx = store.indexOf(store.findWhere({value: _BulletTypes.newSymbol})); + store.add({ displayValue: me.txtSymbol + ': ', value: _BulletTypes.symbol, symbol: props.symbol, font: props.font }, {at: idx}); + } combo.setData(store.models); - combo.selectRecord(combo.store.findWhere({value: 0, symbol: props.symbol, font: props.font})); + combo.selectRecord(combo.store.findWhere({value: _BulletTypes.symbol, symbol: props.symbol, font: props.font})); }, win = new Common.Views.SymbolTableDialog({ api: me.options.api, @@ -275,10 +287,11 @@ define([ }); win.show(); win.on('symbol:dblclick', handler); - } else if (record.value == 2) { // image - // need to set previous image or disable Ok button - this.isImageLoaded = false; - } else if (record.value == -1) { + } else if (record.value == _BulletTypes.newImage) { // new image + } else if (record.value == _BulletTypes.image) { // image + if (this._changedProps) + this._changedProps.asc_fillBulletImage(this.imageProps.id); + } else if (record.value == _BulletTypes.none) { if (this._changedProps) this._changedProps.asc_putListType(0, record.value); } else { @@ -291,7 +304,7 @@ define([ this._changedProps.asc_putSymbol(this.bulletProps.symbol); } } - this.btnOk.setDisabled(record.value === 2 && !this.isImageLoaded); + this.btnOk.setDisabled(record.value === _BulletTypes.newImage); }, this)); this.spnSize = new Common.UI.MetricSpinner({ @@ -377,20 +390,25 @@ define([ this._setDefaults(this.props); var me = this; - var onApiImageLoaded = function() { - me.isImageLoaded = true; + var onApiImageLoaded = function(bullet) { + me.imageProps = {id: bullet.asc_getImageId()}; + if (me._changedProps) + me._changedProps.asc_fillBulletImage(me.imageProps.id); + // add or update record for image to btnBulletFormat and select it + var store = me.cmbBulletFormat.store; + if (!store.findWhere({value: _BulletTypes.image})) { + var idx = store.indexOf(store.findWhere({value: _BulletTypes.newSymbol})); + store.add({ displayValue: me.txtImage, value: _BulletTypes.image }, {at: idx}); + } + me.cmbBulletFormat.setData(store.models); + me.cmbBulletFormat.selectRecord(me.cmbBulletFormat.store.findWhere({value: _BulletTypes.image})); me.btnOk.setDisabled(false); }; this.api.asc_registerCallback('asc_onBulletImageLoaded', onApiImageLoaded); var insertImageFromStorage = function(data) { if (data && data._urls && data.c=='bullet') { - if (me._changedProps) - me._changedProps.asc_putImageUrl(data._urls[0], data.token); - else if (me.originalType == AscFormat.BULLET_TYPE_BULLET_NONE) { - me._changedImageProps = new Asc.asc_CBullet(); - me._changedImageProps.asc_putImageUrl(data._urls[0], data.token); - } + (new Asc.asc_CBullet()).asc_putImageUrl(data._urls[0], data.token); } }; Common.NotificationCenter.on('storage:image-insert', insertImageFromStorage); @@ -417,13 +435,13 @@ define([ }, ShowHideElem: function(value) { - var isImage = value==0 && this.cmbBulletFormat.getValue()===2; + var isImage = value==0 && (this.cmbBulletFormat.getValue()===_BulletTypes.image || this.cmbBulletFormat.getValue()===_BulletTypes.newImage); this.numberingControls.toggleClass('hidden', value==0); this.imageControls.toggleClass('hidden', !isImage); this.colorControls.toggleClass('hidden', isImage); this.cmbNumFormat.setVisible(value==1); this.cmbBulletFormat.setVisible(value==0); - this.btnOk.setDisabled(isImage && !this.isImageLoaded); + this.btnOk.setDisabled(isImage && (this.cmbBulletFormat.getValue()===_BulletTypes.newImage)); var me = this; _.delay(function(){ if (value) @@ -441,13 +459,12 @@ define([ } var type = this.btnBullet.pressed ? 0 : 1; if (this.originalType == AscFormat.BULLET_TYPE_BULLET_NONE) { - if (type==0 && this.cmbBulletFormat.getValue()==2 && this._changedImageProps) {//image - this._changedProps = this._changedImageProps; - this._changedProps.asc_putSize(this.spnSize.getNumberValue()); + this._changedProps = new Asc.asc_CBullet(); + this._changedProps.asc_putSize(this.spnSize.getNumberValue()); + if (type==0 && this.cmbBulletFormat.getValue()===_BulletTypes.image && this.imageProps) {//image + this._changedProps.asc_fillBulletImage(this.imageProps.id); } else { - this._changedProps = new Asc.asc_CBullet(); this._changedProps.asc_putColor(Common.Utils.ThemeColor.getRgbColor(this.color)); - this._changedProps.asc_putSize(this.spnSize.getNumberValue()); } } @@ -455,9 +472,9 @@ define([ (this.originalType == AscFormat.BULLET_TYPE_BULLET_CHAR || this.originalType == AscFormat.BULLET_TYPE_BULLET_BLIP) && type==1 || this.originalType == AscFormat.BULLET_TYPE_BULLET_AUTONUM && type==0) { // changed list type if (type==0) {//markers - if (this.cmbBulletFormat.getValue()==-1) { + if (this.cmbBulletFormat.getValue()==_BulletTypes.none) { this._changedProps.asc_putListType(0, -1); - } else if (this.cmbBulletFormat.getValue()==2) { + } else if (this.cmbBulletFormat.getValue()==_BulletTypes.image) { } else { this._changedProps.asc_putFont(this.bulletProps.font); @@ -517,24 +534,27 @@ define([ if (this.originalType == AscFormat.BULLET_TYPE_BULLET_NONE) { this.cmbNumFormat.setValue(-1); - this.cmbBulletFormat.setValue(-1); + this.cmbBulletFormat.setValue(_BulletTypes.none); type = this.type; } else if (this.originalType == AscFormat.BULLET_TYPE_BULLET_CHAR) { var symbol = bullet.asc_getSymbol(); if (symbol) { this.bulletProps = {symbol: symbol, font: bullet.asc_getFont()}; - if (!this.cmbBulletFormat.store.findWhere({value: 0, symbol: this.bulletProps.symbol, font: this.bulletProps.font})) - this.cmbBulletFormat.store.add({ displayValue: this.txtSymbol + ': ', value: 0, symbol: this.bulletProps.symbol, font: this.bulletProps.font }, {at: this.cmbBulletFormat.store.length-1}); + if (!this.cmbBulletFormat.store.findWhere({value: _BulletTypes.symbol, symbol: this.bulletProps.symbol, font: this.bulletProps.font})) + this.cmbBulletFormat.store.add({ displayValue: this.txtSymbol + ': ', value: _BulletTypes.symbol, symbol: this.bulletProps.symbol, font: this.bulletProps.font }, {at: this.cmbBulletFormat.store.length-2}); this.cmbBulletFormat.setData(this.cmbBulletFormat.store.models); - this.cmbBulletFormat.selectRecord(this.cmbBulletFormat.store.findWhere({value: 0, symbol: this.bulletProps.symbol, font: this.bulletProps.font})); + this.cmbBulletFormat.selectRecord(this.cmbBulletFormat.store.findWhere({value: _BulletTypes.symbol, symbol: this.bulletProps.symbol, font: this.bulletProps.font})); } else this.cmbBulletFormat.setValue(''); this._changedProps = bullet; type = 0; } else if (this.originalType == AscFormat.BULLET_TYPE_BULLET_BLIP) { - this.cmbBulletFormat.selectRecord(this.cmbBulletFormat.store.findWhere({value: 2})); + this.imageProps = {id: bullet.asc_getImageId()}; + if (!this.cmbBulletFormat.store.findWhere({value: _BulletTypes.image})) + this.cmbBulletFormat.store.add({ displayValue: this.txtImage, value: _BulletTypes.image}, {at: this.cmbBulletFormat.store.length-2}); + this.cmbBulletFormat.setData(this.cmbBulletFormat.store.models); + this.cmbBulletFormat.selectRecord(this.cmbBulletFormat.store.findWhere({value: _BulletTypes.image})); this._changedProps = bullet; - this.isImageLoaded = true; type = 0; } else if (this.originalType == AscFormat.BULLET_TYPE_BULLET_AUTONUM) { var autonum = bullet.asc_getAutoNumType(); @@ -548,7 +568,7 @@ define([ } } else {// different bullet types this.cmbNumFormat.setValue(-1); - this.cmbBulletFormat.setValue(-1); + this.cmbBulletFormat.setValue(_BulletTypes.none); this._changedProps = new Asc.asc_CBullet(); type = this.type; } @@ -566,12 +586,7 @@ define([ if (result == 'ok') { var checkUrl = value.replace(/ /g, ''); if (!_.isEmpty(checkUrl)) { - if (me._changedProps) - me._changedProps.asc_putImageUrl(checkUrl); - else if (me.originalType == AscFormat.BULLET_TYPE_BULLET_NONE) { - me._changedImageProps = new Asc.asc_CBullet(); - me._changedImageProps.asc_putImageUrl(checkUrl); - } + (new Asc.asc_CBullet()).asc_putImageUrl(checkUrl); } } } @@ -579,12 +594,7 @@ define([ } else if (item.value==2) { Common.NotificationCenter.trigger('storage:image-load', 'bullet'); } else { - if (this._changedProps) - this._changedProps.asc_showFileDialog(); - else if (this.originalType == AscFormat.BULLET_TYPE_BULLET_NONE) { - this._changedImageProps = new Asc.asc_CBullet(); - this._changedImageProps.asc_showFileDialog(); - } + (new Asc.asc_CBullet()).asc_showFileDialog(); } }, From ff3081bb912445a2d3adeab3027f64e5a19c8f0c Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Mon, 11 Apr 2022 23:08:36 +0300 Subject: [PATCH 03/16] [PE] Draw preview for image bullets --- .../main/lib/view/ListSettingsDialog.js | 33 ++++++++++++++----- 1 file changed, 25 insertions(+), 8 deletions(-) diff --git a/apps/common/main/lib/view/ListSettingsDialog.js b/apps/common/main/lib/view/ListSettingsDialog.js index 02934a0ac..83403445e 100644 --- a/apps/common/main/lib/view/ListSettingsDialog.js +++ b/apps/common/main/lib/view/ListSettingsDialog.js @@ -197,7 +197,9 @@ define([ [ '<% _.each(items, function(item) { %>', '
  • ', - '<%= item.displayValue %><% if (item.value === 0) { %><%=item.symbol%><% } %>', + '<%= item.displayValue %>', + '<% if (item.value === 0) { %><%=item.symbol%>', + '<% } else if (item.value === 2) { %><% } %>', '
  • ', '<% }); %>' ]; @@ -236,9 +238,12 @@ define([ if (record) { if (record.get('value')===_BulletTypes.symbol) formcontrol[0].innerHTML = record.get('displayValue') + '' + record.get('symbol') + ''; - else if (record.get('value')===_BulletTypes.image) - formcontrol[0].innerHTML = me.txtImage; - else if (record.get('value')===_BulletTypes.newImage) + else if (record.get('value')===_BulletTypes.image) { + formcontrol[0].innerHTML = record.get('displayValue') + ''; + var bullet = new Asc.asc_CBullet(); + bullet.asc_fillBulletImage(me.imageProps.id); + bullet.drawSquareImage('id-dlg-list-bullet-combo-preview'); + } else if (record.get('value')===_BulletTypes.newImage) formcontrol[0].innerHTML = me.txtImage; else formcontrol[0].innerHTML = record.get('displayValue'); @@ -306,6 +311,7 @@ define([ } this.btnOk.setDisabled(record.value === _BulletTypes.newImage); }, this)); + this.cmbBulletFormat.on('show:after', _.bind(this.onBulletFormatOpen, this)); this.spnSize = new Common.UI.MetricSpinner({ el : $window.find('#id-dlg-list-size'), @@ -391,14 +397,14 @@ define([ var me = this; var onApiImageLoaded = function(bullet) { - me.imageProps = {id: bullet.asc_getImageId()}; + me.imageProps = {id: bullet.asc_getImageId(), redraw: true}; if (me._changedProps) me._changedProps.asc_fillBulletImage(me.imageProps.id); // add or update record for image to btnBulletFormat and select it var store = me.cmbBulletFormat.store; if (!store.findWhere({value: _BulletTypes.image})) { var idx = store.indexOf(store.findWhere({value: _BulletTypes.newSymbol})); - store.add({ displayValue: me.txtImage, value: _BulletTypes.image }, {at: idx}); + store.add({ displayValue: me.txtImage + ':', value: _BulletTypes.image }, {at: idx}); } me.cmbBulletFormat.setData(store.models); me.cmbBulletFormat.selectRecord(me.cmbBulletFormat.store.findWhere({value: _BulletTypes.image})); @@ -419,6 +425,17 @@ define([ }); }, + onBulletFormatOpen: function(combo) { + var store = combo.store, + rec = store.findWhere({value: _BulletTypes.image}); + if (rec && this.imageProps.redraw) { + var bullet = new Asc.asc_CBullet(); + bullet.asc_fillBulletImage(this.imageProps.id); + bullet.drawSquareImage('id-dlg-list-bullet-image-preview'); + this.imageProps.redraw = false; + } + }, + updateThemeColors: function() { this.colors.updateColors(Common.Utils.ThemeColor.getEffectColors(), Common.Utils.ThemeColor.getStandartColors()); }, @@ -549,9 +566,9 @@ define([ this._changedProps = bullet; type = 0; } else if (this.originalType == AscFormat.BULLET_TYPE_BULLET_BLIP) { - this.imageProps = {id: bullet.asc_getImageId()}; + this.imageProps = {id: bullet.asc_getImageId(), redraw: true}; if (!this.cmbBulletFormat.store.findWhere({value: _BulletTypes.image})) - this.cmbBulletFormat.store.add({ displayValue: this.txtImage, value: _BulletTypes.image}, {at: this.cmbBulletFormat.store.length-2}); + this.cmbBulletFormat.store.add({ displayValue: this.txtImage + ':', value: _BulletTypes.image}, {at: this.cmbBulletFormat.store.length-2}); this.cmbBulletFormat.setData(this.cmbBulletFormat.store.models); this.cmbBulletFormat.selectRecord(this.cmbBulletFormat.store.findWhere({value: _BulletTypes.image})); this._changedProps = bullet; From 5b7672aa70cb8739f721786c365036f56a1b62e8 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Tue, 12 Apr 2022 00:11:09 +0300 Subject: [PATCH 04/16] [PE] Fix style for bullets list --- apps/common/main/lib/view/ListSettingsDialog.js | 4 ++-- apps/common/main/resources/less/combobox.less | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/apps/common/main/lib/view/ListSettingsDialog.js b/apps/common/main/lib/view/ListSettingsDialog.js index 83403445e..15d7d4cf9 100644 --- a/apps/common/main/lib/view/ListSettingsDialog.js +++ b/apps/common/main/lib/view/ListSettingsDialog.js @@ -199,7 +199,7 @@ define([ '
  • ', '<%= item.displayValue %>', '<% if (item.value === 0) { %><%=item.symbol%>', - '<% } else if (item.value === 2) { %><% } %>', + '<% } else if (item.value === 2) { %><% } %>', '
  • ', '<% }); %>' ]; @@ -239,7 +239,7 @@ define([ if (record.get('value')===_BulletTypes.symbol) formcontrol[0].innerHTML = record.get('displayValue') + '' + record.get('symbol') + ''; else if (record.get('value')===_BulletTypes.image) { - formcontrol[0].innerHTML = record.get('displayValue') + ''; + formcontrol[0].innerHTML = record.get('displayValue') + ''; var bullet = new Asc.asc_CBullet(); bullet.asc_fillBulletImage(me.imageProps.id); bullet.drawSquareImage('id-dlg-list-bullet-combo-preview'); diff --git a/apps/common/main/resources/less/combobox.less b/apps/common/main/resources/less/combobox.less index d561e6ee7..4b8615ed6 100644 --- a/apps/common/main/resources/less/combobox.less +++ b/apps/common/main/resources/less/combobox.less @@ -144,7 +144,7 @@ -webkit-filter: @img-border-type-filter; filter: @img-border-type-filter; } - canvas { + .font-item canvas { -webkit-filter: @img-border-type-filter; filter: @img-border-type-filter; } @@ -154,7 +154,7 @@ -webkit-filter: @img-border-type-filter-selected; filter: @img-border-type-filter-selected; } - canvas { + .font-item canvas { -webkit-filter: @img-border-type-filter-selected; filter: @img-border-type-filter-selected; } From 3bae3965b1d88061bc666547daef9e916f7b1637 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Wed, 13 Apr 2022 10:36:38 +0300 Subject: [PATCH 05/16] [PE] Fix different bullet types --- apps/common/main/lib/view/ListSettingsDialog.js | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/apps/common/main/lib/view/ListSettingsDialog.js b/apps/common/main/lib/view/ListSettingsDialog.js index 15d7d4cf9..cb48d3392 100644 --- a/apps/common/main/lib/view/ListSettingsDialog.js +++ b/apps/common/main/lib/view/ListSettingsDialog.js @@ -566,11 +566,15 @@ define([ this._changedProps = bullet; type = 0; } else if (this.originalType == AscFormat.BULLET_TYPE_BULLET_BLIP) { - this.imageProps = {id: bullet.asc_getImageId(), redraw: true}; - if (!this.cmbBulletFormat.store.findWhere({value: _BulletTypes.image})) - this.cmbBulletFormat.store.add({ displayValue: this.txtImage + ':', value: _BulletTypes.image}, {at: this.cmbBulletFormat.store.length-2}); - this.cmbBulletFormat.setData(this.cmbBulletFormat.store.models); - this.cmbBulletFormat.selectRecord(this.cmbBulletFormat.store.findWhere({value: _BulletTypes.image})); + var id = bullet.asc_getImageId(); + if (id) { + this.imageProps = {id: id, redraw: true}; + if (!this.cmbBulletFormat.store.findWhere({value: _BulletTypes.image})) + this.cmbBulletFormat.store.add({ displayValue: this.txtImage + ':', value: _BulletTypes.image}, {at: this.cmbBulletFormat.store.length-2}); + this.cmbBulletFormat.setData(this.cmbBulletFormat.store.models); + this.cmbBulletFormat.selectRecord(this.cmbBulletFormat.store.findWhere({value: _BulletTypes.image})); + } else + this.cmbBulletFormat.setValue(''); this._changedProps = bullet; type = 0; } else if (this.originalType == AscFormat.BULLET_TYPE_BULLET_AUTONUM) { From f80894376a8669cadf480d1c7c7995f64d9836db Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Wed, 13 Apr 2022 14:19:53 +0300 Subject: [PATCH 06/16] Fix coEditing = null --- apps/documenteditor/main/app/controller/Main.js | 6 +++--- apps/presentationeditor/main/app/controller/Main.js | 6 +++--- apps/spreadsheeteditor/main/app/controller/Main.js | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/apps/documenteditor/main/app/controller/Main.js b/apps/documenteditor/main/app/controller/Main.js index f841a5cf7..1d11ef161 100644 --- a/apps/documenteditor/main/app/controller/Main.js +++ b/apps/documenteditor/main/app/controller/Main.js @@ -473,7 +473,7 @@ define([ docInfo.put_Lang(this.editorConfig.lang); docInfo.put_Mode(this.editorConfig.mode); - if (typeof this.editorConfig.coEditing == 'object' && this.editorConfig.coEditing.mode!==undefined) + if (this.editorConfig.coEditing && typeof this.editorConfig.coEditing == 'object' && this.editorConfig.coEditing.mode!==undefined) docInfo.put_CoEditingMode(this.editorConfig.coEditing.mode); var enable = !this.editorConfig.customization || (this.editorConfig.customization.macros!==false); @@ -1548,8 +1548,8 @@ define([ Common.NotificationCenter.on('comments:showdummy', _.bind(this.onShowDummyComment, this)); // change = true by default in editor, change = false by default in viewer - this.appOptions.canChangeCoAuthoring = this.appOptions.isEdit && this.appOptions.canCoAuthoring && !(typeof this.editorConfig.coEditing == 'object' && this.editorConfig.coEditing.change===false) || - !this.appOptions.isEdit && !this.appOptions.isRestrictedEdit && (typeof this.editorConfig.coEditing == 'object' && this.editorConfig.coEditing.change===true) ; + this.appOptions.canChangeCoAuthoring = this.appOptions.isEdit && this.appOptions.canCoAuthoring && !(this.editorConfig.coEditing && this.editorConfig.coEditing.change===false) || + !this.appOptions.isEdit && !this.appOptions.isRestrictedEdit && (this.editorConfig.coEditing && this.editorConfig.coEditing.change===true) ; this.loadCoAuthSettings(); this.applyModeCommonElements(); diff --git a/apps/presentationeditor/main/app/controller/Main.js b/apps/presentationeditor/main/app/controller/Main.js index 69237409d..fc939b9bc 100644 --- a/apps/presentationeditor/main/app/controller/Main.js +++ b/apps/presentationeditor/main/app/controller/Main.js @@ -430,7 +430,7 @@ define([ docInfo.put_Lang(this.editorConfig.lang); docInfo.put_Mode(this.editorConfig.mode); - if (typeof this.editorConfig.coEditing == 'object' && this.editorConfig.coEditing.mode!==undefined) + if (this.editorConfig.coEditing && typeof this.editorConfig.coEditing == 'object' && this.editorConfig.coEditing.mode!==undefined) docInfo.put_CoEditingMode(this.editorConfig.coEditing.mode); var enable = !this.editorConfig.customization || (this.editorConfig.customization.macros!==false); @@ -1195,8 +1195,8 @@ define([ this.editorConfig.customization && Common.UI.FeaturesManager.init(this.editorConfig.customization.features, this.appOptions.canBrandingExt); // change = true by default in editor, change = false by default in viewer - this.appOptions.canChangeCoAuthoring = this.appOptions.isEdit && this.appOptions.canCoAuthoring && !(typeof this.editorConfig.coEditing == 'object' && this.editorConfig.coEditing.change===false) || - !this.appOptions.isEdit && !this.appOptions.isRestrictedEdit && (typeof this.editorConfig.coEditing == 'object' && this.editorConfig.coEditing.change===true) ; + this.appOptions.canChangeCoAuthoring = this.appOptions.isEdit && this.appOptions.canCoAuthoring && !(this.editorConfig.coEditing && this.editorConfig.coEditing.change===false) || + !this.appOptions.isEdit && !this.appOptions.isRestrictedEdit && (this.editorConfig.coEditing && this.editorConfig.coEditing.change===true) ; this.loadCoAuthSettings(); this.applyModeCommonElements(); diff --git a/apps/spreadsheeteditor/main/app/controller/Main.js b/apps/spreadsheeteditor/main/app/controller/Main.js index e38e48a33..bbc3c28db 100644 --- a/apps/spreadsheeteditor/main/app/controller/Main.js +++ b/apps/spreadsheeteditor/main/app/controller/Main.js @@ -504,7 +504,7 @@ define([ docInfo.put_Lang(this.editorConfig.lang); docInfo.put_Mode(this.editorConfig.mode); - if (typeof this.editorConfig.coEditing == 'object' && this.editorConfig.coEditing.mode!==undefined) + if (this.editorConfig.coEditing && typeof this.editorConfig.coEditing == 'object' && this.editorConfig.coEditing.mode!==undefined) docInfo.put_CoEditingMode(this.editorConfig.coEditing.mode); var enable = !this.editorConfig.customization || (this.editorConfig.customization.macros!==false); @@ -1284,8 +1284,8 @@ define([ // change = true by default in editor, change = false by default in viewer this.appOptions.canChangeCoAuthoring = this.appOptions.isEdit && !(this.appOptions.isEditDiagram || this.appOptions.isEditMailMerge || this.appOptions.isEditOle) && this.appOptions.canCoAuthoring && - !(typeof this.editorConfig.coEditing == 'object' && this.editorConfig.coEditing.change===false) || - !this.appOptions.isEdit && !this.appOptions.isRestrictedEdit && (typeof this.editorConfig.coEditing == 'object' && this.editorConfig.coEditing.change===true) ; + !(this.editorConfig.coEditing && this.editorConfig.coEditing.change===false) || + !this.appOptions.isEdit && !this.appOptions.isRestrictedEdit && (this.editorConfig.coEditing && this.editorConfig.coEditing.change===true) ; if (!this.appOptions.isEditDiagram && !this.appOptions.isEditMailMerge && !this.appOptions.isEditOle) { this.appOptions.canBrandingExt = params.asc_getCanBranding() && (typeof this.editorConfig.customization == 'object' || this.editorConfig.plugins); From 97e7c43e9342c3d79f9916018a62bca1a0b29e8d Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Wed, 13 Apr 2022 14:20:11 +0300 Subject: [PATCH 07/16] [SSE] Add loading bullet from storage --- apps/spreadsheeteditor/main/app/controller/DocumentHolder.js | 1 + 1 file changed, 1 insertion(+) diff --git a/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js b/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js index ea87aa03a..e64eca38d 100644 --- a/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js +++ b/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js @@ -915,6 +915,7 @@ define([ api: me.api, props: props, type: 0, + storage: me.permissions.canRequestInsertImage || me.permissions.fileChoiceUrl && me.permissions.fileChoiceUrl.indexOf("{documentType}")>-1, interfaceLang: me.permissions.lang, handler: function(result, value) { if (result == 'ok') { From 0a3f0b973b9449e7209a06ecb074c89addd163c5 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Wed, 13 Apr 2022 16:59:46 +0300 Subject: [PATCH 08/16] [PE][SSE] Fix list settings for different image bullets --- apps/common/main/lib/view/ListSettingsDialog.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/apps/common/main/lib/view/ListSettingsDialog.js b/apps/common/main/lib/view/ListSettingsDialog.js index cb48d3392..4df5c4906 100644 --- a/apps/common/main/lib/view/ListSettingsDialog.js +++ b/apps/common/main/lib/view/ListSettingsDialog.js @@ -452,7 +452,8 @@ define([ }, ShowHideElem: function(value) { - var isImage = value==0 && (this.cmbBulletFormat.getValue()===_BulletTypes.image || this.cmbBulletFormat.getValue()===_BulletTypes.newImage); + var isImage = value==0 && (this.cmbBulletFormat.getValue()===_BulletTypes.image || this.cmbBulletFormat.getValue()===_BulletTypes.newImage || + (this.cmbBulletFormat.getValue()===undefined || this.cmbBulletFormat.getValue()==='') && this.originalType === AscFormat.BULLET_TYPE_BULLET_BLIP); this.numberingControls.toggleClass('hidden', value==0); this.imageControls.toggleClass('hidden', !isImage); this.colorControls.toggleClass('hidden', isImage); From 65e574112b3998eb6eaf9c707ea4b30f13183f84 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Fri, 6 May 2022 10:34:00 +0300 Subject: [PATCH 09/16] [PE] Draw bullets --- .../main/app/controller/Toolbar.js | 4 ++- .../main/app/view/Toolbar.js | 34 +++++++++---------- 2 files changed, 20 insertions(+), 18 deletions(-) diff --git a/apps/presentationeditor/main/app/controller/Toolbar.js b/apps/presentationeditor/main/app/controller/Toolbar.js index 24a347103..f46a9a62c 100644 --- a/apps/presentationeditor/main/app/controller/Toolbar.js +++ b/apps/presentationeditor/main/app/controller/Toolbar.js @@ -1359,7 +1359,9 @@ define([ var store = picker.store; var arr = []; store.each(function(item){ - arr.push(item.get('id')); + var data = item.get('drawdata'); + data['divId'] = item.get('id'); + arr.push(data); }); if (this.api && this.api.SetDrawImagePreviewBulletForMenu) { this.api.SetDrawImagePreviewBulletForMenu(arr, type); diff --git a/apps/presentationeditor/main/app/view/Toolbar.js b/apps/presentationeditor/main/app/view/Toolbar.js index 330f02d09..835052a69 100644 --- a/apps/presentationeditor/main/app/view/Toolbar.js +++ b/apps/presentationeditor/main/app/view/Toolbar.js @@ -1467,15 +1467,15 @@ define([ allowScrollbar: false, delayRenderTips: true, store: new Common.UI.DataViewStore([ - {id: 'id-markers-' + Common.UI.getId(), data: {type: 0, subtype: -1}, skipRenderOnChange: true, tip: this.tipNone}, - {id: 'id-markers-' + Common.UI.getId(), data: {type: 0, subtype: 1}, skipRenderOnChange: true, tip: this.tipMarkersFRound}, - {id: 'id-markers-' + Common.UI.getId(), data: {type: 0, subtype: 2}, skipRenderOnChange: true, tip: this.tipMarkersHRound}, - {id: 'id-markers-' + Common.UI.getId(), data: {type: 0, subtype: 3}, skipRenderOnChange: true, tip: this.tipMarkersFSquare}, - {id: 'id-markers-' + Common.UI.getId(), data: {type: 0, subtype: 4}, skipRenderOnChange: true, tip: this.tipMarkersStar}, - {id: 'id-markers-' + Common.UI.getId(), data: {type: 0, subtype: 5}, skipRenderOnChange: true, tip: this.tipMarkersArrow}, - {id: 'id-markers-' + Common.UI.getId(), data: {type: 0, subtype: 6}, skipRenderOnChange: true, tip: this.tipMarkersCheckmark}, - {id: 'id-markers-' + Common.UI.getId(), data: {type: 0, subtype: 7}, skipRenderOnChange: true, tip: this.tipMarkersFRhombus}, - {id: 'id-markers-' + Common.UI.getId(), data: {type: 0, subtype: 8}, skipRenderOnChange: true, tip: this.tipMarkersDash} + {id: 'id-markers-' + Common.UI.getId(), data: {type: 0, subtype: -1},drawdata: {type: Asc.asc_PreviewBulletType.text, text: 'None'}, skipRenderOnChange: true, tip: this.tipNone}, + {id: 'id-markers-' + Common.UI.getId(), data: {type: 0, subtype: 1}, drawdata: {type: Asc.asc_PreviewBulletType.char, char: String.fromCharCode(0x00B7),specialFont: 'Symbol'}, skipRenderOnChange: true, tip: this.tipMarkersFRound}, + {id: 'id-markers-' + Common.UI.getId(), data: {type: 0, subtype: 2}, drawdata: {type: Asc.asc_PreviewBulletType.char, char: 'o', specialFont: 'Courier New'}, skipRenderOnChange: true, tip: this.tipMarkersHRound}, + {id: 'id-markers-' + Common.UI.getId(), data: {type: 0, subtype: 3}, drawdata: {type: Asc.asc_PreviewBulletType.char, char: String.fromCharCode(0x00A7), specialFont: 'Wingdings'}, skipRenderOnChange: true, tip: this.tipMarkersFSquare}, + {id: 'id-markers-' + Common.UI.getId(), data: {type: 0, subtype: 4}, drawdata: {type: Asc.asc_PreviewBulletType.char, char: String.fromCharCode(0x0076), specialFont: 'Wingdings'}, skipRenderOnChange: true, tip: this.tipMarkersStar}, + {id: 'id-markers-' + Common.UI.getId(), data: {type: 0, subtype: 5}, drawdata: {type: Asc.asc_PreviewBulletType.char, char: String.fromCharCode(0x00D8), specialFont: 'Wingdings'}, skipRenderOnChange: true, tip: this.tipMarkersArrow}, + {id: 'id-markers-' + Common.UI.getId(), data: {type: 0, subtype: 6}, drawdata: {type: Asc.asc_PreviewBulletType.char, char: String.fromCharCode(0x00FC), specialFont: 'Wingdings'}, skipRenderOnChange: true, tip: this.tipMarkersCheckmark}, + {id: 'id-markers-' + Common.UI.getId(), data: {type: 0, subtype: 7}, drawdata: {type: Asc.asc_PreviewBulletType.char, char: String.fromCharCode(0x00A8), specialFont: 'Symbol'}, skipRenderOnChange: true, tip: this.tipMarkersFRhombus}, + {id: 'id-markers-' + Common.UI.getId(), data: {type: 0, subtype: 8}, drawdata: {type: Asc.asc_PreviewBulletType.char, char: String.fromCharCode(0x2013), specialFont: 'Arial'}, skipRenderOnChange: true, tip: this.tipMarkersDash} ]), itemTemplate: _.template('
    ') }); @@ -1491,14 +1491,14 @@ define([ allowScrollbar: false, delayRenderTips: true, store: new Common.UI.DataViewStore([ - {id: 'id-numbers-' + Common.UI.getId(), data: {type: 1, subtype: -1}, skipRenderOnChange: true, tip: this.tipNone}, - {id: 'id-numbers-' + Common.UI.getId(), data: {type: 1, subtype: 4}, skipRenderOnChange: true, tip: this.tipNumCapitalLetters}, - {id: 'id-numbers-' + Common.UI.getId(), data: {type: 1, subtype: 5}, skipRenderOnChange: true, tip: this.tipNumLettersParentheses}, - {id: 'id-numbers-' + Common.UI.getId(), data: {type: 1, subtype: 6}, skipRenderOnChange: true, tip: this.tipNumLettersPoints}, - {id: 'id-numbers-' + Common.UI.getId(), data: {type: 1, subtype: 1}, skipRenderOnChange: true, tip: this.tipNumNumbersPoint}, - {id: 'id-numbers-' + Common.UI.getId(), data: {type: 1, subtype: 2}, skipRenderOnChange: true, tip: this.tipNumNumbersParentheses}, - {id: 'id-numbers-' + Common.UI.getId(), data: {type: 1, subtype: 3}, skipRenderOnChange: true, tip: this.tipNumRoman}, - {id: 'id-numbers-' + Common.UI.getId(), data: {type: 1, subtype: 7}, skipRenderOnChange: true, tip: this.tipNumRomanSmall} + {id: 'id-numbers-' + Common.UI.getId(), data: {type: 1, subtype: -1},drawdata: {type: Asc.asc_PreviewBulletType.text, text: 'None'}, skipRenderOnChange: true, tip: this.tipNone}, + {id: 'id-numbers-' + Common.UI.getId(), data: {type: 1, subtype: 4}, drawdata: {type: Asc.asc_PreviewBulletType.number, numberingType: Asc.asc_oAscNumberingLevel.UpperLetterDot_Left}, skipRenderOnChange: true, tip: this.tipNumCapitalLetters}, + {id: 'id-numbers-' + Common.UI.getId(), data: {type: 1, subtype: 5}, drawdata: {type: Asc.asc_PreviewBulletType.number, numberingType: Asc.asc_oAscNumberingLevel.LowerLetterBracket_Left}, skipRenderOnChange: true, tip: this.tipNumLettersParentheses}, + {id: 'id-numbers-' + Common.UI.getId(), data: {type: 1, subtype: 6}, drawdata: {type: Asc.asc_PreviewBulletType.number, numberingType: Asc.asc_oAscNumberingLevel.LowerLetterDot_Left}, skipRenderOnChange: true, tip: this.tipNumLettersPoints}, + {id: 'id-numbers-' + Common.UI.getId(), data: {type: 1, subtype: 1}, drawdata: {type: Asc.asc_PreviewBulletType.number, numberingType: Asc.asc_oAscNumberingLevel.DecimalDot_Right}, skipRenderOnChange: true, tip: this.tipNumNumbersPoint}, + {id: 'id-numbers-' + Common.UI.getId(), data: {type: 1, subtype: 2}, drawdata: {type: Asc.asc_PreviewBulletType.number, numberingType: Asc.asc_oAscNumberingLevel.DecimalBracket_Right}, skipRenderOnChange: true, tip: this.tipNumNumbersParentheses}, + {id: 'id-numbers-' + Common.UI.getId(), data: {type: 1, subtype: 3}, drawdata: {type: Asc.asc_PreviewBulletType.number, numberingType: Asc.asc_oAscNumberingLevel.UpperRomanDot_Right}, skipRenderOnChange: true, tip: this.tipNumRoman}, + {id: 'id-numbers-' + Common.UI.getId(), data: {type: 1, subtype: 7}, drawdata: {type: Asc.asc_PreviewBulletType.number, numberingType: Asc.asc_oAscNumberingLevel.LowerRomanDot_Right}, skipRenderOnChange: true, tip: this.tipNumRomanSmall} ]), itemTemplate: _.template('
    ') }); From feb8ba0b56ed3a432680e91f34642dc85cdd873e Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Fri, 6 May 2022 17:27:45 +0300 Subject: [PATCH 10/16] [PE] Draw custom bullets --- .../main/app/controller/Toolbar.js | 74 +++++++++++++++++-- .../main/app/view/Toolbar.js | 29 +++++--- 2 files changed, 89 insertions(+), 14 deletions(-) diff --git a/apps/presentationeditor/main/app/controller/Toolbar.js b/apps/presentationeditor/main/app/controller/Toolbar.js index f46a9a62c..f42dd965d 100644 --- a/apps/presentationeditor/main/app/controller/Toolbar.js +++ b/apps/presentationeditor/main/app/controller/Toolbar.js @@ -513,9 +513,53 @@ define([ switch(this._state.bullets.type) { case 0: this.toolbar.btnMarkers.toggle(true, true); + var idx, + setDefault = true; if (this._state.bullets.subtype!==undefined) - this.toolbar.mnuMarkersPicker.selectByIndex(this._state.bullets.subtype, true); - else + idx = this._state.bullets.subtype; + else { + var selectedElements = this.api.getSelectedElements(), + props; + if (selectedElements && _.isArray(selectedElements)) { + for (var i = 0; i< selectedElements.length; i++) { + if (Asc.c_oAscTypeSelectElement.Paragraph == selectedElements[i].get_ObjectType()) { + props = selectedElements[i].get_ObjectValue(); + break; + } + } + } + if (props) { + var bullet = props.asc_getBullet(); + if (bullet) { + var type = bullet.asc_getType(); + if (type == AscFormat.BULLET_TYPE_BULLET_CHAR) { + var symbol = bullet.asc_getSymbol(); + if (symbol) { + var rec = this.toolbar.mnuMarkersPicker.store.at(8); + rec.get('data').subtype = undefined; + rec.set('drawdata', {type: Asc.asc_PreviewBulletType.char, char: symbol, specialFont: bullet.asc_getFont()}); + setDefault = false; + idx = 8; + } + } else if (type == AscFormat.BULLET_TYPE_BULLET_BLIP) { + var id = bullet.asc_getImageId(); + if (id) { + var rec = this.toolbar.mnuMarkersPicker.store.at(8); + rec.get('data').subtype = undefined; + rec.set('drawdata', {type: Asc.asc_PreviewBulletType.image, imageId: id}); + setDefault = false; + idx = 8; + } + } + } + } + } + if (setDefault) { + var rec = this.toolbar.mnuMarkersPicker.store.at(8); + rec.get('data').subtype = 8; + rec.set('drawdata', this.toolbar._markersArr[8]); + } + (idx!==undefined) ? this.toolbar.mnuMarkersPicker.selectByIndex(idx, true) : this.toolbar.mnuMarkersPicker.deselectAll(true); break; case 1: @@ -1384,11 +1428,31 @@ define([ } if (btn) { - btn.toggle(rawData.data.subtype > -1, true); + btn.toggle(rawData.data.subtype !== -1, true); } - if (this.api) - this.api.put_ListType(rawData.data.type, rawData.data.subtype); + if (this.api){ + if (rawData.data.type===0 && rawData.data.subtype===undefined) {// custom bullet + var bullet = new Asc.asc_CBullet(); + if (rawData.drawdata.type===Asc.asc_PreviewBulletType.char) { + bullet.asc_putSymbol(rawData.drawdata.char); + bullet.asc_putFont(rawData.drawdata.specialFont); + } else if (rawData.drawdata.type===Asc.asc_PreviewBulletType.image) + bullet.asc_fillBulletImage(rawData.drawdata.imageId); + var selectedElements = me.api.getSelectedElements(); + if (selectedElements && _.isArray(selectedElements)) { + for (var i = 0; i< selectedElements.length; i++) { + if (Asc.c_oAscTypeSelectElement.Paragraph == selectedElements[i].get_ObjectType()) { + var props = selectedElements[i].get_ObjectValue(); + props.asc_putBullet(bullet); + this.api.paraApply(props); + break; + } + } + } + } else + this.api.put_ListType(rawData.data.type, rawData.data.subtype); + } Common.NotificationCenter.trigger('edit:complete', this.toolbar); Common.component.Analytics.trackEvent('ToolBar', 'List Type'); diff --git a/apps/presentationeditor/main/app/view/Toolbar.js b/apps/presentationeditor/main/app/view/Toolbar.js index 835052a69..88a609fad 100644 --- a/apps/presentationeditor/main/app/view/Toolbar.js +++ b/apps/presentationeditor/main/app/view/Toolbar.js @@ -1458,6 +1458,17 @@ define([ // set dataviews + this._markersArr = [ + {type: Asc.asc_PreviewBulletType.text, text: 'None'}, + {type: Asc.asc_PreviewBulletType.char, char: String.fromCharCode(0x00B7), specialFont: 'Symbol'}, + {type: Asc.asc_PreviewBulletType.char, char: 'o', specialFont: 'Courier New'}, + {type: Asc.asc_PreviewBulletType.char, char: String.fromCharCode(0x00A7), specialFont: 'Wingdings'}, + {type: Asc.asc_PreviewBulletType.char, char: String.fromCharCode(0x0076), specialFont: 'Wingdings'}, + {type: Asc.asc_PreviewBulletType.char, char: String.fromCharCode(0x00D8), specialFont: 'Wingdings'}, + {type: Asc.asc_PreviewBulletType.char, char: String.fromCharCode(0x00FC), specialFont: 'Wingdings'}, + {type: Asc.asc_PreviewBulletType.char, char: String.fromCharCode(0x00A8), specialFont: 'Symbol'}, + {type: Asc.asc_PreviewBulletType.char, char: String.fromCharCode(0x2013), specialFont: 'Arial'} + ]; var _conf = this.mnuMarkersPicker.conf; this.mnuMarkersPicker = new Common.UI.DataView({ el: $('#id-toolbar-menu-markers'), @@ -1467,15 +1478,15 @@ define([ allowScrollbar: false, delayRenderTips: true, store: new Common.UI.DataViewStore([ - {id: 'id-markers-' + Common.UI.getId(), data: {type: 0, subtype: -1},drawdata: {type: Asc.asc_PreviewBulletType.text, text: 'None'}, skipRenderOnChange: true, tip: this.tipNone}, - {id: 'id-markers-' + Common.UI.getId(), data: {type: 0, subtype: 1}, drawdata: {type: Asc.asc_PreviewBulletType.char, char: String.fromCharCode(0x00B7),specialFont: 'Symbol'}, skipRenderOnChange: true, tip: this.tipMarkersFRound}, - {id: 'id-markers-' + Common.UI.getId(), data: {type: 0, subtype: 2}, drawdata: {type: Asc.asc_PreviewBulletType.char, char: 'o', specialFont: 'Courier New'}, skipRenderOnChange: true, tip: this.tipMarkersHRound}, - {id: 'id-markers-' + Common.UI.getId(), data: {type: 0, subtype: 3}, drawdata: {type: Asc.asc_PreviewBulletType.char, char: String.fromCharCode(0x00A7), specialFont: 'Wingdings'}, skipRenderOnChange: true, tip: this.tipMarkersFSquare}, - {id: 'id-markers-' + Common.UI.getId(), data: {type: 0, subtype: 4}, drawdata: {type: Asc.asc_PreviewBulletType.char, char: String.fromCharCode(0x0076), specialFont: 'Wingdings'}, skipRenderOnChange: true, tip: this.tipMarkersStar}, - {id: 'id-markers-' + Common.UI.getId(), data: {type: 0, subtype: 5}, drawdata: {type: Asc.asc_PreviewBulletType.char, char: String.fromCharCode(0x00D8), specialFont: 'Wingdings'}, skipRenderOnChange: true, tip: this.tipMarkersArrow}, - {id: 'id-markers-' + Common.UI.getId(), data: {type: 0, subtype: 6}, drawdata: {type: Asc.asc_PreviewBulletType.char, char: String.fromCharCode(0x00FC), specialFont: 'Wingdings'}, skipRenderOnChange: true, tip: this.tipMarkersCheckmark}, - {id: 'id-markers-' + Common.UI.getId(), data: {type: 0, subtype: 7}, drawdata: {type: Asc.asc_PreviewBulletType.char, char: String.fromCharCode(0x00A8), specialFont: 'Symbol'}, skipRenderOnChange: true, tip: this.tipMarkersFRhombus}, - {id: 'id-markers-' + Common.UI.getId(), data: {type: 0, subtype: 8}, drawdata: {type: Asc.asc_PreviewBulletType.char, char: String.fromCharCode(0x2013), specialFont: 'Arial'}, skipRenderOnChange: true, tip: this.tipMarkersDash} + {id: 'id-markers-' + Common.UI.getId(), data: {type: 0, subtype: -1},drawdata: this._markersArr[0], skipRenderOnChange: true, tip: this.tipNone}, + {id: 'id-markers-' + Common.UI.getId(), data: {type: 0, subtype: 1}, drawdata: this._markersArr[1], skipRenderOnChange: true, tip: this.tipMarkersFRound}, + {id: 'id-markers-' + Common.UI.getId(), data: {type: 0, subtype: 2}, drawdata: this._markersArr[2], skipRenderOnChange: true, tip: this.tipMarkersHRound}, + {id: 'id-markers-' + Common.UI.getId(), data: {type: 0, subtype: 3}, drawdata: this._markersArr[3], skipRenderOnChange: true, tip: this.tipMarkersFSquare}, + {id: 'id-markers-' + Common.UI.getId(), data: {type: 0, subtype: 4}, drawdata: this._markersArr[4], skipRenderOnChange: true, tip: this.tipMarkersStar}, + {id: 'id-markers-' + Common.UI.getId(), data: {type: 0, subtype: 5}, drawdata: this._markersArr[5], skipRenderOnChange: true, tip: this.tipMarkersArrow}, + {id: 'id-markers-' + Common.UI.getId(), data: {type: 0, subtype: 6}, drawdata: this._markersArr[6], skipRenderOnChange: true, tip: this.tipMarkersCheckmark}, + {id: 'id-markers-' + Common.UI.getId(), data: {type: 0, subtype: 7}, drawdata: this._markersArr[7], skipRenderOnChange: true, tip: this.tipMarkersFRhombus}, + {id: 'id-markers-' + Common.UI.getId(), data: {type: 0, subtype: 8}, drawdata: this._markersArr[8], skipRenderOnChange: true, tip: this.tipMarkersDash} ]), itemTemplate: _.template('
    ') }); From 962c7193ee7a286b66cc4a901f338e1ce4a908dc Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Thu, 12 May 2022 14:07:13 +0300 Subject: [PATCH 11/16] [PE] Draw custom bullets in toolbar --- .../main/app/controller/Toolbar.js | 46 ++++++++++++------- 1 file changed, 30 insertions(+), 16 deletions(-) diff --git a/apps/presentationeditor/main/app/controller/Toolbar.js b/apps/presentationeditor/main/app/controller/Toolbar.js index f42dd965d..44869a770 100644 --- a/apps/presentationeditor/main/app/controller/Toolbar.js +++ b/apps/presentationeditor/main/app/controller/Toolbar.js @@ -504,21 +504,31 @@ define([ }, onApiBullets: function(v) { - if (this._state.bullets.type != v.get_ListType() || this._state.bullets.subtype != v.get_ListSubType()) { + if (this._state.bullets.type !== v.get_ListType() || this._state.bullets.subtype !== v.get_ListSubType() || v.get_ListType()===0 && v.get_ListSubType()===undefined || this._state.bullets.force) { + if (!this._state.bullets.force) { + var me = this; + this._state.bullets.force = true; + setTimeout(function(){ + me.onApiBullets(v); + }, 100); + } else + this._state.bullets.force = false; this._state.bullets.type = v.get_ListType(); this._state.bullets.subtype = v.get_ListSubType(); + var rec = this.toolbar.mnuMarkersPicker.store.at(8), + drawDefBullet = (rec.get('data').subtype===undefined) && (this._state.bullets.type===1 || this._state.bullets.subtype!==undefined); + this._clearBullets(); switch(this._state.bullets.type) { case 0: - this.toolbar.btnMarkers.toggle(true, true); - var idx, - setDefault = true; + var idx; if (this._state.bullets.subtype!==undefined) idx = this._state.bullets.subtype; else { - var selectedElements = this.api.getSelectedElements(), + var me = this; + var selectedElements = me.api.getSelectedElements(), props; if (selectedElements && _.isArray(selectedElements)) { for (var i = 0; i< selectedElements.length; i++) { @@ -535,32 +545,30 @@ define([ if (type == AscFormat.BULLET_TYPE_BULLET_CHAR) { var symbol = bullet.asc_getSymbol(); if (symbol) { - var rec = this.toolbar.mnuMarkersPicker.store.at(8); rec.get('data').subtype = undefined; + rec.set('tip', ''); rec.set('drawdata', {type: Asc.asc_PreviewBulletType.char, char: symbol, specialFont: bullet.asc_getFont()}); - setDefault = false; + drawDefBullet = false; idx = 8; } } else if (type == AscFormat.BULLET_TYPE_BULLET_BLIP) { var id = bullet.asc_getImageId(); if (id) { - var rec = this.toolbar.mnuMarkersPicker.store.at(8); rec.get('data').subtype = undefined; + rec.set('tip', ''); rec.set('drawdata', {type: Asc.asc_PreviewBulletType.image, imageId: id}); - setDefault = false; + drawDefBullet = false; idx = 8; } } } } } - if (setDefault) { - var rec = this.toolbar.mnuMarkersPicker.store.at(8); - rec.get('data').subtype = 8; - rec.set('drawdata', this.toolbar._markersArr[8]); - } (idx!==undefined) ? this.toolbar.mnuMarkersPicker.selectByIndex(idx, true) : - this.toolbar.mnuMarkersPicker.deselectAll(true); + this.toolbar.mnuMarkersPicker.deselectAll(true); + + this.toolbar.btnMarkers.toggle(true, true); + this.toolbar.mnuNumbersPicker.deselectAll(true); break; case 1: var idx = 0; @@ -589,8 +597,14 @@ define([ } this.toolbar.btnNumbers.toggle(true, true); this.toolbar.mnuNumbersPicker.selectByIndex(idx, true); + this.toolbar.mnuMarkersPicker.deselectAll(true); break; } + if (drawDefBullet) { + rec.get('data').subtype = 8; + rec.set('tip', this.toolbar.tipMarkersDash); + rec.set('drawdata', me.toolbar._markersArr[8]); + } } }, @@ -1439,7 +1453,7 @@ define([ bullet.asc_putFont(rawData.drawdata.specialFont); } else if (rawData.drawdata.type===Asc.asc_PreviewBulletType.image) bullet.asc_fillBulletImage(rawData.drawdata.imageId); - var selectedElements = me.api.getSelectedElements(); + var selectedElements = this.api.getSelectedElements(); if (selectedElements && _.isArray(selectedElements)) { for (var i = 0; i< selectedElements.length; i++) { if (Asc.c_oAscTypeSelectElement.Paragraph == selectedElements[i].get_ObjectType()) { From affb23683a5336501a1018e54ec9458274007baa Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Thu, 12 May 2022 19:10:31 +0300 Subject: [PATCH 12/16] [PE] Fix custom bullets --- .../main/app/controller/Toolbar.js | 72 +++++++------------ 1 file changed, 26 insertions(+), 46 deletions(-) diff --git a/apps/presentationeditor/main/app/controller/Toolbar.js b/apps/presentationeditor/main/app/controller/Toolbar.js index 44869a770..b97d66568 100644 --- a/apps/presentationeditor/main/app/controller/Toolbar.js +++ b/apps/presentationeditor/main/app/controller/Toolbar.js @@ -504,62 +504,42 @@ define([ }, onApiBullets: function(v) { - if (this._state.bullets.type !== v.get_ListType() || this._state.bullets.subtype !== v.get_ListSubType() || v.get_ListType()===0 && v.get_ListSubType()===undefined || this._state.bullets.force) { - if (!this._state.bullets.force) { - var me = this; - this._state.bullets.force = true; - setTimeout(function(){ - me.onApiBullets(v); - }, 100); - } else - this._state.bullets.force = false; + if (this._state.bullets.type !== v.get_ListType() || this._state.bullets.subtype !== v.get_ListSubType() || v.get_ListType()===0 && v.get_ListSubType()===0x1000) { this._state.bullets.type = v.get_ListType(); this._state.bullets.subtype = v.get_ListSubType(); var rec = this.toolbar.mnuMarkersPicker.store.at(8), - drawDefBullet = (rec.get('data').subtype===undefined) && (this._state.bullets.type===1 || this._state.bullets.subtype!==undefined); + drawDefBullet = (rec.get('data').subtype===0x1000) && (this._state.bullets.type===1 || this._state.bullets.subtype!==0x1000); this._clearBullets(); switch(this._state.bullets.type) { case 0: var idx; - if (this._state.bullets.subtype!==undefined) + if (this._state.bullets.subtype!==0x1000) idx = this._state.bullets.subtype; - else { - var me = this; - var selectedElements = me.api.getSelectedElements(), - props; - if (selectedElements && _.isArray(selectedElements)) { - for (var i = 0; i< selectedElements.length; i++) { - if (Asc.c_oAscTypeSelectElement.Paragraph == selectedElements[i].get_ObjectType()) { - props = selectedElements[i].get_ObjectValue(); - break; + else { // custom + var me = this, + bullet = v.asc_getListCustom(); + if (bullet) { + var type = bullet.asc_getType(); + if (type == Asc.asc_PreviewBulletType.char) { + var symbol = bullet.asc_getChar(); + if (symbol) { + rec.get('data').subtype = 0x1000; + rec.set('tip', ''); + rec.set('drawdata', {type: type, char: symbol, specialFont: bullet.asc_getSpecialFont()}); + drawDefBullet = false; + idx = 8; } - } - } - if (props) { - var bullet = props.asc_getBullet(); - if (bullet) { - var type = bullet.asc_getType(); - if (type == AscFormat.BULLET_TYPE_BULLET_CHAR) { - var symbol = bullet.asc_getSymbol(); - if (symbol) { - rec.get('data').subtype = undefined; - rec.set('tip', ''); - rec.set('drawdata', {type: Asc.asc_PreviewBulletType.char, char: symbol, specialFont: bullet.asc_getFont()}); - drawDefBullet = false; - idx = 8; - } - } else if (type == AscFormat.BULLET_TYPE_BULLET_BLIP) { - var id = bullet.asc_getImageId(); - if (id) { - rec.get('data').subtype = undefined; - rec.set('tip', ''); - rec.set('drawdata', {type: Asc.asc_PreviewBulletType.image, imageId: id}); - drawDefBullet = false; - idx = 8; - } + } else if (type == Asc.asc_PreviewBulletType.image) { + var id = bullet.asc_getImageId(); + if (id) { + rec.get('data').subtype = 0x1000; + rec.set('tip', ''); + rec.set('drawdata', {type: type, imageId: id}); + drawDefBullet = false; + idx = 8; } } } @@ -603,7 +583,7 @@ define([ if (drawDefBullet) { rec.get('data').subtype = 8; rec.set('tip', this.toolbar.tipMarkersDash); - rec.set('drawdata', me.toolbar._markersArr[8]); + rec.set('drawdata', this.toolbar._markersArr[8]); } } }, @@ -1446,7 +1426,7 @@ define([ } if (this.api){ - if (rawData.data.type===0 && rawData.data.subtype===undefined) {// custom bullet + if (rawData.data.type===0 && rawData.data.subtype===0x1000) {// custom bullet var bullet = new Asc.asc_CBullet(); if (rawData.drawdata.type===Asc.asc_PreviewBulletType.char) { bullet.asc_putSymbol(rawData.drawdata.char); From 0f883b3c4ea6a613b4db847cf2818eae2fcd0a03 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Thu, 12 May 2022 22:06:23 +0300 Subject: [PATCH 13/16] [SSE] Draw custom bullents in context menu --- .../main/app/controller/Toolbar.js | 3 +- .../main/app/controller/DocumentHolder.js | 71 +++++++++++++++++-- .../main/app/view/DocumentHolder.js | 40 +++++++---- 3 files changed, 90 insertions(+), 24 deletions(-) diff --git a/apps/presentationeditor/main/app/controller/Toolbar.js b/apps/presentationeditor/main/app/controller/Toolbar.js index b97d66568..b59c6d254 100644 --- a/apps/presentationeditor/main/app/controller/Toolbar.js +++ b/apps/presentationeditor/main/app/controller/Toolbar.js @@ -519,8 +519,7 @@ define([ if (this._state.bullets.subtype!==0x1000) idx = this._state.bullets.subtype; else { // custom - var me = this, - bullet = v.asc_getListCustom(); + var bullet = v.asc_getListCustom(); if (bullet) { var type = bullet.asc_getType(); if (type == Asc.asc_PreviewBulletType.char) { diff --git a/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js b/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js index e64eca38d..ff5dd4956 100644 --- a/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js +++ b/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js @@ -233,7 +233,7 @@ define([ view.menuParagraphVAlign.menu.on('item:click', _.bind(me.onParagraphVAlign, me)); view.menuParagraphDirection.menu.on('item:click', _.bind(me.onParagraphDirection, me)); view.menuParagraphBullets.menu.on('item:click', _.bind(me.onSelectBulletMenu, me)); - view.menuParagraphBullets.menu.on('render:after', _.bind(me.onBulletMenuShowAfter, me)); + // view.menuParagraphBullets.menu.on('render:after', _.bind(me.onBulletMenuShowAfter, me)); view.menuParagraphBullets.menu.on('show:after', _.bind(me.onBulletMenuShowAfter, me)); view.menuAddHyperlinkShape.on('click', _.bind(me.onInsHyperlink, me)); view.menuEditHyperlinkShape.on('click', _.bind(me.onInsHyperlink, me)); @@ -947,7 +947,25 @@ define([ rawData = record; } - if (this.api) + if (rawData.type===0 && rawData.subtype===0x1000) {// custom bullet + var bullet = new Asc.asc_CBullet(); + if (rawData.drawdata.type===Asc.asc_PreviewBulletType.char) { + bullet.asc_putSymbol(rawData.drawdata.char); + bullet.asc_putFont(rawData.drawdata.specialFont); + } else if (rawData.drawdata.type===Asc.asc_PreviewBulletType.image) + bullet.asc_fillBulletImage(rawData.drawdata.imageId); + + var props; + var selectedObjects = this.api.asc_getGraphicObjectProps(); + for (var i = 0; i < selectedObjects.length; i++) { + if (selectedObjects[i].asc_getObjectType() == Asc.c_oAscTypeSelectElement.Paragraph) { + props = selectedObjects[i].asc_getObjectValue(); + props.asc_putBullet(bullet); + this.api.asc_setGraphicObjectProps(props); + break; + } + } + } else this.api.asc_setListType(rawData.type, rawData.subtype); if (e.type !== 'click') @@ -2107,9 +2125,45 @@ define([ documentHolder.menuParagraphDirect270.setChecked(direct == Asc.c_oAscVertDrawingText.vert270); documentHolder.menuParagraphBulletNone.setChecked(listtype.get_ListType() == -1); - // documentHolder.mnuListSettings.setDisabled(listtype.get_ListType() == -1); - var rec = documentHolder.paraBulletsPicker.store.findWhere({ type: listtype.get_ListType(), subtype: listtype.get_ListSubType() }); + var type = listtype.get_ListType(), + subtype = listtype.get_ListSubType(), + rec, + defrec = documentHolder.paraBulletsPicker.store.at(7), + drawDefBullet = (defrec.get('subtype')===0x1000) && (type===1 || subtype!==0x1000); + if (type===1 || subtype!==0x1000) { + rec = documentHolder.paraBulletsPicker.store.findWhere({ type: type, subtype: subtype }); + } else { + var bullet = listtype.asc_getListCustom(); + if (bullet) { + var bullettype = bullet.asc_getType(); + if (bullettype === Asc.asc_PreviewBulletType.char) { + var symbol = bullet.asc_getChar(); + if (symbol) { + rec = defrec; + rec.set('subtype', 0x1000); + rec.set('tip', ''); + rec.set('drawdata', {type: bullettype, char: symbol, specialFont: bullet.asc_getSpecialFont()}); + drawDefBullet = false; + + } + } else if (bullettype === Asc.asc_PreviewBulletType.image) { + var id = bullet.asc_getImageId(); + if (id) { + rec = defrec; + rec.set('subtype', 0x1000); + rec.set('tip', ''); + rec.set('drawdata', {type: bullettype, imageId: id}); + drawDefBullet = false; + } + } + } + } documentHolder.paraBulletsPicker.selectRecord(rec, true); + if (drawDefBullet) { + defrec.set('subtype', 8); + defrec.set('tip', documentHolder.tipMarkersDash); + defrec.set('drawdata', documentHolder._markersArr[7]); + } } else if (elType == Asc.c_oAscTypeSelectElement.Paragraph) { documentHolder.pmiTextAdvanced.textInfo = selectedObjects[i].asc_getObjectValue(); isObjLocked = isObjLocked || documentHolder.pmiTextAdvanced.textInfo.asc_getLocked(); @@ -3759,11 +3813,14 @@ define([ var store = this.documentHolder.paraBulletsPicker.store; var arrNum = [], arrMarker = []; store.each(function(item){ - if (item.get('group')=='menu-list-bullet-group') - arrMarker.push(item.get('id')); + var data = item.get('drawdata'); + data['divId'] = item.get('id'); + if (item.get('group')==='menu-list-bullet-group') + arrMarker.push(data); else - arrNum.push(item.get('id')); + arrNum.push(data); }); + if (this.api && this.api.SetDrawImagePreviewBulletForMenu) { this.api.SetDrawImagePreviewBulletForMenu(arrMarker, 0); this.api.SetDrawImagePreviewBulletForMenu(arrNum, 1); diff --git a/apps/spreadsheeteditor/main/app/view/DocumentHolder.js b/apps/spreadsheeteditor/main/app/view/DocumentHolder.js index 159f2d452..bcf77715e 100644 --- a/apps/spreadsheeteditor/main/app/view/DocumentHolder.js +++ b/apps/spreadsheeteditor/main/app/view/DocumentHolder.js @@ -966,25 +966,35 @@ define([ }) }); + me._markersArr = [ + {type: Asc.asc_PreviewBulletType.char, char: String.fromCharCode(0x00B7), specialFont: 'Symbol'}, + {type: Asc.asc_PreviewBulletType.char, char: 'o', specialFont: 'Courier New'}, + {type: Asc.asc_PreviewBulletType.char, char: String.fromCharCode(0x00A7), specialFont: 'Wingdings'}, + {type: Asc.asc_PreviewBulletType.char, char: String.fromCharCode(0x0076), specialFont: 'Wingdings'}, + {type: Asc.asc_PreviewBulletType.char, char: String.fromCharCode(0x00D8), specialFont: 'Wingdings'}, + {type: Asc.asc_PreviewBulletType.char, char: String.fromCharCode(0x00FC), specialFont: 'Wingdings'}, + {type: Asc.asc_PreviewBulletType.char, char: String.fromCharCode(0x00A8), specialFont: 'Symbol'}, + {type: Asc.asc_PreviewBulletType.char, char: String.fromCharCode(0x2013), specialFont: 'Arial'} + ]; me.paraBulletsPicker = { conf: {rec: null}, delayRenderTips: true, store : new Common.UI.DataViewStore([ - {group: 'menu-list-bullet-group', id: 'id-markers-' + Common.UI.getId(), type: 0, subtype: 1, skipRenderOnChange: true, tip: this.tipMarkersFRound}, - {group: 'menu-list-bullet-group', id: 'id-markers-' + Common.UI.getId(), type: 0, subtype: 2, skipRenderOnChange: true, tip: this.tipMarkersHRound}, - {group: 'menu-list-bullet-group', id: 'id-markers-' + Common.UI.getId(), type: 0, subtype: 3, skipRenderOnChange: true, tip: this.tipMarkersFSquare}, - {group: 'menu-list-bullet-group', id: 'id-markers-' + Common.UI.getId(), type: 0, subtype: 4, skipRenderOnChange: true, tip: this.tipMarkersStar}, - {group: 'menu-list-bullet-group', id: 'id-markers-' + Common.UI.getId(), type: 0, subtype: 5, skipRenderOnChange: true, tip: this.tipMarkersArrow}, - {group: 'menu-list-bullet-group', id: 'id-markers-' + Common.UI.getId(), type: 0, subtype: 6, skipRenderOnChange: true, tip: this.tipMarkersCheckmark}, - {group: 'menu-list-bullet-group', id: 'id-markers-' + Common.UI.getId(), type: 0, subtype: 7, skipRenderOnChange: true, tip: this.tipMarkersFRhombus}, - {group: 'menu-list-bullet-group', id: 'id-markers-' + Common.UI.getId(), type: 0, subtype: 8, skipRenderOnChange: true, tip: this.tipMarkersDash}, - {group: 'menu-list-number-group', id: 'id-numbers-' + Common.UI.getId(), type: 1, subtype: 4, skipRenderOnChange: true, tip: this.tipNumCapitalLetters}, - {group: 'menu-list-number-group', id: 'id-numbers-' + Common.UI.getId(), type: 1, subtype: 5, skipRenderOnChange: true, tip: this.tipNumLettersParentheses}, - {group: 'menu-list-number-group', id: 'id-numbers-' + Common.UI.getId(), type: 1, subtype: 6, skipRenderOnChange: true, tip: this.tipNumLettersPoints}, - {group: 'menu-list-number-group', id: 'id-numbers-' + Common.UI.getId(), type: 1, subtype: 1, skipRenderOnChange: true, tip: this.tipNumNumbersPoint}, - {group: 'menu-list-number-group', id: 'id-numbers-' + Common.UI.getId(), type: 1, subtype: 2, skipRenderOnChange: true, tip: this.tipNumNumbersParentheses}, - {group: 'menu-list-number-group', id: 'id-numbers-' + Common.UI.getId(), type: 1, subtype: 3, skipRenderOnChange: true, tip: this.tipNumRoman}, - {group: 'menu-list-number-group', id: 'id-numbers-' + Common.UI.getId(), type: 1, subtype: 7, skipRenderOnChange: true, tip: this.tipNumRomanSmall} + {group: 'menu-list-bullet-group', id: 'id-markers-' + Common.UI.getId(), type: 0, subtype: 1, drawdata: me._markersArr[0], skipRenderOnChange: true, tip: this.tipMarkersFRound}, + {group: 'menu-list-bullet-group', id: 'id-markers-' + Common.UI.getId(), type: 0, subtype: 2, drawdata: me._markersArr[1], skipRenderOnChange: true, tip: this.tipMarkersHRound}, + {group: 'menu-list-bullet-group', id: 'id-markers-' + Common.UI.getId(), type: 0, subtype: 3, drawdata: me._markersArr[2], skipRenderOnChange: true, tip: this.tipMarkersFSquare}, + {group: 'menu-list-bullet-group', id: 'id-markers-' + Common.UI.getId(), type: 0, subtype: 4, drawdata: me._markersArr[3], skipRenderOnChange: true, tip: this.tipMarkersStar}, + {group: 'menu-list-bullet-group', id: 'id-markers-' + Common.UI.getId(), type: 0, subtype: 5, drawdata: me._markersArr[4], skipRenderOnChange: true, tip: this.tipMarkersArrow}, + {group: 'menu-list-bullet-group', id: 'id-markers-' + Common.UI.getId(), type: 0, subtype: 6, drawdata: me._markersArr[5], skipRenderOnChange: true, tip: this.tipMarkersCheckmark}, + {group: 'menu-list-bullet-group', id: 'id-markers-' + Common.UI.getId(), type: 0, subtype: 7, drawdata: me._markersArr[6], skipRenderOnChange: true, tip: this.tipMarkersFRhombus}, + {group: 'menu-list-bullet-group', id: 'id-markers-' + Common.UI.getId(), type: 0, subtype: 8, drawdata: me._markersArr[7], skipRenderOnChange: true, tip: this.tipMarkersDash}, + {group: 'menu-list-number-group', id: 'id-numbers-' + Common.UI.getId(), type: 1, subtype: 4, drawdata: {type: Asc.asc_PreviewBulletType.number, numberingType: Asc.asc_oAscNumberingLevel.UpperLetterDot_Left}, skipRenderOnChange: true, tip: this.tipNumCapitalLetters}, + {group: 'menu-list-number-group', id: 'id-numbers-' + Common.UI.getId(), type: 1, subtype: 5, drawdata: {type: Asc.asc_PreviewBulletType.number, numberingType: Asc.asc_oAscNumberingLevel.LowerLetterBracket_Left}, skipRenderOnChange: true, tip: this.tipNumLettersParentheses}, + {group: 'menu-list-number-group', id: 'id-numbers-' + Common.UI.getId(), type: 1, subtype: 6, drawdata: {type: Asc.asc_PreviewBulletType.number, numberingType: Asc.asc_oAscNumberingLevel.LowerLetterDot_Left}, skipRenderOnChange: true, tip: this.tipNumLettersPoints}, + {group: 'menu-list-number-group', id: 'id-numbers-' + Common.UI.getId(), type: 1, subtype: 1, drawdata: {type: Asc.asc_PreviewBulletType.number, numberingType: Asc.asc_oAscNumberingLevel.DecimalDot_Right}, skipRenderOnChange: true, tip: this.tipNumNumbersPoint}, + {group: 'menu-list-number-group', id: 'id-numbers-' + Common.UI.getId(), type: 1, subtype: 2, drawdata: {type: Asc.asc_PreviewBulletType.number, numberingType: Asc.asc_oAscNumberingLevel.DecimalBracket_Right}, skipRenderOnChange: true, tip: this.tipNumNumbersParentheses}, + {group: 'menu-list-number-group', id: 'id-numbers-' + Common.UI.getId(), type: 1, subtype: 3, drawdata: {type: Asc.asc_PreviewBulletType.number, numberingType: Asc.asc_oAscNumberingLevel.UpperRomanDot_Right}, skipRenderOnChange: true, tip: this.tipNumRoman}, + {group: 'menu-list-number-group', id: 'id-numbers-' + Common.UI.getId(), type: 1, subtype: 7, drawdata: {type: Asc.asc_PreviewBulletType.number, numberingType: Asc.asc_oAscNumberingLevel.LowerRomanDot_Right}, skipRenderOnChange: true, tip: this.tipNumRomanSmall} ]), groups: new Common.UI.DataViewGroupStore([ {id: 'menu-list-bullet-group', caption: this.textBullets}, From 5ab9ea3550e0995174ae09b4c7d590cfb616f749 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Fri, 13 May 2022 00:07:26 +0300 Subject: [PATCH 14/16] [PE][SSE] Change tooltip for custom bullet --- .../main/app/controller/Toolbar.js | 19 ++++++++++++++++--- .../main/app/controller/DocumentHolder.js | 19 ++++++++++++++++--- 2 files changed, 32 insertions(+), 6 deletions(-) diff --git a/apps/presentationeditor/main/app/controller/Toolbar.js b/apps/presentationeditor/main/app/controller/Toolbar.js index b59c6d254..87acd7754 100644 --- a/apps/presentationeditor/main/app/controller/Toolbar.js +++ b/apps/presentationeditor/main/app/controller/Toolbar.js @@ -503,6 +503,16 @@ define([ } }, + updateBulletTip: function(view, title) { + if (view) { + var tip = $(view.el).data('bs.tooltip'); + if (tip) { + tip.options.title = title; + tip.$tip.find('.tooltip-inner').text(title); + } + } + }, + onApiBullets: function(v) { if (this._state.bullets.type !== v.get_ListType() || this._state.bullets.subtype !== v.get_ListSubType() || v.get_ListType()===0 && v.get_ListSubType()===0x1000) { this._state.bullets.type = v.get_ListType(); @@ -526,8 +536,9 @@ define([ var symbol = bullet.asc_getChar(); if (symbol) { rec.get('data').subtype = 0x1000; - rec.set('tip', ''); rec.set('drawdata', {type: type, char: symbol, specialFont: bullet.asc_getSpecialFont()}); + rec.set('tip', ''); + this.updateBulletTip(this.toolbar.mnuMarkersPicker.dataViewItems[8], ''); drawDefBullet = false; idx = 8; } @@ -535,8 +546,9 @@ define([ var id = bullet.asc_getImageId(); if (id) { rec.get('data').subtype = 0x1000; - rec.set('tip', ''); rec.set('drawdata', {type: type, imageId: id}); + rec.set('tip', ''); + this.updateBulletTip(this.toolbar.mnuMarkersPicker.dataViewItems[8], ''); drawDefBullet = false; idx = 8; } @@ -581,8 +593,9 @@ define([ } if (drawDefBullet) { rec.get('data').subtype = 8; - rec.set('tip', this.toolbar.tipMarkersDash); rec.set('drawdata', this.toolbar._markersArr[8]); + rec.set('tip', this.toolbar.tipMarkersDash); + this.updateBulletTip(this.toolbar.mnuMarkersPicker.dataViewItems[8], this.toolbar.tipMarkersDash); } } }, diff --git a/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js b/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js index ff5dd4956..121d75dd2 100644 --- a/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js +++ b/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js @@ -2141,8 +2141,9 @@ define([ if (symbol) { rec = defrec; rec.set('subtype', 0x1000); - rec.set('tip', ''); rec.set('drawdata', {type: bullettype, char: symbol, specialFont: bullet.asc_getSpecialFont()}); + rec.set('tip', ''); + this.updateBulletTip(documentHolder.paraBulletsPicker.dataViewItems[7], ''); drawDefBullet = false; } @@ -2151,8 +2152,9 @@ define([ if (id) { rec = defrec; rec.set('subtype', 0x1000); - rec.set('tip', ''); rec.set('drawdata', {type: bullettype, imageId: id}); + rec.set('tip', ''); + this.updateBulletTip(documentHolder.paraBulletsPicker.dataViewItems[7], ''); drawDefBullet = false; } } @@ -2161,8 +2163,9 @@ define([ documentHolder.paraBulletsPicker.selectRecord(rec, true); if (drawDefBullet) { defrec.set('subtype', 8); - defrec.set('tip', documentHolder.tipMarkersDash); defrec.set('drawdata', documentHolder._markersArr[7]); + defrec.set('tip', documentHolder.tipMarkersDash); + this.updateBulletTip(documentHolder.paraBulletsPicker.dataViewItems[7], documentHolder.tipMarkersDash); } } else if (elType == Asc.c_oAscTypeSelectElement.Paragraph) { documentHolder.pmiTextAdvanced.textInfo = selectedObjects[i].asc_getObjectValue(); @@ -3827,6 +3830,16 @@ define([ } }, + updateBulletTip: function(view, title) { + if (view) { + var tip = $(view.el).data('bs.tooltip'); + if (tip) { + tip.options.title = title; + tip.$tip.find('.tooltip-inner').text(title); + } + } + }, + onSignatureClick: function(item) { var datavalue = item.cmpEl.attr('data-value'); switch (item.value) { From fd386eea95d96416e41a8ffad9f78790e3521ef5 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Fri, 13 May 2022 12:56:47 +0300 Subject: [PATCH 15/16] [PE][SSE] Fix custom bullets --- apps/presentationeditor/main/app/controller/Toolbar.js | 6 +++--- .../spreadsheeteditor/main/app/controller/DocumentHolder.js | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/apps/presentationeditor/main/app/controller/Toolbar.js b/apps/presentationeditor/main/app/controller/Toolbar.js index 87acd7754..009af8048 100644 --- a/apps/presentationeditor/main/app/controller/Toolbar.js +++ b/apps/presentationeditor/main/app/controller/Toolbar.js @@ -538,7 +538,7 @@ define([ rec.get('data').subtype = 0x1000; rec.set('drawdata', {type: type, char: symbol, specialFont: bullet.asc_getSpecialFont()}); rec.set('tip', ''); - this.updateBulletTip(this.toolbar.mnuMarkersPicker.dataViewItems[8], ''); + this.toolbar.mnuMarkersPicker.dataViewItems && this.updateBulletTip(this.toolbar.mnuMarkersPicker.dataViewItems[8], ''); drawDefBullet = false; idx = 8; } @@ -548,7 +548,7 @@ define([ rec.get('data').subtype = 0x1000; rec.set('drawdata', {type: type, imageId: id}); rec.set('tip', ''); - this.updateBulletTip(this.toolbar.mnuMarkersPicker.dataViewItems[8], ''); + this.toolbar.mnuMarkersPicker.dataViewItems && this.updateBulletTip(this.toolbar.mnuMarkersPicker.dataViewItems[8], ''); drawDefBullet = false; idx = 8; } @@ -595,7 +595,7 @@ define([ rec.get('data').subtype = 8; rec.set('drawdata', this.toolbar._markersArr[8]); rec.set('tip', this.toolbar.tipMarkersDash); - this.updateBulletTip(this.toolbar.mnuMarkersPicker.dataViewItems[8], this.toolbar.tipMarkersDash); + this.toolbar.mnuMarkersPicker.dataViewItems && this.updateBulletTip(this.toolbar.mnuMarkersPicker.dataViewItems[8], this.toolbar.tipMarkersDash); } } }, diff --git a/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js b/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js index 121d75dd2..5a70a29f3 100644 --- a/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js +++ b/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js @@ -2143,7 +2143,7 @@ define([ rec.set('subtype', 0x1000); rec.set('drawdata', {type: bullettype, char: symbol, specialFont: bullet.asc_getSpecialFont()}); rec.set('tip', ''); - this.updateBulletTip(documentHolder.paraBulletsPicker.dataViewItems[7], ''); + documentHolder.paraBulletsPicker.dataViewItems && this.updateBulletTip(documentHolder.paraBulletsPicker.dataViewItems[7], ''); drawDefBullet = false; } @@ -2154,7 +2154,7 @@ define([ rec.set('subtype', 0x1000); rec.set('drawdata', {type: bullettype, imageId: id}); rec.set('tip', ''); - this.updateBulletTip(documentHolder.paraBulletsPicker.dataViewItems[7], ''); + documentHolder.paraBulletsPicker.dataViewItems && this.updateBulletTip(documentHolder.paraBulletsPicker.dataViewItems[7], ''); drawDefBullet = false; } } @@ -2165,7 +2165,7 @@ define([ defrec.set('subtype', 8); defrec.set('drawdata', documentHolder._markersArr[7]); defrec.set('tip', documentHolder.tipMarkersDash); - this.updateBulletTip(documentHolder.paraBulletsPicker.dataViewItems[7], documentHolder.tipMarkersDash); + documentHolder.paraBulletsPicker.dataViewItems && this.updateBulletTip(documentHolder.paraBulletsPicker.dataViewItems[7], documentHolder.tipMarkersDash); } } else if (elType == Asc.c_oAscTypeSelectElement.Paragraph) { documentHolder.pmiTextAdvanced.textInfo = selectedObjects[i].asc_getObjectValue(); From ede44512e5868b231bee3e8af11f27f51169f31e Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Fri, 13 May 2022 13:47:53 +0300 Subject: [PATCH 16/16] [PE][SSE] Fix updating tip for custom bullet --- apps/common/main/lib/component/DataView.js | 6 +++--- .../spreadsheeteditor/main/app/controller/DocumentHolder.js | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/apps/common/main/lib/component/DataView.js b/apps/common/main/lib/component/DataView.js index 241a1b866..2c24c51be 100644 --- a/apps/common/main/lib/component/DataView.js +++ b/apps/common/main/lib/component/DataView.js @@ -476,12 +476,12 @@ define([ var me = this, view_el = $(view.el), tip = record.get('tip'); - if (tip) { + if (tip!==undefined && tip!==null) { if (this.delayRenderTips) view_el.one('mouseenter', function(){ // hide tooltip when mouse is over menu view_el.attr('data-toggle', 'tooltip'); view_el.tooltip({ - title : tip, + title : record.get('tip'), // use actual tip, because it can be changed placement : 'cursor', zIndex : me.tipZIndex }); @@ -490,7 +490,7 @@ define([ else { view_el.attr('data-toggle', 'tooltip'); view_el.tooltip({ - title : tip, + title : record.get('tip'), // use actual tip, because it can be changed placement : 'cursor', zIndex : me.tipZIndex }); diff --git a/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js b/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js index 5a70a29f3..99190b357 100644 --- a/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js +++ b/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js @@ -3801,6 +3801,7 @@ define([ outerMenu: {menu: view.menuParagraphBullets.menu, index: 0}, groups : view.paraBulletsPicker.groups, store : view.paraBulletsPicker.store, + delayRenderTips: true, itemTemplate: _.template('<% if (type==0) { %>' + '
    ' + '<% } else if (type==1) { %>' +