Merge pull request #2467 from ONLYOFFICE/feature/Fix-btnIsertSymbol

Fix btn isert symbol
This commit is contained in:
Julia Radzhabova
2023-07-04 19:36:04 +03:00
committed by GitHub
14 changed files with 622 additions and 14 deletions

View File

@ -815,7 +815,7 @@ define([
getSpecialSymbol: function() {
var rec = this.specialList.getSelectedRec();
return {font: undefined, symbol: this.encodeSurrogateChar(rec.get('code')), code: parseInt(rec.get('code'), 16), special: rec.get('special')};
return {font: undefined, symbol: this.encodeSurrogateChar(rec.get('code')), code: parseInt(rec.get('code'), 16), special: rec.get('special'), speccharacter: true};
},
onBtnClick: function(event) {

View File

@ -559,6 +559,16 @@
.margins-h-var()
}
.margin-x(@left, @right) {
margin-left: @left;
margin-right: @right;
.rtl & {
margin-left: @right;
margin-right: @left;
}
}
.margin-right(@value) {
margin-right: @value;
margin-left: 0;

View File

@ -374,7 +374,8 @@ define([
toolbar.listStyles.on('contextmenu', _.bind(this.onListStyleContextMenu, this));
toolbar.styleMenu.on('hide:before', _.bind(this.onListStyleBeforeHide, this));
toolbar.btnInsertEquation.on('click', _.bind(this.onInsertEquationClick, this));
toolbar.btnInsertSymbol.on('click', _.bind(this.onInsertSymbolClick, this));
toolbar.btnInsertSymbol.menu.items[2].on('click', _.bind(this.onInsertSymbolClick, this));
toolbar.mnuInsertSymbolsPicker.on('item:click', _.bind(this.onInsertSymbolItemClick, this));
toolbar.mnuNoControlsColor.on('click', _.bind(this.onNoControlsColor, this));
toolbar.mnuControlsColorPicker.on('select', _.bind(this.onSelectControlsColor, this));
toolbar.btnLineNumbers.menu.on('item:click', _.bind(this.onLineNumbersSelect, this));
@ -2893,14 +2894,14 @@ define([
buttons: [{value: 'ok', caption: this.textInsert}, 'close'],
handler: function(dlg, result, settings) {
if (result == 'ok') {
me.api.asc_insertSymbol(settings.font ? settings.font : me.api.get_TextProps().get_TextPr().get_FontFamily().get_Name(), settings.code, settings.special);
me.insertSymbol(settings.font, settings.code, settings.special, settings.speccharacter);
} else
Common.NotificationCenter.trigger('edit:complete', me.toolbar);
}
});
me.dlgSymbolTable.show();
me.dlgSymbolTable.on('symbol:dblclick', function(cmp, result, settings) {
me.api.asc_insertSymbol(settings.font ? settings.font : me.api.get_TextProps().get_TextPr().get_FontFamily().get_Name(), settings.code, settings.special);
me.insertSymbol(settings.font, settings.code, settings.special, settings.speccharacter);
});
me.dlgSymbolTable.on('close', function(obj){
Common.NotificationCenter.trigger('edit:complete', me.toolbar);
@ -2908,6 +2909,17 @@ define([
}
},
onInsertSymbolItemClick: function(picker, item, record, e) {
if (this.api && record)
this.insertSymbol(record.get('font'), record.get('symbol'), record.get('special'));
},
insertSymbol: function(fontRecord, symbol, special, specCharacter){
var font = fontRecord ? fontRecord: this.api.get_TextProps().get_TextPr().get_FontFamily().get_Name();
this.api.asc_insertSymbol(font, symbol, special);
!specCharacter && this.toolbar.saveSymbol(symbol, font);
},
onApiMathTypes: function(equation) {
this._equationTemp = equation;
var me = this;

View File

@ -825,6 +825,16 @@ define([
lock: [_set.paragraphLock, _set.headerLock, _set.richEditLock, _set.plainEditLock, _set.richDelLock, _set.plainDelLock, _set.noParagraphSelected, _set.previewReviewMode,
_set.viewFormMode, _set.lostConnect, _set.disableOnStart, _set.docLockView, _set.docLockForms, _set.docLockComments],
caption: me.capBtnInsSymbol,
menu: new Common.UI.Menu({
style: 'min-width: 100px;',
items: [
{template: _.template('<div id="id-toolbar-menu-symbols"></div>')},
{caption: '--'},
new Common.UI.MenuItem({
caption: this.textMoreSymbols
})
]
}),
dataHint: '1',
dataHintDirection: 'bottom',
dataHintOffset: 'small'
@ -2359,6 +2369,47 @@ define([
}));
// set dataviews
this.specSymbols = [
{symbol: 8226, description: this.textBullet},
{symbol: 8364, description: this.textEuro},
{symbol: 65284, description: this.textDollar},
{symbol: 165, description: this.textYen},
{symbol: 169, description: this.textCopyright},
{symbol: 174, description: this.textRegistered},
{symbol: 189, description: this.textOneHalf},
{symbol: 188, description: this.textOneQuarter},
{symbol: 8800, description: this.textNotEqualTo},
{symbol: 177, description: this.textPlusMinus},
{symbol: 247, description: this.textDivision},
{symbol: 8730, description: this.textSquareRoot},
{symbol: 8804, description: this.textLessEqual},
{symbol: 8805, description: this.textGreaterEqual},
{symbol: 8482, description: this.textTradeMark},
{symbol: 8734, description: this.textInfinity},
{symbol: 126, description: this.textTilde},
{symbol: 176, description: this.textDegree},
{symbol: 167, description: this.textSection},
{symbol: 945, description: this.textAlpha},
{symbol: 946, description: this.textBetta},
{symbol: 960, description: this.textLetterPi},
{symbol: 916, description: this.textDelta},
{symbol: 9786, description: this.textSmile},
{symbol: 9829, description: this.textBlackHeart}
];
this.mnuInsertSymbolsPicker = new Common.UI.DataView({
el: $('#id-toolbar-menu-symbols'),
parentMenu: this.btnInsertSymbol.menu,
outerMenu: {menu: this.btnInsertSymbol.menu, index:0},
restoreHeight: 290,
delayRenderTips: true,
scrollAlwaysVisible: true,
store: new Common.UI.DataViewStore(this.loadRecentSymbolsFromStorage()),
itemTemplate: _.template('<div class="item-symbol" <% if (typeof font !== "undefined" && font !=="") { %> style ="font-family: <%= font %>"<% } %>>&#<%= symbol %></div>')
});
this.btnInsertSymbol.menu.setInnerMenu([{menu: this.mnuInsertSymbolsPicker, index: 0}]);
this.btnInsertSymbol.menu.on('show:before', _.bind(function() {
this.mnuInsertSymbolsPicker.deselectAll();
}, this));
var _conf = this.mnuMarkersPicker.conf;
this._markersArr = [
@ -2875,6 +2926,65 @@ define([
this.btnPageMargins.menu.items[0].setVisible(false);
},
loadRecentSymbolsFromStorage: function(){
var recents = Common.localStorage.getItem('de-fastRecentSymbols');
var arr =(!!recents) ? JSON.parse(recents) :
[
{ symbol: 8226, font: 'Arial'},
{ symbol: 8364, font: 'Arial'},
{ symbol: 65284, font: 'Arial'},
{ symbol: 165, font: 'Arial'},
{ symbol: 169, font: 'Arial'},
{ symbol: 174, font: 'Arial'},
{ symbol: 189, font: 'Arial'},
{ symbol: 188, font: 'Arial'},
{ symbol: 8800, font: 'Arial'},
{ symbol: 177, font: 'Arial'},
{ symbol: 247, font: 'Arial'},
{ symbol: 8730, font: 'Arial'},
{ symbol: 8804, font: 'Arial'},
{ symbol: 8805, font: 'Arial'},
{ symbol: 8482, font: 'Arial'},
{ symbol: 8734, font: 'Arial'},
{ symbol: 126, font: 'Arial'},
{ symbol: 176, font: 'Arial'},
{ symbol: 167, font: 'Arial'},
{ symbol: 945, font: 'Arial'},
{ symbol: 946, font: 'Arial'},
{ symbol: 960, font: 'Arial'},
{ symbol: 916, font: 'Arial'},
{ symbol: 9786, font: 'Arial'},
{ symbol: 9829, font: 'Arial'}
];
arr.forEach(function (item){
item.tip = this.getSymbolDescription(item.symbol);
}.bind(this));
return arr;
},
saveSymbol: function(symbol, font) {
var maxLength =25,
picker = this.mnuInsertSymbolsPicker;
var item = picker.store.find(function(item){
return item.get('symbol') == symbol && item.get('font') == font
});
item && picker.store.remove(item);
picker.store.add({symbol: symbol, font: font, tip: this.getSymbolDescription(symbol)},{at:0});
picker.store.length > maxLength && picker.store.remove(picker.store.last());
var arr = picker.store.map(function (item){
return {symbol: item.get('symbol'), font: item.get('font')};
});
var sJSON = JSON.stringify(arr);
Common.localStorage.setItem( 'de-fastRecentSymbols', sJSON);
},
getSymbolDescription: function(symbol){
var specSymbol = this.specSymbols.find(function (item){return item.symbol == symbol});
return !!specSymbol ? specSymbol.description : this.capBtnInsSymbol + ': ' + symbol;
},
loadListPresetsFromStorage: function(path, groupId) {
var recents = Common.localStorage.getItem(path),
arr = [];
@ -3154,7 +3264,33 @@ define([
txtGroupBulletDoc: 'Document bullets',
txtGroupNumDoc: 'Document numbering formats',
txtGroupMultiDoc: 'Lists in current document',
textTabDraw: 'Draw'
textTabDraw: 'Draw',
textMoreSymbols: 'More symbols',
textAlpha: 'Greek Small Letter Alpha',
textBetta: 'Greek Small Letter Betta',
textBlackHeart: 'Black Heart Suit',
textBullet: 'Bullet',
textCopyright: 'Copyright Sign',
textDegree: 'Degree Sign',
textDelta: 'Greek Small Letter Delta',
textDivision: 'Division Sign',
textDollar: 'Dollar Sign',
textEuro: 'Euro Sign',
textGreaterEqual: 'Greater-Than Or Equal To',
textInfinity: 'Infinity',
textLessEqual: 'Less-Than Or Equal To',
textLetterPi: 'Greek Small Letter Pi',
textNotEqualTo: 'Not Equal To',
textOneHalf: 'Vulgar Fraction One Half',
textOneQuarter: 'Vulgar Fraction One Quarter',
textPlusMinus: 'Plus-Minus Sign',
textRegistered: 'Registered Sign',
textSection: 'Section Sign',
textSmile: 'White Smiling Fase',
textSquareRoot: 'Square Root',
textTilde: 'Tilde',
textTradeMark: 'Trade Mark Sign',
textYen: 'Yen Sign'
}
})(), DE.Views.Toolbar || {}));
});

View File

@ -3203,11 +3203,16 @@
"DE.Views.Toolbar.mniToggleCase": "tOGGLE cASE",
"DE.Views.Toolbar.mniUpperCase": "UPPERCASE",
"DE.Views.Toolbar.strMenuNoFill": "No fill",
"DE.Views.Toolbar.textAlpha": "Greek Small Letter Alpha",
"DE.Views.Toolbar.textAutoColor": "Automatic",
"DE.Views.Toolbar.textBetta": "Greek Small Letter Betta",
"DE.Views.Toolbar.textBlackHeart": "Black Heart Suit",
"DE.Views.Toolbar.textBold": "Bold",
"DE.Views.Toolbar.textBottom": "Bottom: ",
"DE.Views.Toolbar.textBullet": "Bullet",
"DE.Views.Toolbar.textChangeLevel": "Change List Level",
"DE.Views.Toolbar.textCheckboxControl": "Check box",
"DE.Views.Toolbar.textCopyright": "Copyright Sign",
"DE.Views.Toolbar.textColumnsCustom": "Custom columns",
"DE.Views.Toolbar.textColumnsLeft": "Left",
"DE.Views.Toolbar.textColumnsOne": "One",
@ -3219,9 +3224,16 @@
"DE.Views.Toolbar.textContPage": "Continuous page",
"DE.Views.Toolbar.textCustomLineNumbers": "Line numbering options",
"DE.Views.Toolbar.textDateControl": "Date",
"DE.Views.Toolbar.textDegree": "Degree Sign",
"DE.Views.Toolbar.textDelta": "Greek Small Letter Delta",
"DE.Views.Toolbar.textDivision": "Division Sign",
"DE.Views.Toolbar.textDollar": "Dollar Sign",
"DE.Views.Toolbar.textDropdownControl": "Drop-down list",
"DE.Views.Toolbar.textEditWatermark": "Custom watermark",
"DE.Views.Toolbar.textEuro": "Euro Sign",
"DE.Views.Toolbar.textEvenPage": "Even page",
"DE.Views.Toolbar.textGreaterEqual": "Greater-Than Or Equal To",
"DE.Views.Toolbar.textInfinity": "Infinity",
"DE.Views.Toolbar.textInMargin": "In Margin",
"DE.Views.Toolbar.textInsColumnBreak": "Insert column break",
"DE.Views.Toolbar.textInsertPageCount": "Insert number of pages",
@ -3232,6 +3244,8 @@
"DE.Views.Toolbar.textItalic": "Italic",
"DE.Views.Toolbar.textLandscape": "Landscape",
"DE.Views.Toolbar.textLeft": "Left: ",
"DE.Views.Toolbar.textLessEqual": "Less-Than Or Equal To",
"DE.Views.Toolbar.textLetterPi": "Greek Small Letter Pi",
"DE.Views.Toolbar.textListSettings": "List Settings",
"DE.Views.Toolbar.textMarginsLast": "Last Custom",
"DE.Views.Toolbar.textMarginsModerate": "Moderate",
@ -3239,22 +3253,31 @@
"DE.Views.Toolbar.textMarginsNormal": "Normal",
"DE.Views.Toolbar.textMarginsUsNormal": "US Normal",
"DE.Views.Toolbar.textMarginsWide": "Wide",
"DE.Views.Toolbar.textMoreSymbols": "More symbols",
"DE.Views.Toolbar.textNewColor": "More Colors",
"DE.Views.Toolbar.textNextPage": "Next page",
"DE.Views.Toolbar.textNoHighlight": "No highlighting",
"DE.Views.Toolbar.textNone": "None",
"DE.Views.Toolbar.textNotEqualTo": "Not Equal To",
"DE.Views.Toolbar.textOddPage": "Odd page",
"DE.Views.Toolbar.textOneHalf": "Vulgar Fraction One Half",
"DE.Views.Toolbar.textOneQuarter": "Vulgar Fraction One Quarter",
"DE.Views.Toolbar.textPageMarginsCustom": "Custom margins",
"DE.Views.Toolbar.textPageSizeCustom": "Custom page size",
"DE.Views.Toolbar.textPictureControl": "Picture",
"DE.Views.Toolbar.textPlainControl": "Plain text",
"DE.Views.Toolbar.textPlusMinus": "Plus-Minus Sign",
"DE.Views.Toolbar.textPortrait": "Portrait",
"DE.Views.Toolbar.textRegistered": "Registered Sign",
"DE.Views.Toolbar.textRemoveControl": "Remove Content Control",
"DE.Views.Toolbar.textRemWatermark": "Remove watermark",
"DE.Views.Toolbar.textRestartEachPage": "Restart each page",
"DE.Views.Toolbar.textRestartEachSection": "Restart each section",
"DE.Views.Toolbar.textRichControl": "Rich text",
"DE.Views.Toolbar.textRight": "Right: ",
"DE.Views.Toolbar.textSection": "Section Sign",
"DE.Views.Toolbar.textSmile": "White Smiling Fase",
"DE.Views.Toolbar.textSquareRoot": "Square Root",
"DE.Views.Toolbar.textStrikeout": "Strikethrough",
"DE.Views.Toolbar.textStyleMenuDelete": "Delete style",
"DE.Views.Toolbar.textStyleMenuDeleteAll": "Delete all custom styles",
@ -3275,10 +3298,13 @@
"DE.Views.Toolbar.textTabProtect": "Protection",
"DE.Views.Toolbar.textTabReview": "Review",
"DE.Views.Toolbar.textTabView": "View",
"DE.Views.Toolbar.textTilde": "Tilde",
"DE.Views.Toolbar.textTitleError": "Error",
"DE.Views.Toolbar.textToCurrent": "To current position",
"DE.Views.Toolbar.textTop": "Top: ",
"DE.Views.Toolbar.textTradeMark": "Trade Mark Sign",
"DE.Views.Toolbar.textUnderline": "Underline",
"DE.Views.Toolbar.textYen": "Yen Sign",
"DE.Views.Toolbar.tipAlignCenter": "Align center",
"DE.Views.Toolbar.tipAlignJust": "Justified",
"DE.Views.Toolbar.tipAlignLeft": "Align left",

View File

@ -29,6 +29,31 @@
background-color: transparent;
}
#id-toolbar-menu-symbols {
display: inline-block;
width: 158px;
.padding-left(3px);
.item {
.box-shadow(none);
.margin-x(6px, 4px);
&:hover, &.selected{
.box-shadow( 0 0 0 2px @border-preview-select-ie);
.box-shadow( 0 0 0 @scaled-two-px-value @border-preview-select);
}
}
.item-symbol {
font-family: @font-family-base;
font-size: 14px;
display: block;
width: 20px;
height: 20px;
text-align: center;
line-height: 20px;
vertical-align: middle;
}
}
.item-markerlist {
width: 40px;
height: 40px;

View File

@ -362,7 +362,8 @@ define([
toolbar.btnSlideSize.menu.on('item:click', _.bind(this.onSlideSize, this));
toolbar.listTheme.on('click', _.bind(this.onListThemeSelect, this));
toolbar.btnInsertEquation.on('click', _.bind(this.onInsertEquationClick, this));
toolbar.btnInsertSymbol.on('click', _.bind(this.onInsertSymbolClick, this));
toolbar.btnInsertSymbol.menu.items[2].on('click', _.bind(this.onInsertSymbolClick, this));
toolbar.mnuInsertSymbolsPicker.on('item:click', _.bind(this.onInsertSymbolItemClick, this));
toolbar.btnEditHeader.on('click', _.bind(this.onEditHeaderClick, this, 'header'));
toolbar.btnInsDateTime.on('click', _.bind(this.onEditHeaderClick, this, 'datetime'));
toolbar.btnInsSlideNum.on('click', _.bind(this.onEditHeaderClick, this, 'slidenum'));
@ -2365,18 +2366,28 @@ define([
symbol: selected && selected.length>0 ? selected.charAt(0) : undefined,
handler: function(dlg, result, settings) {
if (result == 'ok') {
me.api.asc_insertSymbol(settings.font ? settings.font : me.api.get_TextProps().get_TextPr().get_FontFamily().get_Name(), settings.code, settings.special);
me.insertSymbol(settings.font, settings.code, settings.special, settings.speccharacter);
} else
Common.NotificationCenter.trigger('edit:complete', me.toolbar);
}
});
win.show();
win.on('symbol:dblclick', function(cmp, result, settings) {
me.api.asc_insertSymbol(settings.font ? settings.font : me.api.get_TextProps().get_TextPr().get_FontFamily().get_Name(), settings.code, settings.special);
});
me.insertSymbol(settings.font, settings.code, settings.special, settings.speccharacter); });
}
},
onInsertSymbolItemClick: function(picker, item, record, e) {
if (this.api && record)
this.insertSymbol(record.get('font') , record.get('symbol'), record.get('special'));
},
insertSymbol: function(fontRecord, symbol, special, specCharacter){
var font = fontRecord ? fontRecord: this.api.get_TextProps().get_TextPr().get_FontFamily().get_Name();
this.api.asc_insertSymbol(font, symbol, special);
!specCharacter && this.toolbar.saveSymbol(symbol, font);
},
onApiMathTypes: function(equation) {
this._equationTemp = equation;
var me = this;

View File

@ -801,6 +801,16 @@ define([
iconCls: 'toolbar__icon btn-symbol',
caption: me.capBtnInsSymbol,
lock: [_set.slideDeleted, _set.paragraphLock, _set.lostConnect, _set.noSlides, _set.noParagraphSelected],
menu: new Common.UI.Menu({
style: 'min-width: 100px;',
items: [
{template: _.template('<div id="id-toolbar-menu-symbols"></div>')},
{caption: '--'},
new Common.UI.MenuItem({
caption: this.textMoreSymbols
})
]
}),
dataHint: '1',
dataHintDirection: 'bottom',
dataHintOffset: 'small'
@ -1628,6 +1638,47 @@ define([
this.btnInsertTextArt.menu.on('show:before', onShowBeforeTextArt);
// set dataviews
this.specSymbols = [
{symbol: 8226, description: this.textBullet},
{symbol: 8364, description: this.textEuro},
{symbol: 65284, description: this.textDollar},
{symbol: 165, description: this.textYen},
{symbol: 169, description: this.textCopyright},
{symbol: 174, description: this.textRegistered},
{symbol: 189, description: this.textOneHalf},
{symbol: 188, description: this.textOneQuarter},
{symbol: 8800, description: this.textNotEqualTo},
{symbol: 177, description: this.textPlusMinus},
{symbol: 247, description: this.textDivision},
{symbol: 8730, description: this.textSquareRoot},
{symbol: 8804, description: this.textLessEqual},
{symbol: 8805, description: this.textGreaterEqual},
{symbol: 8482, description: this.textTradeMark},
{symbol: 8734, description: this.textInfinity},
{symbol: 126, description: this.textTilde},
{symbol: 176, description: this.textDegree},
{symbol: 167, description: this.textSection},
{symbol: 945, description: this.textAlpha},
{symbol: 946, description: this.textBetta},
{symbol: 960, description: this.textLetterPi},
{symbol: 916, description: this.textDelta},
{symbol: 9786, description: this.textSmile},
{symbol: 9829, description: this.textBlackHeart}
];
this.mnuInsertSymbolsPicker = new Common.UI.DataView({
el: $('#id-toolbar-menu-symbols'),
parentMenu: this.btnInsertSymbol.menu,
outerMenu: {menu: this.btnInsertSymbol.menu, index:0},
restoreHeight: 290,
delayRenderTips: true,
scrollAlwaysVisible: true,
store: new Common.UI.DataViewStore(this.loadRecentSymbolsFromStorage()),
itemTemplate: _.template('<div class="item-symbol" <% if (typeof font !== "undefined" && font !=="") { %> style ="font-family: <%= font %>"<% } %>>&#<%= symbol %></div>')
});
this.btnInsertSymbol.menu.setInnerMenu([{menu: this.mnuInsertSymbolsPicker, index: 0}]);
this.btnInsertSymbol.menu.on('show:before', _.bind(function() {
this.mnuInsertSymbolsPicker.deselectAll();
}, this));
this._markersArr = [
'undefined',
@ -2052,6 +2103,65 @@ define([
}
},
loadRecentSymbolsFromStorage: function(){
var recents = Common.localStorage.getItem('pe-fastRecentSymbols');
var arr = (!!recents) ? JSON.parse(recents) :
[
{ symbol: 8226, font: 'Arial'},
{ symbol: 8364, font: 'Arial'},
{ symbol: 65284, font: 'Arial'},
{ symbol: 165, font: 'Arial'},
{ symbol: 169, font: 'Arial'},
{ symbol: 174, font: 'Arial'},
{ symbol: 189, font: 'Arial'},
{ symbol: 188, font: 'Arial'},
{ symbol: 8800, font: 'Arial'},
{ symbol: 177, font: 'Arial'},
{ symbol: 247, font: 'Arial'},
{ symbol: 8730, font: 'Arial'},
{ symbol: 8804, font: 'Arial'},
{ symbol: 8805, font: 'Arial'},
{ symbol: 8482, font: 'Arial'},
{ symbol: 8734, font: 'Arial'},
{ symbol: 126, font: 'Arial'},
{ symbol: 176, font: 'Arial'},
{ symbol: 167, font: 'Arial'},
{ symbol: 945, font: 'Arial'},
{ symbol: 946, font: 'Arial'},
{ symbol: 960, font: 'Arial'},
{ symbol: 916, font: 'Arial'},
{ symbol: 9786, font: 'Arial'},
{ symbol: 9829, font: 'Arial'}
];
arr.forEach(function (item){
item.tip = this.getSymbolDescription(item.symbol);
}.bind(this));
return arr;
},
saveSymbol: function(symbol, font) {
var maxLength =25,
picker = this.mnuInsertSymbolsPicker;
var item = picker.store.find(function(item){
return item.get('symbol') == symbol && item.get('font') == font
});
item && picker.store.remove(item);
picker.store.add({symbol: symbol, font: font, tip: this.getSymbolDescription(symbol)},{at:0});
picker.store.length > maxLength && picker.store.remove(picker.store.last());
var arr = picker.store.map(function (item){
return {symbol: item.get('symbol'), font: item.get('font')};
});
var sJSON = JSON.stringify(arr);
Common.localStorage.setItem( 'pe-fastRecentSymbols', sJSON);
},
getSymbolDescription: function(symbol){
var specSymbol = this.specSymbols.find(function (item){return item.symbol == symbol});
return !!specSymbol ? specSymbol.description : this.capBtnInsSymbol + ': ' + symbol;
},
textBold: 'Bold',
textItalic: 'Italic',
textUnderline: 'Underline',
@ -2229,7 +2339,33 @@ define([
mniInsertSSE: 'Insert Spreadsheet',
tipSelectAll: 'Select all',
tipCut: 'Cut',
textTabDraw: 'Draw'
textTabDraw: 'Draw',
textMoreSymbols: 'More symbols',
textAlpha: 'Greek Small Letter Alpha',
textBetta: 'Greek Small Letter Betta',
textBlackHeart: 'Black Heart Suit',
textBullet: 'Bullet',
textCopyright: 'Copyright Sign',
textDegree: 'Degree Sign',
textDelta: 'Greek Small Letter Delta',
textDivision: 'Division Sign',
textDollar: 'Dollar Sign',
textEuro: 'Euro Sign',
textGreaterEqual: 'Greater-Than Or Equal To',
textInfinity: 'Infinity',
textLessEqual: 'Less-Than Or Equal To',
textLetterPi: 'Greek Small Letter Pi',
textNotEqualTo: 'Not Equal To',
textOneHalf: 'Vulgar Fraction One Half',
textOneQuarter: 'Vulgar Fraction One Quarter',
textPlusMinus: 'Plus-Minus Sign',
textRegistered: 'Registered Sign',
textSection: 'Section Sign',
textSmile: 'White Smiling Fase',
textSquareRoot: 'Square Root',
textTilde: 'Tilde',
textTradeMark: 'Trade Mark Sign',
textYen: 'Yen Sign'
}
}()), PE.Views.Toolbar || {}));
});

View File

@ -2542,18 +2542,39 @@
"PE.Views.Toolbar.textAlignMiddle": "Align text to the middle",
"PE.Views.Toolbar.textAlignRight": "Align text right",
"PE.Views.Toolbar.textAlignTop": "Align text to the top",
"PE.Views.Toolbar.textAlpha": "Greek Small Letter Alpha",
"PE.Views.Toolbar.textArrangeBack": "Send to background",
"PE.Views.Toolbar.textArrangeBackward": "Send backward",
"PE.Views.Toolbar.textArrangeForward": "Bring forward",
"PE.Views.Toolbar.textArrangeFront": "Bring to foreground",
"PE.Views.Toolbar.textBetta": "Greek Small Letter Betta",
"PE.Views.Toolbar.textBlackHeart": "Black Heart Suit",
"PE.Views.Toolbar.textBold": "Bold",
"PE.Views.Toolbar.textBullet": "Bullet",
"PE.Views.Toolbar.textColumnsCustom": "Custom columns",
"PE.Views.Toolbar.textColumnsOne": "One Column",
"PE.Views.Toolbar.textColumnsThree": "Three Columns",
"PE.Views.Toolbar.textColumnsTwo": "Two Columns",
"PE.Views.Toolbar.textCopyright": "Copyright Sign",
"PE.Views.Toolbar.textDegree": "Degree Sign",
"PE.Views.Toolbar.textDelta": "Greek Small Letter Delta",
"PE.Views.Toolbar.textDivision": "Division Sign",
"PE.Views.Toolbar.textDollar": "Dollar Sign",
"PE.Views.Toolbar.textEuro": "Euro Sign",
"PE.Views.Toolbar.textGreaterEqual": "Greater-Than Or Equal To",
"PE.Views.Toolbar.textInfinity": "Infinity",
"PE.Views.Toolbar.textItalic": "Italic",
"PE.Views.Toolbar.textLessEqual": "Less-Than Or Equal To",
"PE.Views.Toolbar.textLetterPi": "Greek Small Letter Pi",
"PE.Views.Toolbar.textListSettings": "List Settings",
"PE.Views.Toolbar.textMoreSymbols": "More symbols",
"PE.Views.Toolbar.textNotEqualTo": "Not Equal To",
"PE.Views.Toolbar.textOneHalf": "Vulgar Fraction One Half",
"PE.Views.Toolbar.textOneQuarter": "Vulgar Fraction One Quarter",
"PE.Views.Toolbar.textPlusMinus": "Plus-Minus Sign",
"PE.Views.Toolbar.textRecentlyUsed": "Recently Used",
"PE.Views.Toolbar.textRegistered": "Registered Sign",
"PE.Views.Toolbar.textSection": "Section Sign",
"PE.Views.Toolbar.textShapeAlignBottom": "Align Bottom",
"PE.Views.Toolbar.textShapeAlignCenter": "Align Center",
"PE.Views.Toolbar.textShapeAlignLeft": "Align Left",
@ -2564,6 +2585,8 @@
"PE.Views.Toolbar.textShowCurrent": "Show from Current Slide",
"PE.Views.Toolbar.textShowPresenterView": "Show Presenter View",
"PE.Views.Toolbar.textShowSettings": "Show Settings",
"PE.Views.Toolbar.textSmile": "White Smiling Fase",
"PE.Views.Toolbar.textSquareRoot": "Square Root",
"PE.Views.Toolbar.textStrikeout": "Strikethrough",
"PE.Views.Toolbar.textSubscript": "Subscript",
"PE.Views.Toolbar.textSuperscript": "Superscript",
@ -2576,8 +2599,11 @@
"PE.Views.Toolbar.textTabProtect": "Protection",
"PE.Views.Toolbar.textTabTransitions": "Transitions",
"PE.Views.Toolbar.textTabView": "View",
"PE.Views.Toolbar.textTilde": "Tilde",
"PE.Views.Toolbar.textTitleError": "Error",
"PE.Views.Toolbar.textTradeMark": "Trade Mark Sign",
"PE.Views.Toolbar.textUnderline": "Underline",
"PE.Views.Toolbar.textYen": "Yen Sign",
"PE.Views.Toolbar.tipAddSlide": "Add slide",
"PE.Views.Toolbar.tipBack": "Back",
"PE.Views.Toolbar.tipChangeCase": "Change case",

View File

@ -48,6 +48,31 @@
}
}
#id-toolbar-menu-symbols {
display: inline-block;
width: 158px;
.padding-left(3px);
.item {
.box-shadow(none);
.margin-x(6px, 4px);
&:hover, &.selected{
.box-shadow( 0 0 0 2px @border-preview-select-ie);
.box-shadow( 0 0 0 @scaled-two-px-value @border-preview-select);
}
}
.item-symbol {
display: block;
font-family: @font-family-base;
font-size: 14px;
width: 20px;
height: 20px;
text-align: center;
line-height: 20px;
vertical-align: middle;
}
}
.item-markerlist {
width: 40px;
height: 40px;

View File

@ -423,7 +423,8 @@ define([
toolbar.btnInsertText.menu.on('item:click', _.bind(this.onMenuInsertTextClick, this));
toolbar.btnInsertShape.menu.on('hide:after', _.bind(this.onInsertShapeHide, this));
toolbar.btnInsertEquation.on('click', _.bind(this.onInsertEquationClick, this));
toolbar.btnInsertSymbol.on('click', _.bind(this.onInsertSymbolClick, this));
toolbar.btnInsertSymbol.menu.items[2].on('click', _.bind(this.onInsertSymbolClick, this));
toolbar.mnuInsertSymbolsPicker.on('item:click', _.bind(this.onInsertSymbolItemClick, this));
toolbar.btnInsertSlicer.on('click', _.bind(this.onInsertSlicerClick, this));
toolbar.btnTableTemplate.menu.on('show:after', _.bind(this.onTableTplMenuOpen, this));
toolbar.btnPercentStyle.on('click', _.bind(this.onNumberFormat, this));
@ -4080,18 +4081,29 @@ define([
symbol: selected && selected.length>0 ? selected.charAt(0) : undefined,
handler: function(dlg, result, settings) {
if (result == 'ok') {
me.api.asc_insertSymbol(settings.font ? settings.font : me.api.asc_getCellInfo().asc_getXfs().asc_getFontName(), settings.code, settings.special);
me.insertSymbol(settings.font, settings.code, settings.special, settings.speccharacter);
} else
Common.NotificationCenter.trigger('edit:complete', me.toolbar);
}
});
win.show();
win.on('symbol:dblclick', function(cmp, result, settings) {
me.api.asc_insertSymbol(settings.font ? settings.font : me.api.asc_getCellInfo().asc_getXfs().asc_getFontName(), settings.code, settings.special);
me.insertSymbol(settings.font, settings.code, settings.special, settings.speccharacter);
});
}
},
onInsertSymbolItemClick: function(picker, item, record, e) {
if (this.api && record)
this.insertSymbol(record.get('font'), record.get('symbol'), record.get('special'));
},
insertSymbol: function(fontRecord, symbol, special, specCharacter){
var font = fontRecord ? fontRecord: this.api.asc_getCellInfo().asc_getXfs().asc_getFontName();
this.api.asc_insertSymbol(font, symbol, special);
!specCharacter && this.toolbar.saveSymbol(symbol, font);
},
onInsertSlicerClick: function() {
var me = this,
props = me.api.asc_beforeInsertSlicer();

View File

@ -1333,6 +1333,16 @@ define([
iconCls: 'toolbar__icon btn-symbol',
caption: me.capBtnInsSymbol,
lock: [_set.selImage, _set.selChart, _set.selShape, _set.editFormula, _set.selRangeEdit, _set.selSlicer, _set.coAuth, _set.coAuthText, _set.lostConnect],
menu: new Common.UI.Menu({
style: 'min-width: 100px;',
items: [
{template: _.template('<div id="id-toolbar-menu-symbols"></div>')},
{caption: '--'},
new Common.UI.MenuItem({
caption: this.textMoreSymbols
})
]
}),
dataHint: '1',
dataHintDirection: 'bottom',
dataHintOffset: 'small'
@ -2754,6 +2764,49 @@ define([
this.btnInsertTextArt.menu.on('show:before', onShowBeforeTextArt);
}
this.specSymbols = [
{symbol: 8226, description: this.textBullet},
{symbol: 8364, description: this.textEuro},
{symbol: 65284, description: this.textDollar},
{symbol: 165, description: this.textYen},
{symbol: 169, description: this.textCopyright},
{symbol: 174, description: this.textRegistered},
{symbol: 189, description: this.textOneHalf},
{symbol: 188, description: this.textOneQuarter},
{symbol: 8800, description: this.textNotEqualTo},
{symbol: 177, description: this.textPlusMinus},
{symbol: 247, description: this.textDivision},
{symbol: 8730, description: this.textSquareRoot},
{symbol: 8804, description: this.textLessEqual},
{symbol: 8805, description: this.textGreaterEqual},
{symbol: 8482, description: this.textTradeMark},
{symbol: 8734, description: this.textInfinity},
{symbol: 126, description: this.textTilde},
{symbol: 176, description: this.textDegree},
{symbol: 167, description: this.textSection},
{symbol: 945, description: this.textAlpha},
{symbol: 946, description: this.textBetta},
{symbol: 960, description: this.textLetterPi},
{symbol: 916, description: this.textDelta},
{symbol: 9786, description: this.textSmile},
{symbol: 9829, description: this.textBlackHeart}
];
this.mnuInsertSymbolsPicker = new Common.UI.DataView({
el: $('#id-toolbar-menu-symbols'),
parentMenu: this.btnInsertSymbol.menu,
outerMenu: {menu: this.btnInsertSymbol.menu, index:0},
restoreHeight: 290,
delayRenderTips: true,
scrollAlwaysVisible: true,
store: new Common.UI.DataViewStore(this.loadRecentSymbolsFromStorage()),
itemTemplate: _.template('<div class="item-symbol" <% if (typeof font !== "undefined" && font !=="") { %> style ="font-family: <%= font %>"<% } %>>&#<%= symbol %></div>')
});
this.btnInsertSymbol.menu.setInnerMenu([{menu: this.mnuInsertSymbolsPicker, index: 0}]);
this.btnInsertSymbol.menu.on('show:before', _.bind(function() {
this.mnuInsertSymbolsPicker.deselectAll();
}, this));
if (this.btnCondFormat && this.btnCondFormat.rendered) {
this.btnCondFormat.setMenu( new Common.UI.Menu({
items: [
@ -3237,6 +3290,65 @@ define([
},
loadRecentSymbolsFromStorage: function(){
var recents = Common.localStorage.getItem('sse-fastRecentSymbols');
var arr = (!!recents) ? JSON.parse(recents) :
[
{ symbol: 8226, font: 'Arial'},
{ symbol: 8364, font: 'Arial'},
{ symbol: 65284, font: 'Arial'},
{ symbol: 165, font: 'Arial'},
{ symbol: 169, font: 'Arial'},
{ symbol: 174, font: 'Arial'},
{ symbol: 189, font: 'Arial'},
{ symbol: 188, font: 'Arial'},
{ symbol: 8800, font: 'Arial'},
{ symbol: 177, font: 'Arial'},
{ symbol: 247, font: 'Arial'},
{ symbol: 8730, font: 'Arial'},
{ symbol: 8804, font: 'Arial'},
{ symbol: 8805, font: 'Arial'},
{ symbol: 8482, font: 'Arial'},
{ symbol: 8734, font: 'Arial'},
{ symbol: 126, font: 'Arial'},
{ symbol: 176, font: 'Arial'},
{ symbol: 167, font: 'Arial'},
{ symbol: 945, font: 'Arial'},
{ symbol: 946, font: 'Arial'},
{ symbol: 960, font: 'Arial'},
{ symbol: 916, font: 'Arial'},
{ symbol: 9786, font: 'Arial'},
{ symbol: 9829, font: 'Arial'}
];
arr.forEach(function (item){
item.tip = this.getSymbolDescription(item.symbol);
}.bind(this));
return arr;
},
saveSymbol: function(symbol, font) {
var maxLength =25,
picker = this.mnuInsertSymbolsPicker;
var item = picker.store.find(function(item){
return item.get('symbol') == symbol && item.get('font') == font
});
item && picker.store.remove(item);
picker.store.add({symbol: symbol, font: font, tip: this.getSymbolDescription(symbol)},{at:0});
picker.store.length > maxLength && picker.store.remove(picker.store.last());
var arr = picker.store.map(function (item){
return {symbol: item.get('symbol'), font: item.get('font')};
});
var sJSON = JSON.stringify(arr);
Common.localStorage.setItem( 'sse-fastRecentSymbols', sJSON);
},
getSymbolDescription: function(symbol){
var specSymbol = this.specSymbols.find(function (item){return item.symbol == symbol});
return !!specSymbol ? specSymbol.description : this.capBtnInsSymbol + ': ' + symbol;
},
textBold: 'Bold',
textItalic: 'Italic',
textUnderline: 'Underline',
@ -3516,6 +3628,32 @@ define([
mniLowerCase: 'lowercase',
mniUpperCase: 'UPPERCASE',
mniCapitalizeWords: 'Capitalize Each Word',
mniToggleCase: 'tOGGLE cASE'
mniToggleCase: 'tOGGLE cASE',
textMoreSymbols: 'More symbols',
textAlpha: 'Greek Small Letter Alpha',
textBetta: 'Greek Small Letter Betta',
textBlackHeart: 'Black Heart Suit',
textBullet: 'Bullet',
textCopyright: 'Copyright Sign',
textDegree: 'Degree Sign',
textDelta: 'Greek Small Letter Delta',
textDivision: 'Division Sign',
textDollar: 'Dollar Sign',
textEuro: 'Euro Sign',
textGreaterEqual: 'Greater-Than Or Equal To',
textInfinity: 'Infinity',
textLessEqual: 'Less-Than Or Equal To',
textLetterPi: 'Greek Small Letter Pi',
textNotEqualTo: 'Not Equal To',
textOneHalf: 'Vulgar Fraction One Half',
textOneQuarter: 'Vulgar Fraction One Quarter',
textPlusMinus: 'Plus-Minus Sign',
textRegistered: 'Registered Sign',
textSection: 'Section Sign',
textSmile: 'White Smiling Fase',
textSquareRoot: 'Square Root',
textTilde: 'Tilde',
textTradeMark: 'Trade Mark Sign',
textYen: 'Yen Sign'
}, SSE.Views.Toolbar || {}));
});

View File

@ -3882,33 +3882,45 @@
"SSE.Views.Toolbar.textAlignRight": "Align Right",
"SSE.Views.Toolbar.textAlignTop": "Align Top",
"SSE.Views.Toolbar.textAllBorders": "All Borders",
"SSE.Views.Toolbar.textAlpha": "Greek Small Letter Alpha",
"SSE.Views.Toolbar.textAuto": "Auto",
"SSE.Views.Toolbar.textAutoColor": "Automatic",
"SSE.Views.Toolbar.textBetta": "Greek Small Letter Betta",
"SSE.Views.Toolbar.textBlackHeart": "Black Heart Suit",
"SSE.Views.Toolbar.textBold": "Bold",
"SSE.Views.Toolbar.textBordersColor": "Border color",
"SSE.Views.Toolbar.textBordersStyle": "Border style",
"SSE.Views.Toolbar.textBottom": "Bottom: ",
"SSE.Views.Toolbar.textBottomBorders": "Bottom borders",
"SSE.Views.Toolbar.textBullet": "Bullet",
"SSE.Views.Toolbar.textCenterBorders": "Inside vertical borders",
"SSE.Views.Toolbar.textClearPrintArea": "Clear print area",
"SSE.Views.Toolbar.textClearRule": "Clear rules",
"SSE.Views.Toolbar.textClockwise": "Angle clockwise",
"SSE.Views.Toolbar.textColorScales": "Color scales",
"SSE.Views.Toolbar.textCopyright": "Copyright Sign",
"SSE.Views.Toolbar.textCounterCw": "Angle counterclockwise",
"SSE.Views.Toolbar.textCustom": "Custom",
"SSE.Views.Toolbar.textDataBars": "Data bars",
"SSE.Views.Toolbar.textDegree": "Degree Sign",
"SSE.Views.Toolbar.textDelLeft": "Shift cells left",
"SSE.Views.Toolbar.textDelta": "Greek Small Letter Delta",
"SSE.Views.Toolbar.textDelUp": "Shift cells up",
"SSE.Views.Toolbar.textDiagDownBorder": "Diagonal down border",
"SSE.Views.Toolbar.textDiagUpBorder": "Diagonal up border",
"SSE.Views.Toolbar.textDivision": "Division Sign",
"SSE.Views.Toolbar.textDollar": "Dollar Sign",
"SSE.Views.Toolbar.textDone": "Done",
"SSE.Views.Toolbar.textEditVA": "Edit Visible Area",
"SSE.Views.Toolbar.textEntireCol": "Entire column",
"SSE.Views.Toolbar.textEntireRow": "Entire row",
"SSE.Views.Toolbar.textEuro": "Euro Sign",
"SSE.Views.Toolbar.textFewPages": "pages",
"SSE.Views.Toolbar.textGreaterEqual": "Greater-Than Or Equal To",
"SSE.Views.Toolbar.textHeight": "Height",
"SSE.Views.Toolbar.textHideVA": "Hide Visible Area",
"SSE.Views.Toolbar.textHorizontal": "Horizontal text",
"SSE.Views.Toolbar.textInfinity": "Infinity",
"SSE.Views.Toolbar.textInsDown": "Shift cells down",
"SSE.Views.Toolbar.textInsideBorders": "Inside borders",
"SSE.Views.Toolbar.textInsRight": "Shift cells right",
@ -3917,6 +3929,8 @@
"SSE.Views.Toolbar.textLandscape": "Landscape",
"SSE.Views.Toolbar.textLeft": "Left: ",
"SSE.Views.Toolbar.textLeftBorders": "Left borders",
"SSE.Views.Toolbar.textLessEqual": "Less-Than Or Equal To",
"SSE.Views.Toolbar.textLetterPi": "Greek Small Letter Pi",
"SSE.Views.Toolbar.textManageRule": "Manage rules",
"SSE.Views.Toolbar.textManyPages": "pages",
"SSE.Views.Toolbar.textMarginsLast": "Last Custom",
@ -3926,26 +3940,35 @@
"SSE.Views.Toolbar.textMiddleBorders": "Inside horizontal borders",
"SSE.Views.Toolbar.textMoreFormats": "More formats",
"SSE.Views.Toolbar.textMorePages": "More pages",
"SSE.Views.Toolbar.textMoreSymbols": "More symbols",
"SSE.Views.Toolbar.textNewColor": "More colors",
"SSE.Views.Toolbar.textNewRule": "New rule",
"SSE.Views.Toolbar.textNoBorders": "No borders",
"SSE.Views.Toolbar.textNotEqualTo": "Not Equal To",
"SSE.Views.Toolbar.textOneHalf": "Vulgar Fraction One Half",
"SSE.Views.Toolbar.textOnePage": "page",
"SSE.Views.Toolbar.textOneQuarter": "Vulgar Fraction One Quarter",
"SSE.Views.Toolbar.textOutBorders": "Outside borders",
"SSE.Views.Toolbar.textPageMarginsCustom": "Custom margins",
"SSE.Views.Toolbar.textPlusMinus": "Plus-Minus Sign",
"SSE.Views.Toolbar.textPortrait": "Portrait",
"SSE.Views.Toolbar.textPrint": "Print",
"SSE.Views.Toolbar.textPrintGridlines": "Print Gridlines",
"SSE.Views.Toolbar.textPrintHeadings": "Print Headings",
"SSE.Views.Toolbar.textPrintOptions": "Print Settings",
"SSE.Views.Toolbar.textRegistered": "Registered Sign",
"SSE.Views.Toolbar.textRight": "Right: ",
"SSE.Views.Toolbar.textRightBorders": "Right borders",
"SSE.Views.Toolbar.textRotateDown": "Rotate text down",
"SSE.Views.Toolbar.textRotateUp": "Rotate text up",
"SSE.Views.Toolbar.textScale": "Scale",
"SSE.Views.Toolbar.textScaleCustom": "Custom",
"SSE.Views.Toolbar.textSection": "Section Sign",
"SSE.Views.Toolbar.textSelection": "From current selection",
"SSE.Views.Toolbar.textSetPrintArea": "Set print area",
"SSE.Views.Toolbar.textShowVA": "Show Visible Area",
"SSE.Views.Toolbar.textSmile": "White Smiling Fase",
"SSE.Views.Toolbar.textSquareRoot": "Square Root",
"SSE.Views.Toolbar.textStrikeout": "Strikethrough",
"SSE.Views.Toolbar.textSubscript": "Subscript",
"SSE.Views.Toolbar.textSubSuperscript": "Subscript/Superscript",
@ -3963,11 +3986,14 @@
"SSE.Views.Toolbar.textThisPivot": "From this pivot",
"SSE.Views.Toolbar.textThisSheet": "From this worksheet",
"SSE.Views.Toolbar.textThisTable": "From this table",
"SSE.Views.Toolbar.textTilde": "Tilde",
"SSE.Views.Toolbar.textTop": "Top: ",
"SSE.Views.Toolbar.textTopBorders": "Top borders",
"SSE.Views.Toolbar.textTradeMark": "Trade Mark Sign",
"SSE.Views.Toolbar.textUnderline": "Underline",
"SSE.Views.Toolbar.textVertical": "Vertical text",
"SSE.Views.Toolbar.textWidth": "Width",
"SSE.Views.Toolbar.textYen": "Yen Sign",
"SSE.Views.Toolbar.textZoom": "Zoom",
"SSE.Views.Toolbar.tipAlignBottom": "Align bottom",
"SSE.Views.Toolbar.tipAlignCenter": "Align center",

View File

@ -126,6 +126,31 @@
}
}
#id-toolbar-menu-symbols {
display: inline-block;
width: 158px;
.padding-left(3px);
.item {
.box-shadow(none);
.margin-x(6px, 4px);
&:hover, &.selected{
.box-shadow( 0 0 0 2px @border-preview-select-ie);
.box-shadow( 0 0 0 @scaled-two-px-value @border-preview-select);
}
}
.item-symbol {
font-family: @font-family-base;
font-size: 14px;
display: block;
width: 20px;
height: 20px;
text-align: center;
line-height: 20px;
vertical-align: middle;
}
}
.item-markerlist {
width: 40px;
height: 40px;