[PE] Added spell check + changing document language. Moved LanguageDialog to Common.
This commit is contained in:
parent
fe3bd89aa9
commit
b1ba645bf6
|
@ -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) {
|
||||
|
|
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),
|
||||
|
|
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;}
|
||||
}
|
|
@ -216,9 +216,6 @@ define([
|
|||
});
|
||||
},
|
||||
|
||||
/*
|
||||
* */
|
||||
|
||||
setLanguages: function(langs) {
|
||||
this.langs = langs;
|
||||
this.statusbar.reloadLanguages(langs);
|
||||
|
|
|
@ -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||{}));
|
||||
}
|
||||
);
|
|
@ -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 ",
|
||||
|
@ -1305,9 +1308,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
|
||||
// --------------------------------------------------
|
||||
|
|
|
@ -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().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>
|
||||
|
|
|
@ -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 || {}));
|
||||
}
|
||||
);
|
|
@ -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 ",
|
||||
|
@ -832,6 +835,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 +1120,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",
|
||||
|
|
|
@ -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
|
||||
// --------------------------------------------------
|
||||
|
|
|
@ -56,6 +56,16 @@
|
|||
.btn-tpl(-1220px);
|
||||
}
|
||||
|
||||
#btn-doc-lang {
|
||||
.btn-tpl(-160px);
|
||||
margin-right: 9px;
|
||||
}
|
||||
|
||||
#btn-doc-spell {
|
||||
.btn-tpl(-160px);
|
||||
margin-right: 5px;
|
||||
}
|
||||
|
||||
#status-btn-preview {
|
||||
.btn-tpl(-160px);
|
||||
}
|
||||
|
@ -78,6 +88,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 +218,3 @@
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue