[SSE] Apply bullets and numbering to text in shape (need changes in api).

This commit is contained in:
Julia Radzhabova 2017-05-18 10:31:18 +03:00
parent 22e130d9db
commit 845fab903c
8 changed files with 116 additions and 10 deletions

View file

@ -110,6 +110,7 @@ function patchDropDownKeyDown(e) {
_.delay(function() {
var mnu = $('> [role=menu]', li),
$subitems = mnu.find('> li:not(.divider):not(.disabled):visible > a'),
$dataviews = mnu.find('> li:not(.divider):not(.disabled):visible .dataview'),
focusIdx = 0;
if (mnu.find('> .menu-scroll').length>0) {
var offset = mnu.scrollTop();
@ -119,7 +120,7 @@ function patchDropDownKeyDown(e) {
}
}
}
if ($subitems.length>0)
if ($subitems.length>0 && $dataviews.length<1)
$subitems.eq(focusIdx).focus();
}, 250);
}

View file

@ -35,11 +35,6 @@
z-index: @zindex-tooltip + 1;
}
.menu-markers,
.menu-numbers {
//
}
.item-markerlist {
.background-ximage('@{app-image-path}/toolbar/bullets-and-numbering.png', '@{app-image-path}/toolbar/bullets-and-numbering@2x.png', 38px);
width: 38px;

View file

@ -179,6 +179,7 @@ define([
view.imgMenu.on('item:click', _.bind(me.onImgMenu, me));
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.onSelectNoneBullet, me));
view.menuAddHyperlinkShape.on('click', _.bind(me.onInsHyperlink, me));
view.menuEditHyperlinkShape.on('click', _.bind(me.onInsHyperlink, me));
view.menuRemoveHyperlinkShape.on('click', _.bind(me.onRemoveHyperlinkShape, me));
@ -186,6 +187,7 @@ define([
view.mnuShapeAdvanced.on('click', _.bind(me.onShapeAdvanced, me));
view.mnuChartEdit.on('click', _.bind(me.onChartEdit, me));
view.mnuImgAdvanced.on('click', _.bind(me.onImgAdvanced, me));
view.textInShapeMenu.on('render:after', _.bind(me.onTextInShapeAfterRender, me));
var documentHolderEl = view.cmpEl;
@ -643,6 +645,45 @@ define([
}
},
onSelectNoneBullet: function(menu, item) {
if (this.api && item.options.value == -1) {
// var properties = new Asc.asc_CImgProperty();
// properties.asc_putListType(item.options.value);
// this.api.asc_setGraphicObjectProps(properties);
Common.NotificationCenter.trigger('edit:complete', this.documentHolder);
Common.component.Analytics.trackEvent('DocumentHolder', 'List Type');
}
},
onSelectBullets: function(picker, itemView, record, e) {
var rawData = {},
isPickerSelect = _.isFunction(record.toJSON);
if (isPickerSelect){
if (record.get('selected')) {
rawData = record.toJSON();
} else {
// record deselected
return;
}
} else {
rawData = record;
}
// if (this.api){
// var properties = new Asc.asc_CImgProperty();
// properties.asc_putListType(rawData.type, rawData.subtype);
// this.api.asc_setGraphicObjectProps(properties);
// }
if (e.type !== 'click')
this.documentHolder.textInShapeMenu.hide();
Common.NotificationCenter.trigger('edit:complete', this.documentHolder);
Common.component.Analytics.trackEvent('DocumentHolder', 'List Type');
},
onRemoveHyperlinkShape: function(item) {
if (this.api) {
this.api.asc_removeHyperlink();
@ -1266,7 +1307,9 @@ define([
if (elType == Asc.c_oAscTypeSelectElement.Image) {
var value = selectedObjects[i].asc_getObjectValue(),
align = value.asc_getVerticalTextAlign(),
direct = value.asc_getVert();
direct = value.asc_getVert(),
listtype = -1,//value.asc_getListType();
listsubtype = -1;//value.asc_getListSubType();
isObjLocked = isObjLocked || value.asc_getLocked();
documentHolder.menuParagraphTop.setChecked(align == Asc.c_oAscVAlign.Top);
documentHolder.menuParagraphCenter.setChecked(align == Asc.c_oAscVAlign.Center);
@ -1275,6 +1318,10 @@ define([
documentHolder.menuParagraphDirectH.setChecked(direct == Asc.c_oAscVertDrawingText.normal);
documentHolder.menuParagraphDirect90.setChecked(direct == Asc.c_oAscVertDrawingText.vert);
documentHolder.menuParagraphDirect270.setChecked(direct == Asc.c_oAscVertDrawingText.vert270);
documentHolder.menuParagraphBulletNone.setChecked(listtype == -1);
var rec = documentHolder.paraBulletsPicker.store.findWhere({ type: listtype, subtype: listsubtype });
documentHolder.paraBulletsPicker.selectRecord(rec, true);
} else if (elType == Asc.c_oAscTypeSelectElement.Paragraph) {
documentHolder.pmiTextAdvanced.textInfo = selectedObjects[i].asc_getObjectValue();
isObjLocked = isObjLocked || documentHolder.pmiTextAdvanced.textInfo.asc_getLocked();
@ -2338,7 +2385,20 @@ define([
Common.NotificationCenter.trigger('edit:complete', me.documentHolder);
},
guestText : 'Guest',
onTextInShapeAfterRender:function(cmp) {
var view = this.documentHolder,
_conf = view.paraBulletsPicker.conf;
view.paraBulletsPicker = new Common.UI.DataView({
el : $('#id-docholder-menu-bullets'),
parentMenu : view.menuParagraphBullets.menu,
store : view.paraBulletsPicker.store,
itemTemplate: _.template('<div id="<%= id %>" class="item-markerlist" style="background-position: 0 -<%= offsety %>px;"></div>')
});
view.paraBulletsPicker.on('item:click', _.bind(this.onSelectBullets, this));
_conf && view.paraBulletsPicker.selectRecord(_conf.rec, true);
},
guestText : 'Guest',
textCtrlClick : 'Press CTRL and click link',
txtHeight : 'Height',
txtWidth : 'Width',

View file

@ -538,6 +538,45 @@ define([
})
});
me.menuParagraphBullets = new Common.UI.MenuItem({
caption : me.bulletsText,
menu : new Common.UI.Menu({
menuAlign: 'tl-tr',
items : [
{ template: _.template('<div id="id-docholder-menu-bullets" class="menu-layouts" style="width: 325px; margin: 0 4px;"></div>') },
{caption: '--'},
me.menuParagraphBulletNone = new Common.UI.MenuItem({
caption : me.textNone,
checkable : true,
checked : false,
value : -1
})
]
})
});
me.paraBulletsPicker = {
conf: {rec: null},
store : new Common.UI.DataViewStore([
{offsety: 38, type: 0, subtype: 1},
{offsety: 76, type: 0, subtype: 2},
{offsety: 114, type: 0, subtype: 3},
{offsety: 152, type: 0, subtype: 4},
{offsety: 190, type: 0, subtype: 5},
{offsety: 228, type: 0, subtype: 6},
{offsety: 266, type: 0, subtype: 7},
{offsety: 570, type: 1, subtype: 4},
{offsety: 532, type: 1, subtype: 5},
{offsety: 608, type: 1, subtype: 6},
{offsety: 418, type: 1, subtype: 1},
{offsety: 456, type: 1, subtype: 2},
{offsety: 494, type: 1, subtype: 3},
{offsety: 646, type: 1, subtype: 7}
]),
selectRecord: function (rec) {
this.conf.rec = rec;
}
};
me.menuAddHyperlinkShape = new Common.UI.MenuItem({
caption : me.txtInsHyperlink
});
@ -588,6 +627,7 @@ define([
{caption: '--'},
me.menuParagraphVAlign,
me.menuParagraphDirection,
me.menuParagraphBullets,
me.menuAddHyperlinkShape,
me.menuHyperlinkShape,
{caption: '--'},
@ -712,7 +752,9 @@ define([
txtClearSparklines: 'Clear Selected Sparklines',
txtClearSparklineGroups: 'Clear Selected Sparkline Groups',
txtShowComment: 'Show Comment',
advancedImgText: 'Image Advanced Settings'
advancedImgText: 'Image Advanced Settings',
textNone: 'None',
bulletsText: 'Bullets and Numbering'
}, SSE.Views.DocumentHolder || {}));
});

View file

@ -1027,6 +1027,8 @@
"SSE.Views.DocumentHolder.txtUngroup": "Ungroup",
"SSE.Views.DocumentHolder.txtWidth": "Width",
"SSE.Views.DocumentHolder.vertAlignText": "Vertical Alignment",
"SSE.Views.DocumentHolder.textNone": "None",
"SSE.Views.DocumentHolder.bulletsText": "Bullets and Numbering",
"SSE.Views.FileMenu.btnBackCaption": "Go to Documents",
"SSE.Views.FileMenu.btnCloseMenuCaption": "Close Menu",
"SSE.Views.FileMenu.btnCreateNewCaption": "Create New",

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

View file

@ -247,4 +247,10 @@
#slot-field-fontsize {
width: 45px;
}
}
.item-markerlist {
.background-ximage('@{app-image-path}/toolbar/bullets-and-numbering.png', '@{app-image-path}/toolbar/bullets-and-numbering@2x.png', 38px);
width: 38px;
height: 38px;
}