',
'<% if (!_.isEmpty(group.groupName)) { %>',
'
',
'<%= group.groupName %>',
@@ -1356,7 +1356,45 @@ define([
me.recentShapes = recentArr;
- recentStore.add(recentArr);
+ // Add default recent
+
+ if (me.recentShapes.length < 12) {
+ var count = 12 - me.recentShapes.length,
+ defaultArr = [];
+
+ var addItem = function (rec) {
+ var item = rec.toJSON(),
+ model = {
+ data: item.data,
+ tip: item.tip,
+ allowSelected: item.allowSelected,
+ selected: false
+ };
+ defaultArr.push(model);
+ };
+
+ for (var i = 0; i < me.groups.length && count > 0; i++) {
+ var groupStore = me.groups[i].groupStore;
+ if (i === 0) {
+ addItem(groupStore.at(1));
+ count--;
+ if (count > 0) {
+ addItem(groupStore.at(2));
+ count--;
+ }
+ } else if (i !== 3 && i !== 6 && i !== 7) {
+ addItem(groupStore.at(0));
+ count--;
+ if (count > 0) {
+ addItem(groupStore.at(1));
+ count--;
+ }
+ }
+ }
+ me.recentShapes = me.recentShapes.concat(defaultArr);
+ }
+
+ recentStore.add(me.recentShapes);
me.groups.unshift({
groupName : options.textRecentlyUsed,
groupStore : recentStore,
@@ -1377,9 +1415,6 @@ define([
Common.UI.DataViewSimple.prototype.initialize.call(this, options);
me.parentMenu.on('show:before', function() { me.updateRecents(); });
- if (me.recentShapes.length > 0 && !me.cmpEl.find('.recent-group').is(':visible')) {
- me.cmpEl.find('.recent-group').show();
- }
},
onAfterShowMenu: function(e) {
var me = this;
@@ -1490,8 +1525,8 @@ define([
selected: false
};
me.recentShapes.unshift(model);
- if (me.recentShapes.length > 14) {
- me.recentShapes.splice(14, 1);
+ if (me.recentShapes.length > 12) {
+ me.recentShapes.splice(12, 1);
}
Common.localStorage.setItem(this.appPrefix + 'recent-shapes', JSON.stringify(me.recentShapes));
me.recentShapes = undefined;
diff --git a/apps/common/main/resources/less/combo-dataview.less b/apps/common/main/resources/less/combo-dataview.less
index e7f4ccf9a..7afe0696b 100644
--- a/apps/common/main/resources/less/combo-dataview.less
+++ b/apps/common/main/resources/less/combo-dataview.less
@@ -98,7 +98,7 @@
}
}
- .item {
+ &:not(.shapes) .item {
padding: 2px;
border: @scaled-one-px-value-ie solid @border-regular-control-ie;
border: @scaled-one-px-value solid @border-regular-control;
@@ -123,7 +123,7 @@
}
}
- &.disabled {
+ &.disabled:not(.shapes) {
.item {
&:hover:not(.selected) {
.box-shadow(none);
@@ -135,7 +135,7 @@
}
}
- .dropdown-menu {
+ &:not(.shapes) .dropdown-menu {
box-sizing: content-box;
padding: 0;
border-top-left-radius: 0;
diff --git a/apps/common/main/resources/less/dataview.less b/apps/common/main/resources/less/dataview.less
index 7acb0bcdb..19189ea31 100644
--- a/apps/common/main/resources/less/dataview.less
+++ b/apps/common/main/resources/less/dataview.less
@@ -92,7 +92,7 @@
.menu-insert-shape, .menu-change-shape {
width: 362px;
- padding: 10px 5px 10px 10px;
+ padding: 10px 5px 10px 10px !important;
.group-description {
padding: 3px 0 3px 4px;
}
diff --git a/apps/common/main/resources/less/toolbar.less b/apps/common/main/resources/less/toolbar.less
index 838c7b622..06d6dd6e8 100644
--- a/apps/common/main/resources/less/toolbar.less
+++ b/apps/common/main/resources/less/toolbar.less
@@ -567,6 +567,43 @@
}
}
+#slot-combo-insertshape {
+ width: 150px;
+ height: 46px;
+ .view {
+ padding-right: 14px;
+ }
+ .dataview.field-picker {
+ height: 100%;
+ margin: 0;
+ padding: 2px;
+ .item {
+ margin: 0;
+ -webkit-box-shadow: none;
+ box-shadow: none;
+ &:hover {
+ background-color: @highlight-button-hover-ie;
+ background-color: @highlight-button-hover;
+ }
+ &.active {
+ background-color: @highlight-button-pressed-ie;
+ background-color: @highlight-button-pressed;
+
+ svg.icon {
+ fill: @icon-normal-pressed-ie;
+ fill: @icon-normal-pressed;
+ }
+ }
+ }
+ }
+ .button {
+ width: 14px;
+ .caret {
+ width: 4px;
+ height: 4px;
+ }
+ }
+}
.item-shape {
.icon {
diff --git a/apps/presentationeditor/main/app/controller/Toolbar.js b/apps/presentationeditor/main/app/controller/Toolbar.js
index f8d1bbb61..973f47519 100644
--- a/apps/presentationeditor/main/app/controller/Toolbar.js
+++ b/apps/presentationeditor/main/app/controller/Toolbar.js
@@ -188,16 +188,20 @@ define([
btn_id = cmp.closest('button').attr('id');
if (btn_id===undefined)
btn_id = cmp.closest('.btn-group').attr('id');
+ if (btn_id===undefined)
+ btn_id = cmp.closest('.combo-dataview').attr('id');
if (cmp.attr('id') != 'editor_sdk' && cmp_sdk.length<=0) {
if ( me.toolbar.btnsInsertText.pressed() && !me.toolbar.btnsInsertText.contains(btn_id) ||
- me.toolbar.btnsInsertShape.pressed() && !me.toolbar.btnsInsertShape.contains(btn_id) )
+ me.toolbar.btnsInsertShape.pressed() && !me.toolbar.btnsInsertShape.contains(btn_id) ||
+ me.toolbar.cmbInsertShape.isComboViewRecActive() && me.toolbar.cmbInsertShape.id !== btn_id)
{
me._isAddingShape = false;
me._addAutoshape(false);
me.toolbar.btnsInsertShape.toggle(false, true);
me.toolbar.btnsInsertText.toggle(false, true);
+ me.toolbar.cmbInsertShape.deactivateRecords();
Common.NotificationCenter.trigger('edit:complete', me.toolbar);
} else
if ( me.toolbar.btnsInsertShape.pressed() && me.toolbar.btnsInsertShape.contains(btn_id) ) {
@@ -218,6 +222,9 @@ define([
if ( this.toolbar.btnsInsertText.pressed() )
this.toolbar.btnsInsertText.toggle(false, true);
+ if ( this.toolbar.cmbInsertShape.isComboViewRecActive() )
+ this.toolbar.cmbInsertShape.deactivateRecords();
+
$(document.body).off('mouseup', checkInsertAutoshape);
};
@@ -2036,14 +2043,31 @@ define([
},
onResetAutoshapes: function () {
- var me = this;
+ var me = this,
+ collection = PE.getCollection('ShapeGroups');
var onShowBefore = function(menu) {
- me.toolbar.updateAutoshapeMenu(menu, PE.getCollection('ShapeGroups'));
+ me.toolbar.updateAutoshapeMenu(menu, collection);
menu.off('show:before', onShowBefore);
};
me.toolbar.btnsInsertShape.forEach(function (btn, index) {
btn.menu.on('show:before', onShowBefore);
});
+ var onComboShowBefore = function (menu) {
+ me.toolbar.updateComboAutoshapeMenu(collection);
+ menu.off('show:before', onComboShowBefore);
+ }
+ me.toolbar.cmbInsertShape.openButton.menu.on('show:before', onComboShowBefore);
+ me.toolbar.cmbInsertShape.fillComboView(collection);
+ me.toolbar.cmbInsertShape.on('click', function (btn, record, cancel) {
+ if (cancel) {
+ me._addAutoshape(false);
+ return;
+ }
+ if (record) {
+ me.toolbar.cmbInsertShape.updateComboView(record);
+ me.onInsertShape(record.get('data').shapeType);
+ }
+ });
},
onResetSlides: function () {
diff --git a/apps/presentationeditor/main/app/template/Toolbar.template b/apps/presentationeditor/main/app/template/Toolbar.template
index 14e7722d5..924f83a62 100644
--- a/apps/presentationeditor/main/app/template/Toolbar.template
+++ b/apps/presentationeditor/main/app/template/Toolbar.template
@@ -117,9 +117,9 @@
-
+
diff --git a/apps/presentationeditor/main/app/view/ShapeSettings.js b/apps/presentationeditor/main/app/view/ShapeSettings.js
index 7dabaa25a..b8b7c8ec4 100644
--- a/apps/presentationeditor/main/app/view/ShapeSettings.js
+++ b/apps/presentationeditor/main/app/view/ShapeSettings.js
@@ -1699,6 +1699,7 @@ define([
});
shapePicker.on('item:click', function(picker, item, record, e) {
if (me.api) {
+ PE.getController('Toolbar').toolbar.cmbInsertShape.updateComboView(record);
me.api.ChangeShapeType(record.get('data').shapeType);
me.fireEvent('editcomplete', me);
}
diff --git a/apps/presentationeditor/main/app/view/Toolbar.js b/apps/presentationeditor/main/app/view/Toolbar.js
index 3252c4cc0..dbbb31541 100644
--- a/apps/presentationeditor/main/app/view/Toolbar.js
+++ b/apps/presentationeditor/main/app/view/Toolbar.js
@@ -56,7 +56,8 @@ define([
'common/main/lib/component/ComboBoxFonts',
'common/main/lib/component/ComboDataView'
,'common/main/lib/component/SynchronizeTip'
- ,'common/main/lib/component/Mixtbar'
+ ,'common/main/lib/component/Mixtbar',
+ 'common/main/lib/component/ComboDataViewShape'
], function (Backbone, template, template_view) {
'use strict';
@@ -1051,6 +1052,19 @@ define([
'
'
].join(''));
+ this.cmbInsertShape = new Common.UI.ComboDataViewShape({
+ cls: 'combo-styles shapes',
+ itemWidth: 20,
+ itemHeight: 20,
+ menuMaxHeight: 640,
+ menuWidth: 362,
+ enableKeyEvents: true,
+ lock: [PE.enumLock.slideDeleted, PE.enumLock.lostConnect, PE.enumLock.noSlides, PE.enumLock.disableOnStart],
+ dataHint: '1',
+ dataHintDirection: 'bottom',
+ dataHintOffset: '-16, 0'
+ });
+
this.lockControls = [this.btnChangeSlide, this.btnSave,
this.btnCopy, this.btnPaste, this.btnUndo, this.btnRedo, this.cmbFontName, this.cmbFontSize, this.btnIncFontSize, this.btnDecFontSize,
this.btnBold, this.btnItalic, this.btnUnderline, this.btnStrikeout, this.btnSuperscript, this.btnChangeCase, this.btnHighlightColor,
@@ -1193,6 +1207,7 @@ define([
_injectComponent('#slot-btn-editheader', this.btnEditHeader);
_injectComponent('#slot-btn-datetime', this.btnInsDateTime);
_injectComponent('#slot-btn-slidenum', this.btnInsSlideNum);
+ _injectComponent('#slot-combo-insertshape', this.cmbInsertShape);
this.btnInsAudio && _injectComponent('#slot-btn-insaudio', this.btnInsAudio);
this.btnInsVideo && _injectComponent('#slot-btn-insvideo', this.btnInsVideo);
@@ -1711,6 +1726,7 @@ define([
menuShape.addItem(menuitem);
var recents = Common.localStorage.getItem('pe-recent-shapes');
+ recents = recents ? JSON.parse(recents) : null;
var shapePicker = new Common.UI.DataViewShape({
el: $('#id-toolbar-menu-insertshape-'+index),
@@ -1719,13 +1735,23 @@ define([
parentMenu: menuShape,
restoreHeight: 640,
textRecentlyUsed: me.textRecentlyUsed,
- recentShapes: recents ? JSON.parse(recents) : null
+ recentShapes: recents
});
shapePicker.on('item:click', function(picker, item, record, e) {
if (e.type !== 'click') Common.UI.Menu.Manager.hideAll();
- if (record)
+ if (record) {
me.fireEvent('insert:shape', [record.get('data').shapeType]);
+ me.cmbInsertShape.updateComboView(record);
+ }
});
+
+ },
+
+ updateComboAutoshapeMenu: function (collection) {
+ var me = this,
+ recents = Common.localStorage.getItem('pe-recent-shapes');
+ recents = recents ? JSON.parse(recents) : null;
+ me.cmbInsertShape.setMenuPicker(collection, recents, me.textRecentlyUsed);
},
updateAddSlideMenu: function(collection) {