Merge branch feature/new-toolbar
Merge brunch 'feature/new-toolbar'
This commit is contained in:
commit
f0e29ea537
|
@ -123,6 +123,7 @@ define([
|
|||
restoreHeight: this.menuMaxHeight,
|
||||
style: 'max-height: '+this.menuMaxHeight+'px;',
|
||||
enableKeyEvents: this.options.enableKeyEvents,
|
||||
store: this.store,
|
||||
itemTemplate : _.template([
|
||||
'<div class="style" id="<%= id %>">',
|
||||
'<img src="<%= imageUrl %>" width="' + this.itemWidth + '" height="' + this.itemHeight + '"/>',
|
||||
|
|
|
@ -262,17 +262,17 @@ define([
|
|||
},
|
||||
|
||||
hasTabInvisible: function() {
|
||||
var _left_bound_ = $boxTabs.offset().left,
|
||||
_right_bound_ = _left_bound_ + $boxTabs.width();
|
||||
var _left_bound_ = Math.round($boxTabs.offset().left),
|
||||
_right_bound_ = Math.round(_left_bound_ + $boxTabs.width());
|
||||
|
||||
var tab = this.$tabs.first().get(0);
|
||||
var rect = tab.getBoundingClientRect();
|
||||
|
||||
if ( !(rect.left < _left_bound_) ) {
|
||||
if ( !(Math.round(rect.left) < _left_bound_) ) {
|
||||
tab = this.$tabs.last().get(0);
|
||||
rect = tab.getBoundingClientRect();
|
||||
|
||||
if (!(rect.right > _right_bound_))
|
||||
if (!(Math.round(rect.right) > _right_bound_))
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -46,7 +46,8 @@ define([
|
|||
'core',
|
||||
'common/main/lib/model/ReviewChange',
|
||||
'common/main/lib/collection/ReviewChanges',
|
||||
'common/main/lib/view/ReviewChanges'
|
||||
'common/main/lib/view/ReviewChanges',
|
||||
'common/main/lib/view/LanguageDialog'
|
||||
], function () {
|
||||
'use strict';
|
||||
|
||||
|
@ -545,7 +546,7 @@ define([
|
|||
});
|
||||
|
||||
var me = this;
|
||||
(new DE.Views.Statusbar.LanguageDialog({
|
||||
(new Common.Views.LanguageDialog({
|
||||
languages: langs,
|
||||
current: me.api.asc_getDefaultLanguage(),
|
||||
handler: function(result, tip) {
|
||||
|
|
|
@ -71,7 +71,7 @@ define([
|
|||
|
||||
var templateRightBox = '<section>' +
|
||||
'<label id="rib-doc-name" class="status-label"></label>' +
|
||||
'<a href="#" id="rib-save-status" class="status-label locked"><%= textSaveEnd %></a>' +
|
||||
'<a id="rib-save-status" class="status-label locked"><%= textSaveEnd %></a>' +
|
||||
'<div class="elset">' +
|
||||
// '<span class="btn-slot text" id="slot-btn-users"></span>' +
|
||||
'<section id="tlb-box-users" class="box-cousers dropdown"">' +
|
||||
|
|
143
apps/common/main/lib/view/LanguageDialog.js
Normal file
143
apps/common/main/lib/view/LanguageDialog.js
Normal file
|
@ -0,0 +1,143 @@
|
|||
/*
|
||||
*
|
||||
* (c) Copyright Ascensio System Limited 2010-2017
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* LanguageDialog.js
|
||||
*
|
||||
* Created by Julia Radzhabova on 04/25/2017
|
||||
* Copyright (c) 2017 Ascensio System SIA. All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
if (Common === undefined)
|
||||
var Common = {};
|
||||
|
||||
define([
|
||||
'common/main/lib/component/Window'
|
||||
], function () { 'use strict';
|
||||
|
||||
Common.Views.LanguageDialog = Common.UI.Window.extend(_.extend({
|
||||
|
||||
options: {
|
||||
header: false,
|
||||
width: 350,
|
||||
cls: 'modal-dlg'
|
||||
},
|
||||
|
||||
template: '<div class="box">' +
|
||||
'<div class="input-row">' +
|
||||
'<label><%= label %></label>' +
|
||||
'</div>' +
|
||||
'<div class="input-row" id="id-document-language">' +
|
||||
'</div>' +
|
||||
'</div>' +
|
||||
'<div class="footer right">' +
|
||||
'<button class="btn normal dlg-btn primary" result="ok" style="margin-right: 10px;"><%= btns.ok %></button>'+
|
||||
'<button class="btn normal dlg-btn" result="cancel"><%= btns.cancel %></button>'+
|
||||
'</div>',
|
||||
|
||||
initialize : function(options) {
|
||||
_.extend(this.options, options || {}, {
|
||||
label: this.labelSelect,
|
||||
btns: {ok: this.btnOk, cancel: this.btnCancel}
|
||||
});
|
||||
this.options.tpl = _.template(this.template)(this.options);
|
||||
|
||||
Common.UI.Window.prototype.initialize.call(this, this.options);
|
||||
},
|
||||
|
||||
render: function() {
|
||||
Common.UI.Window.prototype.render.call(this);
|
||||
|
||||
var $window = this.getChild();
|
||||
$window.find('.dlg-btn').on('click', _.bind(this.onBtnClick, this));
|
||||
|
||||
this.cmbLanguage = new Common.UI.ComboBox({
|
||||
el: $window.find('#id-document-language'),
|
||||
cls: 'input-group-nr',
|
||||
menuStyle: 'min-width: 318px; max-height: 300px;',
|
||||
editable: false,
|
||||
template: _.template([
|
||||
'<span class="input-group combobox <%= cls %> combo-langs" id="<%= id %>" style="<%= style %>">',
|
||||
'<input type="text" class="form-control">',
|
||||
'<span class="icon input-icon lang-flag"></span>',
|
||||
'<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown"><span class="caret img-commonctrl"></span></button>',
|
||||
'<ul class="dropdown-menu <%= menuCls %>" style="<%= menuStyle %>" role="menu">',
|
||||
'<% _.each(items, function(item) { %>',
|
||||
'<li id="<%= item.id %>" data-value="<%= item.value %>">',
|
||||
'<a tabindex="-1" type="menuitem" style="padding-left: 26px !important;">',
|
||||
'<i class="icon lang-flag <%= item.value %>" style="position: absolute;margin-left:-21px;"></i>',
|
||||
'<%= scope.getDisplayValue(item) %>',
|
||||
'</a>',
|
||||
'</li>',
|
||||
'<% }); %>',
|
||||
'</ul>',
|
||||
'</span>'
|
||||
].join('')),
|
||||
data: this.options.languages
|
||||
});
|
||||
|
||||
if (this.cmbLanguage.scroller) this.cmbLanguage.scroller.update({alwaysVisibleY: true});
|
||||
this.cmbLanguage.on('selected', _.bind(this.onLangSelect, this));
|
||||
this.cmbLanguage.setValue(Common.util.LanguageInfo.getLocalLanguageName(this.options.current)[0]);
|
||||
this.onLangSelect(this.cmbLanguage, this.cmbLanguage.getSelectedRecord());
|
||||
},
|
||||
|
||||
close: function(suppressevent) {
|
||||
var $window = this.getChild();
|
||||
if (!$window.find('.combobox.open').length) {
|
||||
Common.UI.Window.prototype.close.call(this, arguments);
|
||||
}
|
||||
},
|
||||
|
||||
onBtnClick: function(event) {
|
||||
if (this.options.handler) {
|
||||
this.options.handler.call(this, event.currentTarget.attributes['result'].value, this.cmbLanguage.getValue());
|
||||
}
|
||||
|
||||
this.close();
|
||||
},
|
||||
|
||||
onLangSelect: function(cmb, rec, e) {
|
||||
var icon = cmb.$el.find('.input-icon'),
|
||||
plang = icon.attr('lang');
|
||||
|
||||
if (plang) icon.removeClass(plang);
|
||||
icon.addClass(rec.value).attr('lang',rec.value);
|
||||
},
|
||||
|
||||
labelSelect : 'Select document language',
|
||||
btnCancel : 'Cancel',
|
||||
btnOk : 'Ok'
|
||||
}, Common.Views.LanguageDialog || {}))
|
||||
});
|
|
@ -184,7 +184,8 @@
|
|||
.icon.lang-flag {
|
||||
width: 16px;
|
||||
height: 12px;
|
||||
background: data-uri(%("%s",'@{common-image-path}/controls/flags.png')) no-repeat;
|
||||
background-image: data-uri(%("%s",'@{common-image-path}/controls/flags.png'));
|
||||
background-repeat: no-repeat;
|
||||
|
||||
@media
|
||||
only screen and (-webkit-min-device-pixel-ratio: 2),
|
||||
|
|
|
@ -53,9 +53,14 @@
|
|||
|
||||
#rib-doc-name {
|
||||
flex-grow: 1;
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
overflow: hidden;
|
||||
min-width: 50px;
|
||||
}
|
||||
|
||||
#rib-save-status {
|
||||
white-space: nowrap;
|
||||
&.locked {
|
||||
text-decoration: none;
|
||||
color: @gray-darker;
|
||||
|
|
67
apps/common/main/resources/less/language-dialog.less
Normal file
67
apps/common/main/resources/less/language-dialog.less
Normal file
|
@ -0,0 +1,67 @@
|
|||
.combo-langs {
|
||||
.dropdown-menu {
|
||||
li .lang.item-icon {
|
||||
margin-top: 1px;
|
||||
}
|
||||
}
|
||||
|
||||
.input-icon {
|
||||
position: absolute;
|
||||
left: 5px;
|
||||
top: 5px;
|
||||
}
|
||||
|
||||
input {
|
||||
padding-left: 25px !important;
|
||||
}
|
||||
}
|
||||
|
||||
.lang-flag {
|
||||
background-position: -16px -108px;
|
||||
|
||||
&.ca, &.ca-ES {background-position: 0 0;}
|
||||
&.cs, &.cs-CZ {background-position: -16px 0;}
|
||||
&.da, &.da-DK {background-position: -32px 0;}
|
||||
&.de, &.de-DE {background-position: 0 -12px;}
|
||||
&.el, &.el-GR {background-position: -16px -12px;}
|
||||
&.en, &.en-US {background-position: -32px -12px;}
|
||||
&.fr, &.fr-FR {background-position: 0 -24px;}
|
||||
&.hu, &.hu-HU {background-position: -16px -24px;}
|
||||
&.it, &.it-IT {background-position: -32px -24px;}
|
||||
&.ko, &.ko-KR {background-position: 0 -36px;}
|
||||
&.nl, &.nl-NL {background-position: -16px -36px;}
|
||||
&.nb, &.nb-NO {background-position: -32px -36px;}
|
||||
&.pl, &.pl-PL {background-position: 0 -48px;}
|
||||
&.pt, &.pt-BR {background-position: -16px -48px;}
|
||||
&.ro, &.ro-RO {background-position: -32px -48px;}
|
||||
&.ru, &.ru-RU {background-position: 0 -60px;}
|
||||
&.sv, &.sv-SE {background-position: -32px -60px;}
|
||||
&.tr, &.tr-TR {background-position: 0 -72px;}
|
||||
&.uk, &.uk-UA {background-position: -16px -72px;}
|
||||
&.lv, &.lv-LV {background-position: -32px -72px;}
|
||||
&.lt, &.lt-LT {background-position: 0 -84px;}
|
||||
&.vi, &.vi-VN {background-position: -16px -84px;}
|
||||
&.de-CH {background-position: -32px -84px;}
|
||||
&.nn, &.nn-NO {background-position: 0 -96px;}
|
||||
&.pt-PT {background-position: -16px -96px;}
|
||||
&.de-AT {background-position: -32px -96px;}
|
||||
&.es, &.es-ES {background-position: 0 -108px;}
|
||||
&.en-GB {background-position: -32px -108px;}
|
||||
&.en-AU {background-position: 0 -120px;}
|
||||
&.az-Latn-AZ {background-position: -16px -120px;}
|
||||
&.id, &.id-ID {background-position: -32px -120px;}
|
||||
|
||||
&.bg, &.bg-BG {background-position: 0 -132px;}
|
||||
&.ca-ES-valencia {background-position: -16px -132px;}
|
||||
&.en-CA {background-position: -32px -132px;}
|
||||
&.en-ZA {background-position: 0 -144px;}
|
||||
&.eu, &.eu-ES {background-position: -16px -144px;}
|
||||
&.gl, &.gl-ES {background-position: -32px -144px;}
|
||||
&.hr, &.hr-HR {background-position: 0 -156px;}
|
||||
&.lb, &.lb-LU {background-position: -16px -156px;}
|
||||
&.mn, &.mn-MN {background-position: -32px -156px;}
|
||||
&.sl, &.sl-SI {background-position: 0 -168px;}
|
||||
&.sr, &.sr-Cyrl-RS, &.sr-Latn-RS {background-position: -16px -168px;}
|
||||
&.sk, &.sk-SK {background-position: -32px -168px;}
|
||||
&.kk, &.kk-KZ {background-position: 0 -180px;}
|
||||
}
|
|
@ -49,6 +49,7 @@
|
|||
width: 100%;
|
||||
border-top: 1px solid @gray-dark;
|
||||
top: @height-tabs - 1;
|
||||
z-index: 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -122,12 +123,17 @@
|
|||
min-width: 20px;
|
||||
text-align: center;
|
||||
z-index: 1;
|
||||
cursor: pointer;
|
||||
|
||||
&:hover {
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
&.left{
|
||||
box-shadow: 5px 0 20px 5px rgba(208, 221, 182, .8)
|
||||
box-shadow: 5px 0 20px 5px rgba(255, 255, 255, .8)
|
||||
}
|
||||
&.right{
|
||||
box-shadow: -5px 0 20px 5px rgba(208, 221, 182, .8)
|
||||
box-shadow: -5px 0 20px 5px rgba(255, 255, 255, .8)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -216,9 +216,6 @@ define([
|
|||
});
|
||||
},
|
||||
|
||||
/*
|
||||
* */
|
||||
|
||||
setLanguages: function(langs) {
|
||||
this.langs = langs;
|
||||
this.statusbar.reloadLanguages(langs);
|
||||
|
|
|
@ -18,13 +18,13 @@
|
|||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan=2>
|
||||
<td colspan=2 class="padding-small">
|
||||
<label class="header"><%= scope.textWrap %></label>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="padding-small" colspan=2>
|
||||
<div id="chart-button-wrap" style=""></div>
|
||||
<div id="chart-combo-wrap" style="width: 100%;"></div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
|
|
@ -17,19 +17,24 @@
|
|||
<button type="button" class="btn btn-text-default" id="image-button-original-size" style="width:100px;"><%= scope.textOriginalSize %></button>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="padding-small" colspan=2>
|
||||
<button type="button" class="btn btn-text-default" id="image-button-fit-margins" style="width:100px;"><%= scope.textFitMargins %></button>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="padding-small" colspan=2>
|
||||
<div class="separator horizontal"></div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan=2>
|
||||
<td colspan=2 class="padding-small">
|
||||
<label class="header"><%= scope.textWrap %></label>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="padding-small" colspan=2>
|
||||
<div id="image-button-wrap" style=""></div>
|
||||
<div id="image-combo-wrap" style="width: 100%;"></div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
|
|
@ -122,13 +122,13 @@
|
|||
</td>
|
||||
</tr>
|
||||
<tr class="shape-only">
|
||||
<td>
|
||||
<td class="padding-small">
|
||||
<label class="header"><%= scope.textWrap %></label>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="shape-only">
|
||||
<td>
|
||||
<div id="shape-button-wrap" style=""></div>
|
||||
<div id="shape-combo-wrap" style="width: 100%;"></div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="shape-only">
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<div class="box-tabs">
|
||||
<div class="extra left"></div>
|
||||
<section class="tabs">
|
||||
<a href="#" class="scroll left">
|
||||
<a class="scroll left">
|
||||
<i class="icon"><</i>
|
||||
</a>
|
||||
<ul>
|
||||
|
@ -13,7 +13,7 @@
|
|||
<% } %>
|
||||
<div class="marker"></div>
|
||||
</ul>
|
||||
<a href="#" class="scroll right">
|
||||
<a class="scroll right">
|
||||
<i class="icon">></i>
|
||||
</a>
|
||||
</section>
|
||||
|
|
|
@ -117,12 +117,12 @@ define([
|
|||
this._noApply = true;
|
||||
var value = props.get_WrappingStyle();
|
||||
if (this._state.WrappingStyle!==value) {
|
||||
var record = this.mnuWrapPicker.store.findWhere({data: value});
|
||||
this.mnuWrapPicker.selectRecord(record, true);
|
||||
if (record)
|
||||
this.btnWrapType.setIconCls('item-wrap ' + record.get('iconCls'));
|
||||
else
|
||||
this.btnWrapType.setIconCls('');
|
||||
this.cmbWrapType.suspendEvents();
|
||||
var rec = this.cmbWrapType.menuPicker.store.findWhere({
|
||||
data: value
|
||||
});
|
||||
this.cmbWrapType.menuPicker.selectRecord(rec);
|
||||
this.cmbWrapType.resumeEvents();
|
||||
this._state.WrappingStyle=value;
|
||||
}
|
||||
|
||||
|
@ -180,7 +180,7 @@ define([
|
|||
value = props.get_CanBeFlow() && !this._locked;
|
||||
var fromgroup = props.get_FromGroup() || this._locked;
|
||||
if (this._state.CanBeFlow!==value || this._state.FromGroup!==fromgroup) {
|
||||
this.btnWrapType.setDisabled(!value || fromgroup);
|
||||
this.cmbWrapType.setDisabled(!value || fromgroup);
|
||||
this._state.CanBeFlow=value;
|
||||
this._state.FromGroup=fromgroup;
|
||||
}
|
||||
|
@ -210,35 +210,40 @@ define([
|
|||
createDelayedControls: function() {
|
||||
var me = this,
|
||||
viewData = [
|
||||
{ offsetx: 0, data: Asc.c_oAscWrapStyle2.Inline, iconCls:'wrap-inline', tip: this.txtInline, selected: true },
|
||||
{ offsetx: 50, data: Asc.c_oAscWrapStyle2.Square, iconCls:'wrap-square', tip: this.txtSquare },
|
||||
{ offsetx: 100, data: Asc.c_oAscWrapStyle2.Tight, iconCls:'wrap-tight', tip: this.txtTight },
|
||||
{ offsetx: 150, data: Asc.c_oAscWrapStyle2.Through, iconCls:'wrap-through', tip: this.txtThrough },
|
||||
{ offsetx: 200, data: Asc.c_oAscWrapStyle2.TopAndBottom, iconCls:'wrap-topAndBottom', tip: this.txtTopAndBottom },
|
||||
{ offsetx: 250, data: Asc.c_oAscWrapStyle2.InFront, iconCls:'wrap-inFront', tip: this.txtInFront },
|
||||
{ offsetx: 300, data: Asc.c_oAscWrapStyle2.Behind, iconCls:'wrap-behind', tip: this.txtBehind }
|
||||
{ offsetx: 0, data: Asc.c_oAscWrapStyle2.Inline, tip: this.txtInline, selected: true },
|
||||
{ offsetx: 50, data: Asc.c_oAscWrapStyle2.Square, tip: this.txtSquare },
|
||||
{ offsetx: 100, data: Asc.c_oAscWrapStyle2.Tight, tip: this.txtTight },
|
||||
{ offsetx: 150, data: Asc.c_oAscWrapStyle2.Through, tip: this.txtThrough },
|
||||
{ offsetx: 200, data: Asc.c_oAscWrapStyle2.TopAndBottom, tip: this.txtTopAndBottom },
|
||||
{ offsetx: 250, data: Asc.c_oAscWrapStyle2.InFront, tip: this.txtInFront },
|
||||
{ offsetx: 300, data: Asc.c_oAscWrapStyle2.Behind, tip: this.txtBehind }
|
||||
];
|
||||
|
||||
this.btnWrapType = new Common.UI.Button({
|
||||
cls : 'btn-large-dataview',
|
||||
iconCls : 'item-wrap wrap-inline',
|
||||
menu : new Common.UI.Menu({
|
||||
items: [
|
||||
{ template: _.template('<div id="id-chart-menu-wrap" style="width: 235px; margin: 0 5px;"></div>') }
|
||||
]
|
||||
})
|
||||
this.cmbWrapType = new Common.UI.ComboDataView({
|
||||
itemWidth: 50,
|
||||
itemHeight: 50,
|
||||
menuMaxHeight: 300,
|
||||
enableKeyEvents: true,
|
||||
store: new Common.UI.DataViewStore(viewData),
|
||||
cls: 'combo-chart-style'
|
||||
});
|
||||
this.btnWrapType.on('render:after', function(btn) {
|
||||
me.mnuWrapPicker = new Common.UI.DataView({
|
||||
el: $('#id-chart-menu-wrap'),
|
||||
parentMenu: btn.menu,
|
||||
store: new Common.UI.DataViewStore(viewData),
|
||||
itemTemplate: _.template('<div id="<%= id %>" class="item-wrap" style="background-position: -<%= offsetx %>px 0;"></div>')
|
||||
});
|
||||
this.cmbWrapType.menuPicker.itemTemplate = this.cmbWrapType.fieldPicker.itemTemplate = _.template([
|
||||
'<div class="style" id="<%= id %>">',
|
||||
'<img src="data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==" class="combo-wrap-item" ',
|
||||
'width="' + this.cmbWrapType.itemWidth + '" height="' + this.cmbWrapType.itemHeight + '" ',
|
||||
'style="background-position: -<%= offsetx %>px 0;"/>',
|
||||
'</div>'
|
||||
].join(''));
|
||||
this.cmbWrapType.render($('#chart-combo-wrap'));
|
||||
this.cmbWrapType.openButton.menu.cmpEl.css({
|
||||
'min-width': 178,
|
||||
'max-width': 178
|
||||
});
|
||||
this.btnWrapType.render($('#chart-button-wrap'));
|
||||
this.mnuWrapPicker.on('item:click', _.bind(this.onSelectWrap, this, this.btnWrapType));
|
||||
this.lockedControls.push(this.btnWrapType);
|
||||
this.cmbWrapType.on('click', _.bind(this.onSelectWrap, this));
|
||||
this.cmbWrapType.openButton.menu.on('show:after', function () {
|
||||
me.cmbWrapType.menuPicker.scroller.update({alwaysVisibleY: true});
|
||||
});
|
||||
this.lockedControls.push(this.cmbWrapType);
|
||||
|
||||
this.btnChartType = new Common.UI.Button({
|
||||
cls : 'btn-large-dataview',
|
||||
|
@ -315,42 +320,24 @@ define([
|
|||
},
|
||||
|
||||
_ChartWrapStyleChanged: function(style) {
|
||||
if (!this.mnuWrapPicker) return;
|
||||
if (!this.cmbWrapType) return;
|
||||
if (this._state.WrappingStyle!==style) {
|
||||
this._noApply = true;
|
||||
var record = this.mnuWrapPicker.store.findWhere({data: style});
|
||||
this.mnuWrapPicker.selectRecord(record, true);
|
||||
if (record)
|
||||
this.btnWrapType.setIconCls('item-wrap ' + record.get('iconCls'));
|
||||
this.cmbWrapType.suspendEvents();
|
||||
var rec = this.cmbWrapType.menuPicker.store.findWhere({
|
||||
data: style
|
||||
});
|
||||
this.cmbWrapType.menuPicker.selectRecord(rec);
|
||||
this.cmbWrapType.resumeEvents();
|
||||
this._state.WrappingStyle=style;
|
||||
this._noApply = false;
|
||||
}
|
||||
},
|
||||
|
||||
onSelectWrap: function(btn, picker, itemView, record) {
|
||||
if (this._noApply) return;
|
||||
|
||||
var rawData = {},
|
||||
isPickerSelect = _.isFunction(record.toJSON);
|
||||
|
||||
if (isPickerSelect){
|
||||
if (record.get('selected')) {
|
||||
rawData = record.toJSON();
|
||||
} else {
|
||||
// record deselected
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
rawData = record;
|
||||
}
|
||||
|
||||
this.btnWrapType.setIconCls('item-wrap ' + rawData.iconCls);
|
||||
|
||||
onSelectWrap: function(combo, record) {
|
||||
if (this.api) {
|
||||
var props = new Asc.asc_CImgProperty();
|
||||
props.put_WrappingStyle((rawData.data));
|
||||
|
||||
if (this._state.WrappingStyle===Asc.c_oAscWrapStyle2.Inline && rawData.data!==Asc.c_oAscWrapStyle2.Inline ) {
|
||||
var props = new Asc.asc_CImgProperty(),
|
||||
data = record.get('data');
|
||||
props.put_WrappingStyle(data);
|
||||
if (this._state.WrappingStyle===Asc.c_oAscWrapStyle2.Inline && data!==Asc.c_oAscWrapStyle2.Inline ) {
|
||||
props.put_PositionH(new Asc.CImagePositionH());
|
||||
props.get_PositionH().put_UseAlign(false);
|
||||
props.get_PositionH().put_RelativeFrom(Asc.c_oAscRelativeFromH.Column);
|
||||
|
@ -366,7 +353,6 @@ define([
|
|||
|
||||
this.api.ImgApply(props);
|
||||
}
|
||||
|
||||
this.fireEvent('editcomplete', this);
|
||||
},
|
||||
|
||||
|
|
|
@ -78,7 +78,6 @@ define([
|
|||
this.lockedControls = [];
|
||||
this._locked = false;
|
||||
|
||||
this._noApply = false;
|
||||
this._originalProps = null;
|
||||
|
||||
this.render();
|
||||
|
@ -112,42 +111,51 @@ define([
|
|||
createDelayedControls: function() {
|
||||
var me = this,
|
||||
viewData = [
|
||||
{ offsetx: 0, data: Asc.c_oAscWrapStyle2.Inline, iconcls:'wrap-inline', tip: this.txtInline, selected: true },
|
||||
{ offsetx: 50, data: Asc.c_oAscWrapStyle2.Square, iconcls:'wrap-square', tip: this.txtSquare },
|
||||
{ offsetx: 100, data: Asc.c_oAscWrapStyle2.Tight, iconcls:'wrap-tight', tip: this.txtTight },
|
||||
{ offsetx: 150, data: Asc.c_oAscWrapStyle2.Through, iconcls:'wrap-through', tip: this.txtThrough },
|
||||
{ offsetx: 200, data: Asc.c_oAscWrapStyle2.TopAndBottom, iconcls:'wrap-topAndBottom', tip: this.txtTopAndBottom },
|
||||
{ offsetx: 250, data: Asc.c_oAscWrapStyle2.InFront, iconcls:'wrap-inFront', tip: this.txtInFront },
|
||||
{ offsetx: 300, data: Asc.c_oAscWrapStyle2.Behind, iconcls:'wrap-behind', tip: this.txtBehind }
|
||||
{ offsetx: 0, data: Asc.c_oAscWrapStyle2.Inline, tip: this.txtInline, selected: true },
|
||||
{ offsetx: 50, data: Asc.c_oAscWrapStyle2.Square, tip: this.txtSquare },
|
||||
{ offsetx: 100, data: Asc.c_oAscWrapStyle2.Tight, tip: this.txtTight },
|
||||
{ offsetx: 150, data: Asc.c_oAscWrapStyle2.Through, tip: this.txtThrough },
|
||||
{ offsetx: 200, data: Asc.c_oAscWrapStyle2.TopAndBottom, tip: this.txtTopAndBottom },
|
||||
{ offsetx: 250, data: Asc.c_oAscWrapStyle2.InFront, tip: this.txtInFront },
|
||||
{ offsetx: 300, data: Asc.c_oAscWrapStyle2.Behind, tip: this.txtBehind }
|
||||
];
|
||||
|
||||
this.btnWrapType = new Common.UI.Button({
|
||||
cls : 'btn-large-dataview',
|
||||
iconCls : 'item-wrap wrap-inline',
|
||||
menu : new Common.UI.Menu({
|
||||
items: [
|
||||
{ template: _.template('<div id="id-image-menu-wrap" style="width: 235px; margin: 0 5px;"></div>') }
|
||||
]
|
||||
})
|
||||
this.cmbWrapType = new Common.UI.ComboDataView({
|
||||
itemWidth: 50,
|
||||
itemHeight: 50,
|
||||
menuMaxHeight: 300,
|
||||
enableKeyEvents: true,
|
||||
store: new Common.UI.DataViewStore(viewData),
|
||||
cls: 'combo-chart-style'
|
||||
});
|
||||
this.btnWrapType.on('render:after', function(btn) {
|
||||
me.mnuWrapPicker = new Common.UI.DataView({
|
||||
el: $('#id-image-menu-wrap'),
|
||||
parentMenu: btn.menu,
|
||||
store: new Common.UI.DataViewStore(viewData),
|
||||
allowScrollbar: false,
|
||||
itemTemplate: _.template('<div id="<%= id %>" class="item-wrap" style="background-position: -<%= offsetx %>px 0;"></div>')
|
||||
});
|
||||
this.cmbWrapType.menuPicker.itemTemplate = this.cmbWrapType.fieldPicker.itemTemplate = _.template([
|
||||
'<div class="style" id="<%= id %>">',
|
||||
'<img src="data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==" class="combo-wrap-item" ',
|
||||
'width="' + this.cmbWrapType.itemWidth + '" height="' + this.cmbWrapType.itemHeight + '" ',
|
||||
'style="background-position: -<%= offsetx %>px 0;"/>',
|
||||
'</div>'
|
||||
].join(''));
|
||||
this.cmbWrapType.render($('#image-combo-wrap'));
|
||||
this.cmbWrapType.openButton.menu.cmpEl.css({
|
||||
'min-width': 178,
|
||||
'max-width': 178
|
||||
});
|
||||
this.btnWrapType.render($('#image-button-wrap'));
|
||||
this.mnuWrapPicker.on('item:click', _.bind(this.onSelectWrap, this, this.btnWrapType));
|
||||
this.lockedControls.push(this.btnWrapType);
|
||||
this.cmbWrapType.on('click', _.bind(this.onSelectWrap, this));
|
||||
this.cmbWrapType.openButton.menu.on('show:after', function () {
|
||||
me.cmbWrapType.menuPicker.scroller.update({alwaysVisibleY: true});
|
||||
});
|
||||
this.lockedControls.push(this.cmbWrapType);
|
||||
|
||||
this.btnOriginalSize = new Common.UI.Button({
|
||||
el: $('#image-button-original-size')
|
||||
});
|
||||
this.lockedControls.push(this.btnOriginalSize);
|
||||
|
||||
this.btnFitMargins = new Common.UI.Button({
|
||||
el: $('#image-button-fit-margins')
|
||||
});
|
||||
this.lockedControls.push(this.btnFitMargins);
|
||||
|
||||
this.btnInsertFromFile = new Common.UI.Button({
|
||||
el: $('#image-button-from-file')
|
||||
});
|
||||
|
@ -173,6 +181,7 @@ define([
|
|||
if (this.api) this.api.asc_startEditCurrentOleObject();
|
||||
this.fireEvent('editcomplete', this);
|
||||
}, this));
|
||||
this.btnFitMargins.on('click', _.bind(this.setFitMargins, this));
|
||||
|
||||
this.linkAdvanced = $('#image-advanced-link');
|
||||
this.lblReplace = $('#image-lbl-replace');
|
||||
|
@ -196,21 +205,19 @@ define([
|
|||
|
||||
var value = props.get_WrappingStyle();
|
||||
if (this._state.WrappingStyle!==value) {
|
||||
this._noApply = true;
|
||||
var record = this.mnuWrapPicker.store.findWhere({data: value});
|
||||
this.mnuWrapPicker.selectRecord(record, true);
|
||||
if (record)
|
||||
this.btnWrapType.setIconCls('item-wrap ' + record.get('iconcls'));
|
||||
else
|
||||
this.btnWrapType.setIconCls('');
|
||||
this._noApply = false;
|
||||
this.cmbWrapType.suspendEvents();
|
||||
var rec = this.cmbWrapType.menuPicker.store.findWhere({
|
||||
data: value
|
||||
});
|
||||
this.cmbWrapType.menuPicker.selectRecord(rec);
|
||||
this.cmbWrapType.resumeEvents();
|
||||
this._state.WrappingStyle=value;
|
||||
}
|
||||
|
||||
value = props.get_CanBeFlow() && !this._locked;
|
||||
var fromgroup = props.get_FromGroup() || this._locked;
|
||||
if (this._state.CanBeFlow!==value || this._state.FromGroup!==fromgroup) {
|
||||
this.btnWrapType.setDisabled(!value || fromgroup);
|
||||
this.cmbWrapType.setDisabled(!value || fromgroup);
|
||||
this._state.CanBeFlow=value;
|
||||
this._state.FromGroup=fromgroup;
|
||||
}
|
||||
|
@ -250,41 +257,24 @@ define([
|
|||
},
|
||||
|
||||
_ImgWrapStyleChanged: function(style) {
|
||||
if (!this.mnuWrapPicker) return;
|
||||
if (!this.cmbWrapType) return;
|
||||
if (this._state.WrappingStyle!==style) {
|
||||
this._noApply = true;
|
||||
var record = this.mnuWrapPicker.store.findWhere({data: style});
|
||||
this.mnuWrapPicker.selectRecord(record, true);
|
||||
if (record)
|
||||
this.btnWrapType.setIconCls('item-wrap ' + record.get('iconcls'));
|
||||
this.cmbWrapType.suspendEvents();
|
||||
var rec = this.cmbWrapType.menuPicker.store.findWhere({
|
||||
data: style
|
||||
});
|
||||
this.cmbWrapType.menuPicker.selectRecord(rec);
|
||||
this.cmbWrapType.resumeEvents();
|
||||
this._state.WrappingStyle=style;
|
||||
this._noApply = false;
|
||||
}
|
||||
},
|
||||
|
||||
onSelectWrap: function(btn, picker, itemView, record) {
|
||||
if (this._noApply) return;
|
||||
|
||||
var rawData = {},
|
||||
isPickerSelect = _.isFunction(record.toJSON);
|
||||
|
||||
if (isPickerSelect){
|
||||
if (record.get('selected')) {
|
||||
rawData = record.toJSON();
|
||||
} else {
|
||||
// record deselected
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
rawData = record;
|
||||
}
|
||||
|
||||
this.btnWrapType.setIconCls('item-wrap ' + rawData.iconcls);
|
||||
|
||||
onSelectWrap: function(combo, record){
|
||||
if (this.api) {
|
||||
var props = new Asc.asc_CImgProperty();
|
||||
props.put_WrappingStyle((rawData.data));
|
||||
if (this._state.WrappingStyle===Asc.c_oAscWrapStyle2.Inline && rawData.data!==Asc.c_oAscWrapStyle2.Inline ) {
|
||||
var props = new Asc.asc_CImgProperty(),
|
||||
data = record.get('data');
|
||||
props.put_WrappingStyle(data);
|
||||
if (this._state.WrappingStyle===Asc.c_oAscWrapStyle2.Inline && data!==Asc.c_oAscWrapStyle2.Inline ) {
|
||||
props.put_PositionH(new Asc.CImagePositionH());
|
||||
props.get_PositionH().put_UseAlign(false);
|
||||
props.get_PositionH().put_RelativeFrom(Asc.c_oAscRelativeFromH.Column);
|
||||
|
@ -321,6 +311,57 @@ define([
|
|||
}
|
||||
},
|
||||
|
||||
setFitMargins: function() {
|
||||
if (this.api) {
|
||||
var section = this.api.asc_GetSectionProps(),
|
||||
ratio = (this._state.Height>0) ? this._state.Width/this._state.Height : 1,
|
||||
pagew = section.get_W() - section.get_LeftMargin() - section.get_RightMargin(),
|
||||
pageh = section.get_H() - section.get_TopMargin() - section.get_BottomMargin(),
|
||||
pageratio = pagew/pageh,
|
||||
w, h;
|
||||
|
||||
if (ratio>pageratio) {
|
||||
w = pagew;
|
||||
h = w/ratio;
|
||||
} else if (ratio<pageratio) {
|
||||
h = pageh;
|
||||
w = h * ratio;
|
||||
} else {
|
||||
w = pagew;
|
||||
h = pageh;
|
||||
}
|
||||
|
||||
this.labelWidth[0].innerHTML = this.textWidth + ': ' + Common.Utils.Metric.fnRecalcFromMM(w).toFixed(1) + ' ' + Common.Utils.Metric.getCurrentMetricName();
|
||||
this.labelHeight[0].innerHTML = this.textHeight + ': ' + Common.Utils.Metric.fnRecalcFromMM(h).toFixed(1) + ' ' + Common.Utils.Metric.getCurrentMetricName();
|
||||
|
||||
var properties = new Asc.asc_CImgProperty();
|
||||
properties.put_Width(w);
|
||||
properties.put_Height(h);
|
||||
|
||||
if (this._state.WrappingStyle!==Asc.c_oAscWrapStyle2.Inline) {
|
||||
if (ratio>=1) {
|
||||
var position = new Asc.CImagePositionH();
|
||||
position.put_UseAlign(true);
|
||||
position.put_Percent(false);
|
||||
position.put_RelativeFrom(Asc.c_oAscRelativeFromH.Margin);
|
||||
position.put_Align(Asc.c_oAscAlignH.Left);
|
||||
properties.put_PositionH(position);
|
||||
}
|
||||
if (ratio<=1) {
|
||||
position = new Asc.CImagePositionV();
|
||||
position.put_UseAlign(true);
|
||||
position.put_Percent(false);
|
||||
position.put_RelativeFrom(Asc.c_oAscRelativeFromV.Margin);
|
||||
position.put_Align(Asc.c_oAscAlignV.Top);
|
||||
properties.put_PositionV(position);
|
||||
}
|
||||
}
|
||||
|
||||
this.api.ImgApply(properties);
|
||||
this.fireEvent('editcomplete', this);
|
||||
}
|
||||
},
|
||||
|
||||
insertFromUrl: function() {
|
||||
var me = this;
|
||||
(new Common.Views.ImageFromUrlDialog({
|
||||
|
@ -413,7 +454,8 @@ define([
|
|||
txtBehind: 'Behind',
|
||||
txtInFront: 'In front',
|
||||
textEditObject: 'Edit Object',
|
||||
textEdit: 'Edit'
|
||||
textEdit: 'Edit',
|
||||
textFitMargins: 'Fit to Margin'
|
||||
|
||||
}, DE.Views.ImageSettings || {}));
|
||||
});
|
|
@ -85,10 +85,10 @@ define([
|
|||
'</tr>',
|
||||
'<tr>',
|
||||
'<td class="padding-small">',
|
||||
'<div style="display: inline-block; margin-right: 10px;">',
|
||||
'<div style="display: inline-block; margin-right: 10px; vertical-align: middle;">',
|
||||
'<label class="input-label">', me.textNumFormat,'</label>',
|
||||
'<div id="note-settings-combo-format" class="input-group-nr" style="width:150px;"></div>',
|
||||
'</div>','<div style="display: inline-block;">',
|
||||
'</div>','<div style="display: inline-block; vertical-align: middle;">',
|
||||
'<label class="input-label">', me.textStart,'</label>',
|
||||
'<div id="note-settings-spin-start"></div>',
|
||||
'</div>',
|
||||
|
|
|
@ -640,42 +640,24 @@ define([
|
|||
},
|
||||
|
||||
_ImgWrapStyleChanged: function(style) {
|
||||
if (!this.mnuWrapPicker) return;
|
||||
if (!this.cmbWrapType) return;
|
||||
if (this._state.WrappingStyle!==style) {
|
||||
this._noApply = true;
|
||||
var record = this.mnuWrapPicker.store.findWhere({data: style});
|
||||
this.mnuWrapPicker.selectRecord(record, true);
|
||||
if (record)
|
||||
this.btnWrapType.setIconCls('item-wrap ' + record.get('iconcls'));
|
||||
this.cmbWrapType.suspendEvents();
|
||||
var rec = this.cmbWrapType.menuPicker.store.findWhere({
|
||||
data: style
|
||||
});
|
||||
this.cmbWrapType.menuPicker.selectRecord(rec);
|
||||
this.cmbWrapType.resumeEvents();
|
||||
this._state.WrappingStyle=style;
|
||||
this._noApply = false;
|
||||
}
|
||||
},
|
||||
|
||||
onSelectWrap: function(btn, picker, itemView, record) {
|
||||
if (this._noApply) return;
|
||||
|
||||
var rawData = {},
|
||||
isPickerSelect = _.isFunction(record.toJSON);
|
||||
|
||||
if (isPickerSelect){
|
||||
if (record.get('selected')) {
|
||||
rawData = record.toJSON();
|
||||
} else {
|
||||
// record deselected
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
rawData = record;
|
||||
}
|
||||
|
||||
this.btnWrapType.setIconCls('item-wrap ' + rawData.iconcls);
|
||||
|
||||
onSelectWrap: function(combo, record) {
|
||||
if (this.api) {
|
||||
var props = new Asc.asc_CImgProperty();
|
||||
props.put_WrappingStyle((rawData.data));
|
||||
|
||||
if (this._state.WrappingStyle===Asc.c_oAscWrapStyle2.Inline && rawData.data!==Asc.c_oAscWrapStyle2.Inline ) {
|
||||
var props = new Asc.asc_CImgProperty(),
|
||||
data = record.get('data');
|
||||
props.put_WrappingStyle(data);
|
||||
if (this._state.WrappingStyle===Asc.c_oAscWrapStyle2.Inline && data!==Asc.c_oAscWrapStyle2.Inline ) {
|
||||
props.put_PositionH(new Asc.CImagePositionH());
|
||||
props.get_PositionH().put_UseAlign(false);
|
||||
props.get_PositionH().put_RelativeFrom(Asc.c_oAscRelativeFromH.Column);
|
||||
|
@ -691,7 +673,6 @@ define([
|
|||
|
||||
this.api.ImgApply(props);
|
||||
}
|
||||
|
||||
this.fireEvent('editcomplete', this);
|
||||
},
|
||||
|
||||
|
@ -782,19 +763,19 @@ define([
|
|||
|
||||
var value = props.get_WrappingStyle();
|
||||
if (this._state.WrappingStyle!==value) {
|
||||
var record = this.mnuWrapPicker.store.findWhere({data: value});
|
||||
this.mnuWrapPicker.selectRecord(record, true);
|
||||
if (record)
|
||||
this.btnWrapType.setIconCls('item-wrap ' + record.get('iconcls'));
|
||||
else
|
||||
this.btnWrapType.setIconCls('');
|
||||
this.cmbWrapType.suspendEvents();
|
||||
var rec = this.cmbWrapType.menuPicker.store.findWhere({
|
||||
data: value
|
||||
});
|
||||
this.cmbWrapType.menuPicker.selectRecord(rec);
|
||||
this.cmbWrapType.resumeEvents();
|
||||
this._state.WrappingStyle=value;
|
||||
}
|
||||
|
||||
value = props.get_CanBeFlow() && !this._locked;
|
||||
var fromgroup = props.get_FromGroup() || this._locked;
|
||||
if (this._state.CanBeFlow!==value || this._state.FromGroup!==fromgroup) {
|
||||
this.btnWrapType.setDisabled(!value || fromgroup);
|
||||
this.cmbWrapType.setDisabled(!value || fromgroup);
|
||||
this._state.CanBeFlow=value;
|
||||
this._state.FromGroup=fromgroup;
|
||||
}
|
||||
|
@ -1379,35 +1360,41 @@ define([
|
|||
this.lockedControls.push(this.cmbBorderType);
|
||||
|
||||
var viewData = [
|
||||
{ offsetx: 0, data: Asc.c_oAscWrapStyle2.Inline, iconcls:'wrap-inline', tip: this.txtInline, selected: true },
|
||||
{ offsetx: 50, data: Asc.c_oAscWrapStyle2.Square, iconcls:'wrap-square', tip: this.txtSquare },
|
||||
{ offsetx: 100, data: Asc.c_oAscWrapStyle2.Tight, iconcls:'wrap-tight', tip: this.txtTight },
|
||||
{ offsetx: 150, data: Asc.c_oAscWrapStyle2.Through, iconcls:'wrap-through', tip: this.txtThrough },
|
||||
{ offsetx: 200, data: Asc.c_oAscWrapStyle2.TopAndBottom, iconcls:'wrap-topAndBottom', tip: this.txtTopAndBottom },
|
||||
{ offsetx: 250, data: Asc.c_oAscWrapStyle2.InFront, iconcls:'wrap-inFront', tip: this.txtInFront },
|
||||
{ offsetx: 300, data: Asc.c_oAscWrapStyle2.Behind, iconcls:'wrap-behind', tip: this.txtBehind }
|
||||
{ offsetx: 0, data: Asc.c_oAscWrapStyle2.Inline, tip: this.txtInline, selected: true },
|
||||
{ offsetx: 50, data: Asc.c_oAscWrapStyle2.Square, tip: this.txtSquare },
|
||||
{ offsetx: 100, data: Asc.c_oAscWrapStyle2.Tight, tip: this.txtTight },
|
||||
{ offsetx: 150, data: Asc.c_oAscWrapStyle2.Through, tip: this.txtThrough },
|
||||
{ offsetx: 200, data: Asc.c_oAscWrapStyle2.TopAndBottom, tip: this.txtTopAndBottom },
|
||||
{ offsetx: 250, data: Asc.c_oAscWrapStyle2.InFront, tip: this.txtInFront },
|
||||
{ offsetx: 300, data: Asc.c_oAscWrapStyle2.Behind, tip: this.txtBehind }
|
||||
];
|
||||
|
||||
this.btnWrapType = new Common.UI.Button({
|
||||
cls : 'btn-large-dataview',
|
||||
iconCls : 'item-wrap wrap-inline',
|
||||
menu : new Common.UI.Menu({
|
||||
items: [
|
||||
{ template: _.template('<div id="id-shape-menu-wrap" style="width: 235px; margin: 0 5px;"></div>') }
|
||||
]
|
||||
})
|
||||
|
||||
this.cmbWrapType = new Common.UI.ComboDataView({
|
||||
itemWidth: 50,
|
||||
itemHeight: 50,
|
||||
menuMaxHeight: 300,
|
||||
enableKeyEvents: true,
|
||||
store: new Common.UI.DataViewStore(viewData),
|
||||
cls: 'combo-chart-style'
|
||||
});
|
||||
this.btnWrapType.on('render:after', function(btn) {
|
||||
me.mnuWrapPicker = new Common.UI.DataView({
|
||||
el: $('#id-shape-menu-wrap'),
|
||||
parentMenu: btn.menu,
|
||||
store: new Common.UI.DataViewStore(viewData),
|
||||
itemTemplate: _.template('<div id="<%= id %>" class="item-wrap" style="background-position: -<%= offsetx %>px 0;"></div>')
|
||||
});
|
||||
this.cmbWrapType.menuPicker.itemTemplate = this.cmbWrapType.fieldPicker.itemTemplate = _.template([
|
||||
'<div class="style" id="<%= id %>">',
|
||||
'<img src="data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==" class="combo-wrap-item" ',
|
||||
'width="' + this.cmbWrapType.itemWidth + '" height="' + this.cmbWrapType.itemHeight + '" ',
|
||||
'style="background-position: -<%= offsetx %>px 0;"/>',
|
||||
'</div>'
|
||||
].join(''));
|
||||
this.cmbWrapType.render($('#shape-combo-wrap'));
|
||||
this.cmbWrapType.openButton.menu.cmpEl.css({
|
||||
'min-width': 178,
|
||||
'max-width': 178
|
||||
});
|
||||
this.btnWrapType.render($('#shape-button-wrap'));
|
||||
this.mnuWrapPicker.on('item:click', _.bind(this.onSelectWrap, this, this.btnWrapType));
|
||||
this.lockedControls.push(this.btnWrapType);
|
||||
this.cmbWrapType.on('click', _.bind(this.onSelectWrap, this));
|
||||
this.cmbWrapType.openButton.menu.on('show:after', function () {
|
||||
me.cmbWrapType.menuPicker.scroller.update({alwaysVisibleY: true});
|
||||
});
|
||||
this.lockedControls.push(this.cmbWrapType);
|
||||
|
||||
this.btnChangeShape = new Common.UI.Button({
|
||||
cls: 'btn-icon-default',
|
||||
|
|
|
@ -181,9 +181,6 @@ define([
|
|||
});
|
||||
}
|
||||
|
||||
if ( DE.Views.Statusbar )
|
||||
var LanguageDialog = DE.Views.Statusbar.LanguageDialog || {};
|
||||
|
||||
DE.Views.Statusbar = Backbone.View.extend(_.extend({
|
||||
el: '#statusbar',
|
||||
template: _.template(template),
|
||||
|
@ -364,7 +361,7 @@ define([
|
|||
},
|
||||
|
||||
setLanguage: function(info) {
|
||||
if (this.langMenu.prevTip != info.tip) {
|
||||
if (this.langMenu.prevTip != info.tip && info.code !== undefined) {
|
||||
var $parent = $(this.langMenu.el.parentNode, this.$el);
|
||||
$parent.find('.dropdown-toggle > .icon.lang-flag')
|
||||
.removeClass(this.langMenu.prevTip)
|
||||
|
@ -405,99 +402,5 @@ define([
|
|||
textTrackChanges : 'Track Changes',
|
||||
textChangesPanel : 'Changes panel'
|
||||
}, DE.Views.Statusbar || {}));
|
||||
|
||||
DE.Views.Statusbar.LanguageDialog = Common.UI.Window.extend(_.extend({
|
||||
options: {
|
||||
header: false,
|
||||
width: 350,
|
||||
cls: 'modal-dlg'
|
||||
},
|
||||
|
||||
template: '<div class="box">' +
|
||||
'<div class="input-row">' +
|
||||
'<label><%= label %></label>' +
|
||||
'</div>' +
|
||||
'<div class="input-row" id="id-document-language">' +
|
||||
'</div>' +
|
||||
'</div>' +
|
||||
'<div class="footer right">' +
|
||||
'<button class="btn normal dlg-btn primary" result="ok" style="margin-right: 10px;"><%= btns.ok %></button>'+
|
||||
'<button class="btn normal dlg-btn" result="cancel"><%= btns.cancel %></button>'+
|
||||
'</div>',
|
||||
|
||||
initialize : function(options) {
|
||||
_.extend(this.options, options || {}, {
|
||||
label: this.labelSelect,
|
||||
btns: {ok: this.btnOk, cancel: this.btnCancel}
|
||||
});
|
||||
this.options.tpl = _.template(this.template)(this.options);
|
||||
|
||||
Common.UI.Window.prototype.initialize.call(this, this.options);
|
||||
},
|
||||
|
||||
render: function() {
|
||||
Common.UI.Window.prototype.render.call(this);
|
||||
|
||||
var $window = this.getChild();
|
||||
$window.find('.dlg-btn').on('click', _.bind(this.onBtnClick, this));
|
||||
|
||||
this.cmbLanguage = new Common.UI.ComboBox({
|
||||
el: $window.find('#id-document-language'),
|
||||
cls: 'input-group-nr',
|
||||
menuStyle: 'min-width: 318px; max-height: 300px;',
|
||||
editable: false,
|
||||
template: _.template([
|
||||
'<span class="input-group combobox <%= cls %> combo-langs" id="<%= id %>" style="<%= style %>">',
|
||||
'<input type="text" class="form-control">',
|
||||
'<span class="icon input-icon lang-flag"></span>',
|
||||
'<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown"><span class="caret img-commonctrl"></span></button>',
|
||||
'<ul class="dropdown-menu <%= menuCls %>" style="<%= menuStyle %>" role="menu">',
|
||||
'<% _.each(items, function(item) { %>',
|
||||
'<li id="<%= item.id %>" data-value="<%= item.value %>">',
|
||||
'<a tabindex="-1" type="menuitem" style="padding-left: 26px !important;">',
|
||||
'<i class="icon lang-flag <%= item.value %>" style="position: absolute;margin-left:-21px;"></i>',
|
||||
'<%= scope.getDisplayValue(item) %>',
|
||||
'</a>',
|
||||
'</li>',
|
||||
'<% }); %>',
|
||||
'</ul>',
|
||||
'</span>'
|
||||
].join('')),
|
||||
data: this.options.languages
|
||||
});
|
||||
|
||||
if (this.cmbLanguage.scroller) this.cmbLanguage.scroller.update({alwaysVisibleY: true});
|
||||
this.cmbLanguage.on('selected', _.bind(this.onLangSelect, this));
|
||||
this.cmbLanguage.setValue(Common.util.LanguageInfo.getLocalLanguageName(this.options.current)[0]);
|
||||
this.onLangSelect(this.cmbLanguage, this.cmbLanguage.getSelectedRecord());
|
||||
},
|
||||
|
||||
close: function(suppressevent) {
|
||||
var $window = this.getChild();
|
||||
if (!$window.find('.combobox.open').length) {
|
||||
Common.UI.Window.prototype.close.call(this, arguments);
|
||||
}
|
||||
},
|
||||
|
||||
onBtnClick: function(event) {
|
||||
if (this.options.handler) {
|
||||
this.options.handler.call(this, event.currentTarget.attributes['result'].value, this.cmbLanguage.getValue());
|
||||
}
|
||||
|
||||
this.close();
|
||||
},
|
||||
|
||||
onLangSelect: function(cmb, rec, e) {
|
||||
var icon = cmb.$el.find('.input-icon'),
|
||||
plang = icon.attr('lang');
|
||||
|
||||
if (plang) icon.removeClass(plang);
|
||||
icon.addClass(rec.value).attr('lang',rec.value);
|
||||
},
|
||||
|
||||
labelSelect : 'Select document language',
|
||||
btnCancel : 'Cancel',
|
||||
btnOk : 'Ok'
|
||||
}, LanguageDialog||{}));
|
||||
}
|
||||
);
|
|
@ -1988,33 +1988,40 @@ define([
|
|||
onToolbarAfterRender: function(toolbar) {
|
||||
// DataView and pickers
|
||||
//
|
||||
var colorVal = $('<div class="btn-color-value-line"></div>');
|
||||
$('button:first-child', this.btnHighlightColor.cmpEl).append(colorVal);
|
||||
this.btnHighlightColor.currentColor = 'FFFF00';
|
||||
colorVal.css('background-color', '#' + this.btnHighlightColor.currentColor);
|
||||
this.mnuHighlightColorPicker = new Common.UI.ColorPalette({
|
||||
el: $('#id-toolbar-menu-highlight'),
|
||||
colors: [
|
||||
'FFFF00', '00FF00', '00FFFF', 'FF00FF', '0000FF', 'FF0000', '00008B', '008B8B',
|
||||
'006400', '800080', '8B0000', '808000', 'FFFFFF', 'D3D3D3', 'A9A9A9', '000000'
|
||||
]
|
||||
});
|
||||
this.mnuHighlightColorPicker.select('FFFF00');
|
||||
var colorVal;
|
||||
if (this.btnHighlightColor.cmpEl) {
|
||||
colorVal = $('<div class="btn-color-value-line"></div>');
|
||||
$('button:first-child', this.btnHighlightColor.cmpEl).append(colorVal);
|
||||
this.btnHighlightColor.currentColor = 'FFFF00';
|
||||
colorVal.css('background-color', '#' + this.btnHighlightColor.currentColor);
|
||||
this.mnuHighlightColorPicker = new Common.UI.ColorPalette({
|
||||
el: $('#id-toolbar-menu-highlight'),
|
||||
colors: [
|
||||
'FFFF00', '00FF00', '00FFFF', 'FF00FF', '0000FF', 'FF0000', '00008B', '008B8B',
|
||||
'006400', '800080', '8B0000', '808000', 'FFFFFF', 'D3D3D3', 'A9A9A9', '000000'
|
||||
]
|
||||
});
|
||||
this.mnuHighlightColorPicker.select('FFFF00');
|
||||
}
|
||||
|
||||
colorVal = $('<div class="btn-color-value-line"></div>');
|
||||
$('button:first-child', this.btnFontColor.cmpEl).append(colorVal);
|
||||
colorVal.css('background-color', this.btnFontColor.currentColor || 'transparent');
|
||||
this.mnuFontColorPicker = new Common.UI.ThemeColorPalette({
|
||||
el: $('#id-toolbar-menu-fontcolor')
|
||||
});
|
||||
if (this.btnFontColor.cmpEl) {
|
||||
colorVal = $('<div class="btn-color-value-line"></div>');
|
||||
$('button:first-child', this.btnFontColor.cmpEl).append(colorVal);
|
||||
colorVal.css('background-color', this.btnFontColor.currentColor || 'transparent');
|
||||
this.mnuFontColorPicker = new Common.UI.ThemeColorPalette({
|
||||
el: $('#id-toolbar-menu-fontcolor')
|
||||
});
|
||||
}
|
||||
|
||||
colorVal = $('<div class="btn-color-value-line"></div>');
|
||||
$('button:first-child', this.btnParagraphColor.cmpEl).append(colorVal);
|
||||
colorVal.css('background-color', this.btnParagraphColor.currentColor || 'transparent');
|
||||
this.mnuParagraphColorPicker = new Common.UI.ThemeColorPalette({
|
||||
el: $('#id-toolbar-menu-paracolor'),
|
||||
transparent: true
|
||||
});
|
||||
if (this.btnParagraphColor.cmpEl) {
|
||||
colorVal = $('<div class="btn-color-value-line"></div>');
|
||||
$('button:first-child', this.btnParagraphColor.cmpEl).append(colorVal);
|
||||
colorVal.css('background-color', this.btnParagraphColor.currentColor || 'transparent');
|
||||
this.mnuParagraphColorPicker = new Common.UI.ThemeColorPalette({
|
||||
el: $('#id-toolbar-menu-paracolor'),
|
||||
transparent: true
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
updateMetricUnit: function () {
|
||||
|
|
|
@ -170,6 +170,9 @@
|
|||
"Common.Views.InsertTableDialog.txtMinText": "The minimum value for this field is {0}.",
|
||||
"Common.Views.InsertTableDialog.txtRows": "Number of Rows",
|
||||
"Common.Views.InsertTableDialog.txtTitle": "Table Size",
|
||||
"Common.Views.LanguageDialog.btnCancel": "Cancel",
|
||||
"Common.Views.LanguageDialog.btnOk": "Ok",
|
||||
"Common.Views.LanguageDialog.labelSelect": "Select document language",
|
||||
"Common.Views.OpenDialog.cancelButtonText": "Cancel",
|
||||
"Common.Views.OpenDialog.okButtonText": "OK",
|
||||
"Common.Views.OpenDialog.txtEncoding": "Encoding ",
|
||||
|
@ -1016,6 +1019,7 @@
|
|||
"DE.Views.ImageSettings.txtThrough": "Through",
|
||||
"DE.Views.ImageSettings.txtTight": "Tight",
|
||||
"DE.Views.ImageSettings.txtTopAndBottom": "Top and bottom",
|
||||
"DE.Views.ImageSettings.textFitMargins": "Fit to Margin",
|
||||
"DE.Views.ImageSettingsAdvanced.cancelButtonText": "Cancel",
|
||||
"DE.Views.ImageSettingsAdvanced.okButtonText": "OK",
|
||||
"DE.Views.ImageSettingsAdvanced.strMargins": "Text Padding",
|
||||
|
@ -1305,9 +1309,9 @@
|
|||
"DE.Views.ShapeSettings.txtTopAndBottom": "Top and bottom",
|
||||
"DE.Views.ShapeSettings.txtWood": "Wood",
|
||||
"DE.Views.Statusbar.goToPageText": "Go to Page",
|
||||
"DE.Views.Statusbar.LanguageDialog.btnCancel": "Cancel",
|
||||
"DE.Views.Statusbar.LanguageDialog.btnOk": "Ok",
|
||||
"DE.Views.Statusbar.LanguageDialog.labelSelect": "Select document language",
|
||||
"del_DE.Views.Statusbar.LanguageDialog.btnCancel": "Cancel",
|
||||
"del_DE.Views.Statusbar.LanguageDialog.btnOk": "Ok",
|
||||
"del_DE.Views.Statusbar.LanguageDialog.labelSelect": "Select document language",
|
||||
"DE.Views.Statusbar.pageIndexText": "Page {0} of {1}",
|
||||
"DE.Views.Statusbar.tipFitPage": "Fit to Page",
|
||||
"DE.Views.Statusbar.tipFitWidth": "Fit to Width",
|
||||
|
|
|
@ -115,6 +115,7 @@
|
|||
@import "../../../../common/main/resources/less/review-changes.less";
|
||||
@import "../../../../common/main/resources/less/plugins.less";
|
||||
@import "../../../../common/main/resources/less/toolbar.less";
|
||||
@import "../../../../common/main/resources/less/language-dialog.less";
|
||||
|
||||
// App
|
||||
// --------------------------------------------------
|
||||
|
|
|
@ -132,6 +132,10 @@
|
|||
|
||||
.button-otherstates-icon(icon-right-panel, @huge-icon-size);
|
||||
|
||||
.combo-wrap-item {
|
||||
.background-ximage('@{app-image-path}/right-panels/right_panel_wrap_icons.png', '@{app-image-path}/right-panels/right_panel_wrap_icons@2x.png', 350px);
|
||||
}
|
||||
|
||||
.item-wrap {
|
||||
.background-ximage('@{app-image-path}/right-panels/right_panel_wrap_icons.png', '@{app-image-path}/right-panels/right_panel_wrap_icons@2x.png', 350px);
|
||||
width:50px;
|
||||
|
|
|
@ -212,75 +212,6 @@
|
|||
}
|
||||
}
|
||||
|
||||
.combo-langs {
|
||||
.dropdown-menu {
|
||||
li .lang.item-icon {
|
||||
margin-top: 1px;
|
||||
}
|
||||
}
|
||||
|
||||
.input-icon {
|
||||
position: absolute;
|
||||
left: 5px;
|
||||
top: 5px;
|
||||
}
|
||||
|
||||
input {
|
||||
padding-left: 25px !important;
|
||||
}
|
||||
}
|
||||
|
||||
.lang-flag {
|
||||
background-position: -16px -108px;
|
||||
|
||||
&.ca, &.ca-ES {background-position: 0 0;}
|
||||
&.cs, &.cs-CZ {background-position: -16px 0;}
|
||||
&.da, &.da-DK {background-position: -32px 0;}
|
||||
&.de, &.de-DE {background-position: 0 -12px;}
|
||||
&.el, &.el-GR {background-position: -16px -12px;}
|
||||
&.en, &.en-US {background-position: -32px -12px;}
|
||||
&.fr, &.fr-FR {background-position: 0 -24px;}
|
||||
&.hu, &.hu-HU {background-position: -16px -24px;}
|
||||
&.it, &.it-IT {background-position: -32px -24px;}
|
||||
&.ko, &.ko-KR {background-position: 0 -36px;}
|
||||
&.nl, &.nl-NL {background-position: -16px -36px;}
|
||||
&.nb, &.nb-NO {background-position: -32px -36px;}
|
||||
&.pl, &.pl-PL {background-position: 0 -48px;}
|
||||
&.pt, &.pt-BR {background-position: -16px -48px;}
|
||||
&.ro, &.ro-RO {background-position: -32px -48px;}
|
||||
&.ru, &.ru-RU {background-position: 0 -60px;}
|
||||
&.sv, &.sv-SE {background-position: -32px -60px;}
|
||||
&.tr, &.tr-TR {background-position: 0 -72px;}
|
||||
&.uk, &.uk-UA {background-position: -16px -72px;}
|
||||
&.lv, &.lv-LV {background-position: -32px -72px;}
|
||||
&.lt, &.lt-LT {background-position: 0 -84px;}
|
||||
&.vi, &.vi-VN {background-position: -16px -84px;}
|
||||
&.de-CH {background-position: -32px -84px;}
|
||||
&.nn, &.nn-NO {background-position: 0 -96px;}
|
||||
&.pt-PT {background-position: -16px -96px;}
|
||||
&.de-AT {background-position: -32px -96px;}
|
||||
&.es, &.es-ES {background-position: 0 -108px;}
|
||||
&.en-GB {background-position: -32px -108px;}
|
||||
&.en-AU {background-position: 0 -120px;}
|
||||
&.az-Latn-AZ {background-position: -16px -120px;}
|
||||
&.id, &.id-ID {background-position: -32px -120px;}
|
||||
|
||||
&.bg, &.bg-BG {background-position: 0 -132px;}
|
||||
&.ca-ES-valencia {background-position: -16px -132px;}
|
||||
&.en-CA {background-position: -32px -132px;}
|
||||
&.en-ZA {background-position: 0 -144px;}
|
||||
&.eu, &.eu-ES {background-position: -16px -144px;}
|
||||
&.gl, &.gl-ES {background-position: -32px -144px;}
|
||||
&.hr, &.hr-HR {background-position: 0 -156px;}
|
||||
&.lb, &.lb-LU {background-position: -16px -156px;}
|
||||
&.mn, &.mn-MN {background-position: -32px -156px;}
|
||||
&.sl, &.sl-SI {background-position: 0 -168px;}
|
||||
&.sr, &.sr-Cyrl-RS, &.sr-Latn-RS {background-position: -16px -168px;}
|
||||
&.sk, &.sk-SK {background-position: -32px -168px;}
|
||||
&.kk, &.kk-KZ {background-position: 0 -180px;}
|
||||
|
||||
}
|
||||
|
||||
.button-normal-icon(btn-ic-zoomtowidth, 55, @toolbar-icon-size);
|
||||
.button-normal-icon(btn-ic-zoomtopage, 56, @toolbar-icon-size);
|
||||
.button-normal-icon(btn-ic-review, 61, @toolbar-icon-size);
|
||||
|
|
|
@ -230,6 +230,9 @@ define([
|
|||
var value = Common.localStorage.getItem("pe-settings-inputmode");
|
||||
this.api.SetTextBoxInputMode(parseInt(value) == 1);
|
||||
|
||||
value = Common.localStorage.getItem("pe-settings-spellcheck");
|
||||
this.api.asc_setSpellCheck(parseInt(value) == 1);
|
||||
|
||||
/** coauthoring begin **/
|
||||
if (this.mode.isEdit && !this.mode.isOffline && this.mode.canCoAuthoring) {
|
||||
value = Common.localStorage.getItem("pe-settings-coauthmode");
|
||||
|
|
|
@ -100,6 +100,7 @@ define([
|
|||
var me = this;
|
||||
|
||||
this._state = {isDisconnected: false, usersCount: 1, fastCoauth: true, lostEditingRights: false, licenseWarning: false};
|
||||
this.languages = null;
|
||||
|
||||
window.storagename = 'presentation';
|
||||
|
||||
|
@ -137,6 +138,7 @@ define([
|
|||
this.api.asc_registerCallback('asc_onPrintUrl', _.bind(this.onPrintUrl, this));
|
||||
this.api.asc_registerCallback('asc_onMeta', _.bind(this.onMeta, this));
|
||||
this.api.asc_registerCallback('asc_onAdvancedOptions', _.bind(this.onAdvancedOptions, this));
|
||||
this.api.asc_registerCallback('asc_onSpellCheckInit', _.bind(this.loadLanguages, this));
|
||||
Common.NotificationCenter.on('api:disconnect', _.bind(this.onCoAuthoringDisconnect, this));
|
||||
Common.NotificationCenter.on('goback', _.bind(this.goBack, this));
|
||||
|
||||
|
@ -542,6 +544,9 @@ define([
|
|||
var zf = (value!==null) ? parseInt(value) : (this.appOptions.customization && this.appOptions.customization.zoom ? parseInt(this.appOptions.customization.zoom) : -1);
|
||||
(zf == -1) ? this.api.zoomFitToPage() : ((zf == -2) ? this.api.zoomFitToWidth() : this.api.zoom(zf>0 ? zf : 100));
|
||||
|
||||
value = Common.localStorage.getItem("pe-settings-spellcheck");
|
||||
me.api.asc_setSpellCheck(value===null || parseInt(value) == 1);
|
||||
|
||||
function checkWarns() {
|
||||
if (!window['AscDesktopEditor']) {
|
||||
var tips = [];
|
||||
|
@ -637,6 +642,7 @@ define([
|
|||
toolbarController.createDelayedElements();
|
||||
|
||||
documentHolderController.getView('DocumentHolder').createDelayedElements();
|
||||
me.setLanguages();
|
||||
|
||||
me.api.asc_registerCallback('asc_onUpdateLayout', _.bind(me.fillLayoutsStore, me)); // slide layouts loading
|
||||
me.updateThemeColors();
|
||||
|
@ -1449,6 +1455,35 @@ define([
|
|||
|
||||
},
|
||||
|
||||
loadLanguages: function(apiLangs) {
|
||||
var langs = [], info;
|
||||
_.each(apiLangs, function(lang, index, list){
|
||||
lang = parseInt(lang);
|
||||
info = Common.util.LanguageInfo.getLocalLanguageName(lang);
|
||||
langs.push({
|
||||
title: info[1],
|
||||
tip: info[0],
|
||||
code: lang
|
||||
});
|
||||
}, this);
|
||||
|
||||
langs.sort(function(a, b){
|
||||
if (a.tip < b.tip) return -1;
|
||||
if (a.tip > b.tip) return 1;
|
||||
return 0;
|
||||
});
|
||||
|
||||
this.languages = langs;
|
||||
window.styles_loaded && this.setLanguages();
|
||||
},
|
||||
|
||||
setLanguages: function() {
|
||||
if (this.languages && this.languages.length>0) {
|
||||
this.getApplication().getController('DocumentHolder').getView('DocumentHolder').setLanguages(this.languages);
|
||||
this.getApplication().getController('Statusbar').setLanguages(this.languages);
|
||||
}
|
||||
},
|
||||
|
||||
onTryUndoInFastCollaborative: function() {
|
||||
var val = window.localStorage.getItem("pe-hide-try-undoredo");
|
||||
if (!(val && parseInt(val) == 1))
|
||||
|
|
|
@ -42,7 +42,9 @@
|
|||
|
||||
define([
|
||||
'core',
|
||||
'presentationeditor/main/app/view/Statusbar'
|
||||
'presentationeditor/main/app/view/Statusbar',
|
||||
'common/main/lib/util/LanguageInfo',
|
||||
'common/main/lib/view/LanguageDialog'
|
||||
], function () {
|
||||
'use strict';
|
||||
|
||||
|
@ -55,7 +57,11 @@ define([
|
|||
|
||||
initialize: function() {
|
||||
this.addListeners({
|
||||
'FileMenu': {
|
||||
'settings:apply': _.bind(this.applySettings, this)
|
||||
},
|
||||
'Statusbar': {
|
||||
'langchanged': this.onLangMenu
|
||||
}
|
||||
});
|
||||
this._state = {
|
||||
|
@ -67,7 +73,8 @@ define([
|
|||
events: function() {
|
||||
return {
|
||||
'click #btn-zoom-down': _.bind(this.zoomDocument,this,'down'),
|
||||
'click #btn-zoom-up': _.bind(this.zoomDocument,this,'up')
|
||||
'click #btn-zoom-up': _.bind(this.zoomDocument,this,'up'),
|
||||
'click #btn-doc-lang':_.bind(this.onBtnLanguage,this)
|
||||
};
|
||||
},
|
||||
|
||||
|
@ -83,11 +90,13 @@ define([
|
|||
this.statusbar.btnZoomToWidth.on('click', _.bind(this.onBtnZoomTo, this, 'towidth'));
|
||||
this.statusbar.zoomMenu.on('item:click', _.bind(this.menuZoomClick, this));
|
||||
this.statusbar.btnPreview.on('click', _.bind(this.onPreview, this));
|
||||
this.statusbar.btnSetSpelling.on('click', _.bind(this.onBtnSpelling, this));
|
||||
},
|
||||
|
||||
setApi: function(api) {
|
||||
this.api = api;
|
||||
this.api.asc_registerCallback('asc_onZoomChange', _.bind(this._onZoomChange, this));
|
||||
this.api.asc_registerCallback('asc_onTextLanguage', _.bind(this._onTextLanguage, this));
|
||||
|
||||
this.statusbar.setApi(api);
|
||||
},
|
||||
|
@ -175,6 +184,20 @@ define([
|
|||
}
|
||||
},
|
||||
|
||||
_onTextLanguage: function(langId) {
|
||||
var info = Common.util.LanguageInfo.getLocalLanguageName(langId);
|
||||
this.statusbar.setLanguage({
|
||||
tip: info[0],
|
||||
title: info[1],
|
||||
code: langId
|
||||
});
|
||||
},
|
||||
|
||||
setLanguages: function(langs) {
|
||||
this.langs = langs;
|
||||
this.statusbar.reloadLanguages(langs);
|
||||
},
|
||||
|
||||
setStatusCaption: function(text, force, delay) {
|
||||
if (this.timerCaption && ( ((new Date()) < this.timerCaption) || text.length==0 ) && !force )
|
||||
return;
|
||||
|
@ -189,9 +212,49 @@ define([
|
|||
},
|
||||
|
||||
createDelayedElements: function() {
|
||||
var value = Common.localStorage.getItem("pe-settings-spellcheck");
|
||||
this.statusbar.btnSetSpelling.toggle(value===null || parseInt(value) == 1, true);
|
||||
|
||||
this.statusbar.$el.css('z-index', '');
|
||||
},
|
||||
|
||||
onBtnLanguage: function() {
|
||||
var langs = _.map(this.langs, function(item){
|
||||
return {
|
||||
displayValue: item.title,
|
||||
value: item.tip,
|
||||
code: item.code
|
||||
}
|
||||
});
|
||||
|
||||
var me = this;
|
||||
(new Common.Views.LanguageDialog({
|
||||
languages: langs,
|
||||
current: me.api.asc_getDefaultLanguage(),
|
||||
handler: function(result, tip) {
|
||||
if (result=='ok') {
|
||||
var record = _.findWhere(langs, {'value':tip});
|
||||
record && me.api.asc_setDefaultLanguage(record.code);
|
||||
}
|
||||
}
|
||||
})).show();
|
||||
},
|
||||
|
||||
onLangMenu: function(obj, langid, title) {
|
||||
this.api.put_TextPrLang(langid);
|
||||
},
|
||||
|
||||
onBtnSpelling: function(d, b, e) {
|
||||
Common.localStorage.setItem("pe-settings-spellcheck", d.pressed ? 1 : 0);
|
||||
this.api.asc_setSpellCheck(d.pressed);
|
||||
Common.NotificationCenter.trigger('edit:complete', this.statusbar);
|
||||
},
|
||||
|
||||
applySettings: function(menu) {
|
||||
var value = Common.localStorage.getItem("pe-settings-spellcheck");
|
||||
this.statusbar.btnSetSpelling.toggle(value===null || parseInt(value) == 1, true);
|
||||
},
|
||||
|
||||
zoomText : 'Zoom {0}%'
|
||||
}, PE.Controllers.Statusbar || {}));
|
||||
});
|
|
@ -25,6 +25,16 @@
|
|||
<label id="status-label-action" class="status-label"></label>
|
||||
</div>
|
||||
<div class="status-group" style="">
|
||||
<div class="cnt-lang el-edit">
|
||||
<div class="dropdown-toggle" data-toggle="dropdown" style="margin-right: 6px;">
|
||||
<span class="icon lang-flag en" data-vertical-offset="10" />
|
||||
<label id="status-label-lang" class="status-label">English (United States)</label>
|
||||
<div class="caret up img-commonctrl" />
|
||||
</div>
|
||||
</div>
|
||||
<button id="btn-doc-lang" type="button" class="btn small btn-toolbar el-edit"><i class="icon"></i></button>
|
||||
<button id="btn-doc-spell" type="button" class="btn small btn-toolbar el-edit"><i class="icon"></i></button>
|
||||
<div class="separator short el-edit"></div>
|
||||
<button id="btn-zoom-topage" type="button" class="btn small btn-toolbar"><i class="icon"></i></button>
|
||||
<button id="btn-zoom-towidth" type="button" class="btn small btn-toolbar"><i class="icon"></i></button>
|
||||
<button id="btn-zoom-down" type="button" class="btn small btn-toolbar"><i class="icon"></i></button>
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<section class="box-tabs">
|
||||
<div class="extra left"></div>
|
||||
<section class="tabs">
|
||||
<a href="#" class="scroll left">
|
||||
<a class="scroll left">
|
||||
<i class="icon"><</i>
|
||||
</a>
|
||||
<ul>
|
||||
|
@ -13,7 +13,7 @@
|
|||
<% } %>
|
||||
<div class="marker"></div>
|
||||
</ul>
|
||||
<a href="#" class="scroll right">
|
||||
<a class="scroll right">
|
||||
<i class="icon">></i>
|
||||
</a>
|
||||
</section>
|
||||
|
|
|
@ -64,6 +64,8 @@ define([
|
|||
me.fastcoauthtips = [];
|
||||
me._currentMathObj = undefined;
|
||||
me._currentParaObjDisabled = false;
|
||||
me._currentSpellObj = undefined;
|
||||
me._currLang = {};
|
||||
|
||||
/** coauthoring begin **/
|
||||
var usersStore = PE.getCollection('Common.Collections.Users');
|
||||
|
@ -159,6 +161,10 @@ define([
|
|||
if ( (menu_props.shapeProps && menu_props.shapeProps.value || menu_props.chartProps && menu_props.chartProps.value)&& // text in shape, need to show paragraph menu with vertical align
|
||||
_.isUndefined(menu_props.tableProps))
|
||||
menu_to_show = me.textMenu;
|
||||
} else if (Asc.c_oAscTypeSelectElement.SpellCheck == elType) {
|
||||
menu_props.spellProps = {};
|
||||
menu_props.spellProps.value = elValue;
|
||||
me._currentSpellObj = elValue;
|
||||
} else if (Asc.c_oAscTypeSelectElement.Math == elType) {
|
||||
menu_props.mathProps = {};
|
||||
menu_props.mathProps.value = elValue;
|
||||
|
@ -639,6 +645,129 @@ define([
|
|||
}
|
||||
};
|
||||
|
||||
var onTextLanguage = function(langid) {
|
||||
me._currLang.id = langid;
|
||||
};
|
||||
|
||||
this.changeLanguageMenu = function(menu) {
|
||||
var i;
|
||||
if (me._currLang.id===null || me._currLang.id===undefined) {
|
||||
for (i=0; i<menu.items.length; i++)
|
||||
menu.items[i].setChecked(false);
|
||||
menu.currentCheckedItem = undefined;
|
||||
} else {
|
||||
for (i=0; i<menu.items.length; i++) {
|
||||
if (menu.items[i].options.langid === me._currLang.id) {
|
||||
menu.currentCheckedItem = menu.items[i];
|
||||
if (!menu.items[i].checked)
|
||||
menu.items[i].setChecked(true);
|
||||
break;
|
||||
} else if (menu.items[i].checked)
|
||||
menu.items[i].setChecked(false);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var onSpellCheckVariantsFound = function() {
|
||||
var selectedElements = me.api.getSelectedElements(true);
|
||||
var props;
|
||||
if (selectedElements && _.isArray(selectedElements)){
|
||||
for (var i = 0; i <selectedElements.length; i++) {
|
||||
if ( selectedElements[i].get_ObjectType() == Asc.c_oAscTypeSelectElement.SpellCheck) {
|
||||
props = selectedElements[i].get_ObjectValue();
|
||||
me._currentSpellObj = props;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (props && props.get_Checked()===false && props.get_Variants() !== null && props.get_Variants() !== undefined) {
|
||||
me.addWordVariants();
|
||||
if (me.textMenu.isVisible()) {
|
||||
me.textMenu.alignPosition();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
this.addWordVariants = function(isParagraph) {
|
||||
if (_.isUndefined(isParagraph)) {
|
||||
isParagraph = me.textMenu.isVisible();
|
||||
}
|
||||
|
||||
me.clearWordVariants(isParagraph);
|
||||
|
||||
var moreMenu = (isParagraph) ? me.menuSpellMorePara : me.menuSpellMoreTable;
|
||||
var spellMenu = (isParagraph) ? me.menuSpellPara : me.menuSpellTable;
|
||||
var arr = [],
|
||||
arrMore = [];
|
||||
var variants = me._currentSpellObj.get_Variants();
|
||||
|
||||
if (variants.length > 0) {
|
||||
moreMenu.setVisible(variants.length > 3);
|
||||
moreMenu.setDisabled(me._currentParaObjDisabled);
|
||||
|
||||
_.each(variants, function(variant, index) {
|
||||
var mnu = new Common.UI.MenuItem({
|
||||
caption : variant,
|
||||
spellword : true,
|
||||
disabled : me._currentParaObjDisabled
|
||||
}).on('click', function(item, e) {
|
||||
if (me.api) {
|
||||
me.api.asc_replaceMisspelledWord(item.caption, me._currentSpellObj);
|
||||
me.fireEvent('editcomplete', me);
|
||||
}
|
||||
});
|
||||
|
||||
(index < 3) ? arr.push(mnu) : arrMore.push(mnu);
|
||||
});
|
||||
|
||||
if (arr.length > 0) {
|
||||
if (isParagraph) {
|
||||
_.each(arr, function(variant){
|
||||
me.textMenu.insertItem(0, variant);
|
||||
})
|
||||
} else {
|
||||
_.each(arr, function(variant){
|
||||
me.menuSpellCheckTable.menu.insertItem(0, variant);
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
if (arrMore.length > 0) {
|
||||
_.each(arrMore, function(variant){
|
||||
moreMenu.menu.insertItem(0, variant);
|
||||
});
|
||||
}
|
||||
|
||||
spellMenu.setVisible(false);
|
||||
} else {
|
||||
moreMenu.setVisible(false);
|
||||
spellMenu.setVisible(true);
|
||||
spellMenu.setCaption(me.noSpellVariantsText, true);
|
||||
}
|
||||
};
|
||||
|
||||
this.clearWordVariants = function(isParagraph) {
|
||||
var spellMenu = (isParagraph) ? me.textMenu : me.menuSpellCheckTable.menu;
|
||||
|
||||
for (var i = 0; i < spellMenu.items.length; i++) {
|
||||
if (spellMenu.items[i].options.spellword) {
|
||||
if (spellMenu.checkeditem == spellMenu.items[i]) {
|
||||
spellMenu.checkeditem = undefined;
|
||||
spellMenu.activeItem = undefined;
|
||||
}
|
||||
|
||||
spellMenu.removeItem(spellMenu.items[i]);
|
||||
i--;
|
||||
}
|
||||
}
|
||||
(isParagraph) ? me.menuSpellMorePara.menu.removeAll() : me.menuSpellMoreTable.menu.removeAll();
|
||||
|
||||
me.menuSpellMorePara.menu.checkeditem = undefined;
|
||||
me.menuSpellMorePara.menu.activeItem = undefined;
|
||||
me.menuSpellMoreTable.menu.checkeditem = undefined;
|
||||
me.menuSpellMoreTable.menu.activeItem = undefined;
|
||||
};
|
||||
|
||||
this.initEquationMenu = function() {
|
||||
if (!me._currentMathObj) return;
|
||||
var type = me._currentMathObj.get_Type(),
|
||||
|
@ -1349,9 +1478,11 @@ define([
|
|||
if (me.mode.isEdit===true) {
|
||||
me.api.asc_registerCallback('asc_onDialogAddHyperlink', _.bind(onDialogAddHyperlink, me));
|
||||
me.api.asc_registerCallback('asc_doubleClickOnChart', onDoubleClickOnChart);
|
||||
me.api.asc_registerCallback('asc_onSpellCheckVariantsFound', _.bind(onSpellCheckVariantsFound, me));
|
||||
}
|
||||
me.api.asc_registerCallback('asc_onCoAuthoringDisconnect', _.bind(onCoAuthoringDisconnect, me));
|
||||
Common.NotificationCenter.on('api:disconnect', _.bind(onCoAuthoringDisconnect, me));
|
||||
me.api.asc_registerCallback('asc_onTextLanguage', _.bind(onTextLanguage, me));
|
||||
|
||||
me.api.asc_registerCallback('asc_onShowForeignCursorLabel', _.bind(onShowForeignCursorLabel, me));
|
||||
me.api.asc_registerCallback('asc_onHideForeignCursorLabel', _.bind(onHideForeignCursorLabel, me));
|
||||
|
@ -1367,6 +1498,7 @@ define([
|
|||
if (me.api && mode.isEdit) {
|
||||
me.api.asc_registerCallback('asc_onDialogAddHyperlink', _.bind(onDialogAddHyperlink, me));
|
||||
me.api.asc_registerCallback('asc_doubleClickOnChart', onDoubleClickOnChart);
|
||||
me.api.asc_registerCallback('asc_onSpellCheckVariantsFound', _.bind(onSpellCheckVariantsFound, me));
|
||||
}
|
||||
|
||||
me.mode = mode;
|
||||
|
@ -1792,6 +1924,123 @@ define([
|
|||
})()
|
||||
});
|
||||
|
||||
me.menuSpellTable = new Common.UI.MenuItem({
|
||||
caption : me.loadSpellText,
|
||||
disabled : true
|
||||
});
|
||||
|
||||
me.menuSpellMoreTable = new Common.UI.MenuItem({
|
||||
caption : me.moreText,
|
||||
menu : new Common.UI.Menu({
|
||||
menuAlign: 'tl-tr',
|
||||
items : [
|
||||
]
|
||||
})
|
||||
});
|
||||
|
||||
me.langTableMenu = new Common.UI.MenuItem({
|
||||
caption : me.langText,
|
||||
menu : new Common.UI.Menu({
|
||||
menuAlign: 'tl-tr',
|
||||
maxHeight: 300,
|
||||
items : [
|
||||
]
|
||||
}).on('show:after', function(menu) {
|
||||
// TODO: scroll to checked item
|
||||
})
|
||||
});
|
||||
|
||||
var menuIgnoreSpellTable = new Common.UI.MenuItem({
|
||||
caption : me.ignoreSpellText
|
||||
}).on('click', function(item) {
|
||||
if (me.api) {
|
||||
me.api.asc_ignoreMisspelledWord(me._currentSpellObj, false);
|
||||
me.fireEvent('editcomplete', me);
|
||||
}
|
||||
});
|
||||
|
||||
var menuIgnoreAllSpellTable = new Common.UI.MenuItem({
|
||||
caption : me.ignoreAllSpellText
|
||||
}).on('click', function(menu) {
|
||||
if (me.api) {
|
||||
me.api.asc_ignoreMisspelledWord(me._currentSpellObj, true);
|
||||
me.fireEvent('editcomplete', me);
|
||||
}
|
||||
});
|
||||
|
||||
var menuIgnoreSpellTableSeparator = new Common.UI.MenuItem({
|
||||
caption : '--'
|
||||
});
|
||||
|
||||
var menuSpellcheckTableSeparator = new Common.UI.MenuItem({
|
||||
caption : '--'
|
||||
});
|
||||
|
||||
me.menuSpellCheckTable = new Common.UI.MenuItem({
|
||||
caption : me.spellcheckText,
|
||||
menu : new Common.UI.Menu({
|
||||
menuAlign: 'tl-tr',
|
||||
items : [
|
||||
me.menuSpellTable,
|
||||
me.menuSpellMoreTable,
|
||||
menuIgnoreSpellTableSeparator,
|
||||
menuIgnoreSpellTable,
|
||||
menuIgnoreAllSpellTable,
|
||||
{ caption: '--' },
|
||||
me.langTableMenu
|
||||
]
|
||||
})
|
||||
});
|
||||
|
||||
me.menuSpellPara = new Common.UI.MenuItem({
|
||||
caption : me.loadSpellText,
|
||||
disabled : true
|
||||
});
|
||||
|
||||
me.menuSpellMorePara = new Common.UI.MenuItem({
|
||||
caption : me.moreText,
|
||||
menu : new Common.UI.Menu({
|
||||
menuAlign: 'tl-tr',
|
||||
style : 'max-height: 300px;',
|
||||
items: [
|
||||
]
|
||||
})
|
||||
});
|
||||
|
||||
me.langParaMenu = new Common.UI.MenuItem({
|
||||
caption : me.langText,
|
||||
menu : new Common.UI.Menu({
|
||||
menuAlign: 'tl-tr',
|
||||
maxHeight: 300,
|
||||
items : [
|
||||
]
|
||||
}).on('show:after', function(menu) {
|
||||
// TODO: scroll to checked item
|
||||
})
|
||||
});
|
||||
|
||||
var menuIgnoreSpellPara = new Common.UI.MenuItem({
|
||||
caption : me.ignoreSpellText
|
||||
}).on('click', function(item, e) {
|
||||
me.api.asc_ignoreMisspelledWord(me._currentSpellObj, false);
|
||||
me.fireEvent('editcomplete', me);
|
||||
});
|
||||
|
||||
var menuIgnoreAllSpellPara = new Common.UI.MenuItem({
|
||||
caption : me.ignoreAllSpellText
|
||||
}).on('click', function(item, e) {
|
||||
me.api.asc_ignoreMisspelledWord(me._currentSpellObj, true);
|
||||
me.fireEvent('editcomplete', me);
|
||||
});
|
||||
|
||||
var menuIgnoreSpellParaSeparator = new Common.UI.MenuItem({
|
||||
caption : '--'
|
||||
});
|
||||
|
||||
var menuSpellcheckParaSeparator = new Common.UI.MenuItem({
|
||||
caption : '--'
|
||||
});
|
||||
|
||||
var menuTableAdvanced = new Common.UI.MenuItem({
|
||||
caption : me.advancedTableText
|
||||
}).on('click', function(item) {
|
||||
|
@ -2400,15 +2649,43 @@ define([
|
|||
menuParaCut.setDisabled(disabled);
|
||||
menuParaPaste.setDisabled(disabled);
|
||||
|
||||
// spellCheck
|
||||
me.menuSpellPara.setVisible(value.spellProps!==undefined && value.spellProps.value.get_Checked()===false);
|
||||
menuSpellcheckParaSeparator.setVisible(value.spellProps!==undefined && value.spellProps.value.get_Checked()===false);
|
||||
menuIgnoreSpellPara.setVisible(value.spellProps!==undefined && value.spellProps.value.get_Checked()===false);
|
||||
menuIgnoreAllSpellPara.setVisible(value.spellProps!==undefined && value.spellProps.value.get_Checked()===false);
|
||||
me.langParaMenu.setVisible(value.spellProps!==undefined && value.spellProps.value.get_Checked()===false);
|
||||
me.langParaMenu.setDisabled(disabled);
|
||||
menuIgnoreSpellParaSeparator.setVisible(value.spellProps!==undefined && value.spellProps.value.get_Checked()===false);
|
||||
|
||||
if (value.spellProps!==undefined && value.spellProps.value.get_Checked()===false && value.spellProps.value.get_Variants() !== null && value.spellProps.value.get_Variants() !== undefined) {
|
||||
me.addWordVariants(true);
|
||||
} else {
|
||||
me.menuSpellPara.setCaption(me.loadSpellText, true);
|
||||
me.clearWordVariants(true);
|
||||
me.menuSpellMorePara.setVisible(false);
|
||||
}
|
||||
if (me.langParaMenu.isVisible() && me._currLang.id !== me._currLang.paraid) {
|
||||
me.changeLanguageMenu(me.langParaMenu.menu);
|
||||
me._currLang.paraid = me._currLang.id;
|
||||
}
|
||||
|
||||
//equation menu
|
||||
var eqlen = 0;
|
||||
if (isEquation) {
|
||||
eqlen = me.addEquationMenu(true, 4);
|
||||
eqlen = me.addEquationMenu(true, 11);
|
||||
} else
|
||||
me.clearEquationMenu(true, 4);
|
||||
me.clearEquationMenu(true, 11);
|
||||
menuEquationSeparator.setVisible(isEquation && eqlen>0);
|
||||
},
|
||||
items: [
|
||||
me.menuSpellPara,
|
||||
me.menuSpellMorePara,
|
||||
menuSpellcheckParaSeparator,
|
||||
menuIgnoreSpellPara,
|
||||
menuIgnoreAllSpellPara,
|
||||
me.langParaMenu,
|
||||
menuIgnoreSpellParaSeparator,
|
||||
menuParaCut,
|
||||
menuParaCopy,
|
||||
menuParaPaste,
|
||||
|
@ -2441,7 +2718,7 @@ define([
|
|||
return;
|
||||
|
||||
var isEquation= (value.mathProps && value.mathProps.value);
|
||||
for (var i = 4; i < 14; i++) {
|
||||
for (var i = 6; i < 16; i++) {
|
||||
me.tableMenu.items[i].setVisible(!isEquation);
|
||||
}
|
||||
|
||||
|
@ -2456,8 +2733,8 @@ define([
|
|||
mnuTableSplit.setDisabled(value.tableProps.locked || disabled || !me.api.CheckBeforeSplitCells());
|
||||
}
|
||||
|
||||
me.tableMenu.items[5].setDisabled(value.tableProps.locked || disabled);
|
||||
me.tableMenu.items[6].setDisabled(value.tableProps.locked || disabled);
|
||||
me.tableMenu.items[7].setDisabled(value.tableProps.locked || disabled);
|
||||
me.tableMenu.items[8].setDisabled(value.tableProps.locked || disabled);
|
||||
|
||||
menuTableCellAlign.setDisabled(value.tableProps.locked || disabled);
|
||||
menuTableAdvanced.setDisabled(value.tableProps.locked || disabled);
|
||||
|
@ -2493,15 +2770,34 @@ define([
|
|||
/** coauthoring end **/
|
||||
menuHyperlinkSeparator.setVisible(menuAddHyperlinkTable.isVisible() || menuHyperlinkTable.isVisible() /** coauthoring begin **/|| menuAddCommentTable.isVisible()/** coauthoring end **/);
|
||||
|
||||
me.menuSpellCheckTable.setVisible(value.spellProps!==undefined && value.spellProps.value.get_Checked()===false);
|
||||
menuSpellcheckTableSeparator.setVisible(value.spellProps!==undefined && value.spellProps.value.get_Checked()===false);
|
||||
|
||||
me.langTableMenu.setDisabled(disabled);
|
||||
if (value.spellProps!==undefined && value.spellProps.value.get_Checked()===false && value.spellProps.value.get_Variants() !== null && value.spellProps.value.get_Variants() !== undefined) {
|
||||
me.addWordVariants(false);
|
||||
} else {
|
||||
me.menuSpellTable.setCaption(me.loadSpellText, true);
|
||||
me.clearWordVariants(false);
|
||||
me.menuSpellMoreTable.setVisible(false);
|
||||
}
|
||||
|
||||
if (me.menuSpellCheckTable.isVisible() && me._currLang.id !== me._currLang.tableid) {
|
||||
me.changeLanguageMenu(me.langTableMenu.menu);
|
||||
me._currLang.tableid = me._currLang.id;
|
||||
}
|
||||
|
||||
//equation menu
|
||||
var eqlen = 0;
|
||||
if (isEquation) {
|
||||
eqlen = me.addEquationMenu(false, 4);
|
||||
eqlen = me.addEquationMenu(false, 6);
|
||||
menuHyperlinkSeparator.setVisible(menuHyperlinkSeparator.isVisible() && eqlen>0);
|
||||
} else
|
||||
me.clearEquationMenu(false, 4);
|
||||
me.clearEquationMenu(false, 6);
|
||||
},
|
||||
items: [
|
||||
me.menuSpellCheckTable,
|
||||
menuSpellcheckTableSeparator,
|
||||
menuTableCut,
|
||||
menuTableCopy,
|
||||
menuTablePaste,
|
||||
|
@ -2678,6 +2974,53 @@ define([
|
|||
});
|
||||
},
|
||||
|
||||
setLanguages: function(langs){
|
||||
var me = this;
|
||||
|
||||
if (langs && langs.length > 0 && me.langParaMenu && me.langTableMenu) {
|
||||
me.langParaMenu.menu.removeAll();
|
||||
me.langTableMenu.menu.removeAll();
|
||||
_.each(langs, function(lang, index){
|
||||
me.langParaMenu.menu.addItem(new Common.UI.MenuItem({
|
||||
caption : lang.title,
|
||||
checkable : true,
|
||||
toggleGroup : 'popupparalang',
|
||||
langid : lang.code
|
||||
}).on('click', function(item, e){
|
||||
if (me.api){
|
||||
if (!_.isUndefined(item.options.langid))
|
||||
me.api.put_TextPrLang(item.options.langid);
|
||||
|
||||
me._currLang.paraid = item.options.langid;
|
||||
me.langParaMenu.menu.currentCheckedItem = item;
|
||||
|
||||
me.fireEvent('editcomplete', me);
|
||||
}
|
||||
}));
|
||||
|
||||
me.langTableMenu.menu.addItem(new Common.UI.MenuItem({
|
||||
caption : lang.title,
|
||||
checkable : true,
|
||||
toggleGroup : 'popuptablelang',
|
||||
langid : lang.code
|
||||
}).on('click', function(item, e){
|
||||
if (me.api){
|
||||
if (!_.isUndefined(item.options.langid))
|
||||
me.api.put_TextPrLang(item.options.langid);
|
||||
|
||||
me._currLang.tableid = item.options.langid;
|
||||
me.langTableMenu.menu.currentCheckedItem = item;
|
||||
|
||||
me.fireEvent('editcomplete', me);
|
||||
}
|
||||
}));
|
||||
});
|
||||
|
||||
me.langTableMenu.menu.doLayout();
|
||||
me.langParaMenu.menu.doLayout();
|
||||
}
|
||||
},
|
||||
|
||||
insertRowAboveText : 'Row Above',
|
||||
insertRowBelowText : 'Row Below',
|
||||
insertColumnLeftText : 'Column Left',
|
||||
|
@ -2825,7 +3168,14 @@ define([
|
|||
alignmentText: 'Alignment',
|
||||
leftText: 'Left',
|
||||
rightText: 'Right',
|
||||
centerText: 'Center'
|
||||
centerText: 'Center',
|
||||
loadSpellText: 'Loading variants...',
|
||||
ignoreAllSpellText: 'Ignore All',
|
||||
ignoreSpellText: 'Ignore',
|
||||
noSpellVariantsText: 'No variants',
|
||||
moreText: 'More variants...',
|
||||
spellcheckText: 'Spellcheck',
|
||||
langText: 'Select Language'
|
||||
|
||||
}, PE.Views.DocumentHolder || {}));
|
||||
});
|
|
@ -111,6 +111,10 @@ define([
|
|||
|
||||
template: _.template([
|
||||
'<table><tbody>',
|
||||
'<tr class="edit">',
|
||||
'<td class="left"><label><%= scope.txtSpellCheck %></label></td>',
|
||||
'<td class="right"><div id="fms-chb-spell-check"/></td>',
|
||||
'</tr>','<tr class="divider edit"></tr>',
|
||||
'<tr class="edit">',
|
||||
'<td class="left"><label><%= scope.txtInput %></label></td>',
|
||||
'<td class="right"><div id="fms-chb-input-mode"/></td>',
|
||||
|
@ -159,6 +163,11 @@ define([
|
|||
render: function() {
|
||||
$(this.el).html(this.template({scope: this}));
|
||||
|
||||
this.chSpell = new Common.UI.CheckBox({
|
||||
el: $('#fms-chb-spell-check'),
|
||||
labelText: this.strSpellCheckMode
|
||||
});
|
||||
|
||||
this.chInputMode = new Common.UI.CheckBox({
|
||||
el: $('#fms-chb-input-mode'),
|
||||
labelText: this.strInputMode
|
||||
|
@ -276,9 +285,12 @@ define([
|
|||
},
|
||||
|
||||
updateSettings: function() {
|
||||
var value = Common.localStorage.getItem("pe-settings-spellcheck");
|
||||
this.chSpell.setValue(value===null || parseInt(value) == 1);
|
||||
|
||||
this.chInputMode.setValue(Common.localStorage.getBool("pe-settings-inputmode"));
|
||||
|
||||
var value = Common.localStorage.getItem("pe-settings-zoom");
|
||||
value = Common.localStorage.getItem("pe-settings-zoom");
|
||||
value = (value!==null) ? parseInt(value) : (this.mode.customization && this.mode.customization.zoom ? parseInt(this.mode.customization.zoom) : -1);
|
||||
var item = this.cmbZoom.store.findWhere({value: value});
|
||||
this.cmbZoom.setValue(item ? parseInt(item.get('value')) : (value>0 ? value+'%' : 100));
|
||||
|
@ -316,6 +328,7 @@ define([
|
|||
},
|
||||
|
||||
applySettings: function() {
|
||||
Common.localStorage.setItem("pe-settings-spellcheck", this.chSpell.isChecked() ? 1 : 0);
|
||||
Common.localStorage.setItem("pe-settings-inputmode", this.chInputMode.isChecked() ? 1 : 0);
|
||||
Common.localStorage.setItem("pe-settings-zoom", this.cmbZoom.getValue());
|
||||
/** coauthoring begin **/
|
||||
|
@ -365,7 +378,9 @@ define([
|
|||
txtInch: 'Inch',
|
||||
txtFitWidth: 'Fit to Width',
|
||||
textForceSave: 'Save to Server',
|
||||
strForcesave: 'Always save to server (otherwise save to server on document close)'
|
||||
strForcesave: 'Always save to server (otherwise save to server on document close)',
|
||||
txtSpellCheck: 'Spell Checking',
|
||||
strSpellCheckMode: 'Turn on spell checking option'
|
||||
}, PE.Views.FileMenuPanels.Settings || {}));
|
||||
|
||||
PE.Views.FileMenuPanels.RecentFiles = Common.UI.BaseView.extend({
|
||||
|
|
|
@ -66,6 +66,19 @@ define([
|
|||
Common.Utils.String.format(this.pageIndexText, model.get('current'), model.get('count')) );
|
||||
}
|
||||
|
||||
function _clickLanguage(menu, item, state) {
|
||||
var $parent = menu.$el.parent();
|
||||
|
||||
$parent.find('#status-label-lang').text(item.caption);
|
||||
$parent.find('.dropdown-toggle > .icon.lang-flag')
|
||||
.removeClass(this.langMenu.prevTip)
|
||||
.addClass(item.value.tip);
|
||||
|
||||
this.langMenu.prevTip = item.value.tip;
|
||||
|
||||
this.fireEvent('langchanged', [this, item.value.code, item.caption]);
|
||||
}
|
||||
|
||||
PE.Views.Statusbar = Backbone.View.extend(_.extend({
|
||||
el: '#statusbar',
|
||||
template: _.template(template),
|
||||
|
@ -223,6 +236,62 @@ define([
|
|||
hintAnchor: 'top'
|
||||
});
|
||||
|
||||
this.btnDocLanguage = new Common.UI.Button({
|
||||
el: $('#btn-doc-lang',this.el),
|
||||
hint: this.tipSetDocLang,
|
||||
hintAnchor: 'top',
|
||||
disabled: true
|
||||
});
|
||||
|
||||
this.btnSetSpelling = new Common.UI.Button({
|
||||
el: $('#btn-doc-spell',this.el),
|
||||
enableToggle: true,
|
||||
hint: this.tipSetSpelling,
|
||||
hintAnchor: 'top'
|
||||
});
|
||||
|
||||
var panelLang = $('.cnt-lang',this.el);
|
||||
this.langMenu = new Common.UI.Menu({
|
||||
style: 'margin-top:-5px;',
|
||||
maxHeight: 300,
|
||||
itemTemplate: _.template([
|
||||
'<a id="<%= id %>" tabindex="-1" type="menuitem">',
|
||||
'<i class="icon lang-flag <%= iconCls %>"></i>',
|
||||
'<%= caption %>',
|
||||
'</a>'
|
||||
].join('')),
|
||||
menuAlign: 'bl-tl'
|
||||
});
|
||||
|
||||
this.btnLanguage = new Common.UI.Button({
|
||||
el: panelLang,
|
||||
hint: this.tipSetLang,
|
||||
hintAnchor: 'top-left',
|
||||
disabled: true
|
||||
});
|
||||
this.btnLanguage.cmpEl.on({
|
||||
'show.bs.dropdown': function () {
|
||||
_.defer(function(){
|
||||
me.btnLanguage.cmpEl.find('ul').focus();
|
||||
}, 100);
|
||||
},
|
||||
'hide.bs.dropdown': function () {
|
||||
_.defer(function(){
|
||||
me.api.asc_enableKeyEvents(true);
|
||||
}, 100);
|
||||
},
|
||||
'click': function (e) {
|
||||
if (me.btnLanguage.isDisabled()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
this.langMenu.render(panelLang);
|
||||
this.langMenu.cmpEl.attr({tabindex: -1});
|
||||
this.langMenu.prevTip = 'en';
|
||||
this.langMenu.on('item:click', _.bind(_clickLanguage,this));
|
||||
|
||||
return this;
|
||||
},
|
||||
|
||||
|
@ -257,6 +326,49 @@ define([
|
|||
$('#status-label-action').text('');
|
||||
},
|
||||
|
||||
reloadLanguages: function(array) {
|
||||
this.langMenu.removeAll();
|
||||
_.each(array, function(item) {
|
||||
this.langMenu.addItem({
|
||||
iconCls : item['tip'],
|
||||
caption : item['title'],
|
||||
value : {tip: item['tip'], code: item['code']},
|
||||
checkable : true,
|
||||
checked : this.langMenu.saved == item.title,
|
||||
toggleGroup : 'language'
|
||||
});
|
||||
}, this);
|
||||
|
||||
this.langMenu.doLayout();
|
||||
if (this.langMenu.items.length>0) {
|
||||
this.btnLanguage.setDisabled(false);
|
||||
this.btnDocLanguage.setDisabled(false);
|
||||
}
|
||||
},
|
||||
|
||||
setLanguage: function(info) {
|
||||
if (this.langMenu.prevTip != info.tip && info.code !== undefined) {
|
||||
var $parent = $(this.langMenu.el.parentNode, this.$el);
|
||||
$parent.find('.dropdown-toggle > .icon.lang-flag')
|
||||
.removeClass(this.langMenu.prevTip)
|
||||
.addClass(info.tip);
|
||||
|
||||
this.langMenu.prevTip = info.tip;
|
||||
|
||||
$parent.find('#status-label-lang').text(info.title);
|
||||
|
||||
var index = $parent.find('ul li a:contains("'+info.title+'")').parent().index();
|
||||
index < 0 ? this.langMenu.saved = info.title :
|
||||
this.langMenu.items[index-1].setChecked(true);
|
||||
}
|
||||
},
|
||||
|
||||
SetDisabled: function(disable) {
|
||||
var langs = this.langMenu.items.length>0;
|
||||
this.btnLanguage.setDisabled(disable || !langs);
|
||||
this.btnDocLanguage.setDisabled(disable || !langs);
|
||||
},
|
||||
|
||||
pageIndexText : 'Slide {0} of {1}',
|
||||
goToPageText : 'Go to Slide',
|
||||
tipFitPage : 'Fit to Slide',
|
||||
|
@ -266,7 +378,10 @@ define([
|
|||
tipZoomFactor : 'Magnification',
|
||||
txtPageNumInvalid: 'Slide number invalid',
|
||||
tipPreview : 'Start Slideshow',
|
||||
tipAccessRights : 'Manage document access rights'
|
||||
tipAccessRights : 'Manage document access rights',
|
||||
tipSetLang : 'Set Text Language',
|
||||
tipSetDocLang : 'Set Document Language',
|
||||
tipSetSpelling : 'Spell checking'
|
||||
}, PE.Views.Statusbar || {}));
|
||||
}
|
||||
);
|
|
@ -1403,12 +1403,14 @@ define([
|
|||
onToolbarAfterRender: function(toolbar) {
|
||||
// DataView and pickers
|
||||
//
|
||||
var colorVal = $('<div class="btn-color-value-line"></div>');
|
||||
$('button:first-child', this.btnFontColor.cmpEl).append(colorVal);
|
||||
colorVal.css('background-color', this.btnFontColor.currentColor || 'transparent');
|
||||
this.mnuFontColorPicker = new Common.UI.ThemeColorPalette({
|
||||
el: $('#id-toolbar-menu-fontcolor')
|
||||
});
|
||||
if (this.btnFontColor.cmpEl) {
|
||||
var colorVal = $('<div class="btn-color-value-line"></div>');
|
||||
$('button:first-child', this.btnFontColor.cmpEl).append(colorVal);
|
||||
colorVal.css('background-color', this.btnFontColor.currentColor || 'transparent');
|
||||
this.mnuFontColorPicker = new Common.UI.ThemeColorPalette({
|
||||
el: $('#id-toolbar-menu-fontcolor')
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
setApi: function (api) {
|
||||
|
|
|
@ -105,6 +105,9 @@
|
|||
"Common.Views.InsertTableDialog.txtMinText": "The minimum value for this field is {0}.",
|
||||
"Common.Views.InsertTableDialog.txtRows": "Number of Rows",
|
||||
"Common.Views.InsertTableDialog.txtTitle": "Table Size",
|
||||
"Common.Views.LanguageDialog.btnCancel": "Cancel",
|
||||
"Common.Views.LanguageDialog.btnOk": "Ok",
|
||||
"Common.Views.LanguageDialog.labelSelect": "Select document language",
|
||||
"Common.Views.OpenDialog.cancelButtonText": "Cancel",
|
||||
"Common.Views.OpenDialog.okButtonText": "OK",
|
||||
"Common.Views.OpenDialog.txtEncoding": "Encoding ",
|
||||
|
@ -760,6 +763,13 @@
|
|||
"PE.Views.DocumentHolder.txtUnderbar": "Bar under text",
|
||||
"PE.Views.DocumentHolder.txtUngroup": "Ungroup",
|
||||
"PE.Views.DocumentHolder.vertAlignText": "Vertical Alignment",
|
||||
"PE.Views.DocumentHolder.loadSpellText": "Loading variants...",
|
||||
"PE.Views.DocumentHolder.ignoreAllSpellText": "Ignore All",
|
||||
"PE.Views.DocumentHolder.ignoreSpellText": "Ignore",
|
||||
"PE.Views.DocumentHolder.noSpellVariantsText": "No variants",
|
||||
"PE.Views.DocumentHolder.moreText": "'More variants...",
|
||||
"PE.Views.DocumentHolder.spellcheckText": "Spellcheck",
|
||||
"PE.Views.DocumentHolder.langText": "Select Language",
|
||||
"PE.Views.DocumentPreview.goToSlideText": "Go to Slide",
|
||||
"PE.Views.DocumentPreview.slideIndexText": "Slide {0} of {1}",
|
||||
"PE.Views.DocumentPreview.txtClose": "Close Slideshow",
|
||||
|
@ -832,6 +842,8 @@
|
|||
"PE.Views.FileMenuPanels.Settings.txtInput": "Alternate Input",
|
||||
"PE.Views.FileMenuPanels.Settings.txtLast": "View Last",
|
||||
"PE.Views.FileMenuPanels.Settings.txtPt": "Point",
|
||||
"PE.Views.FileMenuPanels.Settings.txtSpellCheck": "Spell Checking",
|
||||
"PE.Views.FileMenuPanels.Settings.strSpellCheckMode": "Turn on spell checking option",
|
||||
"PE.Views.HyperlinkSettingsDialog.cancelButtonText": "Cancel",
|
||||
"PE.Views.HyperlinkSettingsDialog.okButtonText": "OK",
|
||||
"PE.Views.HyperlinkSettingsDialog.strDisplay": "Display",
|
||||
|
@ -1115,6 +1127,9 @@
|
|||
"PE.Views.Statusbar.tipZoomFactor": "Magnification",
|
||||
"PE.Views.Statusbar.tipZoomIn": "Zoom In",
|
||||
"PE.Views.Statusbar.tipZoomOut": "Zoom Out",
|
||||
"PE.Views.Statusbar.tipSetLang": "Set Text Language",
|
||||
"PE.Views.Statusbar.tipSetDocLang": "Set Document Language",
|
||||
"PE.Views.Statusbar.tipSetSpelling": "Spell checking",
|
||||
"del_PE.Views.Statusbar.txAccessRights": "Change access rights",
|
||||
"PE.Views.Statusbar.txtPageNumInvalid": "Invalid slide number",
|
||||
"PE.Views.TableSettings.deleteColumnText": "Delete Column",
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
Binary file not shown.
Before Width: | Height: | Size: 30 KiB After Width: | Height: | Size: 32 KiB |
|
@ -112,6 +112,7 @@
|
|||
@import "../../../../common/main/resources/less/opendialog.less";
|
||||
@import "../../../../common/main/resources/less/plugins.less";
|
||||
@import "../../../../common/main/resources/less/toolbar.less";
|
||||
@import "../../../../common/main/resources/less/language-dialog.less";
|
||||
|
||||
// App
|
||||
// --------------------------------------------------
|
||||
|
|
|
@ -41,6 +41,7 @@
|
|||
#btn-zoom-topage {
|
||||
.btn-tpl(-1160px);
|
||||
margin-right: 9px;
|
||||
margin-left: 6px;
|
||||
}
|
||||
|
||||
#btn-zoom-towidth {
|
||||
|
@ -56,6 +57,16 @@
|
|||
.btn-tpl(-1220px);
|
||||
}
|
||||
|
||||
#btn-doc-lang {
|
||||
.btn-tpl(-1500px);
|
||||
margin-right: 9px;
|
||||
}
|
||||
|
||||
#btn-doc-spell {
|
||||
.btn-tpl(-1520px);
|
||||
margin-right: 5px;
|
||||
}
|
||||
|
||||
#status-btn-preview {
|
||||
.btn-tpl(-160px);
|
||||
}
|
||||
|
@ -78,6 +89,49 @@
|
|||
}
|
||||
}
|
||||
|
||||
.cnt-lang {
|
||||
display: inline-block;
|
||||
cursor: pointer;
|
||||
color: #000;
|
||||
margin-left: 6px;
|
||||
|
||||
.dropdown-toggle > .icon.lang-flag {
|
||||
position: relative;
|
||||
top: 3px;
|
||||
margin-left: 3px;
|
||||
margin-right: 2px;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.caret.up {
|
||||
background-position: @arrow-up-small-offset-x @arrow-up-small-offset-y;
|
||||
|
||||
border: none;
|
||||
width: 7px;
|
||||
height: 7px;
|
||||
}
|
||||
|
||||
label {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.dropdown-menu {
|
||||
> li .icon {
|
||||
display: inline-block;
|
||||
vertical-align: text-bottom;
|
||||
margin: 1px 5px 0 2px;
|
||||
}
|
||||
}
|
||||
|
||||
&.disabled {
|
||||
cursor: default;
|
||||
label, .icon.lang-flag {
|
||||
cursor: default;
|
||||
opacity: 0.4;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.cnt-zoom {
|
||||
display: inline-block;
|
||||
|
||||
|
@ -165,4 +219,3 @@
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue