This commit is contained in:
Alexey Golubev 2020-03-04 18:13:18 +03:00
commit 028c1bd42b
2468 changed files with 71670 additions and 25913 deletions

7
.gitignore vendored
View file

@ -3,12 +3,17 @@ Thumbs.db
.DS_Store
/deploy
build/node_modules
build/sprites/node_modules/
apps/documenteditor/embed/resources/less/node_modules
apps/presentationeditor/embed/resources/less/node_modules
apps/spreadsheeteditor/embed/resources/less/node_modules
apps/documenteditor/mobile/resources/sass/.sass-cache
apps/spreadsheeteditor/mobile/resources/sass/.sass-cache
apps/presentationeditor/mobile/resources/sass/.sass-cache
apps/**/main/resources/**/iconssmall*.png
apps/**/main/resources/**/iconssmall*.less
apps/**/main/resources/**/iconsbig*.png
apps/**/main/resources/**/iconsbig*.less
# test documents
@ -22,4 +27,4 @@ apps/spreadsheeteditor/mobile/offlinedocs
# tests
selenium-debug.log
**/test/bin
**/test/reports
**/test/reports

View file

@ -1,7 +1,6 @@
dist: trusty
language: node_js
node_js:
- '6'
- '12'
before_install: npm install -g grunt-cli
before_script:
- cd build

10
.vscode/settings.json vendored Normal file
View file

@ -0,0 +1,10 @@
{
"filewatcher.commands": [
{
"match": "app-(ios|material)\\.less",
"isAsync": true,
"cmd": "lessc --js --no-color '${file}' '${fileDirname}/../css/${fileBasenameNoExt}.css'",
"event": "onFileChange"
}
]
}

View file

@ -4,7 +4,7 @@
The frontend for [ONLYOFFICE Document Server][2]. Builds the program interface and allows the user create, edit, save and export text, spreadsheet and presentation documents using the common interface of a document editor.
## Previos versions
## Previous versions
Until 2019-10-23 the repository was called web-apps-pro

View file

@ -44,7 +44,7 @@
review: <can review>, // default = edit
print: <can print>, // default = true
rename: <can rename>, // default = false
changeHistory: <can change history>, // default = false
changeHistory: <can change history>, // default = false // must be deprecated, check onRequestRestore event instead
comment: <can comment in view mode> // default = edit,
modifyFilter: <can add, remove and save filter in the spreadsheet> // default = true
modifyContentControl: <can modify content controls in documenteditor> // default = true
@ -109,7 +109,8 @@
goback: {
url: 'http://...',
text: 'Go to London',
blank: true
blank: true,
requestClose: false // if true - goback send onRequestClose event instead opening url
},
chat: true,
comments: true,
@ -128,7 +129,11 @@
compactHeader: false,
toolbarNoTabs: false,
toolbarHideFileName: false,
reviewDisplay: 'original'
reviewDisplay: 'original',
spellcheck: true,
compatibleFeatures: false,
unit: 'cm' // cm, pt, inch,
mentionShare : true // customize tooltip for mention
},
plugins: {
autostart: ['asc.{FFE1F462-1EA2-4391-990D-4CC84940B754}'],
@ -205,6 +210,8 @@
_config.editorConfig.canRequestSaveAs = _config.events && !!_config.events.onRequestSaveAs;
_config.editorConfig.canRequestInsertImage = _config.events && !!_config.events.onRequestInsertImage;
_config.editorConfig.canRequestMailMergeRecipients = _config.events && !!_config.events.onRequestMailMergeRecipients;
_config.editorConfig.canRequestCompareFile = _config.events && !!_config.events.onRequestCompareFile;
_config.editorConfig.canRequestSharingSettings = _config.events && !!_config.events.onRequestSharingSettings;
_config.frameEditorId = placeholderId;
var onMouseUp = function (evt) {
@ -574,6 +581,13 @@
});
};
var _setRevisedFile = function(data) {
_sendCommand({
command: 'setRevisedFile',
data: data
});
};
var _processMouse = function(evt) {
var r = iframe.getBoundingClientRect();
var data = {
@ -618,7 +632,8 @@
showSharingSettings : _showSharingSettings,
setSharingSettings : _setSharingSettings,
insertImage : _insertImage,
setMailMergeRecipients: _setMailMergeRecipients
setMailMergeRecipients: _setMailMergeRecipients,
setRevisedFile : _setRevisedFile
}
};
@ -729,14 +744,28 @@
}
}
var userAgent = navigator.userAgent.toLowerCase(),
check = function(regex){ return regex.test(userAgent); },
isIE = !check(/opera/) && (check(/msie/) || check(/trident/) || check(/edge/)),
isChrome = !isIE && check(/\bchrome\b/),
isSafari_mobile = !isIE && !isChrome && check(/safari/) && (navigator.maxTouchPoints>0);
path += app + "/";
path += config.type === "mobile"
path += (config.type === "mobile" || isSafari_mobile)
? "mobile"
: config.type === "embedded"
? "embed"
: "main";
path += "/index.html";
var index = "/index.html";
if (config.editorConfig) {
var customization = config.editorConfig.customization;
if ( typeof(customization) == 'object' && ( customization.toolbarNoTabs ||
(config.editorConfig.targetApp!=='desktop') && (customization.loaderName || customization.loaderLogo))) {
index = "/index_loader.html";
}
}
path += index;
return path;
}
@ -750,15 +779,33 @@
if ( (typeof(config.editorConfig.customization) == 'object') && config.editorConfig.customization.loaderName) {
if (config.editorConfig.customization.loaderName !== 'none') params += "&customer=" + config.editorConfig.customization.loaderName;
} else
params += "&customer=ONLYOFFICE";
params += "&customer={{APP_CUSTOMER_NAME}}";
if ( (typeof(config.editorConfig.customization) == 'object') && config.editorConfig.customization.loaderLogo) {
if (config.editorConfig.customization.loaderLogo !== '') params += "&logo=" + config.editorConfig.customization.loaderLogo;
} else if ( (typeof(config.editorConfig.customization) == 'object') && config.editorConfig.customization.logo) {
if (config.type=='embedded' && config.editorConfig.customization.logo.imageEmbedded)
params += "&headerlogo=" + config.editorConfig.customization.logo.imageEmbedded;
else if (config.type!='embedded' && config.editorConfig.customization.logo.image)
params += "&headerlogo=" + config.editorConfig.customization.logo.image;
}
}
if (config.editorConfig && (config.editorConfig.mode == 'editdiagram' || config.editorConfig.mode == 'editmerge'))
params += "&internal=true";
if (config.frameEditorId)
params += "&frameEditorId=" + config.frameEditorId;
if (config.editorConfig && config.editorConfig.mode == 'view' ||
config.document && config.document.permissions && (config.document.permissions.edit === false && !config.document.permissions.review ))
params += "&mode=view";
if (config.editorConfig && config.editorConfig.customization && !!config.editorConfig.customization.compactHeader)
params += "&compact=true";
if (config.editorConfig && config.editorConfig.customization && (config.editorConfig.customization.toolbar===false))
params += "&toolbar=false";
return params;
}
@ -774,7 +821,8 @@
iframe.allowFullscreen = true;
iframe.setAttribute("allowfullscreen",""); // for IE11
iframe.setAttribute("onmousewheel",""); // for Safari on Mac
iframe.setAttribute("allow", "autoplay");
if (config.type == "mobile")
{
iframe.style.position = "fixed";

View file

@ -21,7 +21,7 @@
var editor = new Asc.asc_docs_api({
'id-view' : 'editor_sdk'
});
editor.LoadFontsFromServer();
editor.asc_loadFontsFromServer();
</script>
</body>
</html>

View file

@ -118,6 +118,10 @@ if (Common === undefined) {
'setMailMergeRecipients': function(data) {
$me.trigger('setmailmergerecipients', data);
},
'setRevisedFile': function(data) {
$me.trigger('setrevisedfile', data);
}
};
@ -289,23 +293,31 @@ if (Common === undefined) {
},
requestMakeActionLink: function (config) {
_postMessage({event:'onMakeActionLink', data: config})
_postMessage({event:'onMakeActionLink', data: config});
},
requestUsers: function () {
_postMessage({event:'onRequestUsers'})
_postMessage({event:'onRequestUsers'});
},
requestSendNotify: function (emails) {
_postMessage({event:'onRequestSendNotify', data: emails})
_postMessage({event:'onRequestSendNotify', data: emails});
},
requestInsertImage: function () {
_postMessage({event:'onRequestInsertImage'})
_postMessage({event:'onRequestInsertImage'});
},
requestMailMergeRecipients: function () {
_postMessage({event:'onRequestMailMergeRecipients'})
_postMessage({event:'onRequestMailMergeRecipients'});
},
requestCompareFile: function () {
_postMessage({event:'onRequestCompareFile'});
},
requestSharingSettings: function () {
_postMessage({event:'onRequestSharingSettings'});
},
on: function(event, handler){

View file

@ -38,7 +38,8 @@ Common.Locale = new(function() {
"use strict";
var l10n = null;
var loadcallback,
apply = false;
apply = false,
currentLang = 'en';
var _applyLocalization = function(callback) {
try {
@ -78,6 +79,10 @@ Common.Locale = new(function() {
return res || (scope ? eval(scope.name).prototype[prop] : '');
};
var _getCurrentLanguage = function() {
return (currentLang || 'en');
};
var _getUrlParameterByName = function(name) {
name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
@ -87,9 +92,11 @@ Common.Locale = new(function() {
var _requireLang = function () {
var lang = (_getUrlParameterByName('lang') || 'en').split(/[\-_]/)[0];
currentLang = lang;
fetch('locale/' + lang + '.json')
.then(function(response) {
if (!response.ok) {
currentLang = 'en';
if (lang != 'en')
/* load default lang if fetch failed */
return fetch('locale/en.json');
@ -121,7 +128,7 @@ Common.Locale = new(function() {
/* use fetch polifill if native method isn't supported */
var polyfills = ['../vendor/fetch/fetch.umd'];
if ( !window.Promise ) {
require(['../vendor/es6-promise/es6-promise.auto.min.js'],
require(['../vendor/es6-promise/es6-promise.auto.min'],
function () {
require(polyfills, _requireLang);
});
@ -130,7 +137,8 @@ Common.Locale = new(function() {
return {
apply: _applyLocalization,
get: _get
get: _get,
getCurrentLanguage: _getCurrentLanguage
};
})();

View file

@ -187,8 +187,9 @@ define([
'<img src="<%= iconImg %>">' +
'<% } else { %>' +
'<% if (/svgicon/.test(iconCls)) {' +
'print(\'<svg width="26" height="26" class=\"icon\"><use href=\"#\' + /svgicon\\s(\\S+)/.exec(iconCls)[1] + \'\"></use></svg>\');' +
'} else ' +
'print(\'<svg class=\"icon\"><use class=\"zoom-int\" xlink:href=\"#\' + /svgicon\\s(\\S+)/.exec(iconCls)[1] + \'\"></use>' +
'<use class=\"zoom-grit\" xlink:href=\"#\' + /svgicon\\s(\\S+)/.exec(iconCls)[1] + \'-150\"></use></svg>\');' +
'} else ' +
'print(\'<i class=\"icon \' + iconCls + \'\">&nbsp;</i>\'); %>' +
'<% } %>';
@ -253,7 +254,8 @@ define([
// '<% if (iconCls != "") { print(\'<i class=\"icon \' + iconCls + \'\">&nbsp;</i>\'); }} %>',
'<% if (iconCls != "") { ' +
' if (/svgicon/.test(iconCls)) {' +
'print(\'<svg class=\"icon\"><use xlink:href=\"#\' + /svgicon\\s(\\S+)/.exec(iconCls)[1] + \'\"></use></svg>\');' +
'print(\'<svg class=\"icon\"><use class=\"zoom-int\" xlink:href=\"#\' + /svgicon\\s(\\S+)/.exec(iconCls)[1] + \'\"></use>' +
'<use class=\"zoom-grit\" xlink:href=\"#\' + /svgicon\\s(\\S+)/.exec(iconCls)[1] + \'-150\"></use></svg>\');' +
'} else ' +
'print(\'<i class=\"icon \' + iconCls + \'\">&nbsp;</i>\'); ' +
'}} %>',
@ -319,7 +321,7 @@ define([
me.trigger('render:before', me);
me.cmpEl = $(me.el);
me.cmpEl = me.$el || $(me.el);
if (parentEl) {
me.setElement(parentEl, false);
@ -386,6 +388,18 @@ define([
if (modalParents.length > 0) {
me.btnEl.data('bs.tooltip').tip().css('z-index', parseInt(modalParents.css('z-index')) + 10);
me.btnMenuEl && me.btnMenuEl.data('bs.tooltip').tip().css('z-index', parseInt(modalParents.css('z-index')) + 10);
var onModalClose = function(dlg) {
if (modalParents[0] !== dlg.$window[0]) return;
var tip = me.btnEl.data('bs.tooltip');
if (tip) {
if (tip.dontShow===undefined)
tip.dontShow = true;
tip.hide();
}
Common.NotificationCenter.off({'modal:close': onModalClose});
};
Common.NotificationCenter.on({'modal:close': onModalClose});
}
}
@ -561,6 +575,13 @@ define([
this.trigger('toggle', this, state);
},
click: function(opts) {
if ( !this.disabled ) {
this.doToggle();
this.trigger('click', this, opts);
}
},
isActive: function() {
if (this.enableToggle)
return this.pressed;
@ -629,6 +650,24 @@ define([
btnIconEl.addClass(cls || '');
},
changeIcon: function(opts) {
var me = this;
if ( opts && (opts.curr || opts.next)) {
!!opts.curr && (me.$icon.removeClass(opts.curr));
!!opts.next && !me.$icon.hasClass(opts.next) && (me.$icon.addClass(opts.next));
if ( !!me.options.signals ) {
if ( !(me.options.signals.indexOf('icon:changed') < 0) ) {
me.trigger('icon:changed', me, opts);
}
}
}
},
hasIcon: function(iconcls) {
return this.$icon.hasClass(iconcls);
},
setVisible: function(visible) {
if (this.cmpEl) this.cmpEl.toggleClass('hidden', !visible);
this.visible = visible;
@ -698,7 +737,7 @@ define([
this.caption = caption;
if (this.rendered) {
var captionNode = this.cmpEl.find('button:first > .caption').addBack().filter('button > .caption');
var captionNode = this.cmpEl.find('.caption');
if (captionNode.length > 0) {
captionNode.text(caption);

View file

@ -0,0 +1,491 @@
/*
*
* (c) Copyright Ascensio System SIA 2010-2019
*
* 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 20A-12 Ernesta Birznieka-Upisha
* street, Riga, Latvia, EU, LV-1050.
*
* 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
*
*/
if (Common === undefined)
var Common = {};
define([
'common/main/lib/component/BaseView',
'common/main/lib/util/utils'
], function () {
'use strict';
Common.UI.Calendar = Common.UI.BaseView.extend(_.extend({
template :
_.template([
'<div id="calendar" class="calendar-box">',
'<div class="calendar-header">',
'<div class="top-row">',
'<div id="prev-arrow"><button type="button"><i class="arrow-prev img-commonctrl">&nbsp;</i></button></div>',
'<div class="title"></div>',
'<div id="next-arrow"><button type="button"><i class="arrow-next img-commonctrl">&nbsp;</i></button></div>',
'</div>',
'<div class="bottom-row">',
'</div>',
'</div>',
'<div class="calendar-content"></div>',
'</div>'
].join('')),
options: {
date: undefined,
firstday: 0 // 0 - sunday, 1 - monday
},
initialize : function(options) {
Common.UI.BaseView.prototype.initialize.call(this, options);
var me = this;
this.monthNames = [this.textJanuary, this.textFebruary, this.textMarch, this.textApril, this.textMay, this.textJune, this.textJuly, this.textAugust, this.textSeptember, this.textOctober, this.textNovember, this.textDecember];
this.dayNamesShort = [this.textShortSunday, this.textShortMonday, this.textShortTuesday, this.textShortWednesday, this.textShortThursday, this.textShortFriday, this.textShortSaturday];
this.monthShortNames = [this.textShortJanuary, this.textShortFebruary, this.textShortMarch, this.textShortApril, this.textShortMay, this.textShortJune, this.textShortJuly, this.textShortAugust, this.textShortSeptember, this.textShortOctober, this.textShortNovember, this.textShortDecember];
me.options.date = options.date;
if (!_.isUndefined(options.firstday) && (options.firstday === 0 || options.firstday === 1)) {
me.options.firstday = options.firstday;
}
me.enableKeyEvents= me.options.enableKeyEvents;
me._state = undefined; // 0 - month, 1 - months, 2 - years
me.render();
},
render: function () {
var me = this;
me.cmpEl = me.$el || $(this.el);
me.cmpEl.html(this.template());
me.currentDate = me.options.date || new Date();
me.btnPrev = new Common.UI.Button({
cls: '',
iconCls: 'arrow-prev img-commonctrl'
});
me.btnPrev.render(me.cmpEl.find('#prev-arrow'));
me.btnPrev.on('click', _.bind(me.onClickPrev, me));
me.btnNext = new Common.UI.Button({
cls: '',
iconCls: 'arrow-next img-commonctrl'
});
me.btnNext.render(me.cmpEl.find('#next-arrow'));
me.btnNext.on('click', _.bind(me.onClickNext, me));
me.cmpEl.on('keydown', function(e) {
me.trigger('calendar:keydown', me, e);
});
me.renderMonth(me.currentDate);
this.trigger('render:after', this);
return this;
},
onClickPrev: function () {
var me = this;
if (me._state === 0) {
var d = new Date(me.currentDate);
d.setMonth(d.getMonth() - 1);
if (d.getFullYear() > 0) {
me.renderMonth(d);
}
} else if (me._state === 1) {
var d = new Date(me.currentDate);
d.setFullYear(d.getFullYear() - 1);
if (d.getFullYear() > 0) {
me.renderMonths(d);
}
} else if (me._state === 2) {
var year = me.currentDate.getFullYear(),
newYear;
if (year % 10 !== 0) {
newYear = String(year);
newYear = Number(newYear.slice(0, -1) + '0') - 1;
} else {
newYear = year - 1;
}
if (newYear > 0) {
me.currentDate.setFullYear(newYear);
me.renderYears(newYear);
}
}
},
onClickNext: function () {
var me = this;
if (me._state === 0) {
var d = new Date(me.currentDate);
d.setMonth(d.getMonth() + 1);
if (d.getFullYear() > 0) {
me.renderMonth(d);
}
} else if (me._state === 1) {
var d = new Date(me.currentDate);
d.setFullYear(d.getFullYear() + 1);
if (d.getFullYear() > 0) {
me.renderMonths(d);
}
} else if (me._state === 2) {
var year = me.currentDate.getFullYear(),
newYear;
if (year % 10 !== 9) {
newYear = String(year);
newYear = Number(newYear.slice(0, -1) + '9') + 1;
} else {
newYear = year + 1;
}
if (newYear > 0) {
me.currentDate.setFullYear(newYear);
me.renderYears(newYear);
}
}
},
renderYears: function (year) {
var me = this,
year = _.isNumber(year) ? year : (me.currentDate ? me.currentDate.getFullYear() : new Date().getFullYear());
me._state = 2;
var firstYear = year,
lastYear = year;
if ((firstYear % 10) !== 0) {
var strYear = String(year);
firstYear = Number(strYear.slice(0, -1) + '0');
}
if ((lastYear % 10) !== 9) {
var strYear = String(year);
lastYear = Number(strYear.slice(0, -1) + '9');
}
me.topTitle = _.template([
'<label>' + firstYear + '-' + lastYear + '</label>'
].join(''));
me.cmpEl.find('.calendar-header .title').html(me.topTitle);
me.bottomTitle = _.template([
'<label>' + me.textYears + '</label>'
].join(''));
me.cmpEl.find('.calendar-header .bottom-row').html(me.bottomTitle);
var arrYears = [];
var tmpYear = firstYear - 3;
for (var i = 0; i < 16; i++) {
arrYears.push({
year: (tmpYear > 0) ? tmpYear : '',
isCurrentDecade: ((tmpYear >= firstYear) && (tmpYear <= lastYear)) ? true : false,
disabled: (tmpYear > 0) ? false : true,
selected: (_.isDate(me.selectedDate)) ?
(tmpYear === me.selectedDate.getFullYear()) :
(tmpYear === new Date().getFullYear())
});
tmpYear++;
}
if (!me.yearPicker) {
me.yearPicker = new Common.UI.DataView({
el: me.cmpEl.find('.calendar-content'),
store: new Common.UI.DataViewStore(arrYears),
itemTemplate: _.template('<div class="name-year <% if (!isCurrentDecade) { %> no-current-decade <% } %>" data-year="<%= year %>"><%= year %></div>')
});
me.yearPicker.on('item:click', function (picker, item, record, e) {
var year = record.get('year'),
date = new Date();
date.setFullYear(year);
me.renderMonths(date);
});
me.enableKeyEvents && this.yearPicker.on('item:keydown', function(view, record, e) {
if (e.keyCode==Common.UI.Keys.ESC) {
Common.NotificationCenter.trigger('dataview:blur');
}
});
} else
me.yearPicker.store.reset(arrYears);
me.enableKeyEvents && _.delay(function() {
me.monthPicker.cmpEl.find('.dataview').focus();
}, 10);
},
renderMonths: function (date) {
var me = this,
curDate = (_.isDate(date)) ? date : (me.currentDate ? me.currentDate : new Date()),
year = curDate.getFullYear();
me._state = 1;
me.currentDate = curDate;
// Number of year
me.topTitle = _.template([
'<div class="button"><label>' + year + '</label></div>'
].join(''));
me.cmpEl.find('.calendar-header .title').html(me.topTitle);
me.cmpEl.find('.calendar-header .title').off();
me.cmpEl.find('.calendar-header .title').on('click', _.bind(me.renderYears, me));
me.bottomTitle = _.template([
'<label>' + me.textMonths + '</label>'
].join(''));
me.cmpEl.find('.calendar-header .bottom-row').html(me.bottomTitle);
var arrMonths = [];
var today = new Date();
for (var ind = 0; ind < 12; ind++) {
arrMonths.push({
indexMonth: ind,
nameMonth: me.monthShortNames[ind],
year: year,
curYear: true,
isCurrentMonth: (ind === curDate.getMonth()),
selected: (_.isDate(me.selectedDate)) ?
(ind === me.selectedDate.getMonth() && year === me.selectedDate.getFullYear()) :
(ind === today.getMonth() && year === today.getFullYear())
});
}
year = year + 1;
for (var ind = 0; ind < 4; ind++) {
arrMonths.push({
indexMonth: ind,
nameMonth: me.monthShortNames[ind],
year: year,
curYear: false,
selected: (_.isDate(me.selectedDate)) ?
(ind === me.selectedDate.getMonth() && year === me.selectedDate.getFullYear()) :
(ind === today.getMonth() && year === today.getFullYear())
});
}
if (!me.monthsPicker) {
me.monthsPicker = new Common.UI.DataView({
el: me.cmpEl.find('.calendar-content'),
store: new Common.UI.DataViewStore(arrMonths),
itemTemplate: _.template('<div class="name-month <% if (!curYear) { %> no-cur-year <% } %>" data-month="<%= indexMonth %>" data-year="<%= year %>"><%= nameMonth %></div>')
});
me.monthsPicker.on('item:click', function (picker, item, record, e) {
var month = record.get('indexMonth'),
year = record.get('year'),
date = new Date();
date.setFullYear(year, month);
me.renderMonth(date);
});
me.enableKeyEvents && this.monthsPicker.on('item:keydown', function(view, record, e) {
if (e.keyCode==Common.UI.Keys.ESC) {
Common.NotificationCenter.trigger('dataview:blur');
}
});
} else
me.monthsPicker.store.reset(arrMonths);
me.enableKeyEvents && _.delay(function() {
me.monthPicker.cmpEl.find('.dataview').focus();
}, 10);
},
renderMonth: function (date) {
var me = this;
me._state = 0;
var firstDay = me.options.firstday;
// Current date
var curDate = date || new Date(),
curMonth = curDate.getMonth(),
curIndexDayInWeek = curDate.getDay(),
curNumberDayInMonth = curDate.getDate(),
curYear = curDate.getFullYear();
me.currentDate = curDate;
// Name month
me.topTitle = _.template([
'<div class="button">',
'<label>' + me.monthNames[curMonth] + ' ' + curYear + '</label>',
'</div>'
].join(''));
me.cmpEl.find('.calendar-header .title').html(me.topTitle);
me.cmpEl.find('.calendar-header .title').off();
me.cmpEl.find('.calendar-header .title').on('click', _.bind(me.renderMonths, me));
// Name days of week
var dayNamesTemplate = '';
for (var i = firstDay; i < 7; i++) {
dayNamesTemplate += '<label>' + me.dayNamesShort[i] + '</label>';
}
if (firstDay > 0) {
dayNamesTemplate += '<label>' + me.dayNamesShort[0] + '</label>';
}
me.cmpEl.find('.calendar-header .bottom-row').html(_.template(dayNamesTemplate));
// Month
var rows = 6,
cols = 7;
var arrDays = [];
var d = new Date(curDate);
d.setDate(1);
var firstDayOfMonthIndex = d.getDay();
var daysInPrevMonth = me.daysInMonth(d.getTime() - (10 * 24 * 60 * 60 * 1000)),
numberDay,
month,
year;
if (firstDay === 0) {
numberDay = (firstDayOfMonthIndex > 0) ? (daysInPrevMonth - (firstDayOfMonthIndex - 1)) : 1;
} else {
if (firstDayOfMonthIndex === 0) {
numberDay = daysInPrevMonth - 5;
} else {
numberDay = daysInPrevMonth - (firstDayOfMonthIndex - 2);
}
}
if ((firstDayOfMonthIndex > 0 && firstDay === 0) || firstDay === 1) {
if (curMonth - 1 >= 0) {
month = curMonth - 1;
year = curYear;
} else {
month = 11;
year = curYear - 1;
}
} else {
month = curMonth;
year = curYear;
}
var tmp = new Date();
tmp.setFullYear(year, month, numberDay);
var today = new Date();
for(var r = 0; r < rows; r++) {
for(var c = 0; c < cols; c++) {
var tmpDay = tmp.getDay(),
tmpNumber = tmp.getDate(),
tmpMonth = tmp.getMonth(),
tmpYear = tmp.getFullYear();
arrDays.push({
indexInWeek: tmpDay,
dayNumber: tmpNumber,
month: tmpMonth,
year: tmpYear,
isCurrentMonth: tmpMonth === curMonth,
selected: (_.isDate(me.selectedDate)) ?
(tmpNumber === me.selectedDate.getDate() && tmpMonth === me.selectedDate.getMonth() && tmpYear === me.selectedDate.getFullYear()) :
(tmpNumber === today.getDate() && tmpMonth === today.getMonth() && tmpYear === today.getFullYear())
});
tmp.setDate(tmpNumber + 1);
}
}
if (!me.monthPicker) {
me.monthPicker = new Common.UI.DataView({
el: me.cmpEl.find('.calendar-content'),
store: new Common.UI.DataViewStore(arrDays),
itemTemplate: _.template('<div class="number-day<% if (indexInWeek === 6 || indexInWeek === 0) { %> weekend<% } %><% if (!isCurrentMonth) { %> no-current-month<% } %>" data-number="<%= dayNumber %>" data-month="<%= month %>" data-year="<%= year %>"><%= dayNumber %></div>')
});
me.monthPicker.on('item:click', function(picker, item, record, e) {
var day = record.get('dayNumber'),
month = record.get('month'),
year = record.get('year');
if (_.isUndefined(me.selectedDate)) {
me.selectedDate = new Date();
}
me.selectedDate.setFullYear(year, month, day);
me.trigger('date:click', me, me.selectedDate);
});
me.enableKeyEvents && this.monthPicker.on('item:keydown', function(view, record, e) {
if (e.keyCode==Common.UI.Keys.ESC) {
Common.NotificationCenter.trigger('dataview:blur');
}
});
} else
me.monthPicker.store.reset(arrDays);
me.enableKeyEvents && _.delay(function() {
me.monthPicker.cmpEl.find('.dataview').focus();
}, 10);
},
daysInMonth: function (date) {
var d;
d = date ? new Date(date) : new Date();
var result = new Date();
result.setFullYear(d.getFullYear(), d.getMonth() + 1, 0);
return result.getDate();
},
setDate: function (date) {
if (_.isDate(date)) {
this.selectedDate = new Date(date);
this.renderMonth(this.selectedDate);
}
},
textJanuary: 'January',
textFebruary: 'February',
textMarch: 'March',
textApril: 'April',
textMay: 'May',
textJune: 'June',
textJuly: 'July',
textAugust: 'August',
textSeptember: 'September',
textOctober: 'October',
textNovember: 'November',
textDecember: 'December',
textShortJanuary: 'Jan',
textShortFebruary: 'Feb',
textShortMarch: 'Mar',
textShortApril: 'Apr',
textShortMay: 'May',
textShortJune: 'Jun',
textShortJuly: 'Jul',
textShortAugust: 'Aug',
textShortSeptember: 'Sep',
textShortOctober: 'Oct',
textShortNovember: 'Nov',
textShortDecember: 'Dec',
textShortSunday: 'Su',
textShortMonday: 'Mo',
textShortTuesday: 'Tu',
textShortWednesday: 'We',
textShortThursday: 'Th',
textShortFriday: 'Fr',
textShortSaturday: 'Sa',
textMonths: 'Months',
textYears: 'Years'
}, Common.UI.Calendar || {}));
});

View file

@ -94,7 +94,8 @@ define([
checked : false,
value : 'unchecked',
template : _.template('<label class="checkbox-indeterminate"><input type="button" class="img-commonctrl"><span><%= labelText %></span></label>'),
template : _.template('<label class="checkbox-indeterminate"><input id="<%= id %>" type="checkbox" class="checkbox__native">' +
'<label for="<%= id %>" class="checkbox__shape" /><span><%= labelText %></span></label>'),
initialize : function(options) {
Common.UI.BaseView.prototype.initialize.call(this, options);
@ -104,27 +105,25 @@ define([
},
render: function (parentEl) {
var me = this,
el = $(this.el);
var me = this;
if (!me.rendered) {
var elem = this.template({
labelText: this.options.labelText,
id: Common.UI.getId('chb-')
});
if (parentEl) {
this.setElement(parentEl, false);
parentEl.html(this.template({
labelText: this.options.labelText
}));
el = $(this.el);
parentEl.html(elem);
} else {
el.html(this.template({
labelText: this.options.labelText
}));
me.$el.html(elem);
}
this.$chk = el.find('input[type=button]');
this.$label = el.find('label');
this.$chk.on('click', _.bind(this.onItemCheck, this));
}
this.$chk = me.$el.find('input[type=checkbox]');
this.$label = me.$el.find('label.checkbox-indeterminate');
this.$chk.on('click', this.onItemCheck.bind(this));
this.rendered = true;
this.rendered = true;
}
if (this.options.disabled)
this.setDisabled(this.options.disabled);
@ -168,18 +167,18 @@ define([
this.checked = (value === true || value === 'true' || value === '1' || value === 1 || value === 'checked');
this.indeterminate = (value === 'indeterminate');
this.$chk.toggleClass('checked', this.checked);
this.$chk.toggleClass('indeterminate', this.indeterminate);
this.value = this.indeterminate ? 'indeterminate' : (this.checked ? 'checked' : 'unchecked');
this.$chk.prop({indeterminate: this.indeterminate, checked: this.checked});
},
setValue: function(value, suspendchange) {
if (this.rendered) {
this.lastValue = this.value;
this.setRawValue(value);
if (suspendchange !== true && this.lastValue !== value)
this.trigger('change', this, this.value, this.lastValue);
if ( value != this.value ) {
this.lastValue = this.value;
this.setRawValue(value);
if (suspendchange !== true)
this.trigger('change', this, this.value, this.lastValue);
}
} else {
this.options.value = value;
}

View file

@ -91,16 +91,14 @@ define([
this.setElement(parentEl, false);
parentEl.html(this.cmpEl);
} else {
$(this.el).html(this.cmpEl);
me.$el.html(this.cmpEl);
}
} else {
this.cmpEl = $(this.el);
this.cmpEl = me.$el || $(this.el);
}
if (!me.rendered) {
var el = this.cmpEl;
el.on('click', 'span.color-item', _.bind(this.itemClick, this));
me.cmpEl.on('click', 'span.color-item', me.itemClick.bind(me));
}
me.rendered = true;

View file

@ -108,12 +108,12 @@ define([
this.setElement(parentEl, false);
parentEl.html(this.cmpEl);
} else {
$(this.el).html(this.cmpEl);
this.$el.html(this.cmpEl);
}
this.cmpEl.on('click', _.bind(this.handleClick, this));
this.cmpEl.on('click', me.handleClick.bind(me));
} else {
this.cmpEl = $(this.el);
this.cmpEl = me.$el || $(this.el);
}
me.rendered = true;

View file

@ -268,4 +268,108 @@ define([
formcontrol.css('background-position', '0 -' + record.get('offsety') + 'px');
}
}, Common.UI.ComboBorderType || {}));
Common.UI.ComboBoxColor = Common.UI.ComboBox.extend(_.extend({
template: _.template([
'<div class="input-group combobox input-group-nr <%= cls %>" id="<%= id %>" style="<%= style %>">',
'<div class="form-control" style="padding:2px 14px 2px 3px; <%= style %> display: block;">',
'<div style="display: inline-block;overflow: hidden;width: 100%;height: 100%;"></div>',
'</div>',
'<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) { %>',
'<% if (item.value==-1) { %>',
'<li id="<%= item.id %>" data-value="<%= item.value %>"><a tabindex="-1" type="menuitem"><%= scope.getDisplayValue(item) %></a></li>',
'<% } else { %>',
'<li id="<%= item.id %>" data-value="<%= item.value %>">',
'<a tabindex="-1" type="menuitem" style="padding: 5px;"><div style="height: 15px;background-color: #<%= item.value %>"></div></a>',
'</li>',
'<% } %>',
'<% }); %>',
'</ul>',
'</div>'
].join('')),
itemClicked: function (e) {
var el = $(e.currentTarget).parent();
this._selectedItem = this.store.findWhere({
id: el.attr('id')
});
if (this._selectedItem) {
$('.selected', $(this.el)).removeClass('selected');
el.addClass('selected');
this.updateFormControl(this._selectedItem);
this.trigger('selected', this, _.extend({}, this._selectedItem.toJSON()), e);
e.preventDefault();
}
},
updateFormControl: function(record) {
var formcontrol = $(this.el).find('.form-control > div');
if (record.get('value')!=-1) {
formcontrol[0].innerHTML = '';
formcontrol.css({'background': '#' + record.get('value'), 'margin-top': '0'});
} else {
formcontrol[0].innerHTML = record.get('displayValue');
formcontrol.css({'background': '', 'margin-top': '1px'});
}
},
setValue: function(value) {
var obj;
this._selectedItem = this.store.findWhere((obj={}, obj[this.valueField]=value, obj));
$('.selected', $(this.el)).removeClass('selected');
if (this._selectedItem) {
this.updateFormControl(this._selectedItem);
$('#' + this._selectedItem.get('id'), $(this.el)).addClass('selected');
} else {
var formcontrol = $(this.el).find('.form-control > div');
formcontrol[0].innerHTML = '';
formcontrol.css('background', '');
}
},
onResetItems: function() {
if (this.itemsTemplate) {
$(this.el).find('ul').html( $(this.itemsTemplate({
items: this.store.toJSON(),
scope: this
})));
} else {
$(this.el).find('ul').html(_.template([
'<% _.each(items, function(item) { %>',
'<% if (item.value==-1) { %>',
'<li id="<%= item.id %>" data-value="<%= item.value %>"><a tabindex="-1" type="menuitem"><%= scope.getDisplayValue(item) %></a></li>',
'<% } else { %>',
'<li id="<%= item.id %>" data-value="<%= item.value %>">',
'<a tabindex="-1" type="menuitem" style="padding: 5px;"><div style="height: 15px;background-color: #<%= item.value %>"></div></a>',
'</li>',
'<% } %>',
'<% }); %>'
].join(''))({
items: this.store.toJSON(),
scope: this
}));
}
if (!_.isUndefined(this.scroller)) {
this.scroller.destroy();
delete this.scroller;
}
this.scroller = new Common.UI.Scroller(_.extend({
el: $('.dropdown-menu', this.cmpEl),
minScrollbarLength : 40,
includePadding : true,
wheelSpeed: 10,
alwaysVisibleY: this.scrollAlwaysVisible
}, this.options.scroller));
}
}, Common.UI.ComboBoxColor || {}));
});

View file

@ -104,8 +104,7 @@ define([
initialize : function(options) {
Common.UI.BaseView.prototype.initialize.call(this, options);
var me = this,
el = $(this.el);
var me = this;
this.id = me.options.id || Common.UI.getId();
this.cls = me.options.cls;
@ -158,10 +157,10 @@ define([
this.setElement(parentEl, false);
parentEl.html(this.cmpEl);
} else {
$(this.el).html(this.cmpEl);
this.$el.html(this.cmpEl);
}
} else {
this.cmpEl = $(this.el);
this.cmpEl = me.$el || $(this.el);
}
if (!me.rendered) {
@ -194,6 +193,18 @@ define([
var modalParents = el.closest('.asc-window');
if (modalParents.length > 0) {
el.data('bs.tooltip').tip().css('z-index', parseInt(modalParents.css('z-index')) + 10);
var onModalClose = function(dlg) {
if (modalParents[0] !== dlg.$window[0]) return;
var tip = el.data('bs.tooltip');
if (tip) {
if (tip.dontShow===undefined)
tip.dontShow = true;
tip.hide();
}
Common.NotificationCenter.off({'modal:close': onModalClose});
};
Common.NotificationCenter.on({'modal:close': onModalClose});
}
el.find('.dropdown-menu').on('mouseenter', function(){ // hide tooltip when mouse is over menu
@ -206,6 +217,11 @@ define([
});
}
var $list = el.find('.dropdown-menu');
if ($list.hasClass('menu-absolute')) {
$list.css('min-width', el.outerWidth());
}
el.on('show.bs.dropdown', _.bind(me.onBeforeShowMenu, me));
el.on('shown.bs.dropdown', _.bind(me.onAfterShowMenu, me));
el.on('hide.bs.dropdown', _.bind(me.onBeforeHideMenu, me));
@ -241,7 +257,6 @@ define([
this.scroller = new Common.UI.Scroller(_.extend({
el: $('.dropdown-menu', this.cmpEl),
minScrollbarLength: 40,
scrollYMarginOffset: 30,
includePadding: true,
wheelSpeed: 10,
alwaysVisibleY: this.scrollAlwaysVisible
@ -266,7 +281,6 @@ define([
this.scroller = new Common.UI.Scroller(_.extend({
el: $('.dropdown-menu', this.cmpEl),
minScrollbarLength: 40,
scrollYMarginOffset: 30,
includePadding: true,
wheelSpeed: 10,
alwaysVisibleY: this.scrollAlwaysVisible
@ -283,6 +297,12 @@ define([
tip.hide();
}
}
var $list = this.cmpEl.find('ul');
if ($list.hasClass('menu-absolute')) {
var offset = this.cmpEl.offset();
$list.css({left: offset.left, top: offset.top + this.cmpEl.outerHeight() + 2});
}
},
onAfterShowMenu: function(e) {
@ -291,11 +311,13 @@ define([
if ($selected.length) {
var itemTop = $selected.position().top,
itemHeight = $selected.height(),
listHeight = $list.height();
itemHeight = $selected.outerHeight(),
listHeight = $list.outerHeight();
if (itemTop < 0 || itemTop + itemHeight > listHeight) {
$list.scrollTop($list.scrollTop() + itemTop + itemHeight - (listHeight/2));
var height = $list.scrollTop() + itemTop + (itemHeight - listHeight)/2;
height = (Math.floor(height/itemHeight) * itemHeight);
$list.scrollTop(height);
}
setTimeout(function(){$selected.find('a').focus();}, 1);
}
@ -333,10 +355,13 @@ define([
return false;
}
else if (e.keyCode == Common.UI.Keys.ESC && this.isMenuOpen()) {
this._input.val(this.lastValue);
this.closeMenu();
this.onAfterHideMenu(e);
return false;
} else if (this.search && e.keyCode > 64 && e.keyCode < 91 && e.key){
if (typeof this._search !== 'object') return;
var me = this;
clearTimeout(this._search.timer);
this._search.timer = setTimeout(function () { me._search = {}; }, 1000);
@ -380,10 +405,12 @@ define([
this.scroller.update({alwaysVisibleY: this.scrollAlwaysVisible});
var $list = $(this.el).find('ul');
var itemTop = item.position().top,
itemHeight = item.height(),
listHeight = $list.height();
itemHeight = item.outerHeight(),
listHeight = $list.outerHeight();
if (itemTop < 0 || itemTop + itemHeight > listHeight) {
$list.scrollTop($list.scrollTop() + itemTop + itemHeight - (listHeight/2));
var height = $list.scrollTop() + itemTop;
height = (Math.floor(height/itemHeight) * itemHeight);
$list.scrollTop(height);
}
}
item.focus();
@ -394,6 +421,7 @@ define([
var me = this;
if (e.keyCode == Common.UI.Keys.ESC){
this._input.val(this.lastValue);
this.closeMenu();
this.onAfterHideMenu(e);
} else if (e.keyCode == Common.UI.Keys.UP || e.keyCode == Common.UI.Keys.DOWN) {
@ -631,7 +659,6 @@ define([
this.scroller = new Common.UI.Scroller(_.extend({
el: $('.dropdown-menu', this.cmpEl),
minScrollbarLength : 40,
scrollYMarginOffset: 30,
includePadding : true,
wheelSpeed: 10,
alwaysVisibleY: this.scrollAlwaysVisible
@ -639,4 +666,24 @@ define([
}
}
})());
Common.UI.ComboBoxCustom = Common.UI.ComboBox.extend(_.extend({
itemClicked: function (e) {
Common.UI.ComboBox.prototype.itemClicked.call(this, e);
if (this.options.updateFormControl)
this.options.updateFormControl.call(this, this._selectedItem);
},
setValue: function(value) {
Common.UI.ComboBox.prototype.setValue.call(this, value);
if (this.options.updateFormControl)
this.options.updateFormControl.call(this, this._selectedItem);
},
selectRecord: function(record) {
Common.UI.ComboBox.prototype.selectRecord.call(this, record);
if (this.options.updateFormControl)
this.options.updateFormControl.call(this, this._selectedItem);
}
}, Common.UI.ComboBoxCustom || {}));
});

View file

@ -430,7 +430,7 @@ define([
},
addItemToRecent: function(record, silent) {
if (this.recent<1) return;
if (!record || this.recent<1) return;
var font = this.store.findWhere({name: record.get('name'),type:FONT_TYPE_RECENT});
font && this.store.remove(font);

View file

@ -148,7 +148,7 @@ define([
me.trigger('render:before', me);
me.cmpEl = $(me.el);
me.cmpEl = me.$el || $(me.el);
var templateEl = me.template({
id : me.id,

View file

@ -135,7 +135,7 @@ define([
if (_.isUndefined(this.model.id))
return this;
var el = $(this.el);
var el = this.$el || $(this.el);
el.html(this.template(this.model.toJSON()));
el.addClass('item');
@ -262,7 +262,6 @@ define([
this.trigger('render:before', this);
this.cmpEl = $(this.el);
if (parentEl) {
this.setElement(parentEl, false);
this.cmpEl = $(this.template({
@ -272,6 +271,7 @@ define([
parentEl.html(this.cmpEl);
} else {
this.cmpEl = me.$el || $(this.el);
this.cmpEl.html(this.template({
groups: me.groups ? me.groups.toJSON() : null,
style: me.style
@ -766,6 +766,435 @@ define([
}
});
Common.UI.DataViewSimple = Common.UI.BaseView.extend({
options : {
handleSelect: true,
enableKeyEvents: true,
keyMoveDirection: 'both', // 'vertical', 'horizontal'
restoreHeight: 0,
scrollAlwaysVisible: false,
useBSKeydown: false
},
template: _.template([
'<div class="dataview inner" style="<%= style %>">',
'<% _.each(items, function(item) { %>',
'<% if (!item.id) item.id = Common.UI.getId(); %>',
'<div class="item" <% if(!!item.tip) { %> data-toggle="tooltip" <% } %> ><%= itemTemplate(item) %></div>',
'<% }) %>',
'</div>'
].join('')),
initialize : function(options) {
Common.UI.BaseView.prototype.initialize.call(this, options);
var me = this;
me.template = me.options.template || me.template;
me.store = me.options.store || new Common.UI.DataViewStore();
me.itemTemplate = me.options.itemTemplate || null;
me.handleSelect = me.options.handleSelect;
me.parentMenu = me.options.parentMenu;
me.enableKeyEvents= me.options.enableKeyEvents;
me.useBSKeydown = me.options.useBSKeydown; // only with enableKeyEvents && parentMenu
me.style = me.options.style || '';
me.scrollAlwaysVisible = me.options.scrollAlwaysVisible || false;
if (me.parentMenu)
me.parentMenu.options.restoreHeight = (me.options.restoreHeight>0);
me.rendered = false;
if (me.options.keyMoveDirection=='vertical')
me.moveKeys = [Common.UI.Keys.UP, Common.UI.Keys.DOWN];
else if (me.options.keyMoveDirection=='horizontal')
me.moveKeys = [Common.UI.Keys.LEFT, Common.UI.Keys.RIGHT];
else
me.moveKeys = [Common.UI.Keys.UP, Common.UI.Keys.DOWN, Common.UI.Keys.LEFT, Common.UI.Keys.RIGHT];
if (me.options.el)
me.render();
},
render: function (parentEl) {
var me = this;
this.trigger('render:before', this);
if (parentEl) {
this.setElement(parentEl, false);
this.cmpEl = $(this.template({
items: me.store.toJSON(),
itemTemplate: me.itemTemplate,
style: me.style
}));
parentEl.html(this.cmpEl);
} else {
this.cmpEl = me.$el || $(this.el);
this.cmpEl.html(this.template({
items: me.store.toJSON(),
itemTemplate: me.itemTemplate,
style: me.style
}));
}
var modalParents = this.cmpEl.closest('.asc-window');
if (modalParents.length < 1)
modalParents = this.cmpEl.closest('[id^="menu-container-"]'); // context menu
if (modalParents.length > 0) {
this.tipZIndex = parseInt(modalParents.css('z-index')) + 10;
}
if (!this.rendered) {
if (this.parentMenu) {
this.cmpEl.closest('li').css('height', '100%');
this.cmpEl.css('height', '100%');
this.parentMenu.on('show:after', _.bind(this.alignPosition, this));
this.parentMenu.on('show:after', _.bind(this.onAfterShowMenu, this));
} else if (this.store.length>0)
this.onAfterShowMenu();
if (this.enableKeyEvents && this.parentMenu && this.handleSelect) {
this.parentMenu.on('show:before', function(menu) { me.deselectAll(); });
this.parentMenu.on('show:after', function(menu) {
Common.NotificationCenter.trigger('dataview:focus');
_.delay(function() {
menu.cmpEl.find('.dataview').focus();
}, 10);
}).on('hide:after', function() {
Common.NotificationCenter.trigger('dataview:blur');
});
}
this.attachKeyEvents();
this.cmpEl.on( "click", "div.item", _.bind(me.onClickItem, me));
}
if (_.isUndefined(this.scroller)) {
this.scroller = new Common.UI.Scroller({
el: $(this.el).find('.inner').addBack().filter('.inner'),
useKeyboard: this.enableKeyEvents && !this.handleSelect,
minScrollbarLength : 40,
wheelSpeed: 10,
alwaysVisibleY: this.scrollAlwaysVisible
});
}
this.rendered = true;
this.cmpEl.on('click', function(e){
if (/dataview/.test(e.target.className)) return false;
});
this.trigger('render:after', this);
return this;
},
selectRecord: function(record, suspendEvents) {
if (!this.handleSelect)
return;
if (suspendEvents)
this.suspendEvents();
this.deselectAll(suspendEvents);
if (record) {
record.set({selected: true});
var idx = _.indexOf(this.store.models, record);
if (idx>=0 && this.dataViewItems && this.dataViewItems.length>idx) {
this.dataViewItems[idx].el.addClass('selected');
}
}
if (suspendEvents)
this.resumeEvents();
return record;
},
selectByIndex: function(index, suspendEvents) {
if (this.store.length > 0 && index > -1 && index < this.store.length) {
return this.selectRecord(this.store.at(index), suspendEvents);
}
},
deselectAll: function(suspendEvents) {
if (suspendEvents)
this.suspendEvents();
_.each(this.store.where({selected: true}), function(record){
record.set({selected: false});
});
this.cmpEl.find('.item.selected').removeClass('selected');
if (suspendEvents)
this.resumeEvents();
},
getSelectedRec: function() {
return this.store.findWhere({selected: true});
},
onResetItems: function() {
this.dataViewItems && _.each(this.dataViewItems, function(item) {
var tip = item.el.data('bs.tooltip');
if (tip) {
if (tip.dontShow===undefined)
tip.dontShow = true;
(tip.tip()).remove();
}
}, this);
this.dataViewItems = null;
var template = _.template([
'<% _.each(items, function(item) { %>',
'<% if (!item.id) item.id = Common.UI.getId(); %>',
'<div class="item" <% if(!!item.tip) { %> data-toggle="tooltip" <% } %> ><%= itemTemplate(item) %></div>',
'<% }) %>'
].join(''));
this.cmpEl && this.cmpEl.find('.inner').html(template({
items: this.store.toJSON(),
itemTemplate: this.itemTemplate,
style : this.style
}));
if (!_.isUndefined(this.scroller)) {
this.scroller.destroy();
delete this.scroller;
}
this.scroller = new Common.UI.Scroller({
el: $(this.el).find('.inner').addBack().filter('.inner'),
useKeyboard: this.enableKeyEvents && !this.handleSelect,
minScrollbarLength : 40,
wheelSpeed: 10,
alwaysVisibleY: this.scrollAlwaysVisible
});
if (!this.parentMenu && this.store.length>0)
this.onAfterShowMenu();
this._layoutParams = undefined;
},
setStore: function(store) {
if (store) {
this.store = store;
this.onResetItems();
}
},
onClickItem: function(e) {
if ( this.disabled ) return;
window._event = e; // for FireFox only
var index = $(e.currentTarget).closest('div.item').index(),
record = (index>=0) ? this.store.at(index) : null,
view = (index>=0) ? this.dataViewItems[index] : null;
if (!record || !view) return;
record.set({selected: true});
var tip = view.el.data('bs.tooltip');
if (tip) (tip.tip()).remove();
if (!this.isSuspendEvents) {
this.trigger('item:click', this, view.el, record, e);
}
},
onAfterShowMenu: function(e) {
if (!this.dataViewItems) {
var me = this;
this.dataViewItems = [];
_.each(this.cmpEl.find('div.item'), function(item, index) {
var $item = $(item),
rec = me.store.at(index);
me.dataViewItems.push({el: $item});
if (rec.get('tip')) {
$item.tooltip({
title : rec.get('tip'),
placement : 'cursor',
zIndex : me.tipZIndex
});
}
});
}
},
scrollToRecord: function (record) {
if (!record) return;
var innerEl = $(this.el).find('.inner'),
inner_top = innerEl.offset().top,
idx = _.indexOf(this.store.models, record),
div = (idx>=0 && this.dataViewItems.length>idx) ? this.dataViewItems[idx].el : innerEl.find('#' + record.get('id'));
if (div.length<=0) return;
var div_top = div.offset().top,
div_first = this.dataViewItems[0].el,
div_first_top = (div_first.length>0) ? div_first[0].offsetTop : 0;
if (div_top < inner_top + div_first_top || div_top+div.outerHeight() > inner_top + innerEl.height()) {
if (this.scroller) {
this.scroller.scrollTop(innerEl.scrollTop() + div_top - inner_top - div_first_top, 0);
} else {
innerEl.scrollTop(innerEl.scrollTop() + div_top - inner_top - div_first_top);
}
}
},
onKeyDown: function (e, data) {
if ( this.disabled ) return;
if (data===undefined) data = e;
if (_.indexOf(this.moveKeys, data.keyCode)>-1 || data.keyCode==Common.UI.Keys.RETURN) {
data.preventDefault();
data.stopPropagation();
var rec = this.getSelectedRec();
if (data.keyCode==Common.UI.Keys.RETURN) {
if (this.selectedBeforeHideRec) // only for ComboDataView menuPicker
rec = this.selectedBeforeHideRec;
this.trigger('item:click', this, this, rec, e);
if (this.parentMenu)
this.parentMenu.hide();
} else {
var idx = _.indexOf(this.store.models, rec);
if (idx<0) {
if (data.keyCode==Common.UI.Keys.LEFT) {
var target = $(e.target).closest('.dropdown-submenu.over');
if (target.length>0) {
target.removeClass('over');
target.find('> a').focus();
} else
idx = 0;
} else
idx = 0;
} else if (this.options.keyMoveDirection == 'both') {
if (this._layoutParams === undefined)
this.fillIndexesArray();
var topIdx = this.dataViewItems[idx].topIdx,
leftIdx = this.dataViewItems[idx].leftIdx;
idx = undefined;
if (data.keyCode==Common.UI.Keys.LEFT) {
while (idx===undefined) {
leftIdx--;
if (leftIdx<0) {
var target = $(e.target).closest('.dropdown-submenu.over');
if (target.length>0) {
target.removeClass('over');
target.find('> a').focus();
break;
} else
leftIdx = this._layoutParams.columns-1;
}
idx = this._layoutParams.itemsIndexes[topIdx][leftIdx];
}
} else if (data.keyCode==Common.UI.Keys.RIGHT) {
while (idx===undefined) {
leftIdx++;
if (leftIdx>this._layoutParams.columns-1) leftIdx = 0;
idx = this._layoutParams.itemsIndexes[topIdx][leftIdx];
}
} else if (data.keyCode==Common.UI.Keys.UP) {
while (idx===undefined) {
topIdx--;
if (topIdx<0) topIdx = this._layoutParams.rows-1;
idx = this._layoutParams.itemsIndexes[topIdx][leftIdx];
}
} else {
while (idx===undefined) {
topIdx++;
if (topIdx>this._layoutParams.rows-1) topIdx = 0;
idx = this._layoutParams.itemsIndexes[topIdx][leftIdx];
}
}
} else {
idx = (data.keyCode==Common.UI.Keys.UP || data.keyCode==Common.UI.Keys.LEFT)
? Math.max(0, idx-1)
: Math.min(this.store.length - 1, idx + 1) ;
}
if (idx !== undefined && idx>=0) rec = this.store.at(idx);
if (rec) {
this._fromKeyDown = true;
this.selectRecord(rec);
this._fromKeyDown = false;
this.scrollToRecord(rec);
}
}
} else {
this.trigger('item:keydown', this, rec, e);
}
},
attachKeyEvents: function() {
if (this.enableKeyEvents && this.handleSelect) {
var el = $(this.el).find('.inner').addBack().filter('.inner');
el.addClass('canfocused');
el.attr('tabindex', '0');
el.on((this.parentMenu && this.useBSKeydown) ? 'dataview:keydown' : 'keydown', _.bind(this.onKeyDown, this));
}
},
setDisabled: function(disabled) {
this.disabled = disabled;
$(this.el).find('.inner').addBack().filter('.inner').toggleClass('disabled', disabled);
},
isDisabled: function() {
return this.disabled;
},
alignPosition: function() {
var menuRoot = (this.parentMenu.cmpEl.attr('role') === 'menu')
? this.parentMenu.cmpEl
: this.parentMenu.cmpEl.find('[role=menu]'),
docH = Common.Utils.innerHeight()-10,
innerEl = $(this.el).find('.inner').addBack().filter('.inner'),
parent = innerEl.parent(),
margins = parseInt(parent.css('margin-top')) + parseInt(parent.css('margin-bottom')) + parseInt(menuRoot.css('margin-top')),
paddings = parseInt(menuRoot.css('padding-top')) + parseInt(menuRoot.css('padding-bottom')),
menuH = menuRoot.outerHeight(),
top = parseInt(menuRoot.css('top')),
props = {minScrollbarLength : 40};
this.scrollAlwaysVisible && (props.alwaysVisibleY = this.scrollAlwaysVisible);
if (top + menuH > docH ) {
innerEl.css('max-height', (docH - top - paddings - margins) + 'px');
this.scroller.update(props);
} else if ( top + menuH < docH && innerEl.height() < this.options.restoreHeight ) {
innerEl.css('max-height', (Math.min(docH - top - paddings - margins, this.options.restoreHeight)) + 'px');
this.scroller.update(props);
}
},
fillIndexesArray: function() {
if (this.dataViewItems.length<=0) return;
this._layoutParams = {
itemsIndexes: [],
columns: 0,
rows: 0
};
var el = this.dataViewItems[0].el,
itemW = el.outerWidth() + parseInt(el.css('margin-left')) + parseInt(el.css('margin-right')),
offsetLeft = this.$el.offset().left,
offsetTop = el.offset().top,
prevtop = -1, topIdx = 0, leftIdx = 0;
for (var i=0; i<this.dataViewItems.length; i++) {
var item = this.dataViewItems[i];
var top = item.el.offset().top - offsetTop;
leftIdx = Math.floor((item.el.offset().left - offsetLeft)/itemW);
if (top>prevtop) {
prevtop = top;
this._layoutParams.itemsIndexes.push([]);
topIdx = this._layoutParams.itemsIndexes.length-1;
}
this._layoutParams.itemsIndexes[topIdx][leftIdx] = i;
item.topIdx = topIdx;
item.leftIdx = leftIdx;
if (this._layoutParams.columns<leftIdx) this._layoutParams.columns = leftIdx;
}
this._layoutParams.rows = this._layoutParams.itemsIndexes.length;
this._layoutParams.columns++;
},
onResize: function() {
this._layoutParams = undefined;
}
});
$(document).on('keydown.dataview', '[data-toggle=dropdown], [role=menu]', function(e) {
if (e.keyCode !== Common.UI.Keys.UP && e.keyCode !== Common.UI.Keys.DOWN && e.keyCode !== Common.UI.Keys.LEFT && e.keyCode !== Common.UI.Keys.RIGHT && e.keyCode !== Common.UI.Keys.RETURN) return;

View file

@ -47,31 +47,6 @@ define([
'use strict';
Common.UI.DimensionPicker = Common.UI.BaseView.extend((function(){
var me,
rootEl,
areaMouseCatcher,
areaUnHighLighted,
areaHighLighted,
areaStatus,
curColumns = 0,
curRows = 0;
var onMouseMove = function(event){
me.setTableSize(
Math.ceil((event.offsetX === undefined ? event.originalEvent.layerX : event.offsetX*Common.Utils.zoom()) / me.itemSize),
Math.ceil((event.offsetY === undefined ? event.originalEvent.layerY : event.offsetY*Common.Utils.zoom()) / me.itemSize),
event
);
};
var onMouseLeave = function(event){
me.setTableSize(0, 0, event);
};
var onHighLightedMouseClick = function(e){
me.trigger('select', me, curColumns, curRows, e);
};
return {
options: {
itemSize : 18,
@ -95,9 +70,13 @@ define([
initialize : function(options) {
Common.UI.BaseView.prototype.initialize.call(this, options);
me = this;
var me = this;
rootEl = $(this.el);
this.render();
this.cmpEl = me.$el || $(this.el);
var rootEl = this.cmpEl;
me.itemSize = me.options.itemSize;
me.minRows = me.options.minRows;
@ -105,35 +84,52 @@ define([
me.maxRows = me.options.maxRows;
me.maxColumns = me.options.maxColumns;
this.render();
me.curColumns = 0;
me.curRows = 0;
var onMouseMove = function(event){
me.setTableSize(
Math.ceil((event.offsetX === undefined ? event.originalEvent.layerX : event.offsetX*Common.Utils.zoom()) / me.itemSize),
Math.ceil((event.offsetY === undefined ? event.originalEvent.layerY : event.offsetY*Common.Utils.zoom()) / me.itemSize),
event
);
};
var onMouseLeave = function(event){
me.setTableSize(0, 0, event);
};
var onHighLightedMouseClick = function(e){
me.trigger('select', me, me.curColumns, me.curRows, e);
};
if (rootEl){
areaMouseCatcher = rootEl.find('.dimension-picker-mousecatcher');
areaUnHighLighted = rootEl.find('.dimension-picker-unhighlighted');
areaHighLighted = rootEl.find('.dimension-picker-highlighted');
areaStatus = rootEl.find('.dimension-picker-status');
var areaMouseCatcher = rootEl.find('.dimension-picker-mousecatcher');
me.areaUnHighLighted = rootEl.find('.dimension-picker-unhighlighted');
me.areaHighLighted = rootEl.find('.dimension-picker-highlighted');
me.areaStatus = rootEl.find('.dimension-picker-status');
rootEl.css({width: me.minColumns + 'em'});
areaMouseCatcher.css('z-index', 1);
areaMouseCatcher.width(me.maxColumns + 'em').height(me.maxRows + 'em');
areaUnHighLighted.width(me.minColumns + 'em').height(me.minRows + 'em');
areaStatus.html(curColumns + ' x ' + curRows);
areaStatus.width(areaUnHighLighted.width());
}
me.areaUnHighLighted.width(me.minColumns + 'em').height(me.minRows + 'em');
me.areaStatus.html(me.curColumns + ' x ' + me.curRows);
me.areaStatus.width(me.areaUnHighLighted.width());
areaMouseCatcher.on('mousemove', onMouseMove);
areaHighLighted.on('mousemove', onMouseMove);
areaUnHighLighted.on('mousemove', onMouseMove);
areaMouseCatcher.on('mouseleave', onMouseLeave);
areaHighLighted.on('mouseleave', onMouseLeave);
areaUnHighLighted.on('mouseleave', onMouseLeave);
areaMouseCatcher.on('click', onHighLightedMouseClick);
areaHighLighted.on('click', onHighLightedMouseClick);
areaUnHighLighted.on('click', onHighLightedMouseClick);
areaMouseCatcher.on('mousemove', onMouseMove);
me.areaHighLighted.on('mousemove', onMouseMove);
me.areaUnHighLighted.on('mousemove', onMouseMove);
areaMouseCatcher.on('mouseleave', onMouseLeave);
me.areaHighLighted.on('mouseleave', onMouseLeave);
me.areaUnHighLighted.on('mouseleave', onMouseLeave);
areaMouseCatcher.on('click', onHighLightedMouseClick);
me.areaHighLighted.on('click', onHighLightedMouseClick);
me.areaUnHighLighted.on('click', onHighLightedMouseClick);
}
},
render: function() {
$(this.el).html(this.template());
(this.$el || $(this.el)).html(this.template());
return this;
},
@ -142,38 +138,38 @@ define([
if (columns > this.maxColumns) columns = this.maxColumns;
if (rows > this.maxRows) rows = this.maxRows;
if (curColumns != columns || curRows != rows){
curColumns = columns;
curRows = rows;
if (this.curColumns != columns || this.curRows != rows){
this.curColumns = columns;
this.curRows = rows;
areaHighLighted.width(curColumns + 'em').height(curRows + 'em');
areaUnHighLighted.width(
((curColumns < me.minColumns)
? me.minColumns
: ((curColumns + 1 > me.maxColumns)
? me.maxColumns
: curColumns + 1)) + 'em'
).height(((curRows < me.minRows)
? me.minRows
: ((curRows + 1 > me.maxRows)
? me.maxRows
: curRows + 1)) + 'em'
this.areaHighLighted.width(this.curColumns + 'em').height(this.curRows + 'em');
this.areaUnHighLighted.width(
((this.curColumns < this.minColumns)
? this.minColumns
: ((this.curColumns + 1 > this.maxColumns)
? this.maxColumns
: this.curColumns + 1)) + 'em'
).height(((this.curRows < this.minRows)
? this.minRows
: ((this.curRows + 1 > this.maxRows)
? this.maxRows
: this.curRows + 1)) + 'em'
);
rootEl.width(areaUnHighLighted.width());
areaStatus.html(curColumns + ' x ' + curRows);
areaStatus.width(areaUnHighLighted.width());
this.cmpEl.width(this.areaUnHighLighted.width());
this.areaStatus.html(this.curColumns + ' x ' + this.curRows);
this.areaStatus.width(this.areaUnHighLighted.width());
me.trigger('change', me, curColumns, curRows, event);
this.trigger('change', this, this.curColumns, this.curRows, event);
}
},
getColumnsCount: function() {
return curColumns;
return this.curColumns;
},
getRowsCount: function() {
return curRows;
return this.curRows;
}
}
})())

View file

@ -82,7 +82,7 @@ define([
Common.UI.BaseView.prototype.initialize.call(this, options);
var me = this,
el = $(this.el),
el = me.$el || $(this.el),
arrowSatBrightness, arrowHue,
areaSatBrightness, areaHue,
previewColor, previewTransparentColor, previewColorText,
@ -278,7 +278,7 @@ define([
},
render: function () {
$(this.el).html(this.template());
(this.$el || $(this.el)).html(this.template());
this.trigger('render:after', this);
return this;

View file

@ -94,8 +94,7 @@ define([
initialize : function(options) {
Common.UI.BaseView.prototype.initialize.call(this, options);
var me = this,
el = $(this.el);
var me = this;
this.id = me.options.id || Common.UI.getId();
this.cls = me.options.cls;
@ -142,10 +141,10 @@ define([
this.setElement(parentEl, false);
parentEl.html(this.cmpEl);
} else {
$(this.el).html(this.cmpEl);
this.$el.html(this.cmpEl);
}
} else {
this.cmpEl = $(this.el);
this.cmpEl = this.$el;
}
if (!me.rendered) {

View file

@ -67,11 +67,15 @@ define([
this.trigger('items:reset', this);
},
onAddItem: function(record, store, opts) {
var view = new Common.UI.DataViewItem({
createNewItem: function(record) {
return new Common.UI.DataViewItem({
template: this.itemTemplate,
model: record
});
},
onAddItem: function(record, store, opts) {
var view = this.createNewItem(record);
if (!this.innerEl)
this.innerEl = $(this.el).find('.inner');

View file

@ -48,7 +48,7 @@ define([
Common.UI.BaseView.prototype.initialize.call(this, options);
var me = this,
el = $(this.el);
el = me.$el || $(this.el);
el.addClass('masked-field user-select');
el.attr('maxlength', me.options.maxLength);
@ -75,11 +75,11 @@ define([
setValue: function(value) {
if (this.options.maskExp.test(value) && value.length<=this.options.maxLength)
$(this.el).val(value);
this.$el.val(value);
},
getValue: function() {
$(this.el).val();
this.$el.val();
}
});
});

View file

@ -208,7 +208,7 @@ define([
this.trigger('render:before', this);
this.cmpEl = $(this.el);
this.cmpEl = me.$el || $(this.el);
if (parentEl) {
this.setElement(parentEl, false);
@ -225,7 +225,7 @@ define([
this.cmpEl = this.template({
options : me.options
});
$(this.el).append(this.cmpEl);
this.$el.append(this.cmpEl);
}
}
@ -246,7 +246,7 @@ define([
if (this.options.maxHeight) {
menuRoot.css({'max-height': me.options.maxHeight});
this.scroller = new Common.UI.Scroller({
el: $(this.el).find('.dropdown-menu '),
el: me.$el.find('.dropdown-menu '),
minScrollbarLength: 30,
suppressScrollX: true,
alwaysVisibleY: this.scrollAlwaysVisible
@ -380,15 +380,23 @@ define([
onAfterShowMenu: function(e) {
this.trigger('show:after', this, e);
if (this.scroller) {
this.scroller.update({alwaysVisibleY: this.scrollAlwaysVisible});
var menuRoot = this.menuRoot,
$selected = menuRoot.find('> li .checked');
var menuRoot = this.menuRoot;
if (this.wheelSpeed===undefined) {
var item = menuRoot.find('> li:first'),
itemHeight = (item.length) ? item.outerHeight() : 1;
this.wheelSpeed = Math.min((Math.floor(menuRoot.height()/itemHeight) * itemHeight)/10, 20);
}
this.scroller.update({alwaysVisibleY: this.scrollAlwaysVisible, wheelSpeed: this.wheelSpeed});
var $selected = menuRoot.find('> li .checked');
if ($selected.length) {
var itemTop = $selected.position().top,
itemHeight = $selected.height(),
listHeight = menuRoot.height();
itemHeight = $selected.outerHeight(),
listHeight = menuRoot.outerHeight();
if (itemTop < 0 || itemTop + itemHeight > listHeight) {
menuRoot.scrollTop(menuRoot.scrollTop() + itemTop + itemHeight - (listHeight/2));
var height = menuRoot.scrollTop() + itemTop + (itemHeight - listHeight)/2;
height = (Math.floor(height/itemHeight) * itemHeight);
menuRoot.scrollTop(height);
}
setTimeout(function(){$selected.focus();}, 1);
}
@ -469,12 +477,14 @@ define([
this._search.index = idxCandidate;
var item = itemCandidate.cmpEl.find('a');
if (this.scroller) {
this.scroller.update({alwaysVisibleY: this.scrollAlwaysVisible});
this.scroller.update({alwaysVisibleY: this.scrollAlwaysVisible, wheelSpeed: this.wheelSpeed});
var itemTop = item.position().top,
itemHeight = item.height(),
listHeight = this.menuRoot.height();
itemHeight = item.outerHeight(),
listHeight = this.menuRoot.outerHeight();
if (itemTop < 0 || itemTop + itemHeight > listHeight) {
this.menuRoot.scrollTop(this.menuRoot.scrollTop() + itemTop + itemHeight - (listHeight/2));
var height = this.menuRoot.scrollTop() + itemTop;
height = (Math.floor(height/itemHeight) * itemHeight);
this.menuRoot.scrollTop(height);
}
}
item.focus();
@ -513,7 +523,7 @@ define([
menuParent = this.menuAlignEl || menuRoot.parent(),
m = this.menuAlign.match(/^([a-z]+)-([a-z]+)/),
offset = menuParent.offset(),
docW = Common.Utils.innerWidth(),
docW = Common.Utils.innerWidth() - 10,
docH = Common.Utils.innerHeight() - 10, // Yep, it's magic number
menuW = menuRoot.outerWidth(),
menuH = menuRoot.outerHeight(),
@ -541,19 +551,23 @@ define([
} else {
left = docW - menuW;
}
if (left < 0)
left = 0;
if (this.options.restoreHeight) {
if (typeof (this.options.restoreHeight) == "number") {
if (top + menuH > docH) {
menuRoot.css('max-height', (docH - top) + 'px');
(!this.scroller) && (this.scroller = new Common.UI.Scroller({
el: $(this.el).find('.dropdown-menu '),
el: this.$el.find('.dropdown-menu '),
minScrollbarLength: 30,
suppressScrollX: true,
alwaysVisibleY: this.scrollAlwaysVisible
}));
this.wheelSpeed = undefined;
} else if ( top + menuH < docH && menuRoot.height() < this.options.restoreHeight) {
menuRoot.css('max-height', (Math.min(docH - top, this.options.restoreHeight)) + 'px');
this.wheelSpeed = undefined;
}
}
} else {
@ -568,7 +582,6 @@ define([
if (top < 0)
top = 0;
}
if (this.options.additionalAlign)
this.options.additionalAlign.call(this, menuRoot, left, top);
else
@ -588,4 +601,451 @@ define([
})()
})
})();
Common.UI.MenuSimple = Common.UI.BaseView.extend({
options : {
cls : '',
style : '',
itemTemplate: null,
items : [],
menuAlign : 'tl-bl',
menuAlignEl : null,
offset : [0, 0],
cyclic : true,
search : false,
scrollAlwaysVisible: true
},
template: _.template([
'<ul class="dropdown-menu <%= options.cls %>" oo_editor_input="true" style="<%= options.style %>" role="menu">',
'<% _.each(items, function(item) { %>',
'<% if (!item.id) item.id = Common.UI.getId(); %>',
'<% item.checked = item.checked || false; %>',
'<li><%= itemTemplate(item) %></li>',
'<% }) %>',
'</ul>'
].join('')),
initialize : function(options) {
Common.UI.BaseView.prototype.initialize.call(this, options);
var me = this;
this.id = this.options.id || Common.UI.getId();
this.itemTemplate = this.options.itemTemplate || _.template([
'<a id="<%= id %>" <% if(typeof style !== "undefined") { %> style="<%= style %>" <% } %>',
'<% if(typeof canFocused !== "undefined") { %> tabindex="-1" type="menuitem" <% } %>',
'<% if(typeof stopPropagation !== "undefined") { %> data-stopPropagation="true" <% } %>',
'class="<% if (checked) { %> checked <% } %>" >',
'<% if (typeof iconCls !== "undefined") { %>',
'<span class="menu-item-icon <%= iconCls %>"></span>',
'<% } %>',
'<%= caption %>',
'</a>'
].join(''));
this.rendered = false;
this.items = this.options.items || [];
this.offset = [0, 0];
this.menuAlign = this.options.menuAlign;
this.menuAlignEl = this.options.menuAlignEl;
this.scrollAlwaysVisible = this.options.scrollAlwaysVisible;
this.search = this.options.search;
if (this.options.restoreHeight) {
this.options.restoreHeight = (typeof (this.options.restoreHeight) == "number") ? this.options.restoreHeight : (this.options.maxHeight ? this.options.maxHeight : 100000);
!this.options.maxHeight && (this.options.maxHeight = this.options.restoreHeight);
}
if (!this.options.cyclic) this.options.cls += ' no-cyclic';
if (this.options.el)
this.render();
Common.UI.Menu.Manager.register(this);
},
remove: function() {
Common.UI.Menu.Manager.unregister(this);
Common.UI.BaseView.prototype.remove.call(this);
},
render: function(parentEl) {
var me = this;
this.trigger('render:before', this);
this.cmpEl = me.$el || $(this.el);
parentEl && this.setElement(parentEl, false);
if (!me.rendered) {
this.cmpEl = $(this.template({
items: me.items,
itemTemplate: me.itemTemplate,
options : me.options
}));
parentEl ? parentEl.append(this.cmpEl) : this.$el.append(this.cmpEl);
}
var rootEl = this.cmpEl.parent(),
menuRoot = (rootEl.attr('role') === 'menu') ? rootEl : rootEl.find('[role=menu]');
this.menuRoot = menuRoot;
if (menuRoot) {
if (!me.rendered) {
menuRoot.on( "click", "li", _.bind(me.onItemClick, me));
menuRoot.on( "mousedown", "li", _.bind(me.onItemMouseDown, me));
}
if (this.options.maxHeight) {
menuRoot.css({'max-height': me.options.maxHeight});
this.scroller = new Common.UI.Scroller({
el: me.$el.find('.dropdown-menu '),
minScrollbarLength: 30,
suppressScrollX: true,
alwaysVisibleY: this.scrollAlwaysVisible
});
}
menuRoot.css({
position : 'fixed',
right : 'auto',
left : -1000,
top : -1000
});
this.parentEl = menuRoot.parent();
this.parentEl.on('show.bs.dropdown', _.bind(me.onBeforeShowMenu, me));
this.parentEl.on('shown.bs.dropdown', _.bind(me.onAfterShowMenu, me));
this.parentEl.on('hide.bs.dropdown', _.bind(me.onBeforeHideMenu, me));
this.parentEl.on('hidden.bs.dropdown', _.bind(me.onAfterHideMenu, me));
this.parentEl.on('keydown.after.bs.dropdown', _.bind(me.onAfterKeydownMenu, me));
menuRoot.hover(
function(e) { me.isOver = true;},
function(e) { me.isOver = false; }
);
}
this.rendered = true;
this.trigger('render:after', this);
return this;
},
resetItems: function(items) {
this.items = items || [];
this.$items = null;
var template = _.template([
'<% _.each(items, function(item) { %>',
'<% if (!item.id) item.id = Common.UI.getId(); %>',
'<% item.checked = item.checked || false; %>',
'<li><%= itemTemplate(item) %></li>',
'<% }) %>'
].join(''));
this.cmpEl && this.cmpEl.html(template({
items: this.items,
itemTemplate: this.itemTemplate,
options : this.options
}));
},
isVisible: function() {
return this.rendered && (this.cmpEl.is(':visible'));
},
show: function() {
if (this.rendered && this.parentEl && !this.parentEl.hasClass('open')) {
this.cmpEl.dropdown('toggle');
}
},
hide: function() {
if (this.rendered && this.parentEl) {
if ( this.parentEl.hasClass('open') )
this.cmpEl.dropdown('toggle');
else if (this.parentEl.hasClass('over'))
this.parentEl.removeClass('over');
}
},
onItemClick: function(e) {
if (e.which != 1 && e.which !== undefined)
return false;
var index = $(e.currentTarget).closest('li').index(),
item = (index>=0) ? this.items[index] : null;
if (!item) return;
if (item.disabled)
return false;
if (item.checkable && !item.checked)
this.setChecked(index, !item.checked);
this.isOver = false;
if (item.stopPropagation) {
e.stopPropagation();
var me = this;
_.delay(function(){
me.$el.parent().parent().find('[data-toggle=dropdown]').focus();
}, 10);
return;
}
this.trigger('item:click', this, item, e);
},
onItemMouseDown: function(e) {
if (e.which != 1) {
e.preventDefault();
e.stopPropagation();
return false;
}
e.stopPropagation();
},
setChecked: function(index, check, suppressEvent) {
this.toggle(index, check, suppressEvent);
},
toggle: function(index, toggle, suppressEvent) {
var state = !!toggle;
var item = this.items[index];
this.clearAll();
if (item && item.checkable) {
item.checked = state;
if (this.rendered) {
var itemEl = item.el || this.cmpEl.find('#'+item.id);
if (itemEl) {
itemEl.toggleClass('checked', item.checked);
if (!_.isEmpty(item.iconCls)) {
itemEl.css('background-image', 'none');
}
}
}
if (!suppressEvent)
this.trigger('item:toggle', this, item, state);
}
},
setDisabled: function(disabled) {
this.disabled = !!disabled;
if (this.rendered)
this.cmpEl.toggleClass('disabled', this.disabled);
},
isDisabled: function() {
return this.disabled;
},
onBeforeShowMenu: function(e) {
Common.NotificationCenter.trigger('menu:show');
this.trigger('show:before', this, e);
this.alignPosition();
},
onAfterShowMenu: function(e) {
this.trigger('show:after', this, e);
if (this.scroller) {
this.scroller.update({alwaysVisibleY: this.scrollAlwaysVisible});
var menuRoot = this.menuRoot,
$selected = menuRoot.find('> li .checked');
if ($selected.length) {
var itemTop = $selected.position().top,
itemHeight = $selected.outerHeight(),
listHeight = menuRoot.outerHeight();
if (itemTop < 0 || itemTop + itemHeight > listHeight) {
var height = menuRoot.scrollTop() + itemTop + (itemHeight - listHeight)/2;
height = (Math.floor(height/itemHeight) * itemHeight);
menuRoot.scrollTop(height);
}
setTimeout(function(){$selected.focus();}, 1);
}
}
this._search = {};
if (this.search && !this.$items) {
var me = this;
this.$items = this.menuRoot.find('> li').find('> a');
_.each(this.$items, function(item, index) {
me.items[index].el = $(item);
});
}
},
onBeforeHideMenu: function(e) {
this.trigger('hide:before', this, e);
if (Common.UI.Scroller.isMouseCapture())
e.preventDefault();
},
onAfterHideMenu: function(e, isFromInputControl) {
this.trigger('hide:after', this, e, isFromInputControl);
Common.NotificationCenter.trigger('menu:hide', this, isFromInputControl);
},
onAfterKeydownMenu: function(e) {
if (e.keyCode == Common.UI.Keys.RETURN) {
var li = $(e.target).closest('li');
if (li.length<=0) li = $(e.target).parent().find('li .dataview');
if (li.length>0) li.click();
if (!li.hasClass('dropdown-submenu'))
Common.UI.Menu.Manager.hideAll();
if ( $(e.currentTarget).closest('li').hasClass('dropdown-submenu')) {
e.stopPropagation();
return false;
}
} else if (e.keyCode == Common.UI.Keys.UP || e.keyCode == Common.UI.Keys.DOWN) {
this.fromKeyDown = true;
} else if (e.keyCode == Common.UI.Keys.ESC) {
// Common.NotificationCenter.trigger('menu:afterkeydown', e);
// return false;
} else if (this.search && e.keyCode > 64 && e.keyCode < 91 && e.key){
var me = this;
clearTimeout(this._search.timer);
this._search.timer = setTimeout(function () { me._search = {}; }, 1000);
(!this._search.text) && (this._search.text = '');
(!this._search.char) && (this._search.char = e.key);
(this._search.char !== e.key) && (this._search.full = true);
this._search.text += e.key;
if (this._search.index===undefined) {
this._search.index = this.$items.index(this.$items.filter(':focus'));
}
this.selectCandidate();
}
},
selectCandidate: function() {
var index = this._search.index || 0,
re = new RegExp('^' + ((this._search.full) ? this._search.text : this._search.char), 'i'),
itemCandidate, idxCandidate;
for (var i=0; i<this.items.length; i++) {
var item = this.items[i];
if (re.test(item.caption)) {
if (!itemCandidate) {
itemCandidate = item;
idxCandidate = i;
}
if (this._search.full && i==index || i>index) {
itemCandidate = item;
idxCandidate = i;
break;
}
}
}
if (itemCandidate) {
this._search.index = idxCandidate;
var item = itemCandidate.el;
if (this.scroller) {
this.scroller.update({alwaysVisibleY: this.scrollAlwaysVisible});
var itemTop = item.position().top,
itemHeight = item.outerHeight(),
listHeight = this.menuRoot.outerHeight();
if (itemTop < 0 || itemTop + itemHeight > listHeight) {
var height = this.menuRoot.scrollTop() + itemTop;
height = (Math.floor(height/itemHeight) * itemHeight);
this.menuRoot.scrollTop(height);
}
}
item.focus();
}
},
setOffset: function(offsetX, offsetY) {
this.offset[0] = _.isUndefined(offsetX) ? this.offset[0] : offsetX;
this.offset[1] = _.isUndefined(offsetY) ? this.offset[1] : offsetY;
this.alignPosition();
},
getOffset: function() {
return this.offset;
},
alignPosition: function(fixedAlign, fixedOffset) {
var menuRoot = this.menuRoot,
menuParent = this.menuAlignEl || menuRoot.parent(),
m = this.menuAlign.match(/^([a-z]+)-([a-z]+)/),
offset = menuParent.offset(),
docW = Common.Utils.innerWidth(),
docH = Common.Utils.innerHeight() - 10, // Yep, it's magic number
menuW = menuRoot.outerWidth(),
menuH = menuRoot.outerHeight(),
parentW = menuParent.outerWidth(),
parentH = menuParent.outerHeight();
var posMenu = {
'tl': [0, 0],
'bl': [0, menuH],
'tr': [menuW, 0],
'br': [menuW, menuH]
};
var posParent = {
'tl': [0, 0],
'tr': [parentW, 0],
'bl': [0, parentH],
'br': [parentW, parentH]
};
var left = offset.left - posMenu[m[1]][0] + posParent[m[2]][0] + this.offset[0];
var top = offset.top - posMenu[m[1]][1] + posParent[m[2]][1] + this.offset[1];
if (left + menuW > docW)
if (menuParent.is('li.dropdown-submenu')) {
left = offset.left - menuW + 2;
} else {
left = docW - menuW;
}
if (this.options.restoreHeight) {
if (typeof (this.options.restoreHeight) == "number") {
if (top + menuH > docH) {
menuRoot.css('max-height', (docH - top) + 'px');
(!this.scroller) && (this.scroller = new Common.UI.Scroller({
el: this.$el.find('.dropdown-menu '),
minScrollbarLength: 30,
suppressScrollX: true,
alwaysVisibleY: this.scrollAlwaysVisible
}));
} else if ( top + menuH < docH && menuRoot.height() < this.options.restoreHeight) {
menuRoot.css('max-height', (Math.min(docH - top, this.options.restoreHeight)) + 'px');
}
}
} else {
if (top + menuH > docH) {
if (fixedAlign && typeof fixedAlign == 'string') { // how to align if menu height > window height
m = fixedAlign.match(/^([a-z]+)-([a-z]+)/);
top = offset.top - posMenu[m[1]][1] + posParent[m[2]][1] + this.offset[1] + (fixedOffset || 0);
} else
top = docH - menuH;
}
if (top < 0)
top = 0;
}
if (this.options.additionalAlign)
this.options.additionalAlign.call(this, menuRoot, left, top);
else
menuRoot.css({left: Math.ceil(left), top: Math.ceil(top)});
},
clearAll: function() {
this.cmpEl && this.cmpEl.find('li > a.checked').removeClass('checked');
_.each(this.items, function(item){
item.checked = false;
});
}
});
});

View file

@ -119,8 +119,7 @@ define([
initialize : function(options) {
Common.UI.BaseView.prototype.initialize.call(this, options);
var me = this,
el = $(this.el);
var me = this;
this.id = me.options.id || Common.UI.getId();
this.cls = me.options.cls;
@ -138,7 +137,7 @@ define([
this.hint = me.options.hint;
this.rendered = false;
if (this.menu !== null && !(this.menu instanceof Common.UI.Menu)) {
if (this.menu !== null && !(this.menu instanceof Common.UI.Menu) && !(this.menu instanceof Common.UI.MenuSimple)) {
this.menu = new Common.UI.Menu(_.extend({}, me.options.menu));
}
@ -148,7 +147,7 @@ define([
render: function() {
var me = this,
el = $(this.el);
el = me.$el || $(this.el);
me.trigger('render:before', me);
@ -159,7 +158,7 @@ define([
el.off('click');
Common.UI.ToggleManager.unregister(me);
$(this.el).html(this.template({
el.html(this.template({
id : me.id,
caption : me.caption,
iconCls : me.iconCls,
@ -170,7 +169,7 @@ define([
if (me.menu) {
el.addClass('dropdown-submenu');
me.menu.render($(this.el));
me.menu.render(el);
el.mouseenter(_.bind(me.menu.alignPosition, me.menu));
// el.focusin(_.bind(me.onFocusItem, me));
el.focusout(_.bind(me.onBlurItem, me));
@ -184,6 +183,7 @@ define([
if (this.checkable && firstChild) {
firstChild.toggleClass('checkable', this.checkable);
firstChild.toggleClass('no-checkmark', this.options.checkmark===false);
firstChild.toggleClass('checked', this.checked);
if (!_.isEmpty(this.iconCls)) {
firstChild.css('background-image', 'none');
@ -214,7 +214,7 @@ define([
}
if (this.disabled)
$(this.el).toggleClass('disabled', this.disabled);
el.toggleClass('disabled', this.disabled);
el.on('click', _.bind(this.onItemClick, this));
el.on('mousedown', _.bind(this.onItemMouseDown, this));
@ -223,7 +223,7 @@ define([
}
}
me.cmpEl = $(this.el);
me.cmpEl = el;
me.rendered = true;
me.trigger('render:after', me);

View file

@ -128,7 +128,7 @@ define([
Common.UI.BaseView.prototype.initialize.call(this, options);
var me = this,
el = $(this.el);
el = me.$el || $(this.el);
el.addClass('spinner');
@ -144,6 +144,14 @@ define([
el.on('input', '.form-control', _.bind(this.onInput, this));
if (!this.options.allowDecimal)
el.on('keypress', '.form-control', _.bind(this.onKeyPress, this));
el.on('focus', 'input.form-control', function() {
setTimeout(function(){me.$input && me.$input.select();}, 1);
});
Common.Utils.isGecko && el.on('blur', 'input.form-control', function() {
setTimeout(function(){
me.$input && (me.$input[0].selectionStart = me.$input[0].selectionEnd = 0);
}, 1);
});
this.switches = {
count: 1,
@ -165,7 +173,7 @@ define([
this.setRawValue(this.value);
if (this.options.width) {
$(this.el).width(this.options.width);
el.width(this.options.width);
}
if (this.options.defaultValue===undefined)
@ -176,7 +184,7 @@ define([
},
render: function () {
var el = $(this.el);
var el = this.$el || $(this.el);
el.html(this.template);
this.$input = el.find('.form-control');
@ -189,7 +197,7 @@ define([
},
setDisabled: function(disabled) {
var el = $(this.el);
var el = this.$el || $(this.el);
if (disabled !== this.disabled) {
el.find('button').toggleClass('disabled', disabled);
el.toggleClass('disabled', disabled);
@ -347,6 +355,7 @@ define([
var value = this.getRawValue();
if (this.value != value) {
this.onEnterValue();
this.trigger('inputleave', this);
return (this.value == value);
}
} else {
@ -355,6 +364,11 @@ define([
} else {
this._fromKeyDown = true;
}
if (e.keyCode == Common.UI.Keys.ESC)
this.setRawValue(this.value);
if (e.keyCode==Common.UI.Keys.RETURN || e.keyCode==Common.UI.Keys.ESC)
this.trigger('inputleave', this);
},
onKeyUp: function (e) {
@ -477,6 +491,8 @@ define([
_step: function (type, suspend) {
(type) ? this._increase(suspend) : this._decrease(suspend);
if (this.options.hold && this.switches.fromKeyDown)
this.$input && this.$input.select();
},
_add: function (a, b, precision) {

View file

@ -74,7 +74,7 @@ define([
if ( this.isFolded ) {
if ( $(e.target).parents('.toolbar, #file-menu-panel').length ){
} else {
this.collapse();
optsFold.$bar && optsFold.$bar.hasClass('expanded') && this.collapse();
}
}
}

View file

@ -159,11 +159,21 @@ define([
me.changeSliderStyle();
},
addNewThumb: function(index, color) {
var me = this;
me.thumbs[index].thumbcolor = me.thumbs[index].thumb.find('> div');
(index>0) && this.setColorValue(color, index);
me.sortThumbs();
me.changeSliderStyle();
me.changeGradientStyle();
},
removeThumb: function(index) {
if (index===undefined) index = this.thumbs.length-1;
if (index>0) {
if (this.thumbs.length > 2) {
this.thumbs[index].thumb.remove();
this.thumbs.splice(index, 1);
this.sortThumbs();
this.changeSliderStyle();
}
},

View file

@ -71,13 +71,13 @@ define([
disabled : false,
rendered : false,
template : _.template('<label class="radiobox"><input type="button" name="<%= name %>" class="img-commonctrl"><%= labelText %></label>'),
template : _.template('<label class="radiobox"><input type="radio" name="<%= name %>" id="<%= id %>" class="button__radiobox">' +
'<label for="<%= id %>" class="radiobox__shape" /><span><%= labelText %></span></label>'),
initialize : function(options) {
Common.UI.BaseView.prototype.initialize.call(this, options);
var me = this,
el = $(this.el);
var me = this;
this.name = this.options.name || Common.UI.getId();
@ -94,13 +94,15 @@ define([
},
render: function () {
var el = $(this.el);
var el = this.$el || $(this.el);
el.html(this.template({
labelText: this.options.labelText,
name: this.name
name: this.name,
id: Common.UI.getId('rdb-')
}));
this.$radio = el.find('input[type=button]');
this.$radio = el.find('input[type=radio]');
this.$label = el.find('label.radiobox');
this.rendered = true;
return this;
@ -111,6 +113,7 @@ define([
return;
if (disabled !== this.disabled) {
this.$label.toggleClass('disabled', disabled);
this.$radio.toggleClass('disabled', disabled);
(disabled) ? this.$radio.attr({disabled: disabled}) : this.$radio.removeAttr('disabled');
}
@ -128,8 +131,9 @@ define([
setRawValue: function(value) {
var value = (value === true || value === 'true' || value === '1' || value === 1 );
$('input[type=button][name=' + this.name + ']').removeClass('checked');
$('input[type=radio][name=' + this.name + ']').removeClass('checked');
this.$radio.toggleClass('checked', value);
this.$radio.prop('checked', value);
},
setValue: function(value, suspendchange) {
@ -137,14 +141,18 @@ define([
var lastValue = this.$radio.hasClass('checked');
this.setRawValue(value);
if (suspendchange !== true && lastValue !== value)
this.trigger('change', this, this.$radio.hasClass('checked'));
this.trigger('change', this, this.$radio.is(':checked'));
} else {
this.options.checked = value;
}
},
getValue: function() {
return this.$radio.hasClass('checked');
return this.$radio.is(':checked');
},
setCaption: function(text) {
this.$label.find('span').text(text);
}
});
});

View file

@ -78,7 +78,7 @@ define([
render: function() {
var me = this;
me.cmpEl = $(this.el);
me.cmpEl = me.$el || $(this.el);
if (!me.rendered) {
me.cmpEl.perfectScrollbar(_.extend({}, me.options));

View file

@ -104,8 +104,7 @@ define([
initialize : function(options) {
Common.UI.BaseView.prototype.initialize.call(this, options);
var me = this,
el = $(this.el);
var me = this;
me.width = me.options.width;
me.minValue = me.options.minValue;
@ -131,10 +130,10 @@ define([
this.setElement(parentEl, false);
parentEl.html(this.cmpEl);
} else {
$(this.el).html(this.cmpEl);
me.$el.html(this.cmpEl);
}
} else {
this.cmpEl = $(this.el);
this.cmpEl = me.$el;
}
this.cmpEl.find('.track-center').width(me.options.width - 14);
@ -299,8 +298,7 @@ define([
initialize : function(options) {
Common.UI.BaseView.prototype.initialize.call(this, options);
var me = this,
el = $(this.el);
var me = this;
me.width = me.options.width;
me.minValue = me.options.minValue;
@ -326,10 +324,10 @@ define([
this.setElement(parentEl, false);
parentEl.html(this.cmpEl);
} else {
$(this.el).html(this.cmpEl);
this.$el.html(this.cmpEl);
}
} else {
this.cmpEl = $(this.el);
this.cmpEl = this.$el;
}
var el = this.cmpEl;
@ -349,17 +347,30 @@ define([
pos = Math.max(0, Math.min(100, position)),
value = pos/me.delta + me.minValue;
me.setThumbPosition(index, pos);
me.thumbs[index].value = value;
if (me.isRemoveThumb) {
if (me.thumbs.length < 3) {
$(document).off('mouseup', me.binding.onMouseUp);
$(document).off('mousemove', me.binding.onMouseMove);
me._dragstart = undefined;
return;
}
me.trigger('removethumb', me, _.findIndex(me.thumbs, {index: index}));
me.trigger('change', me, value, lastValue);
me.trigger('changecomplete', me, value, lastValue);
} else {
me.setThumbPosition(index, pos);
me.thumbs[index].value = value;
if (need_sort)
me.sortThumbs();
if (need_sort)
me.sortThumbs();
}
$(document).off('mouseup', me.binding.onMouseUp);
$(document).off('mousemove', me.binding.onMouseMove);
me._dragstart = undefined;
me.trigger('changecomplete', me, value, lastValue);
!me.isRemoveThumb && me.trigger('changecomplete', me, value, lastValue);
me.isRemoveThumb = undefined;
};
var onMouseMove = function (e) {
@ -384,6 +395,10 @@ define([
if (need_sort)
me.sortThumbs();
var positionY = e.pageY*Common.Utils.zoom() - me.cmpEl.offset().top;
me.isRemoveThumb = positionY > me.cmpEl.height() || positionY < 0;
me.setRemoveThumb(index, me.isRemoveThumb);
if (Math.abs(value-lastValue)>0.001)
me.trigger('change', me, value, lastValue);
};
@ -405,7 +420,25 @@ define([
$(document).on('mousemove', null, e.data, me.binding.onMouseMove);
};
var onTrackMouseDown = function (e) {
var onTrackMouseUp = function (e) {
if ( me.disabled || !_.isUndefined(me._dragstart) || me.thumbs.length > 9) return;
var pos = Math.max(0, Math.min(100, (Math.round((e.pageX*Common.Utils.zoom() - me.cmpEl.offset().left) / me.width * 100)))),
nearIndex = findThumb(pos),
thumbColor = me.thumbs[nearIndex].colorValue,
thumbValue = me.thumbs[nearIndex].value,
value = pos/me.delta + me.minValue;
me.addThumb();
var index = me.thumbs.length - 1;
me.setThumbPosition(index, pos);
me.thumbs[index].value = value;
me.trigger('addthumb', me, index, nearIndex, thumbColor);
me.trigger('change', me);
me.trigger('changecomplete', me);
};
/*var onTrackMouseDown = function (e) {
if ( me.disabled ) return;
var pos = Math.max(0, Math.min(100, (Math.round((e.pageX*Common.Utils.zoom() - me.cmpEl.offset().left) / me.width * 100)))),
@ -418,7 +451,7 @@ define([
me.trigger('change', me, value, lastValue);
me.trigger('changecomplete', me, value, lastValue);
};
};*/
var findThumb = function(pos) {
var nearest = 100,
@ -464,7 +497,8 @@ define([
me.setActiveThumb(0, true);
if (!me.rendered) {
el.on('mousedown', '.track', onTrackMouseDown);
/*el.on('mousedown', '.track', onTrackMouseDown);*/
el.on('mouseup', '.track', onTrackMouseUp);
}
me.rendered = true;
@ -474,11 +508,23 @@ define([
setActiveThumb: function(index, suspend) {
this.currentThumb = index;
this.$thumbs = this.cmpEl.find('.thumb');
this.$thumbs.removeClass('active');
this.thumbs[index].thumb.addClass('active');
if (suspend!==true) this.trigger('thumbclick', this, index);
},
setRemoveThumb: function(index, remove) {
var ind = _.findIndex(this.thumbs, {index: index});
if (ind !== -1) {
if (remove && this.thumbs.length > 2) {
this.$el.find('.active').addClass('remove');
} else {
this.$el.find('.remove').removeClass('remove');
}
}
},
setThumbPosition: function(index, x) {
this.thumbs[index].position = x;
this.thumbs[index].thumb.css({left: x + '%'});

View file

@ -65,8 +65,7 @@ define([
initialize : function(options) {
Common.UI.BaseView.prototype.initialize.call(this, options);
var me = this,
el = $(this.el);
var me = this;
me.width = me.options.width;
me.thumbWidth = me.options.thumbWidth;
@ -89,10 +88,10 @@ define([
this.setElement(parentEl, false);
parentEl.html(this.cmpEl);
} else {
$(this.el).html(this.cmpEl);
this.$el.html(this.cmpEl);
}
} else {
this.cmpEl = $(this.el);
this.cmpEl = this.$el;
}
this.thumb = this.cmpEl.find('.thumb');

View file

@ -51,8 +51,8 @@ define([
this.active = false;
this.label = 'Tab';
this.cls = '';
this.template = _.template(['<li class="<% if(active){ %>active<% } %> <% if(cls.length){%><%= cls %><%}%>" data-label="<%= label %>">',
'<a><%- label %></a>',
this.template = _.template(['<li class="<% if(active){ %>active selected<% } %> <% if(cls.length){%><%= cls %><%}%>" data-label="<%= label %>">',
'<a title="<%= label %>"><%- label %></a>',
'</li>'].join(''));
this.initialize.call(this, opts);
@ -82,6 +82,10 @@ define([
this.$el.addClass('active');
},
isSelected: function() {
return this.$el.hasClass('selected');
},
deactivate: function(){
this.$el.removeClass('active');
},
@ -110,6 +114,11 @@ define([
this.$el.removeClass(cls);
},
toggleClass: function(cls) {
if (cls.length)
this.$el.toggleClass(cls);
},
hasClass: function(cls) {
return this.$el.hasClass(cls);
},

View file

@ -69,12 +69,28 @@ define([
};
StateManager.prototype.attach = function (tab) {
tab.changeState = $.proxy(function () {
this.trigger('tab:change', tab);
this.bar.$el.find('ul > li.active').removeClass('active');
tab.activate();
tab.changeState = $.proxy(function (select) {
if (select) {
tab.toggleClass('selected');
var selectTab = _.find(this.bar.selectTabs, function (item) {return item.sheetindex === tab.sheetindex;});
if (selectTab) {
this.bar.selectTabs = _.without(this.bar.selectTabs, selectTab);
} else {
this.bar.selectTabs.push(tab);
}
} else {
if (!tab.isSelected()) {
this.bar.$el.find('ul > li.selected').removeClass('selected');
tab.addClass('selected');
this.bar.selectTabs.length = 0;
this.bar.selectTabs.push(tab);
}
this.trigger('tab:change', tab);
this.bar.$el.find('ul > li.active').removeClass('active');
tab.activate();
this.bar.trigger('tab:changed', this.bar, this.bar.tabs.indexOf(tab), tab);
this.bar.trigger('tab:changed', this.bar, this.bar.tabs.indexOf(tab), tab);
}
}, this);
var dragHelper = new (function() {
@ -87,6 +103,8 @@ define([
var me = this,
length = me.bar.tabs.length,
barBounds = me.bar.$bar.get(0).getBoundingClientRect();
me.leftBorder = barBounds.left;
me.rightBorder = barBounds.right;
if (barBounds) {
me.bounds = [];
@ -97,134 +115,30 @@ define([
this.bounds.push(me.bar.tabs[i].$el.get(0).getBoundingClientRect());
}
me.lastTabRight = me.bounds[length - 1].right;
me.tabBarLeft = me.bounds[0].left;
me.tabBarRight = me.bounds[length - 1].right;
me.tabBarRight = Math.min(me.tabBarRight, barBounds.right - 1);
}
},
setAbsTabs: function () {
var me = this, tab = null, length = this.bounds.length;
for (var i = 0; i < length; ++i) {
tab = me.bar.tabs[i].$el;
tab.css('position', 'absolute');
tab.css('left', (me.bounds[i].left - me.tabBarLeft - this.scrollLeft) + 'px');
if (tab.hasClass('active')) {
tab.css('top', '1px');
} else {
tab.css('top', '0px');
}
}
},
updatePositions: function () {
this.drag.place = undefined;
var i, tabBound, center, place = -1, next = -this.scrollLeft,
tabsCount = this.bounds.length,
dragBound = this.drag.tab.$el.get(0).getBoundingClientRect();
if (this.drag.moveX - this.drag.mouseX > 0) {
for (i = tabsCount - 1; i >= 0; --i) {
tabBound = this.bounds[i];
center = (tabBound.right + tabBound.left) * 0.5;
if (dragBound.left < center && center < dragBound.right) {
place = i;
break;
}
}
if (-1 === place) {
for (i = tabsCount - 1; i >= 0; --i) {
tabBound = dragBound;
center = (tabBound.right + tabBound.left) * 0.5;
if (this.bounds[i].left < center && center < this.bounds[i].right) {
place = i;
break;
}
}
}
} else {
for (i = 0; i < tabsCount; ++i) {
tabBound = this.bounds[i];
center = (tabBound.right + tabBound.left) * 0.5;
if (dragBound.left < center && center < dragBound.right) {
place = i;
break;
}
}
if (-1 === place) {
for (i = 0; i < tabsCount; ++i) {
tabBound = dragBound;
center = (tabBound.right + tabBound.left) * 0.5;
if (this.bounds[i].left < center && center < this.bounds[i].right) {
place = i;
break;
}
}
}
}
if (-1 !== place) {
this.drag.place = place;
for (i = 0; i < tabsCount; ++i) {
if (i === place) {
if (place < this.drag.index) {
next += this.drag.tabWidth;
}
}
if (place > this.drag.index) {
if (i === place + 1) {
next += this.drag.tabWidth;
}
}
if (i !== this.drag.index) {
this.bar.tabs[i].$el.css('left', next + 'px');
} else {
if (this.drag.index === place) {
next += this.drag.tabWidth;
}
continue;
}
next += this.bounds[i].width;
}
}
},
setHook: function(e, bar, tab) {
setHookTabs: function (e, bar, tabs) {
var me = this;
function dragComplete() {
if (!_.isUndefined(me.drag)) {
me.drag.tab.removeClass('dragged');
me.drag.tab.$el.css('z-index', '');
me.bar.dragging = false;
var tab = null;
for (var i = me.bar.tabs.length - 1; i >= 0; --i) {
tab = me.bar.tabs[i].$el;
if (tab) {
tab.css('top', '');
tab.css('position', '');
tab.css('left', '');
}
}
bar.dragging = false;
bar.$el.find('li.mousemove').removeClass('mousemove right');
var arrSelectIndex = [];
tabs.forEach(function (item) {
arrSelectIndex.push(item.sheetindex);
});
if (!_.isUndefined(me.drag.place)) {
me.bar.trigger('tab:move', me.drag.index, me.drag.place);
me.bar.trigger('tab:move', arrSelectIndex, me.drag.place);
me.bar.$bar.scrollLeft(me.scrollLeft);
me.bar.scrollX = undefined;
} else {
me.bar.trigger('tab:move', me.drag.index);
me.bar.trigger('tab:move', arrSelectIndex);
me.bar.$bar.scrollLeft(me.scrollLeft);
me.bar.scrollX = undefined;
}
@ -232,50 +146,46 @@ define([
me.drag = undefined;
}
}
function dragMove (e) {
function dragMove (event) {
if (!_.isUndefined(me.drag)) {
me.drag.moveX = e.clientX*Common.Utils.zoom();
var leftPos = Math.max(me.drag.moveX - me.drag.anchorX - me.tabBarLeft - me.scrollLeft, 0);
leftPos = Math.min(leftPos, me.tabBarRight - me.tabBarLeft - me.drag.tabWidth - me.scrollLeft);
me.drag.tab.$el.css('left', leftPos + 'px');
me.drag.tab.$el.css('z-index','100');
me.updatePositions();
me.drag.moveX = event.clientX*Common.Utils.zoom();
if (me.drag.moveX < me.leftBorder) {
me.scrollLeft -= 20;
me.bar.$bar.scrollLeft(me.scrollLeft);
me.calculateBounds();
} else if (me.drag.moveX < me.tabBarRight && me.drag.moveX > me.tabBarLeft) {
var name = $(event.target).parent().data('label'),
currentTab = _.findIndex(bar.tabs, {label: name});
if (currentTab === -1) {
bar.$el.find('li.mousemove').removeClass('mousemove right');
me.drag.place = undefined;
} else if (me.bounds[currentTab].left - me.scrollLeft >= me.tabBarLeft) {
me.drag.place = currentTab;
$(event.target).parent().parent().find('li.mousemove').removeClass('mousemove right');
$(event.target).parent().addClass('mousemove');
}
} else if (me.drag.moveX > me.lastTabRight && Math.abs(me.tabBarRight - me.bounds[me.bar.tabs.length - 1].right) < 1) { //move to end of list, right border of the right tab is visible
bar.$el.find('li.mousemove').removeClass('mousemove right');
bar.tabs[bar.tabs.length - 1].$el.addClass('mousemove right');
me.drag.place = bar.tabs.length;
} else if (me.drag.moveX - me.rightBorder > 3) {
me.scrollLeft += 20;
me.bar.$bar.scrollLeft(me.scrollLeft);
me.calculateBounds();
}
}
}
function dragDropText (e) { // disable firefox drag&drop
e.preventDefault();
}
if (!_.isUndefined(bar) && !_.isUndefined(tab) && bar.tabs.length > 1) {
tab.addClass('dragged');
var index = bar.tabs.indexOf(tab),
_clientX = e.clientX*Common.Utils.zoom();
if (!_.isUndefined(bar) && !_.isUndefined(tabs) && bar.tabs.length > 1) {
me.bar = bar;
me.drag = {tab: tab, index: index};
me.drag = {tabs: tabs};
bar.dragging = true;
this.calculateBounds();
this.setAbsTabs();
me.drag.moveX = _clientX;
me.drag.mouseX = _clientX;
me.drag.anchorX = _clientX - this.bounds[index].left;
me.drag.tabWidth = this.bounds[index].width;
document.addEventListener('dragstart',dragDropText);
$(document).on('mousemove.tabbar', dragMove);
$(document).on('mouseup.tabbar', function (e) {
dragComplete(e);
$(document).off('mouseup.tabbar');
$(document).off('mousemove.tabbar');
document.removeEventListener('dragstart',dragDropText);
$(document).off('mousemove.tabbar', dragMove);
});
}
}
@ -283,12 +193,33 @@ define([
});
tab.$el.on({
click: $.proxy(function () {
if (!tab.disabled && !tab.$el.hasClass('active')) {
if (tab.control == 'manual') {
this.bar.trigger('tab:manual', this.bar, this.bar.tabs.indexOf(tab), tab);
} else {
tab.changeState();
click: $.proxy(function (event) {
if (!tab.disabled) {
if (event.ctrlKey || event.metaKey) {
if (!tab.isActive()) {
tab.changeState(true);
}
} else if (event.shiftKey) {
this.bar.$el.find('ul > li.selected').removeClass('selected');
this.bar.selectTabs.length = 0;
var $active = this.bar.$el.find('ul > li.active'),
indexAct = $active.index(),
indexCur = this.bar.tabs.indexOf(tab);
var startIndex = (indexCur > indexAct) ? indexAct : indexCur,
endIndex = (indexCur > indexAct) ? indexCur : indexAct;
for (var i = startIndex; i <= endIndex; i++) {
this.bar.tabs[i].changeState(true);
}
} else if (!tab.$el.hasClass('active')) {
if (this.bar.tabs.length === this.bar.selectTabs.length) {
this.bar.$el.find('ul > li.selected').removeClass('selected');
this.bar.selectTabs.length = 0;
}
if (tab.control == 'manual') {
this.bar.trigger('tab:manual', this.bar, this.bar.tabs.indexOf(tab), tab);
} else {
tab.changeState();
}
}
}
!tab.disabled && Common.NotificationCenter.trigger('edit:complete', this.bar);
@ -297,12 +228,15 @@ define([
this.trigger('tab:dblclick', this, this.tabs.indexOf(tab), tab);
}, this.bar),
contextmenu: $.proxy(function () {
this.trigger('tab:contextmenu', this, this.tabs.indexOf(tab), tab);
this.trigger('tab:contextmenu', this, this.tabs.indexOf(tab), tab, this.selectTabs);
}, this.bar),
mousedown: $.proxy(function (e) {
if (this.bar.options.draggable && !_.isUndefined(dragHelper) && (3 !== e.which)) {
if (!tab.isLockTheDrag) {
dragHelper.setHook(e, this.bar, tab);
if (!e.ctrlKey && !e.metaKey && !e.shiftKey) {
tab.changeState();
dragHelper.setHookTabs(e, this.bar, this.bar.selectTabs);
}
}
}
}, this)
@ -322,6 +256,7 @@ define([
tabs: [],
template: _.template('<ul class="nav nav-tabs <%= placement %>" />'),
selectTabs: [],
initialize : function (options) {
_.extend(this.config, options);
@ -397,6 +332,10 @@ define([
me.$bar.append(tab.render().$el);
me.tabs.push(tab);
me.manager.attach(tab);
if (tab.isActive()) {
me.selectTabs.length = 0;
me.selectTabs.push(tab);
}
}
} else {
for (i = tabs.length; i-- > 0 ; ) {
@ -410,6 +349,11 @@ define([
me.tabs.splice(index, 0, tab);
}
if (tab.isActive()) {
me.selectTabs.length = 0;
me.selectTabs.push(tab);
}
me.manager.attach(tab);
}
}
@ -462,6 +406,27 @@ define([
this.checkInvisible();
},
setSelectAll: function(isSelect) {
var me = this;
me.selectTabs.length = 0;
if (isSelect) {
me.tabs.forEach(function(tab){
if (!tab.isSelected()) {
tab.addClass('selected');
}
me.selectTabs.push(tab);
});
} else {
me.tabs.forEach(function(tab){
if (tab.isActive()) {
me.selectTabs.push(tab);
} else if (tab.isSelected()) {
tab.removeClass('selected');
}
});
}
},
getActive: function(iselem) {
return iselem ? this.$bar.find('> li.active') : this.$bar.find('> li.active').index();
},
@ -575,7 +540,7 @@ define([
//left = tab.position().left;
//right = left + tab.width();
return !(left < leftbound) && !(right > rightbound);
return !(left < leftbound) && !(right - rightbound > 0.1);
}
return false;

View file

@ -335,10 +335,10 @@ define([
this.setElement(parentEl, false);
parentEl.html(this.cmpEl);
} else {
$(this.el).html(this.cmpEl);
this.$el.html(this.cmpEl);
}
} else {
this.cmpEl = $(this.el);
this.cmpEl = this.$el;
}
me.rendered = true;

View file

@ -98,7 +98,7 @@ define([
Common.UI.BaseView.prototype.initialize.call(this, options);
var me = this,
el = $(this.el);
el = me.$el || $(this.el);
this.colors = me.options.colors || this.generateColorData(me.options.themecolors, me.options.effects, me.options.standardcolors, me.options.transparent);
@ -116,7 +116,7 @@ define([
},
render: function () {
$(this.el).html(this.template({colors: this.colors}));
this.$el.html(this.template({colors: this.colors}));
return this;
},
@ -144,7 +144,7 @@ define([
},
updateCustomColors: function() {
var el = $(this.el);
var el = this.$el || $(this.el);
if (el) {
var selected = el.find('a.' + this.selectedCls),
color = (selected.length>0 && /color-dynamic/.test(selected[0].className)) ? selected.attr('color') : undefined;
@ -221,7 +221,7 @@ define([
},
setCustomColor: function(color) {
var el = $(this.el);
var el = this.$el || $(this.el);
color = /#?([a-fA-F0-9]{6})/.exec(color);
if (color) {
this.saveCustomColor(color[1]);
@ -272,7 +272,7 @@ define([
},
select: function(color, suppressEvent) {
var el = $(this.el);
var el = this.$el || $(this.el);
el.find('a.' + this.selectedCls).removeClass(this.selectedCls);
if (typeof(color) == 'object' ) {
@ -321,7 +321,7 @@ define([
},
selectByRGB: function(rgb, suppressEvent) {
var el = $(this.el);
var el = this.$el || $(this.el);
el.find('a.' + this.selectedCls).removeClass(this.selectedCls);
var color = (typeof(rgb) == 'object') ? rgb.color : rgb;
@ -351,7 +351,7 @@ define([
if (effectcolors===undefined || standartcolors===undefined) return;
var me = this,
el = $(this.el);
el = me.$el || $(this.el);
if (me.aColorElements === undefined) {
me.aColorElements = el.find('a.palette-color');
@ -407,7 +407,7 @@ define([
if (value)
this.select(value, true);
else {
var selected = $(this.el).find('a.' + this.selectedCls);
var selected = el.find('a.' + this.selectedCls);
if (selected.length && selected.hasClass('palette-color-effect')) {
this.value = selected[0].className.match(this.colorRe)[1].toUpperCase();
}
@ -416,7 +416,7 @@ define([
},
clearSelection: function(suppressEvent) {
$(this.el).find('a.' + this.selectedCls).removeClass(this.selectedCls);
this.$el.find('a.' + this.selectedCls).removeClass(this.selectedCls);
this.value = undefined;
},

View file

@ -193,7 +193,7 @@ define([
});
if (view) {
var innerEl = $(this.el).find('.inner').addBack().filter('.inner');
var innerEl = (this.$el || $(this.el)).find('.inner').addBack().filter('.inner');
if (innerEl) {
(this.dataViewItems.length<1) && innerEl.find('.empty-text').remove();

View file

@ -63,6 +63,12 @@
* @cfg {Boolean} animate
* Makes the window to animate while showing or hiding
*
* @cfg {Object} buttons
* Use an array for predefined buttons (ok, cancel, yes, no): @example ['yes', 'no']
* Use a named array for the custom buttons: {value: caption, ...}
* @param {String} value will be returned in callback function
* @param {String} caption
*
* Methods
*
* @method show
@ -106,12 +112,6 @@
* @window Common.UI.warning
* Shows warning message.
* @cfg {String} msg
* @cfg {Object} buttons
* Use an array for predefined buttons (ok, cancel, yes, no): @example ['yes', 'no']
* Use a named array for the custom buttons: {value: caption, ...}
* @param {String} value will be returned in callback function
* @param {String} caption
*
* @cfg {Function} callback
* @param {String} button
* If the window is closed via shortcut or header's close tool, the 'button' will be 'close'
@ -167,7 +167,15 @@ define([
'<div class="title"><%= title %></div> ' +
'</div>' +
'<% } %>' +
'<div class="body"><%= tpl %></div>' +
'<div class="body"><%= tpl %>' +
'<% if (typeof (buttons) !== "undefined" && _.size(buttons) > 0) { %>' +
'<div class="footer">' +
'<% for(var bt in buttons) { %>' +
'<button class="btn normal dlg-btn <%= buttons[bt].cls %>" result="<%= bt %>"><%= buttons[bt].text %></button>'+
'<% } %>' +
'</div>' +
'<% } %>' +
'</div>' +
'</div>';
function _getMask() {
@ -340,20 +348,11 @@ define([
maxwidth = (this.initConfig.maxwidth) ? this.initConfig.maxwidth : main_width,
maxheight = (this.initConfig.maxheight) ? this.initConfig.maxheight : main_height;
if (this.resizing.type[0]>0) {
this.resizing.maxx = Math.min(main_width, left+maxwidth);
this.resizing.minx = left+this.initConfig.minwidth;
} else if (this.resizing.type[0]<0) {
this.resizing.maxx = left+this.resizing.initw-this.initConfig.minwidth;
this.resizing.minx = Math.max(0, left+this.resizing.initw-maxwidth);
}
if (this.resizing.type[1]>0) {
this.resizing.maxy = Math.min(main_height, top+maxheight);
this.resizing.miny = top+this.initConfig.minheight;
} else if (this.resizing.type[1]<0) {
this.resizing.maxy = top+this.resizing.inith-this.initConfig.minheight;
this.resizing.miny = Math.max(0, top+this.resizing.inith-maxheight);
}
this.resizing.minw = this.initConfig.minwidth;
this.resizing.maxw = (this.resizing.type[0]>0) ? Math.min(main_width-left, maxwidth) : Math.min(left+this.resizing.initw, maxwidth);
this.resizing.minh = this.initConfig.minheight;
this.resizing.maxh = (this.resizing.type[1]>0) ? Math.min(main_height-top, maxheight) : Math.min(top+this.resizing.inith, maxheight);
$(document.body).css('cursor', el.css('cursor'));
this.$window.find('.resize-border').addClass('resizing');
@ -370,16 +369,34 @@ define([
zoom = (event instanceof jQuery.Event) ? Common.Utils.zoom() : 1,
pageX = event.pageX*zoom,
pageY = event.pageY*zoom;
if (this.resizing.type[0] && pageX<this.resizing.maxx && pageX>this.resizing.minx) {
if (this.resizing.type[0]) {
var new_width = this.resizing.initw + (pageX - this.resizing.initpage_x) * this.resizing.type[0];
if (new_width>this.resizing.maxw) {
pageX = pageX - (new_width-this.resizing.maxw) * this.resizing.type[0];
new_width = this.resizing.maxw;
} else if (new_width<this.resizing.minw) {
pageX = pageX - (new_width-this.resizing.minw) * this.resizing.type[0];
new_width = this.resizing.minw;
}
if (this.resizing.type[0]<0)
this.$window.css({left: pageX - this.resizing.initx});
this.setWidth(this.resizing.initw + (pageX - this.resizing.initpage_x) * this.resizing.type[0]);
this.setWidth(new_width);
resized = true;
}
if (this.resizing.type[1] && pageY<this.resizing.maxy && pageY>this.resizing.miny) {
if (this.resizing.type[1]) {
var new_height = this.resizing.inith + (pageY - this.resizing.initpage_y) * this.resizing.type[1];
if (new_height>this.resizing.maxh) {
pageY = pageY - (new_height-this.resizing.maxh) * this.resizing.type[1];
new_height = this.resizing.maxh;
} else if (new_height<this.resizing.minh) {
pageY = pageY - (new_height-this.resizing.minh) * this.resizing.type[1];
new_height = this.resizing.minh;
}
if (this.resizing.type[1]<0)
this.$window.css({top: pageY - this.resizing.inity});
this.setHeight(this.resizing.inith + (pageY - this.resizing.initpage_y) * this.resizing.type[1]);
this.setHeight(new_height);
resized = true;
}
if (resized) this.fireEvent('resizing');
@ -399,31 +416,9 @@ define([
Common.UI.alert = function(options) {
var me = this.Window.prototype;
var arrBtns = {ok: me.okButtonText, cancel: me.cancelButtonText,
yes: me.yesButtonText, no: me.noButtonText,
close: me.closeButtonText};
if (!options.buttons) {
options.buttons = {};
options.buttons['ok'] = {text: arrBtns['ok'], cls: 'primary'};
} else {
if (_.isArray(options.buttons)) {
if (options.primary==undefined)
options.primary = 'ok';
var newBtns = {};
_.each(options.buttons, function(b){
if (typeof(b) == 'object') {
if (b.value !== undefined)
newBtns[b.value] = {text: b.caption, cls: 'custom' + ((b.primary || options.primary==b.value) ? ' primary' : '')};
} else {
newBtns[b] = {text: (b=='custom') ? options.customButtonText : arrBtns[b], cls: (options.primary==b) ? 'primary' : ''};
if (b=='custom')
newBtns[b].cls += ' custom';
}
});
options.buttons = newBtns;
}
options.buttons = ['ok'];
}
options.dontshow = options.dontshow || false;
@ -435,14 +430,7 @@ define([
'<% if (dontshow) { %><div class="dont-show-checkbox"></div><% } %>' +
'</div>' +
'</div>' +
'<% if (dontshow) { %><div class="separator horizontal" style="width: 100%;"/><% } %>' +
'<% if (_.size(buttons) > 0) { %>' +
'<div class="footer <% if (dontshow) { %> dontshow <% } %>">' +
'<% for(var bt in buttons) { %>' +
'<button class="btn normal dlg-btn <%= buttons[bt].cls %>" result="<%= bt %>"><%= buttons[bt].text %></button>'+
'<% } %>' +
'</div>' +
'<% } %>';
'<% if (dontshow) { %><div class="separator horizontal" style="width: 100%;"/><% } %>';
_.extend(options, {
cls: 'alert',
@ -500,7 +488,9 @@ define([
win.on({
'render:after': function(obj){
obj.getChild('.footer .dlg-btn').on('click', onBtnClick);
var footer = obj.getChild('.footer');
options.dontshow && footer.addClass('dontshow');
footer.find('.dlg-btn').on('click', onBtnClick);
chDontShow = new Common.UI.CheckBox({
el: win.$window.find('.dont-show-checkbox'),
labelText: win.textDontShow
@ -572,6 +562,29 @@ define([
this.initConfig = {};
this.binding = {};
var arrBtns = {ok: this.okButtonText, cancel: this.cancelButtonText,
yes: this.yesButtonText, no: this.noButtonText,
close: this.closeButtonText};
if (options.buttons && _.isArray(options.buttons)) {
if (options.primary==undefined)
options.primary = 'ok';
var newBtns = {};
_.each(options.buttons, function(b){
if (typeof(b) == 'object') {
if (b.value !== undefined)
newBtns[b.value] = {text: b.caption, cls: 'custom' + ((b.primary || options.primary==b.value) ? ' primary' : '')};
} else {
newBtns[b] = {text: (b=='custom') ? options.customButtonText : arrBtns[b], cls: (options.primary==b) ? 'primary' : ''};
if (b=='custom')
newBtns[b].cls += ' custom';
}
});
options.buttons = newBtns;
options.footerCls = options.footerCls || 'center';
}
_.extend(this.initConfig, config, options || {});
!this.initConfig.id && (this.initConfig.id = 'window-' + this.cid);
@ -588,6 +601,9 @@ define([
this.$window = $('#' + this.initConfig.id);
if (Common.Locale.getCurrentLanguage() !== 'en')
this.$window.attr('applang', Common.Locale.getCurrentLanguage());
this.binding.keydown = _.bind(_keydown,this);
// $(document).on('keydown', this.binding.keydown);
@ -632,6 +648,8 @@ define([
};
Common.NotificationCenter.on('window:close', this.binding.winclose);
this.initConfig.footerCls && this.$window.find('.footer').addClass(this.initConfig.footerCls);
this.fireEvent('render:after',this);
return this;
},

View file

@ -126,6 +126,9 @@ define([
'comment:closeEditing': _.bind(this.closeEditing, this),
'comment:disableHint': _.bind(this.disableHint, this),
'comment:addDummyComment': _.bind(this.onAddDummyComment, this)
},
'Common.Views.ReviewChanges': {
'comment:removeComments': _.bind(this.onRemoveComments, this)
}
});
@ -180,7 +183,7 @@ define([
this.api.asc_registerCallback('asc_onAddComments', _.bind(this.onApiAddComments, this));
this.api.asc_registerCallback('asc_onRemoveComment', _.bind(this.onApiRemoveComment, this));
this.api.asc_registerCallback('asc_onChangeComments', _.bind(this.onChangeComments, this));
this.api.asc_registerCallback('asc_onRemoveComments', _.bind(this.onRemoveComments, this));
this.api.asc_registerCallback('asc_onRemoveComments', _.bind(this.onApiRemoveComments, this));
this.api.asc_registerCallback('asc_onChangeCommentData', _.bind(this.onApiChangeCommentData, this));
this.api.asc_registerCallback('asc_onLockComment', _.bind(this.onApiLockComment, this));
this.api.asc_registerCallback('asc_onUnLockComment', _.bind(this.onApiUnLockComment, this));
@ -233,6 +236,11 @@ define([
this.api.asc_removeComment(id);
}
},
onRemoveComments: function (type) {
if (this.api) {
this.api.asc_RemoveAllComments(type=='my' || !this.mode.canEditComments, type=='current');// 1 param = true if remove only my comments, 2 param - remove current comments
}
},
onResolveComment: function (uid) {
var t = this,
reply = null,
@ -499,7 +507,7 @@ define([
ascComment.asc_addReply(addReply);
me.api.asc_changeComment(id, ascComment);
me.mode && me.mode.canRequestUsers && me.view.pickEMail(ascComment.asc_getGuid(), replyVal);
me.mode && me.mode.canRequestSendNotify && me.view.pickEMail(ascComment.asc_getGuid(), replyVal);
return true;
}
@ -725,7 +733,7 @@ define([
this.updateComments(true);
},
onRemoveComments: function (data) {
onApiRemoveComments: function (data) {
for (var i = 0; i < data.length; ++i) {
this.onApiRemoveComment(data[i], true);
}
@ -821,6 +829,7 @@ define([
}
},
onApiShowComment: function (uids, posX, posY, leftX, opts, hint) {
var apihint = hint;
var same_uids = (0 === _.difference(this.uids, uids).length) && (0 === _.difference(uids, this.uids).length);
if (hint && this.isSelectedComment && same_uids && !this.isModeChanged) {
@ -886,7 +895,7 @@ define([
this.animate = false;
}
this.isSelectedComment = !hint || !this.hintmode;
this.isSelectedComment = !apihint || !this.hintmode;
this.uids = _.clone(uids);
comments.push(comment);
@ -1133,7 +1142,8 @@ define([
commentsStore : this.popoverComments,
renderTo : this.sdkViewName,
canRequestUsers: (this.mode) ? this.mode.canRequestUsers : undefined,
canRequestSendNotify: (this.mode) ? this.mode.canRequestSendNotify : undefined
canRequestSendNotify: (this.mode) ? this.mode.canRequestSendNotify : undefined,
mentionShare: (this.mode) ? this.mode.mentionShare : true
});
this.popover.setCommentsStore(this.popoverComments);
}
@ -1354,7 +1364,7 @@ define([
this.api.asc_addComment(comment);
this.view.showEditContainer(false);
this.mode && this.mode.canRequestUsers && this.view.pickEMail(comment.asc_getGuid(), commentVal);
this.mode && this.mode.canRequestSendNotify && this.view.pickEMail(comment.asc_getGuid(), commentVal);
if (!_.isUndefined(this.api.asc_SetDocumentPlaceChangedEnabled)) {
this.api.asc_SetDocumentPlaceChangedEnabled(false);
}

View file

@ -42,8 +42,15 @@ define([
'use strict';
var Desktop = function () {
var config = {};
var app = window.AscDesktopEditor;
var config = {version:'{{PRODUCT_VERSION}}'};
var app = window.AscDesktopEditor,
webapp = window.DE || window.PE || window.SSE;
var titlebuttons;
var btnsave_icons = {
'btn-save': 'save',
'btn-save-coauth': 'coauth',
'btn-synch': 'synch' };
if ( !!app ) {
window.on_native_message = function (cmd, param) {
@ -83,15 +90,87 @@ define([
}
} else
if (/editor:config/.test(cmd)) {
if ( param == 'request' )
app.execCommand('editor:config', JSON.stringify({user: config.user, 'extraleft': $('#box-document-title #slot-btn-dt-save').parent().width()}));
if ( param == 'request' ) {
if ( !!titlebuttons ) {
var opts = {
user: config.user,
title: { buttons: [] }
};
var header = webapp.getController('Viewport').getView('Common.Views.Header');
if ( header ) {
for (var i in titlebuttons) {
opts.title.buttons.push(_serializeHeaderButton(i, titlebuttons[i]));
}
}
app.execCommand('editor:config', JSON.stringify(opts));
} else
if ( !config.callback_editorconfig ) {
config.callback_editorconfig = function() {
setTimeout(function(){window.on_native_message(cmd, param);},0);
}
}
}
} else
if (/button:click/.test(cmd)) {
var obj = JSON.parse(param);
if ( !!obj.action ) {
titlebuttons[obj.action].btn.click();
}
} else
if (/element:show/.test(cmd)) {
var _mr = /title:(?:(true|show)|(false|hide))/.exec(param);
if ( _mr ) {
if (!!_mr[1]) $('#app-title').show();
else if (!!_mr[2]) $('#app-title').hide();
}
}
};
app.execCommand('webapps:events', 'loading');
app.execCommand('window:features', 'request');
if ( !!window.native_message_cmd ) {
for ( var c in window.native_message_cmd ) {
window.on_native_message(c, window.native_message_cmd[c]);
}
}
// app.execCommand('window:features', {version: config.version, action: 'request'});
app.execCommand('webapps:features', {version: config.version, eventloading:true, titlebuttons:true});
}
var _serializeHeaderButton = function(action, config) {
return {
action: action,
icon: config.icon || undefined,
hint: config.btn.options.hint,
disabled: config.disabled
};
};
var _onTitleButtonDisabled = function (action, e, status) {
titlebuttons[action].disabled = status;
var _buttons = {};
_buttons[action] = status;
app.execCommand('title:button', JSON.stringify({disabled: _buttons}));
};
var _onSaveIconChanged = function (e, opts) {
app.execCommand('title:button', JSON.stringify({'icon:changed': {'save': btnsave_icons[opts.next]}}));
};
var _onModalDialog = function (status) {
if ( status == 'open' ) {
app.execCommand('title:button', JSON.stringify({disabled: {'all':true}}));
} else {
var _buttons = {};
for (var i in titlebuttons) {
_buttons[i] = titlebuttons[i].disabled;
}
app.execCommand('title:button', JSON.stringify({'disabled': _buttons}));
}
};
return {
init: function (opts) {
_.extend(config, opts);
@ -112,6 +191,44 @@ define([
if ( config.canUndock ) {
Common.NotificationCenter.trigger('app:config', {canUndock: true});
}
var header = webapp.getController('Viewport').getView('Common.Views.Header');
titlebuttons = {};
if ( !!header.btnSave ) {
titlebuttons['save'] = {btn: header.btnSave, disabled:false};
var iconname = /\s?([^\s]+)$/.exec(titlebuttons.save.btn.$icon.attr('class'));
!!iconname && iconname.length && (titlebuttons.save.icon = btnsave_icons[iconname]);
}
if ( !!header.btnPrint )
titlebuttons['print'] = {btn: header.btnPrint, disabled:false};
if ( !!header.btnUndo )
titlebuttons['undo'] = {btn: header.btnUndo, disabled:false};
if ( !!header.btnRedo )
titlebuttons['redo'] = {btn: header.btnRedo, disabled:false};
for (var i in titlebuttons) {
titlebuttons[i].btn.options.signals = ['disabled'];
titlebuttons[i].btn.on('disabled', _onTitleButtonDisabled.bind(this, i));
}
if (!!titlebuttons.save) {
titlebuttons.save.btn.options.signals.push('icon:changed');
titlebuttons.save.btn.on('icon:changed', _onSaveIconChanged.bind(this));
}
if ( !!config.callback_editorconfig ) {
config.callback_editorconfig();
delete config.callback_editorconfig;
}
});
Common.NotificationCenter.on({
'modal:show': _onModalDialog.bind(this, 'open'),
'modal:close': _onModalDialog.bind(this, 'close')
});
}
},
@ -145,4 +262,4 @@ define([
};
Common.Controllers.Desktop = new Desktop();
});
});

View file

@ -180,7 +180,7 @@ define([
if (historyStore && data!==null) {
var rev, revisions = historyStore.findRevisions(data.version),
urlGetTime = new Date();
var diff = (this.currentChangeId===undefined) ? null : opts.data.changesUrl, // if revision has changes, but serverVersion !== app.buildVersion -> hide revision changes
var diff = (!opts.data.previous || this.currentChangeId===undefined) ? null : opts.data.changesUrl, // if revision has changes, but serverVersion !== app.buildVersion -> hide revision changes
url = (!_.isEmpty(diff) && opts.data.previous) ? opts.data.previous.url : opts.data.url,
docId = opts.data.key ? opts.data.key : this.currentDocId,
docIdPrev = opts.data.previous && opts.data.previous.key ? opts.data.previous.key : this.currentDocIdPrev,

View file

@ -172,7 +172,7 @@ define([
},
onAfterRender: function(panelPlugins) {
panelPlugins.viewPluginsList.on('item:click', _.bind(this.onSelectPlugin, this));
panelPlugins.viewPluginsList && panelPlugins.viewPluginsList.on('item:click', _.bind(this.onSelectPlugin, this));
this.bindViewEvents(this.panelPlugins, this.events);
var me = this;
Common.NotificationCenter.on({
@ -367,14 +367,14 @@ define([
var me = this,
isCustomWindow = variation.get_CustomWindow(),
arrBtns = variation.get_Buttons(),
newBtns = {},
newBtns = [],
size = variation.get_Size();
if (!size || size.length<2) size = [800, 600];
if (_.isArray(arrBtns)) {
_.each(arrBtns, function(b, index){
if (b.visible)
newBtns[index] = {text: b.text, cls: 'custom' + ((b.primary) ? ' primary' : '')};
newBtns[index] = {caption: b.text, value: index, primary: b.primary};
});
}

View file

@ -69,12 +69,17 @@ define([
'FileMenu': {
'settings:apply': this.applySettings.bind(this)
},
'LeftMenu': {
'comments:show': _.bind(this.commentsShowHide, this, 'show'),
'comments:hide': _.bind(this.commentsShowHide, this, 'hide')
},
'Common.Views.ReviewChanges': {
'reviewchange:accept': _.bind(this.onAcceptClick, this),
'reviewchange:reject': _.bind(this.onRejectClick, this),
'reviewchange:delete': _.bind(this.onDeleteClick, this),
'reviewchange:preview': _.bind(this.onBtnPreviewClick, this),
'reviewchanges:view': _.bind(this.onReviewViewClick, this),
'reviewchange:view': _.bind(this.onReviewViewClick, this),
'reviewchange:compare': _.bind(this.onCompareClick, this),
'lang:document': _.bind(this.onDocLanguage, this),
'collaboration:coauthmode': _.bind(this.onCoAuthMode, this)
},
@ -95,12 +100,14 @@ define([
this.collection = this.getApplication().getCollection('Common.Collections.ReviewChanges');
this.userCollection = this.getApplication().getCollection('Common.Collections.Users');
this._state = {posx: -1000, posy: -1000, popoverVisible: false, previewMode: false};
this._state = {posx: -1000, posy: -1000, popoverVisible: false, previewMode: false, compareSettings: null /*new AscCommon.CComparisonPr()*/};
Common.NotificationCenter.on('reviewchanges:turn', this.onTurnPreview.bind(this));
Common.NotificationCenter.on('spelling:turn', this.onTurnSpelling.bind(this));
Common.NotificationCenter.on('app:ready', this.onAppReady.bind(this));
Common.NotificationCenter.on('api:disconnect', _.bind(this.onCoAuthoringDisconnect, this));
Common.NotificationCenter.on('collaboration:sharing', this.changeAccessRights.bind(this));
Common.NotificationCenter.on('collaboration:sharingdeny', this.onLostEditRights.bind(this));
this.userCollection.on('reset', _.bind(this.onUpdateUsers, this));
this.userCollection.on('add', _.bind(this.onUpdateUsers, this));
@ -112,6 +119,7 @@ define([
this.currentUserId = data.config.user.id;
this.sdkViewName = data['sdkviewname'] || this.sdkViewName;
}
return this;
},
setApi: function (api) {
if (api) {
@ -120,8 +128,13 @@ define([
if (this.appConfig.canReview || this.appConfig.canViewReview) {
this.api.asc_registerCallback('asc_onShowRevisionsChange', _.bind(this.onApiShowChange, this));
this.api.asc_registerCallback('asc_onUpdateRevisionsChangesPosition', _.bind(this.onApiUpdateChangePosition, this));
this.api.asc_registerCallback('asc_onAuthParticipantsChanged', _.bind(this.onAuthParticipantsChanged, this));
this.api.asc_registerCallback('asc_onParticipantsChanged', _.bind(this.onAuthParticipantsChanged, this));
}
this.api.asc_registerCallback('asc_onAcceptChangesBeforeCompare',_.bind(this.onAcceptChangesBeforeCompare, this));
this.api.asc_registerCallback('asc_onCoAuthoringDisconnect',_.bind(this.onCoAuthoringDisconnect, this));
Common.Gateway.on('setrevisedfile', _.bind(this.setRevisedFile, this));
}
},
@ -130,9 +143,18 @@ define([
this.popoverChanges = new Common.Collections.ReviewChanges();
this.view = this.createView('Common.Views.ReviewChanges', { mode: mode });
if (!!this.appConfig.sharingSettingsUrl && this.appConfig.sharingSettingsUrl.length || this.appConfig.canRequestSharingSettings) {
Common.Gateway.on('showsharingsettings', _.bind(this.changeAccessRights, this));
Common.Gateway.on('setsharingsettings', _.bind(this.setSharingSettings, this));
}
return this;
},
loadDocument: function(data) {
this.document = data.doc;
},
SetDisabled: function(state) {
if (this.dlgChanges)
this.dlgChanges.close();
@ -395,9 +417,9 @@ define([
if (value.Get_WidowControl())
proptext += ((value.Get_WidowControl() ? me.textWidow : me.textNoWidow) + ', ');
if (value.Get_Tabs() !== undefined)
proptext += proptext += (me.textTabs + ', ');
proptext += (me.textTabs + ', ');
if (value.Get_NumPr() !== undefined)
proptext += proptext += (me.textNum + ', ');
proptext += (me.textNum + ', ');
if (value.Get_PStyle() !== undefined) {
var style = me.api.asc_GetStyleNameById(value.Get_PStyle());
if (!_.isEmpty(style)) proptext += (style + ', ');
@ -554,6 +576,84 @@ define([
Common.NotificationCenter.trigger('edit:complete', this.view);
},
onCompareClick: function(item) {
if (this.api) {
var me = this;
if (!this._state.compareSettings) {
this._state.compareSettings = new AscCommonWord.ComparisonOptions();
this._state.compareSettings.putWords(!Common.localStorage.getBool("de-compare-char"));
}
if (item === 'file') {
if (this.api)
this.api.asc_CompareDocumentFile(this._state.compareSettings);
Common.NotificationCenter.trigger('edit:complete', this.view);
} else if (item === 'url') {
(new Common.Views.ImageFromUrlDialog({
title: me.textUrl,
handler: function(result, value) {
if (result == 'ok') {
if (me.api) {
var checkUrl = value.replace(/ /g, '');
if (!_.isEmpty(checkUrl)) {
me.api.asc_CompareDocumentUrl(checkUrl, me._state.compareSettings);
}
}
Common.NotificationCenter.trigger('edit:complete', me.view);
}
}
})).show();
} else if (item === 'storage') {
if (this.appConfig.canRequestCompareFile) {
Common.Gateway.requestCompareFile();
} else {
(new Common.Views.SelectFileDlg({
fileChoiceUrl: this.appConfig.fileChoiceUrl.replace("{fileExt}", "").replace("{documentType}", "DocumentsOnly")
})).on('selectfile', function(obj, file){
me.setRevisedFile(file, me._state.compareSettings);
}).show();
}
} else if (item === 'settings') {
(new DE.Views.CompareSettingsDialog({
props: me._state.compareSettings,
handler: function(result, value) {
if (result == 'ok') {
me._state.compareSettings = value;
}
Common.NotificationCenter.trigger('edit:complete', me.toolbar);
}
})).show();
}
}
Common.NotificationCenter.trigger('edit:complete', this.view);
},
setRevisedFile: function(data) {
if (!this._state.compareSettings) {
this._state.compareSettings = new AscCommonWord.ComparisonOptions();
this._state.compareSettings.putWords(!Common.localStorage.getBool("de-compare-char"));
}
if (data && data.url) {
this.api.asc_CompareDocumentUrl(data.url, this._state.compareSettings, data.token);// for loading from storage
}
},
onAcceptChangesBeforeCompare: function(callback) {
var me = this;
Common.UI.warning({
width: 550,
msg: this.textAcceptBeforeCompare,
buttons: ['yes', 'no'],
primary: 'yes',
callback: function(result) {
_.defer(function() {
if (callback) callback(result=='yes');
});
Common.NotificationCenter.trigger('edit:complete', this.view);
}
});
},
turnDisplayMode: function(mode) {
if (this.api) {
if (mode === 'final')
@ -618,7 +718,7 @@ define([
comments.setPreviewMode(disable);
var leftMenu = app.getController('LeftMenu');
leftMenu.leftMenu.getMenu('file').miProtect.setDisabled(disable);
leftMenu.leftMenu.getMenu('file').getButton('protect').setDisabled(disable);
leftMenu.setPreviewMode(disable);
if (this.view) {
@ -643,7 +743,7 @@ define([
onAppReady: function (config) {
var me = this;
if ( me.view && Common.localStorage.getBool(me.view.appPrefix + "settings-spellcheck", true) )
if ( me.view && Common.localStorage.getBool(me.view.appPrefix + "settings-spellcheck", !(config.customization && config.customization.spellcheck===false)))
me.view.turnSpelling(true);
if ( config.canReview ) {
@ -685,7 +785,9 @@ define([
if (state !== me.view.btnChat.pressed)
me.view.turnChat(state);
});
}
if (me.view && me.view.btnCommentRemove) {
me.view.btnCommentRemove.setDisabled(!Common.localStorage.getBool(me.view.appPrefix + "settings-livecomment", true));
}
},
@ -724,9 +826,38 @@ define([
},
onLostEditRights: function() {
this._readonlyRights = true;
this.view && this.view.onLostEditRights();
},
changeAccessRights: function(btn,event,opts) {
if (this._docAccessDlg || this._readonlyRights) return;
if (this.appConfig.canRequestSharingSettings) {
Common.Gateway.requestSharingSettings();
} else {
var me = this;
me._docAccessDlg = new Common.Views.DocumentAccessDialog({
settingsurl: this.appConfig.sharingSettingsUrl
});
me._docAccessDlg.on('accessrights', function(obj, rights){
me.setSharingSettings({sharingSettings: rights});
}).on('close', function(obj){
me._docAccessDlg = undefined;
});
me._docAccessDlg.show();
}
},
setSharingSettings: function(data) {
if (data) {
this.document.info.sharingSettings = data.sharingSettings;
Common.NotificationCenter.trigger('collaboration:sharingupdate', data.sharingSettings);
Common.NotificationCenter.trigger('mentions:clearusers', this);
}
},
onCoAuthoringDisconnect: function() {
this.SetDisabled(true);
},
@ -739,6 +870,23 @@ define([
});
},
onAuthParticipantsChanged: function(users) {
if (this.view && this.view.btnCompare) {
var length = 0;
_.each(users, function(item){
if (!item.asc_getView())
length++;
});
this.view.btnCompare.setDisabled(length>1 || this.viewmode);
}
},
commentsShowHide: function(mode) {
if (!this.view) return;
var value = Common.Utils.InternalSettings.get(this.view.appPrefix + "settings-livecomment");
(value!==undefined) && this.view.btnCommentRemove && this.view.btnCommentRemove.setDisabled(mode != 'show' && !value);
},
textInserted: '<b>Inserted:</b>',
textDeleted: '<b>Deleted:</b>',
textParaInserted: '<b>Paragraph Inserted</b> ',
@ -797,6 +945,8 @@ define([
textTableRowsDel: '<b>Table Rows Deleted<b/>',
textParaMoveTo: '<b>Moved:</b>',
textParaMoveFromUp: '<b>Moved Up:</b>',
textParaMoveFromDown: '<b>Moved Down:</b>'
textParaMoveFromDown: '<b>Moved Down:</b>',
textUrl: 'Paste a document URL',
textAcceptBeforeCompare: 'In order to compare documents all the tracked changes in them will be considered to have been accepted. Do you want to continue?'
}, Common.Controllers.ReviewChanges || {}));
});

View file

@ -155,8 +155,8 @@
else
$scrollbarYRail.css({top: $this.scrollTop(), right: scrollbarYRight - $this.scrollLeft(), height: scrollbarYRailHeight, display: scrollbarYActive ? "inherit": "none"});
$scrollbarX.css({left: scrollbarXLeft, width: scrollbarXWidth});
$scrollbarY.css({top: scrollbarYTop, height: scrollbarYHeight});
$scrollbarX && $scrollbarX.css({left: scrollbarXLeft, width: scrollbarXWidth});
$scrollbarY && $scrollbarY.css({top: scrollbarYTop, height: scrollbarYHeight});
};
var updateBarSizeAndPosition = function () {

View file

@ -363,6 +363,8 @@ Common.util.LanguageInfo = new(function() {
0x380A : ["es-UY", "Español (Uruguay)", "Spanish (Uruguay)"],
0x200A : ["es-VE", "Español (Republica Bolivariana de Venezuela)", "Spanish (Venezuela)"],
0x040a : ["es-ES_tradnl", "Spanish"],
0x580a : ["es-419", "Español (América Latina y el Caribe)", "Spanish (Latin America and the Caribbean)"],
0x5C0a : ["es-CU", "Español (Cuba)", "Spanish (Cuba)"],
0x001D : ["sv", "Svenska"],
0x081D : ["sv-FI", "Svenska (Finland)", "Swedish (Finland)"],
0x041D : ["sv-SE", "Svenska (Sverige)", "Swedish (Sweden)"],

File diff suppressed because it is too large Load diff

View file

@ -30,14 +30,15 @@
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
if (Common === undefined) {
var Common = {};
}
define(function(){ 'use strict';
if (Common.define === undefined) {
Common.define = {};
}
define(function(){ 'use strict';
Common.define.c_oAscMathMainType = {
Symbol : 0x00,
@ -413,4 +414,86 @@ define(function(){ 'use strict';
Matrix_Flat_Round : 0x0b040000,
Matrix_Flat_Square : 0x0b040001
};
Common.define.chartData = _.extend( new(function() {
return {
textLine: 'Line',
textColumn: 'Column',
textBar: 'Bar',
textArea: 'Area',
textPie: 'Pie',
textPoint: 'XY (Scatter)',
textStock: 'Stock',
textSurface: 'Surface',
textCharts: 'Charts',
textSparks: 'Sparklines',
textLineSpark: 'Line',
textColumnSpark: 'Column',
textWinLossSpark: 'Win/Loss',
getChartGroupData: function(headername) {
return [
{id: 'menu-chart-group-bar', caption: this.textColumn, headername: (headername) ? this.textCharts : undefined},
{id: 'menu-chart-group-line', caption: this.textLine},
{id: 'menu-chart-group-pie', caption: this.textPie},
{id: 'menu-chart-group-hbar', caption: this.textBar},
{id: 'menu-chart-group-area', caption: this.textArea, inline: true},
{id: 'menu-chart-group-scatter', caption: this.textPoint, inline: true},
{id: 'menu-chart-group-stock', caption: this.textStock, inline: true}
// {id: 'menu-chart-group-surface', caption: this.textSurface}
];
},
getChartData: function() {
return [
{ group: 'menu-chart-group-bar', type: Asc.c_oAscChartTypeSettings.barNormal, iconCls: 'column-normal'},
{ group: 'menu-chart-group-bar', type: Asc.c_oAscChartTypeSettings.barStacked, iconCls: 'column-stack'},
{ group: 'menu-chart-group-bar', type: Asc.c_oAscChartTypeSettings.barStackedPer, iconCls: 'column-pstack'},
{ group: 'menu-chart-group-bar', type: Asc.c_oAscChartTypeSettings.barNormal3d, iconCls: 'column-3d-normal'},
{ group: 'menu-chart-group-bar', type: Asc.c_oAscChartTypeSettings.barStacked3d, iconCls: 'column-3d-stack'},
{ group: 'menu-chart-group-bar', type: Asc.c_oAscChartTypeSettings.barStackedPer3d, iconCls: 'column-3d-pstack'},
{ group: 'menu-chart-group-bar', type: Asc.c_oAscChartTypeSettings.barNormal3dPerspective, iconCls: 'column-3d-normal-per'},
{ group: 'menu-chart-group-line', type: Asc.c_oAscChartTypeSettings.lineNormal, iconCls: 'line-normal'},
{ group: 'menu-chart-group-line', type: Asc.c_oAscChartTypeSettings.lineStacked, iconCls: 'line-stack'},
{ group: 'menu-chart-group-line', type: Asc.c_oAscChartTypeSettings.lineStackedPer, iconCls: 'line-pstack'},
{ group: 'menu-chart-group-line', type: Asc.c_oAscChartTypeSettings.line3d, iconCls: 'line-3d'},
{ group: 'menu-chart-group-pie', type: Asc.c_oAscChartTypeSettings.pie, iconCls: 'pie-normal'},
{ group: 'menu-chart-group-pie', type: Asc.c_oAscChartTypeSettings.doughnut, iconCls: 'pie-doughnut'},
{ group: 'menu-chart-group-pie', type: Asc.c_oAscChartTypeSettings.pie3d, iconCls: 'pie-3d-normal'},
{ group: 'menu-chart-group-hbar', type: Asc.c_oAscChartTypeSettings.hBarNormal, iconCls: 'bar-normal'},
{ group: 'menu-chart-group-hbar', type: Asc.c_oAscChartTypeSettings.hBarStacked, iconCls: 'bar-stack'},
{ group: 'menu-chart-group-hbar', type: Asc.c_oAscChartTypeSettings.hBarStackedPer, iconCls: 'bar-pstack'},
{ group: 'menu-chart-group-hbar', type: Asc.c_oAscChartTypeSettings.hBarNormal3d, iconCls: 'bar-3d-normal'},
{ group: 'menu-chart-group-hbar', type: Asc.c_oAscChartTypeSettings.hBarStacked3d, iconCls: 'bar-3d-stack'},
{ group: 'menu-chart-group-hbar', type: Asc.c_oAscChartTypeSettings.hBarStackedPer3d, iconCls: 'bar-3d-pstack'},
{ group: 'menu-chart-group-area', type: Asc.c_oAscChartTypeSettings.areaNormal, iconCls: 'area-normal'},
{ group: 'menu-chart-group-area', type: Asc.c_oAscChartTypeSettings.areaStacked, iconCls: 'area-stack'},
{ group: 'menu-chart-group-area', type: Asc.c_oAscChartTypeSettings.areaStackedPer, iconCls: 'area-pstack'},
{ group: 'menu-chart-group-scatter', type: Asc.c_oAscChartTypeSettings.scatter, iconCls: 'point-normal'},
{ group: 'menu-chart-group-stock', type: Asc.c_oAscChartTypeSettings.stock, iconCls: 'stock-normal'}
// { group: 'menu-chart-group-surface', type: Asc.c_oAscChartTypeSettings.surfaceNormal, iconCls: 'surface-normal'},
// { group: 'menu-chart-group-surface', type: Asc.c_oAscChartTypeSettings.surfaceWireframe, iconCls: 'surface-wireframe'},
// { group: 'menu-chart-group-surface', type: Asc.c_oAscChartTypeSettings.contourNormal, iconCls: 'contour-normal'},
// { group: 'menu-chart-group-surface', type: Asc.c_oAscChartTypeSettings.contourWireframe, iconCls: 'contour-wireframe'}
];
},
getSparkGroupData: function(headername) {
return [
{ id: 'menu-chart-group-sparkcolumn', inline: true, headername: (headername) ? this.textSparks : undefined },
{ id: 'menu-chart-group-sparkline', inline: true },
{ id: 'menu-chart-group-sparkwin', inline: true }
];
},
getSparkData: function() {
return [
{ group: 'menu-chart-group-sparkcolumn', type: Asc.c_oAscSparklineType.Column, allowSelected: true, iconCls: 'spark-column', tip: this.textColumnSpark},
{ group: 'menu-chart-group-sparkline', type: Asc.c_oAscSparklineType.Line, allowSelected: true, iconCls: 'spark-line', tip: this.textLineSpark},
{ group: 'menu-chart-group-sparkwin', type: Asc.c_oAscSparklineType.Stacked, allowSelected: true, iconCls: 'spark-win', tip: this.textWinLossSpark}
];
}
}
})(), Common.define.chartData || {});
});

View file

@ -87,12 +87,12 @@ Common.Utils = _.extend(new(function() {
isSecure = /^https/i.test(window.location.protocol),
emailRe = /^(mailto:)?([a-z0-9'\._-]+@[a-z0-9\.-]+\.[a-z0-9]{2,4})([a-яё0-9\._%+-=\? :&]*)/i,
ipRe = /^(((https?)|(ftps?)):\/\/)?([\-\wа-яё]*:?[\-\wа-яё]*@)?(((1[0-9]{2}|2[0-4][0-9]|25[0-5]|[1-9][0-9]|[0-9])\.){3}(1[0-9]{2}|2[0-4][0-9]|25[0-5]|[1-9][0-9]|[0-9]))(:\d+)?(\/[%\-\wа-яё]*(\.[\wа-яё]{2,})?(([\wа-яё\-\.\?\\\/+@&#;:`~=%!,\(\)]*)(\.[\wа-яё]{2,})?)*)*\/?/i,
hostnameRe = /^(((https?)|(ftps?)):\/\/)?([\-\wа-яё]*:?[\-\wа-яё]*@)?(([\-\wа-яё]+\.)+[\wа-яё\-]{2,}(:\d+)?(\/[%\-\wа-яё]*(\.[\wа-яё]{2,})?(([\wа-яё\-\.\?\\\/+@&#;:`'~=%!,\(\)]*)(\.[\wа-яё]{2,})?)*)*\/?)/i,
localRe = /^(((https?)|(ftps?)):\/\/)([\-\wа-яё]*:?[\-\wа-яё]*@)?(([\-\wа-яё]+)(:\d+)?(\/[%\-\wа-яё]*(\.[\wа-яё]{2,})?(([\wа-яё\-\.\?\\\/+@&#;:`'~=%!,\(\)]*)(\.[\wа-яё]{2,})?)*)*\/?)/i,
hostnameRe = /^(((https?)|(ftps?)):\/\/)?([\-\wа-яё]*:?[\-\wа-яё]*@)?(([\-\wа-яё]+\.)+[\wа-яё\-]{2,}(:\d+)?(\/[%\-\wа-яё]*(\.[\wа-яё]{2,})?(([\wа-яё\-\.\?\\\/\+@&#;:`'~=%!,\(\)]*)(\.[\wа-яё]{2,})?)*)*\/?)/i,
localRe = /^(((https?)|(ftps?)):\/\/)([\-\wа-яё]*:?[\-\wа-яё]*@)?(([\-\wа-яё]+)(:\d+)?(\/[%\-\wа-яё]*(\.[\wа-яё]{2,})?(([\wа-яё\-\.\?\\\/\+@&#;:`'~=%!,\(\)]*)(\.[\wа-яё]{2,})?)*)*\/?)/i,
emailStrongRe = /(mailto:)?([a-z0-9'\._-]+@[a-z0-9\.-]+\.[a-z0-9]{2,4})([a-яё0-9\._%+-=\?:&]*)/ig,
emailAddStrongRe = /(mailto:|\s[@]|\s[+])?([a-z0-9'\._-]+@[a-z0-9\.-]+\.[a-z0-9]{2,4})([a-яё0-9\._%+-=\?:&]*)/ig,
ipStrongRe = /(((https?)|(ftps?)):\/\/([\-\wа-яё]*:?[\-\wа-яё]*@)?)(((1[0-9]{2}|2[0-4][0-9]|25[0-5]|[1-9][0-9]|[0-9])\.){3}(1[0-9]{2}|2[0-4][0-9]|25[0-5]|[1-9][0-9]|[0-9]))(:\d+)?(\/[%\-\wа-яё]*(\.[\wа-яё]{2,})?(([\wа-яё\-\.\?\\\/+@&#;:`~=%!,\(\)]*)(\.[\wа-яё]{2,})?)*)*\/?/ig,
hostnameStrongRe = /((((https?)|(ftps?)):\/\/([\-\wа-яё]*:?[\-\wа-яё]*@)?)|(([\-\wа-яё]*:?[\-\wа-яё]*@)?www\.))((([\-\wа-яё]+\.)+[\wа-яё\-]{2,}|([\-\wа-яё]+))(:\d+)?(\/[%\-\wа-яё]*(\.[\wа-яё]{2,})?(([\wа-яё\-\.\?\\\/+@&#;:`~=%!,\(\)]*)(\.[\wа-яё]{2,})?)*)*\/?)/ig,
emailAddStrongRe = /(mailto:|\s[@]|\s[+])?([a-z0-9'\._-]+@[a-z0-9\.-]+\.[a-z0-9]{2,4})([a-яё0-9\._%\+-=\?:&]*)/ig,
ipStrongRe = /(((https?)|(ftps?)):\/\/([\-\wа-яё]*:?[\-\wа-яё]*@)?)(((1[0-9]{2}|2[0-4][0-9]|25[0-5]|[1-9][0-9]|[0-9])\.){3}(1[0-9]{2}|2[0-4][0-9]|25[0-5]|[1-9][0-9]|[0-9]))(:\d+)?(\/[%\-\wа-яё]*(\.[\wа-яё]{2,})?(([\wа-яё\-\.\?\\\/\+@&#;:`~=%!,\(\)]*)(\.[\wа-яё]{2,})?)*)*\/?/ig,
hostnameStrongRe = /((((https?)|(ftps?)):\/\/([\-\wа-яё]*:?[\-\wа-яё]*@)?)|(([\-\wа-яё]*:?[\-\wа-яё]*@)?www\.))((([\-\wа-яё]+\.)+[\wа-яё\-]{2,}|([\-\wа-яё]+))(:\d+)?(\/[%\-\wа-яё]*(\.[\wа-яё]{2,})?(([\wа-яё\-\.\?\\\/\+@&#;:`~=%!,\(\)]*)(\.[\wа-яё]{2,})?)*)*\/?)/ig,
documentSettingsType = {
Paragraph : 0,
Table : 1,
@ -117,14 +117,12 @@ Common.Utils = _.extend(new(function() {
isMobile = /android|avantgo|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od|ad)|iris|kindle|lge |maemo|midp|mmp|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test(navigator.userAgent || navigator.vendor || window.opera),
me = this,
checkSize = function() {
me.zoom = 1;
if (isChrome && !isOpera && !isMobile && document && document.firstElementChild && document.body)
{
me.zoom = 1;
if (isChrome && !isOpera && !isMobile && document && document.firstElementChild && document.body) {
// делаем простую проверку
// считаем: 0 < window.devicePixelRatio < 2 => _devicePixelRatio = 1; zoom = window.devicePixelRatio / _devicePixelRatio;
// считаем: window.devicePixelRatio >= 2 => _devicePixelRatio = 2; zoom = window.devicePixelRatio / _devicePixelRatio;
if (window.devicePixelRatio > 0.1)
{
if (window.devicePixelRatio > 0.1) {
if (window.devicePixelRatio < 1.99)
{
var _devicePixelRatio = 1;
@ -137,11 +135,11 @@ Common.Utils = _.extend(new(function() {
}
// chrome 54.x: zoom = "reset" - clear retina zoom (windows)
//document.firstElementChild.style.zoom = "reset";
document.firstElementChild.style.zoom = 1.0 / me.zoom;
}
document.firstElementChild.style.zoom = 1.0 / me.zoom; }
else
document.firstElementChild.style.zoom = "normal";
}
}
me.innerWidth = window.innerWidth * me.zoom;
me.innerHeight = window.innerHeight * me.zoom;
};
@ -152,6 +150,8 @@ Common.Utils = _.extend(new(function() {
$(window).on('resize', checkSize);
return {
checkSize: checkSize,
userAgent: userAgent,
isStrict: isStrict,
isIEQuirks: isIE && (!isStrict && (isIE6 || isIE7 || isIE8 || isIE9)),
@ -846,6 +846,47 @@ Common.Utils.injectComponent = function ($slot, cmp) {
}
};
jQuery.fn.extend({
elementById: function (id, parent) {
/**
* usage: $obj.findById('#id')
* $().findById('#id', $obj | node)
* $.fn.findById('#id', $obj | node)
*
* return: dom element
* */
var _el = document.getElementById(id.substring(1));
if ( !_el ) {
parent = parent || this;
if ( parent instanceof jQuery ) {
parent.each(function (i, node) {
_el = node.querySelectorAll(id);
if ( _el.length == 0 ) {
if ( ('#' + node.id) == id ) {
_el = node;
return false;
}
} else
if ( _el.length ) {
_el = _el[0];
return false;
}
})
} else {
_el = parent.querySelectorAll(id);
if ( _el && _el.length ) return _el[0];
}
}
return _el;
},
findById: function (id, parent) {
var _el = $.fn.elementById.apply(this, arguments);
return !!_el ? $(_el) : $();
}
});
Common.Utils.InternalSettings.set('toolbar-height-tabs', 32);
Common.Utils.InternalSettings.set('toolbar-height-tabs-top-title', 28);
Common.Utils.InternalSettings.set('toolbar-height-controls', 67);

View file

@ -45,6 +45,7 @@ define([
Common.Views.About = Common.UI.BaseView.extend(_.extend({
menu: undefined,
rendered: false,
options: {
alias: 'Common.Views.About'
},
@ -152,81 +153,95 @@ define([
},
render: function() {
var el = $(this.el);
el.html(this.template({
publishername: '{{PUBLISHER_NAME}}',
publisheraddr: '{{PUBLISHER_ADDRESS}}',
publisherurl: '{{PUBLISHER_URL}}',
supportemail: '{{SUPPORT_EMAIL}}',
phonenum: '{{PUBLISHER_PHONE}}',
scope: this
}));
if ( !this.rendered ) {
this.rendered = true;
el.addClass('about-dlg');
this.cntLicenseeInfo = $('#id-about-licensee-info');
this.cntLicensorInfo = $('#id-about-licensor-info');
this.divCompanyLogo = $('#id-about-company-logo');
this.lblCompanyName = $('#id-about-company-name');
this.lblCompanyAddress = $('#id-about-company-address');
this.lblCompanyMail = $('#id-about-company-mail');
this.lblCompanyUrl = $('#id-about-company-url');
this.lblCompanyLic = $('#id-about-company-lic');
var _$l = $(this.template({
publishername: '{{PUBLISHER_NAME}}',
publisheraddr: '{{PUBLISHER_ADDRESS}}',
publisherurl: '{{PUBLISHER_URL}}',
supportemail: '{{SUPPORT_EMAIL}}',
phonenum: '{{PUBLISHER_PHONE}}',
scope: this
}));
if (_.isUndefined(this.scroller)) {
this.scroller = new Common.UI.Scroller({
el: $(this.el),
suppressScrollX: true
});
this.cntLicenseeInfo = _$l.findById('#id-about-licensee-info');
this.cntLicensorInfo = _$l.findById('#id-about-licensor-info');
this.divCompanyLogo = _$l.findById('#id-about-company-logo');
this.lblCompanyName = _$l.findById('#id-about-company-name');
this.lblCompanyAddress = _$l.findById('#id-about-company-address');
this.lblCompanyMail = _$l.findById('#id-about-company-mail');
this.lblCompanyUrl = _$l.findById('#id-about-company-url');
this.lblCompanyLic = _$l.findById('#id-about-company-lic');
this.$el.html(_$l);
this.$el.addClass('about-dlg');
if ( this.licData )
this.setLicInfo(this.licData);
if (_.isUndefined(this.scroller)) {
this.scroller = new Common.UI.Scroller({
el: this.$el,
suppressScrollX: true
});
}
}
return this;
},
setLicInfo: function(data){
if (data && typeof data == 'object' && typeof(data.customer)=='object') {
var customer = data.customer;
$('#id-about-licensor-logo').addClass('hidden');
$('#id-about-licensor-short').removeClass('hidden');
this.cntLicensorInfo.addClass('hidden');
if ( !this.rendered ) {
this.licData = data || true;
} else {
if (data && typeof data == 'object' && typeof(data.customer)=='object') {
var customer = data.customer;
this.cntLicenseeInfo.removeClass('hidden');
this.cntLicensorInfo.removeClass('margin-bottom');
$('#id-about-licensor-logo').addClass('hidden');
$('#id-about-licensor-short').removeClass('hidden');
this.cntLicensorInfo.addClass('hidden');
var value = customer.name;
value && value.length ?
this.cntLicenseeInfo.removeClass('hidden');
this.cntLicensorInfo.removeClass('margin-bottom');
var value = customer.name;
value && value.length ?
this.lblCompanyName.text(value) :
this.lblCompanyName.parents('tr').addClass('hidden');
value = customer.address;
value && value.length ?
value = customer.address;
value && value.length ?
this.lblCompanyAddress.text(value) :
this.lblCompanyAddress.parents('tr').addClass('hidden');
(value = customer.mail) && value.length ?
(value = customer.mail) && value.length ?
this.lblCompanyMail.attr('href', "mailto:"+value).text(value) :
this.lblCompanyMail.parents('tr').addClass('hidden');
if ((value = customer.www) && value.length) {
var http = !/^https?:\/{2}/i.test(value) ? "http:\/\/" : '';
this.lblCompanyUrl.attr('href', http+value).text(value);
} else
this.lblCompanyUrl.parents('tr').addClass('hidden');
if ((value = customer.www) && value.length) {
var http = !/^https?:\/{2}/i.test(value) ? "http:\/\/" : '';
this.lblCompanyUrl.attr('href', http+value).text(value);
} else
this.lblCompanyUrl.parents('tr').addClass('hidden');
(value = customer.info) && value.length ?
(value = customer.info) && value.length ?
this.lblCompanyLic.text(value) :
this.lblCompanyLic.parents('tr').addClass('hidden');
(value = customer.logo) && value.length ?
(value = customer.logo) && value.length ?
this.divCompanyLogo.html('<img src="'+value+'" style="max-width:216px; max-height: 35px;" />') :
this.divCompanyLogo.parents('tr').addClass('hidden');
} else {
this.cntLicenseeInfo.addClass('hidden');
this.cntLicensorInfo.addClass('margin-bottom');
} else {
this.cntLicenseeInfo.addClass('hidden');
this.cntLicensorInfo.addClass('margin-bottom');
}
}
},
show: function () {
if ( !this.rendered ) this.render();
Common.UI.BaseView.prototype.show.call(this,arguments);
this.fireEvent('show', this );
},

View file

@ -51,7 +51,8 @@ define([
cls: 'advanced-settings-dlg',
toggleGroup: 'advanced-settings-group',
contentTemplate: '',
items: []
items: [],
buttons: ['ok', 'cancel']
}, options);
this.template = options.template || [
@ -64,11 +65,7 @@ define([
'<div class="separator"/>',
'<div class="content-panel" >' + _options.contentTemplate + '</div>',
'</div>',
'<div class="separator horizontal"/>',
'<div class="footer center">',
'<button class="btn normal dlg-btn primary" result="ok" style="margin-right: 10px;">' + this.okButtonText + '</button>',
'<button class="btn normal dlg-btn" result="cancel">' + this.cancelButtonText + '</button>',
'</div>'
'<div class="separator horizontal"/>'
].join('');
_options.tpl = _.template(this.template)(_options);
@ -190,9 +187,6 @@ define([
if (this.storageName)
Common.localStorage.setItem(this.storageName, this.getActiveCategory());
Common.UI.Window.prototype.close.call(this, suppressevent);
},
cancelButtonText: 'Cancel',
okButtonText : 'Ok'
}
}, Common.Views.AdvancedSettingsWindow || {}));
});

View file

@ -208,7 +208,7 @@ define([
var user = this.storeUsers.findOriginalUser(m.get('userid'));
m.set({
usercolor : user ? user.get('color') : null,
message : this._pickLink(Common.Utils.String.htmlEncode(m.get('message')))
message : this._pickLink(m.get('message'))
}, {silent:true});
},
@ -216,6 +216,9 @@ define([
var arr = [], offset, len;
message.replace(Common.Utils.ipStrongRe, function(subStr) {
var result = /[\.,\?\+;:=!\(\)]+$/.exec(subStr);
if (result)
subStr = subStr.substring(0, result.index);
offset = arguments[arguments.length-2];
arr.push({start: offset, end: subStr.length+offset, str: '<a href="' + subStr + '" target="_blank" data-can-copy="true">' + subStr + '</a>'});
return '';
@ -223,6 +226,9 @@ define([
if (message.length<1000 || message.search(/\S{255,}/)<0)
message.replace(Common.Utils.hostnameStrongRe, function(subStr) {
var result = /[\.,\?\+;:=!\(\)]+$/.exec(subStr);
if (result)
subStr = subStr.substring(0, result.index);
var ref = (! /(((^https?)|(^ftp)):\/\/)/i.test(subStr) ) ? ('http://' + subStr) : subStr;
offset = arguments[arguments.length-2];
len = subStr.length;
@ -250,14 +256,13 @@ define([
arr = _.sortBy(arr, function(item){ return item.start; });
var str_res = (arr.length>0) ? ( message.substring(0, arr[0].start) + arr[0].str) : message;
var str_res = (arr.length>0) ? ( Common.Utils.String.htmlEncode(message.substring(0, arr[0].start)) + arr[0].str) : Common.Utils.String.htmlEncode(message);
for (var i=1; i<arr.length; i++) {
str_res += (message.substring(arr[i-1].end, arr[i].start) + arr[i].str);
str_res += (Common.Utils.String.htmlEncode(message.substring(arr[i-1].end, arr[i].start)) + arr[i].str);
}
if (arr.length>0) {
str_res += message.substring(arr[i-1].end, message.length);
str_res += Common.Utils.String.htmlEncode(message.substring(arr[i-1].end, message.length));
}
return str_res;
},

View file

@ -72,6 +72,99 @@ define([
return tpl;
}
var CommentsPanelDataView = Common.UI.DataView.extend((function() {
return {
options : {
handleSelect: false,
scrollable: true,
listenStoreEvents: false,
template: _.template('<div class="dataview-ct inner"></div>')
},
getTextBox: function () {
var text = $(this.el).find('textarea');
return (text && text.length) ? text : undefined;
},
setFocusToTextBox: function () {
var text = $(this.el).find('textarea');
if (text && text.length) {
var val = text.val();
text.focus();
text.val('');
text.val(val);
}
},
getActiveTextBoxVal: function () {
var text = $(this.el).find('textarea');
return (text && text.length) ? text.val().trim() : '';
},
autoHeightTextBox: function () {
var view = this,
textBox = $(this.el).find('textarea'),
domTextBox = null,
minHeight = 50,
lineHeight = 0,
scrollPos = 0,
oldHeight = 0,
newHeight = 0;
function updateTextBoxHeight() {
if (domTextBox.scrollHeight > domTextBox.clientHeight) {
textBox.css({height: (domTextBox.scrollHeight + lineHeight) + 'px'});
} else {
oldHeight = domTextBox.clientHeight;
if (oldHeight >= minHeight) {
textBox.css({height: minHeight + 'px'});
if (domTextBox.scrollHeight > domTextBox.clientHeight) {
newHeight = Math.max(domTextBox.scrollHeight + lineHeight, minHeight);
textBox.css({height: newHeight + 'px'});
}
}
}
view.autoScrollToEditButtons();
}
if (textBox && textBox.length) {
domTextBox = textBox.get(0);
if (domTextBox) {
lineHeight = parseInt(textBox.css('lineHeight'), 10) * 0.25;
updateTextBoxHeight();
textBox.bind('input propertychange', updateTextBoxHeight)
}
}
this.textBox = textBox;
},
clearTextBoxBind: function () {
if (this.textBox) {
this.textBox.unbind('input propertychange');
this.textBox = undefined;
}
},
autoScrollToEditButtons: function () {
var button = $('#id-comments-change'), // TODO: add to cache
btnBounds = null,
contentBounds = this.el.getBoundingClientRect(),
moveY = 0,
padding = 7;
if (button.length) {
btnBounds = button.get(0).getBoundingClientRect();
if (btnBounds && contentBounds) {
moveY = contentBounds.bottom - (btnBounds.bottom + padding);
if (moveY < 0) {
this.scroller.scrollTop(this.scroller.getScrollTop() - moveY);
}
}
}
}
}
})());
Common.Views.Comments = Common.UI.BaseView.extend(_.extend({
el: '#left-panel-comments',
template: _.template(panelTemplate),
@ -81,11 +174,126 @@ define([
textBoxAutoSizeLocked: undefined, // disable autosize textbox
viewmode: false,
_commentsViewOnItemClick: function (picker, item, record, e) {
var me = this;
var btn, showEditBox, showReplyBox, commentId, replyId, hideAddReply;
function readdresolves() {
me.update();
}
btn = $(e.target);
if (btn) {
showEditBox = record.get('editText');
showReplyBox = record.get('showReply');
commentId = record.get('uid');
replyId = btn.attr('data-value');
if (btn.hasClass('btn-edit')) {
if (!_.isUndefined(replyId)) {
me.fireEvent('comment:closeEditing', [commentId]);
me.fireEvent('comment:editReply', [commentId, replyId]);
me.commentsView.reply = replyId;
picker.autoHeightTextBox();
readdresolves();
me.hookTextBox();
picker.autoScrollToEditButtons();
picker.setFocusToTextBox();
} else {
if (!showEditBox) {
me.fireEvent('comment:closeEditing');
record.set('editText', true);
picker.autoHeightTextBox();
readdresolves();
picker.setFocusToTextBox();
me.hookTextBox();
}
}
} else if (btn.hasClass('btn-delete')) {
if (!_.isUndefined(replyId)) {
me.fireEvent('comment:removeReply', [commentId, replyId]);
} else {
me.fireEvent('comment:remove', [commentId]);
Common.NotificationCenter.trigger('edit:complete', me);
}
me.fireEvent('comment:closeEditing');
readdresolves();
} else if (btn.hasClass('user-reply')) {
me.fireEvent('comment:closeEditing');
record.set('showReply', true);
readdresolves();
picker.autoHeightTextBox();
me.hookTextBox();
picker.autoScrollToEditButtons();
picker.setFocusToTextBox();
} else if (btn.hasClass('btn-reply', false)) {
if (showReplyBox) {
me.fireEvent('comment:addReply', [commentId, picker.getActiveTextBoxVal()]);
me.fireEvent('comment:closeEditing');
readdresolves();
}
} else if (btn.hasClass('btn-close', false)) {
me.fireEvent('comment:closeEditing', [commentId]);
} else if (btn.hasClass('btn-inner-edit', false)) {
if (!_.isUndefined(me.commentsView.reply)) {
me.fireEvent('comment:changeReply', [commentId, me.commentsView.reply, picker.getActiveTextBoxVal()]);
me.commentsView.reply = undefined;
} else if (showEditBox) {
me.fireEvent('comment:change', [commentId, picker.getActiveTextBoxVal()]);
}
me.fireEvent('comment:closeEditing');
readdresolves();
} else if (btn.hasClass('btn-inner-close', false)) {
me.fireEvent('comment:closeEditing');
me.commentsView.reply = undefined;
readdresolves();
} else if (btn.hasClass('btn-resolve', false)) {
var tip = btn.data('bs.tooltip');
if (tip) tip.dontShow = true;
me.fireEvent('comment:resolve', [commentId]);
readdresolves();
} else if (btn.hasClass('btn-resolve-check', false)) {
var tip = btn.data('bs.tooltip');
if (tip) tip.dontShow = true;
me.fireEvent('comment:resolve', [commentId]);
readdresolves();
} else if (!btn.hasClass('msg-reply') &&
!btn.hasClass('btn-resolve-check') &&
!btn.hasClass('btn-resolve')) {
me.fireEvent('comment:show', [commentId, false]);
}
}
},
initialize: function (options) {
Common.UI.BaseView.prototype.initialize.call(this, options);
this.store = this.options.store;
},
render: function () {
var me = this;
@ -134,255 +342,51 @@ define([
}
});
}
var CommentsPanelDataView = Common.UI.DataView.extend((function() {
return {
if (this.commentsView) {
this.commentsView.onResetItems();
} else {
this.commentsView = new CommentsPanelDataView({
el: $('.messages-ct',me.el),
store: me.store,
itemTemplate: _.template(replaceWords(commentsTemplate, {
textAddReply: me.textAddReply,
textAdd: me.textAdd,
textCancel: me.textCancel,
textEdit: me.textEdit,
textReply: me.textReply,
textClose: me.textClose,
maxCommLength: Asc.c_oAscMaxCellOrCommentLength
}))
});
options : {
handleSelect: false,
scrollable: true,
listenStoreEvents: false,
template: _.template('<div class="dataview-ct inner"></div>')
},
getTextBox: function () {
var text = $(this.el).find('textarea');
return (text && text.length) ? text : undefined;
},
setFocusToTextBox: function () {
var text = $(this.el).find('textarea');
if (text && text.length) {
var val = text.val();
text.focus();
text.val('');
text.val(val);
}
},
getActiveTextBoxVal: function () {
var text = $(this.el).find('textarea');
return (text && text.length) ? text.val().trim() : '';
},
autoHeightTextBox: function () {
var view = this,
textBox = $(this.el).find('textarea'),
domTextBox = null,
minHeight = 50,
lineHeight = 0,
scrollPos = 0,
oldHeight = 0,
newHeight = 0;
function updateTextBoxHeight() {
if (domTextBox.scrollHeight > domTextBox.clientHeight) {
textBox.css({height: (domTextBox.scrollHeight + lineHeight) + 'px'});
} else {
oldHeight = domTextBox.clientHeight;
if (oldHeight >= minHeight) {
textBox.css({height: minHeight + 'px'});
if (domTextBox.scrollHeight > domTextBox.clientHeight) {
newHeight = Math.max(domTextBox.scrollHeight + lineHeight, minHeight);
textBox.css({height: newHeight + 'px'});
}
}
}
view.autoScrollToEditButtons();
}
if (textBox && textBox.length) {
domTextBox = textBox.get(0);
if (domTextBox) {
lineHeight = parseInt(textBox.css('lineHeight'), 10) * 0.25;
updateTextBoxHeight();
textBox.bind('input propertychange', updateTextBoxHeight)
}
}
this.textBox = textBox;
},
clearTextBoxBind: function () {
if (this.textBox) {
this.textBox.unbind('input propertychange');
this.textBox = undefined;
}
},
autoScrollToEditButtons: function () {
var button = $('#id-comments-change'), // TODO: add to cache
btnBounds = null,
contentBounds = this.el.getBoundingClientRect(),
moveY = 0,
padding = 7;
if (button.length) {
btnBounds = button.get(0).getBoundingClientRect();
if (btnBounds && contentBounds) {
moveY = contentBounds.bottom - (btnBounds.bottom + padding);
if (moveY < 0) {
this.scroller.scrollTop(this.scroller.getScrollTop() - moveY);
}
}
}
var addtooltip = function (dataview, view, record) {
if (view.tipsArray) {
view.tipsArray.forEach(function(item){
item.remove();
});
}
}
})());
if (CommentsPanelDataView) {
if (this.commentsView) {
this.commentsView.onResetItems();
} else {
this.commentsView = new CommentsPanelDataView({
el: $('.messages-ct',me.el),
store: me.store,
itemTemplate: _.template(replaceWords(commentsTemplate, {
textAddReply: me.textAddReply,
textAdd: me.textAdd,
textCancel: me.textCancel,
textEdit: me.textEdit,
textReply: me.textReply,
textClose: me.textClose,
maxCommLength: Asc.c_oAscMaxCellOrCommentLength
}))
var arr = [],
btns = $(view.el).find('.btn-resolve');
btns.tooltip({title: me.textResolve, placement: 'cursor'});
btns.each(function(idx, item){
arr.push($(item).data('bs.tooltip').tip());
});
var addtooltip = function (dataview, view, record) {
if (view.tipsArray) {
view.tipsArray.forEach(function(item){
item.remove();
});
}
var arr = [],
btns = $(view.el).find('.btn-resolve');
btns.tooltip({title: me.textResolve, placement: 'cursor'});
btns.each(function(idx, item){
arr.push($(item).data('bs.tooltip').tip());
});
btns = $(view.el).find('.btn-resolve-check');
btns.tooltip({title: me.textOpenAgain, placement: 'cursor'});
btns.each(function(idx, item){
arr.push($(item).data('bs.tooltip').tip());
});
view.tipsArray = arr;
};
this.commentsView.on('item:add', addtooltip);
this.commentsView.on('item:remove', addtooltip);
this.commentsView.on('item:change', addtooltip);
this.commentsView.on('item:click', function (picker, item, record, e) {
var btn, showEditBox, showReplyBox, commentId, replyId, hideAddReply;
function readdresolves() {
me.update();
}
btn = $(e.target);
if (btn) {
showEditBox = record.get('editText');
showReplyBox = record.get('showReply');
commentId = record.get('uid');
replyId = btn.attr('data-value');
if (btn.hasClass('btn-edit')) {
if (!_.isUndefined(replyId)) {
me.fireEvent('comment:closeEditing', [commentId]);
me.fireEvent('comment:editReply', [commentId, replyId]);
me.commentsView.reply = replyId;
this.autoHeightTextBox();
readdresolves();
me.hookTextBox();
this.autoScrollToEditButtons();
this.setFocusToTextBox();
} else {
if (!showEditBox) {
me.fireEvent('comment:closeEditing');
record.set('editText', true);
this.autoHeightTextBox();
readdresolves();
this.setFocusToTextBox();
me.hookTextBox();
}
}
} else if (btn.hasClass('btn-delete')) {
if (!_.isUndefined(replyId)) {
me.fireEvent('comment:removeReply', [commentId, replyId]);
} else {
me.fireEvent('comment:remove', [commentId]);
Common.NotificationCenter.trigger('edit:complete', me);
}
me.fireEvent('comment:closeEditing');
readdresolves();
} else if (btn.hasClass('user-reply')) {
me.fireEvent('comment:closeEditing');
record.set('showReply', true);
readdresolves();
this.autoHeightTextBox();
me.hookTextBox();
this.autoScrollToEditButtons();
this.setFocusToTextBox();
} else if (btn.hasClass('btn-reply', false)) {
if (showReplyBox) {
me.fireEvent('comment:addReply', [commentId, this.getActiveTextBoxVal()]);
me.fireEvent('comment:closeEditing');
readdresolves();
}
} else if (btn.hasClass('btn-close', false)) {
me.fireEvent('comment:closeEditing', [commentId]);
} else if (btn.hasClass('btn-inner-edit', false)) {
if (!_.isUndefined(me.commentsView.reply)) {
me.fireEvent('comment:changeReply', [commentId, me.commentsView.reply, this.getActiveTextBoxVal()]);
me.commentsView.reply = undefined;
} else if (showEditBox) {
me.fireEvent('comment:change', [commentId, this.getActiveTextBoxVal()]);
}
me.fireEvent('comment:closeEditing');
readdresolves();
} else if (btn.hasClass('btn-inner-close', false)) {
me.fireEvent('comment:closeEditing');
me.commentsView.reply = undefined;
readdresolves();
} else if (btn.hasClass('btn-resolve', false)) {
var tip = btn.data('bs.tooltip');
if (tip) tip.dontShow = true;
me.fireEvent('comment:resolve', [commentId]);
readdresolves();
} else if (btn.hasClass('btn-resolve-check', false)) {
var tip = btn.data('bs.tooltip');
if (tip) tip.dontShow = true;
me.fireEvent('comment:resolve', [commentId]);
readdresolves();
} else if (!btn.hasClass('msg-reply') &&
!btn.hasClass('btn-resolve-check') &&
!btn.hasClass('btn-resolve')) {
me.fireEvent('comment:show', [commentId, false]);
}
}
btns = $(view.el).find('.btn-resolve-check');
btns.tooltip({title: me.textOpenAgain, placement: 'cursor'});
btns.each(function(idx, item){
arr.push($(item).data('bs.tooltip').tip());
});
}
view.tipsArray = arr;
};
this.commentsView.on({
'item:add': addtooltip,
'item:remove': addtooltip,
'item:change': addtooltip,
'item:click': this._commentsViewOnItemClick.bind(this)
});
}
if (!this.rendered) this.setupLayout();
@ -482,7 +486,7 @@ define([
},
setupLayout: function () {
var me = this, parent = $(me.el);
var me = this, parent = me.$el;
var add = $('.new-comment-ct', me.el),
to = $('.add-link-ct', me.el),
@ -555,9 +559,13 @@ define([
add = $('.new-comment-ct', this.el),
to = $('.add-link-ct', this.el),
msgs = $('.messages-ct', this.el);
msgs.toggleClass('stretch', !mode.canComments);
if (!mode.canComments) {
add.hide(); to.hide();
msgs.toggleClass('stretch', !mode.canComments || mode.compatibleFeatures);
if (!mode.canComments || mode.compatibleFeatures) {
if (mode.compatibleFeatures) {
add.remove(); to.remove();
} else {
add.hide(); to.hide();
}
this.layout.changeLayout([{el: msgs[0], rely: false, stretch: true}]);
} else {
var container = $('#comments-box', this.el),
@ -652,9 +660,10 @@ define([
pickLink: function (message) {
var arr = [], offset, len;
message = Common.Utils.String.htmlEncode(message);
message.replace(Common.Utils.ipStrongRe, function(subStr) {
var result = /[\.,\?\+;:=!\(\)]+$/.exec(subStr);
if (result)
subStr = subStr.substring(0, result.index);
offset = arguments[arguments.length-2];
arr.push({start: offset, end: subStr.length+offset, str: '<a href="' + subStr + '" target="_blank" data-can-copy="true">' + subStr + '</a>'});
return '';
@ -662,6 +671,9 @@ define([
if (message.length<1000 || message.search(/\S{255,}/)<0)
message.replace(Common.Utils.hostnameStrongRe, function(subStr) {
var result = /[\.,\?\+;:=!\(\)]+$/.exec(subStr);
if (result)
subStr = subStr.substring(0, result.index);
var ref = (! /(((^https?)|(^ftp)):\/\/)/i.test(subStr) ) ? ('http://' + subStr) : subStr;
offset = arguments[arguments.length-2];
len = subStr.length;
@ -689,14 +701,13 @@ define([
arr = _.sortBy(arr, function(item){ return item.start; });
var str_res = (arr.length>0) ? ( message.substring(0, arr[0].start) + arr[0].str) : message;
var str_res = (arr.length>0) ? ( Common.Utils.String.htmlEncode(message.substring(0, arr[0].start)) + arr[0].str) : Common.Utils.String.htmlEncode(message);
for (var i=1; i<arr.length; i++) {
str_res += (message.substring(arr[i-1].end, arr[i].start) + arr[i].str);
str_res += (Common.Utils.String.htmlEncode(message.substring(arr[i-1].end, arr[i].start)) + arr[i].str);
}
if (arr.length>0) {
str_res += message.substring(arr[i-1].end, message.length);
str_res += Common.Utils.String.htmlEncode(message.substring(arr[i-1].end, message.length));
}
return str_res;
},

View file

@ -50,12 +50,14 @@ define([
options: {
width : 500,
height : 325,
cls : 'modal-dlg copy-warning'
cls : 'modal-dlg copy-warning',
buttons: ['ok']
},
initialize : function(options) {
_.extend(this.options, {
title: this.textTitle
title: this.textTitle,
buttons: ['ok']
}, options || {});
this.template = [
@ -77,10 +79,7 @@ define([
'</div>',
'<div id="copy-warning-checkbox" style="margin-top: 20px; text-align: left;"></div>',
'</div>',
'<div class="separator horizontal"/>',
'<div class="footer center">',
'<button class="btn normal dlg-btn primary">' + this.okButtonText + '</button>',
'</div>'
'<div class="separator horizontal"/>'
].join('');
this.options.tpl = _.template(this.template)(this.options);

View file

@ -286,7 +286,6 @@ define([
return false;
},
cancelButtonText: 'Cancel',
addButtonText: 'Add',
textNew: 'New',
textCurrent: 'Current',

View file

@ -61,7 +61,7 @@ define([
'</div>',
'<div class="separator horizontal"/>',
'<div class="footer" style="text-align: center;">',
'<button id="id-btn-diagram-editor-apply" class="btn normal dlg-btn primary custom" result="ok" style="margin-right: 10px;">' + this.textSave + '</button>',
'<button id="id-btn-diagram-editor-apply" class="btn normal dlg-btn primary custom" result="ok">' + this.textSave + '</button>',
'<button id="id-btn-diagram-editor-cancel" class="btn normal dlg-btn" result="cancel">' + this.textClose + '</button>',
'</div>'
].join('');
@ -88,6 +88,11 @@ define([
this.$window.find('.dlg-btn').on('click', _.bind(this.onDlgBtnClick, this));
},
show: function() {
this.setPlaceholder();
Common.UI.Window.prototype.show.apply(this, arguments);
},
setChartData: function(data) {
this._chartData = data;
if (this._isExternalDocReady)
@ -143,6 +148,14 @@ define([
}
},
setPlaceholder: function(placeholder) {
this._placeholder = placeholder;
},
getPlaceholder: function() {
return this._placeholder;
},
textSave: 'Save & Exit',
textClose: 'Close',
textTitle: 'Chart Editor'

View file

@ -61,7 +61,7 @@ define([
'</div>',
'<div class="separator horizontal"/>',
'<div class="footer" style="text-align: center;">',
'<button id="id-btn-merge-editor-apply" class="btn normal dlg-btn primary custom" result="ok" style="margin-right: 10px;">' + this.textSave + '</button>',
'<button id="id-btn-merge-editor-apply" class="btn normal dlg-btn primary custom" result="ok">' + this.textSave + '</button>',
'<button id="id-btn-merge-editor-cancel" class="btn normal dlg-btn disabled" result="cancel">' + this.textClose + '</button>',
'</div>'
].join('');

View file

@ -74,7 +74,7 @@ define([
var templateRightBox = '<section>' +
'<section id="box-doc-name">' +
'<input type="text" id="rib-doc-name" spellcheck="false" data-can-copy="false" style="pointer-events: none;">' +
'<input type="text" id="rib-doc-name" spellcheck="false" data-can-copy="false" style="pointer-events: none;" disabled="disabled">' +
'</section>' +
'<a id="rib-save-status" class="status-label locked"><%= textSaveEnd %></a>' +
'<div class="hedset">' +
@ -86,7 +86,7 @@ define([
// '<span class="btn-slot text" id="slot-btn-users"></span>' +
'<section id="tlb-box-users" class="box-cousers dropdown"">' +
'<div class="btn-users">' +
'<svg class="icon"><use xlink:href="#svg-btn-users"></use></svg>' +
'<i class="icon toolbar__icon icon--inverse btn-users"></i>' +
'<label class="caption">&plus;</label>' +
'</div>' +
'<div class="cousers-menu dropdown-menu">' +
@ -116,7 +116,7 @@ define([
'<div class="btn-slot" id="slot-btn-dt-redo"></div>' +
'</div>' +
'<div class="lr-separator"></div>' +
'<input type="text" id="title-doc-name" spellcheck="false" data-can-copy="false" style="pointer-events: none;">' +
'<input type="text" id="title-doc-name" spellcheck="false" data-can-copy="false" style="pointer-events: none;" disabled="disabled">' +
'<label id="title-user-name" style="pointer-events: none;"></label>' +
'</section>';
@ -166,7 +166,7 @@ define([
.removeClass('dropdown-toggle')
.menu = false;
$panelUsers[(!_readonlyRights && appConfig && !appConfig.isReviewOnly && appConfig.sharingSettingsUrl && appConfig.sharingSettingsUrl.length) ? 'show' : 'hide']();
$panelUsers[(!_readonlyRights && appConfig && (appConfig.sharingSettingsUrl && appConfig.sharingSettingsUrl.length || appConfig.canRequestSharingSettings)) ? 'show' : 'hide']();
}
$btnUsers.find('.caption')
@ -183,14 +183,14 @@ define([
function onLostEditRights() {
_readonlyRights = true;
$panelUsers.find('#tlb-change-rights').hide();
$panelUsers && $panelUsers.find('#tlb-change-rights').hide();
$btnUsers && !$btnUsers.menu && $panelUsers.hide();
}
function onUsersClick(e) {
if ( !$btnUsers.menu ) {
$panelUsers.removeClass('open');
this.fireEvent('click:users', this);
Common.NotificationCenter.trigger('collaboration:sharing');
} else {
var usertip = $btnUsers.data('bs.tooltip');
if ( usertip ) {
@ -245,11 +245,11 @@ define([
var $labelChangeRights = $panelUsers.find('#tlb-change-rights');
$labelChangeRights.on('click', function(e) {
$panelUsers.removeClass('open');
me.fireEvent('click:users', me);
Common.NotificationCenter.trigger('collaboration:sharing');
});
$labelChangeRights[(!mode.isOffline && !mode.isReviewOnly && mode.sharingSettingsUrl && mode.sharingSettingsUrl.length)?'show':'hide']();
$panelUsers[(editingUsers > 1 || editingUsers > 0 && !appConfig.isEdit && !appConfig.isRestrictedEdit || !mode.isOffline && !mode.isReviewOnly && mode.sharingSettingsUrl && mode.sharingSettingsUrl.length) ? 'show' : 'hide']();
$labelChangeRights[(!mode.isOffline && (mode.sharingSettingsUrl && mode.sharingSettingsUrl.length || mode.canRequestSharingSettings))?'show':'hide']();
$panelUsers[(editingUsers > 1 || editingUsers > 0 && !appConfig.isEdit && !appConfig.isRestrictedEdit || !mode.isOffline && (mode.sharingSettingsUrl && mode.sharingSettingsUrl.length || mode.canRequestSharingSettings)) ? 'show' : 'hide']();
if ( $saveStatus ) {
$saveStatus.attr('data-width', me.textSaveExpander);
@ -397,7 +397,7 @@ define([
me.btnGoBack = new Common.UI.Button({
id: 'btn-goback',
cls: 'btn-header',
iconCls: 'svgicon svg-btn-goback',
iconCls: 'toolbar__icon icon--inverse btn-goback',
split: true
});
@ -410,7 +410,7 @@ define([
me.btnOptions = new Common.UI.Button({
cls: 'btn-header no-caret',
iconCls: 'svgicon svg-btn-options',
iconCls: 'toolbar__icon icon--inverse btn-ic-options',
menu: true
});
@ -437,7 +437,7 @@ define([
function createTitleButton(iconid, slot, disabled) {
return (new Common.UI.Button({
cls: 'btn-header',
iconCls: 'svgicon ' + iconid,
iconCls: iconid,
disabled: disabled === true
})).render(slot);
}
@ -489,13 +489,13 @@ define([
if ( !config.isEdit ) {
if ( (config.canDownload || config.canDownloadOrigin) && !config.isOffline )
this.btnDownload = createTitleButton('svg-btn-download', $html.find('#slot-hbtn-download'));
this.btnDownload = createTitleButton('toolbar__icon icon--inverse btn-download', $html.findById('#slot-hbtn-download'));
if ( config.canPrint )
this.btnPrint = createTitleButton('svg-btn-print', $html.find('#slot-hbtn-print'));
this.btnPrint = createTitleButton('toolbar__icon icon--inverse btn-print', $html.findById('#slot-hbtn-print'));
if ( config.canEdit && config.canRequestEditRights )
this.btnEdit = createTitleButton('svg-btn-edit', $html.find('#slot-hbtn-edit'));
this.btnEdit = createTitleButton('toolbar__icon icon--inverse btn-edit', $html.findById('#slot-hbtn-edit'));
}
me.btnOptions.render($html.find('#slot-btn-options'));
@ -519,15 +519,15 @@ define([
me.setUserName(me.options.userName);
if ( config.canPrint && config.isEdit ) {
me.btnPrint = createTitleButton('svg-btn-print', $('#slot-btn-dt-print', $html), true);
me.btnPrint = createTitleButton('toolbar__icon icon--inverse btn-print', $html.findById('#slot-btn-dt-print'), true);
}
me.btnSave = createTitleButton('svg-btn-save', $('#slot-btn-dt-save', $html), true);
me.btnUndo = createTitleButton('svg-btn-undo', $('#slot-btn-dt-undo', $html), true);
me.btnRedo = createTitleButton('svg-btn-redo', $('#slot-btn-dt-redo', $html), true);
me.btnSave = createTitleButton('toolbar__icon icon--inverse btn-save', $html.findById('#slot-btn-dt-save'), true);
me.btnUndo = createTitleButton('toolbar__icon icon--inverse btn-undo', $html.findById('#slot-btn-dt-undo'), true);
me.btnRedo = createTitleButton('toolbar__icon icon--inverse btn-redo', $html.findById('#slot-btn-dt-redo'), true);
if ( me.btnSave.$icon.is('svg') ) {
me.btnSave.$icon.addClass('icon-save');
me.btnSave.$icon.addClass('icon-save btn-save');
var _create_use = function (extid, intid) {
var _use = document.createElementNS('http://www.w3.org/2000/svg', 'use');
_use.setAttributeNS('http://www.w3.org/1999/xlink', 'xlink:href', extid);

View file

@ -46,7 +46,8 @@ define([
options: {
width: 330,
header: false,
cls: 'modal-dlg'
cls: 'modal-dlg',
buttons: ['ok', 'cancel']
},
initialize : function(options) {
@ -55,13 +56,9 @@ define([
this.template = [
'<div class="box">',
'<div class="input-row">',
'<label>' + this.textUrl + '</label>',
'<label>' + (this.options.title || this.textUrl) + '</label>',
'</div>',
'<div id="id-dlg-url" class="input-row"></div>',
'</div>',
'<div class="footer right">',
'<button class="btn normal dlg-btn primary" result="ok" style="margin-right: 10px;">' + this.okButtonText + '</button>',
'<button class="btn normal dlg-btn" result="cancel">' + this.cancelButtonText + '</button>',
'</div>'
].join('');
@ -95,7 +92,7 @@ define([
var me = this;
_.delay(function(){
me.getChild('input').focus();
},500);
},100);
},
onPrimary: function(event) {
@ -123,8 +120,6 @@ define([
},
textUrl : 'Paste an image URL:',
cancelButtonText: 'Cancel',
okButtonText : 'Ok',
txtEmpty : 'This field is required',
txtNotUrl : 'This field should be a URL in the format \"http://www.example.com\"'
}, Common.Views.ImageFromUrlDialog || {}));

View file

@ -51,7 +51,8 @@ define([
height: 156,
style: 'min-width: 230px;',
cls: 'modal-dlg',
split: false
split: false,
buttons: ['ok', 'cancel']
},
initialize : function(options) {
@ -67,10 +68,6 @@ define([
'<div class="input-row" style="margin-top: 10px;">',
'<label class="text rows-text" style="width: 130px;">' + this.txtRows + '</label><div class="rows-val" style="float: right;"></div>',
'</div>',
'</div>',
'<div class="footer center">',
'<button class="btn normal dlg-btn primary" result="ok" style="margin-right: 10px;">' + this.okButtonText + '</button>',
'<button class="btn normal dlg-btn" result="cancel">' + this.cancelButtonText + '</button>',
'</div>'
].join('');
@ -113,8 +110,8 @@ define([
onBtnClick: function(event) {
if (this.options.handler) {
this.options.handler.call(this, event.currentTarget.attributes['result'].value, {
columns : this.udColumns.getValue(),
rows : this.udRows.getValue()
columns : this.udColumns.getNumberValue(),
rows : this.udRows.getNumberValue()
});
}
@ -124,8 +121,8 @@ define([
onPrimary: function() {
if (this.options.handler) {
this.options.handler.call(this, 'ok', {
columns : this.udColumns.getValue(),
rows : this.udRows.getValue()
columns : this.udColumns.getNumberValue(),
rows : this.udRows.getNumberValue()
});
}
@ -138,8 +135,6 @@ define([
txtColumns: 'Number of Columns',
txtRows: 'Number of Rows',
textInvalidRowsCols: 'You need to specify valid rows and columns count.',
cancelButtonText: 'Cancel',
okButtonText: 'Ok',
txtMinText: 'The minimum value for this field is {0}',
txtMaxText: 'The maximum value for this field is {0}'
}, Common.Views.InsertTableDialog || {}))

View file

@ -51,25 +51,21 @@ define([
options: {
header: false,
width: 350,
cls: 'modal-dlg'
cls: 'modal-dlg',
buttons: ['ok', 'cancel']
},
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>',
'<div class="input-row">' +
'<label><%= label %></label>' +
'</div>' +
'<div class="input-row" id="id-document-language">' +
'</div>' +
'</div>',
initialize : function(options) {
_.extend(this.options, options || {}, {
label: this.labelSelect,
btns: {ok: this.btnOk, cancel: this.btnCancel}
label: this.labelSelect
});
this.options.tpl = _.template(this.template)(this.options);
@ -90,13 +86,13 @@ define([
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 spellcheck-lang img-toolbarmenu"></span>',
'<span class="icon input-icon spellcheck-lang toolbar__icon btn-ic-docspell"></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: 28px !important;" langval="<%= item.value %>">',
'<i class="icon <% if (item.spellcheck) { %> img-toolbarmenu spellcheck-lang <% } %>"></i>',
'<i class="icon <% if (item.spellcheck) { %> toolbar__icon btn-ic-docspell spellcheck-lang <% } %>"></i>',
'<%= scope.getDisplayValue(item) %>',
'</a>',
'</li>',
@ -144,8 +140,6 @@ define([
return false;
},
labelSelect : 'Select document language',
btnCancel : 'Cancel',
btnOk : 'Ok'
labelSelect : 'Select document language'
}, Common.Views.LanguageDialog || {}))
});

View file

@ -0,0 +1,295 @@
/*
*
* (c) Copyright Ascensio System SIA 2010-2019
*
* 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 20A-12 Ernesta Birznieka-Upisha
* street, Riga, Latvia, EU, LV-1050.
*
* 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
*
*/
/**
* ListSettingsDialog.js
*
* Created by Julia Radzhabova on 30.10.2019
* Copyright (c) 2019 Ascensio System SIA. All rights reserved.
*
*/
if (Common === undefined)
var Common = {};
define([
'common/main/lib/component/Window',
'common/main/lib/component/MetricSpinner',
'common/main/lib/component/ThemeColorPalette',
'common/main/lib/component/ColorButton',
'common/main/lib/view/SymbolTableDialog'
], function () { 'use strict';
Common.Views.ListSettingsDialog = Common.UI.Window.extend(_.extend({
options: {
type: 0, // 0 - markers, 1 - numbers
width: 230,
height: 200,
style: 'min-width: 240px;',
cls: 'modal-dlg',
split: false,
buttons: ['ok', 'cancel']
},
initialize : function(options) {
this.type = options.type || 0;
_.extend(this.options, {
title: this.txtTitle
}, options || {});
this.template = [
'<div class="box">',
'<div class="input-row" style="margin-bottom: 10px;">',
'<label class="text" style="width: 70px;">' + this.txtSize + '</label><div id="id-dlg-list-size"></div><label class="text" style="margin-left: 10px;">' + this.txtOfText + '</label>',
'</div>',
'<div style="margin-bottom: 10px;">',
'<label class="text" style="width: 70px;">' + this.txtColor + '</label><div id="id-dlg-list-color" style="display: inline-block;"></div>',
'</div>',
'<% if (type == 0) { %>',
'<div class="input-row" style="margin-bottom: 10px;">',
'<label class="text" style="width: 70px;vertical-align: top;">' + this.txtBullet + '</label>',
'<button type="button" class="btn btn-text-default" id="id-dlg-list-edit" style="width:53px;display: inline-block;vertical-align: top;"></button>',
'</div>',
'<% } %>',
'<% if (type == 1) { %>',
'<div class="input-row" style="margin-bottom: 10px;">',
'<label class="text" style="width: 70px;">' + this.txtStart + '</label><div id="id-dlg-list-start"></div>',
'</div>',
'<% } %>',
'</div>'
].join('');
this.props = options.props;
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 me = this,
$window = this.getChild();
$window.find('.dlg-btn').on('click', _.bind(this.onBtnClick, this));
this.menuAddAlign = function(menuRoot, left, top) {
var self = this;
if (!$window.hasClass('notransform')) {
$window.addClass('notransform');
menuRoot.addClass('hidden');
setTimeout(function() {
menuRoot.removeClass('hidden');
menuRoot.css({left: left, top: top});
self.options.additionalAlign = null;
}, 300);
} else {
menuRoot.css({left: left, top: top});
self.options.additionalAlign = null;
}
};
this.spnSize = new Common.UI.MetricSpinner({
el : $window.find('#id-dlg-list-size'),
step : 1,
width : 53,
value : 100,
defaultUnit : '',
maxValue : 400,
minValue : 25,
allowDecimal: false
}).on('change', function(field, newValue, oldValue, eOpts){
if (me._changedProps) {
me._changedProps.asc_putBulletSize(field.getNumberValue());
}
});
this.btnColor = new Common.UI.ColorButton({
style: "width:53px;",
menu : new Common.UI.Menu({
additionalAlign: this.menuAddAlign,
items: [
{ template: _.template('<div id="id-dlg-list-color-menu" style="width: 169px; height: 220px; margin: 10px;"></div>') },
{ template: _.template('<a id="id-dlg-list-color-new" style="padding-left:12px;">' + this.textNewColor + '</a>') }
]
})
});
this.btnColor.on('render:after', function(btn) {
me.colors = new Common.UI.ThemeColorPalette({
el: $('#id-dlg-list-color-menu'),
transparent: false
});
me.colors.on('select', _.bind(me.onColorsSelect, me));
});
this.btnColor.render($window.find('#id-dlg-list-color'));
$('#id-dlg-list-color-new').on('click', _.bind(this.addNewColor, this, this.colors));
this.spnStart = new Common.UI.MetricSpinner({
el : $window.find('#id-dlg-list-start'),
step : 1,
width : 53,
value : 1,
defaultUnit : '',
maxValue : 32767,
minValue : 1,
allowDecimal: false
}).on('change', function(field, newValue, oldValue, eOpts){
if (me._changedProps) {
me._changedProps.put_NumStartAt(field.getNumberValue());
}
});
this.btnEdit = new Common.UI.Button({
el: $window.find('#id-dlg-list-edit'),
hint: this.tipChange
});
this.btnEdit.on('click', _.bind(this.onEditBullet, this));
this.btnEdit.cmpEl.css({'font-size': '16px', 'line-height': '16px'});
this.afterRender();
},
afterRender: function() {
this.updateThemeColors();
this._setDefaults(this.props);
},
updateThemeColors: function() {
this.colors.updateColors(Common.Utils.ThemeColor.getEffectColors(), Common.Utils.ThemeColor.getStandartColors());
},
addNewColor: function(picker, btn) {
picker.addNewColor((typeof(btn.color) == 'object') ? btn.color.color : btn.color);
},
onColorsSelect: function(picker, color) {
this.btnColor.setColor(color);
if (this._changedProps) {
this._changedProps.asc_putBulletColor(Common.Utils.ThemeColor.getRgbColor(color));
}
},
onEditBullet: function() {
var me = this,
props = me.bulletProps,
handler = function(dlg, result, settings) {
if (result == 'ok') {
props.changed = true;
props.code = settings.code;
props.font = settings.font;
props.symbol = settings.symbol;
props.font && me.btnEdit.cmpEl.css('font-family', props.font);
settings.symbol && me.btnEdit.setCaption(settings.symbol);
if (me._changedProps) {
me._changedProps.asc_putBulletFont(props.font);
me._changedProps.asc_putBulletSymbol(props.symbol);
}
}
},
win = new Common.Views.SymbolTableDialog({
api: me.options.api,
lang: me.options.interfaceLang,
modal: true,
type: 0,
font: props.font,
symbol: props.symbol,
handler: handler
});
win.show();
win.on('symbol:dblclick', handler);
},
_handleInput: function(state) {
if (this.options.handler) {
this.options.handler.call(this, state, this._changedProps);
}
this.close();
},
onBtnClick: function(event) {
this._handleInput(event.currentTarget.attributes['result'].value);
},
onPrimary: function(event) {
this._handleInput('ok');
return false;
},
_setDefaults: function (props) {
if (props) {
this.spnSize.setValue(props.asc_getBulletSize() || '', true);
var value = props.get_NumStartAt();
this.spnStart.setValue(value || '', true);
this.spnStart.setDisabled(value===null);
var color = props.asc_getBulletColor();
if (color) {
if (color.get_type() == Asc.c_oAscColor.COLOR_TYPE_SCHEME) {
color = {color: Common.Utils.ThemeColor.getHexColor(color.get_r(), color.get_g(), color.get_b()), effectValue: color.get_value()};
} else {
color = Common.Utils.ThemeColor.getHexColor(color.get_r(), color.get_g(), color.get_b());
}
} else
color = 'transparent';
this.btnColor.setColor(color);
if ( typeof(color) == 'object' ) {
var isselected = false;
for (var i=0; i<10; i++) {
if ( Common.Utils.ThemeColor.ThemeValues[i] == color.effectValue ) {
this.colors.select(color,true);
isselected = true;
break;
}
}
if (!isselected) this.colors.clearSelection();
} else
this.colors.select(color,true);
if (this.type==0) {
this.bulletProps = {symbol: props.asc_getBulletSymbol(), font: props.asc_getBulletFont()};
this.bulletProps.font && this.btnEdit.cmpEl.css('font-family', this.bulletProps.font);
this.bulletProps.symbol && this.btnEdit.setCaption(this.bulletProps.symbol);
}
}
this._changedProps = new Asc.asc_CParagraphProperty();
},
txtTitle: 'List Settings',
txtSize: 'Size',
txtColor: 'Color',
txtOfText: '% of text',
textNewColor: 'Add New Custom Color',
txtStart: 'Start at',
txtBullet: 'Bullet',
tipChange: 'Change bullet'
}, Common.Views.ListSettingsDialog || {}))
});

View file

@ -231,6 +231,9 @@ define([
delimiter = this.cmbDelimiter ? this.cmbDelimiter.getValue() : null,
delimiterChar = (delimiter == -1) ? this.inputDelimiter.getValue() : null;
(delimiter == -1) && (delimiter = null);
if (!this.closable && this.type == Common.Utils.importTextType.TXT) { //save last encoding only for opening txt files
Common.localStorage.setItem("de-settings-open-encoding", encoding);
}
this.handler.call(this, state, encoding, delimiter, delimiterChar);
}
}
@ -284,11 +287,17 @@ define([
data: listItems,
editable: false,
disabled: true,
search: true,
itemsTemplate: itemsTemplate
});
this.cmbEncoding.setDisabled(false);
this.cmbEncoding.setValue((this.settings && this.settings.asc_getCodePage()) ? this.settings.asc_getCodePage() : encodedata[0][0]);
var encoding = (this.settings && this.settings.asc_getCodePage()) ? this.settings.asc_getCodePage() : encodedata[0][0];
if (!this.closable && this.type == Common.Utils.importTextType.TXT) { // only for opening txt files
var value = Common.localStorage.getItem("de-settings-open-encoding");
value && (encoding = parseInt(value));
}
this.cmbEncoding.setValue(encoding);
if (this.preview)
this.cmbEncoding.on('selected', _.bind(this.onCmbEncodingSelect, this));
@ -435,8 +444,6 @@ define([
this.updatePreview();
},
okButtonText : "OK",
cancelButtonText : "Cancel",
txtDelimiter : "Delimiter",
txtEncoding : "Encoding ",
txtSpace : "Space",

View file

@ -59,7 +59,8 @@ define([
header : true,
cls : 'modal-dlg',
contentTemplate : '',
title : t.txtTitle
title : t.txtTitle,
buttons: ['ok', 'cancel']
}, options);
@ -77,11 +78,7 @@ define([
'</div>',
'<div id="id-repeat-txt" class="input-row"></div>',
'</div>',
'<div class="separator horizontal"/>',
'<div class="footer center">',
'<button class="btn normal dlg-btn primary" result="ok" style="margin-right:10px;">' + t.okButtonText + '</button>',
'<button class="btn normal dlg-btn" result="cancel">' + t.cancelButtonText + '</button>',
'</div>'
'<div class="separator horizontal"/>'
].join('');
this.handler = options.handler;
@ -154,8 +151,6 @@ define([
this.close();
},
okButtonText : "OK",
cancelButtonText : "Cancel",
txtTitle : "Set Password",
txtPassword : "Password",
txtDescription : "A Password is required to open this document",

View file

@ -88,22 +88,22 @@ define([
el && (this.$el = $(el));
this.$el.html(this.template({scope: this}));
this.viewPluginsList = new Common.UI.DataView({
el: $('#plugins-list'),
store: this.storePlugins,
enableKeyEvents: false,
itemTemplate: _.template([
'<div id="<%= id %>" class="item-plugins" style="display: <% if (visible) {%> block; <%} else {%> none; <% } %>">',
'<div class="plugin-icon" style="background-image: url(' + '<%= baseUrl %>' + '<%= variations[currentVariation].get("icons")[((window.devicePixelRatio > 1) ? 1 : 0) + (variations[currentVariation].get("icons").length>2 ? 2 : 0)] %>);"></div>',
'<% if (variations.length>1) { %>',
'<div class="plugin-caret img-commonctrl"></div>',
'<% } %>',
'<%= name %>',
'</div>'
].join(''))
});
this.lockedControls.push(this.viewPluginsList);
this.viewPluginsList.cmpEl.off('click');
// this.viewPluginsList = new Common.UI.DataView({
// el: $('#plugins-list'),
// store: this.storePlugins,
// enableKeyEvents: false,
// itemTemplate: _.template([
// '<div id="<%= id %>" class="item-plugins" style="display: <% if (visible) {%> block; <%} else {%> none; <% } %>">',
// '<div class="plugin-icon" style="background-image: url(' + '<%= baseUrl %>' + '<%= variations[currentVariation].get("icons")[((window.devicePixelRatio > 1) ? 1 : 0) + (variations[currentVariation].get("icons").length>2 ? 2 : 0)] %>);"></div>',
// '<% if (variations.length>1) { %>',
// '<div class="plugin-caret img-commonctrl"></div>',
// '<% } %>',
// '<%= name %>',
// '</div>'
// ].join(''))
// });
// this.lockedControls.push(this.viewPluginsList);
// this.viewPluginsList.cmpEl.off('click');
this.pluginName = $('#current-plugin-header label');
this.pluginsPanel = $('#plugins-box');
@ -366,11 +366,6 @@ define([
'</div>',
'<% if ((typeof buttons !== "undefined") && _.size(buttons) > 0) { %>',
'<div class="separator horizontal"/>',
'<div class="footer" style="text-align: center;">',
'<% for(var bt in buttons) { %>',
'<button class="btn normal dlg-btn <%= buttons[bt].cls %>" result="<%= bt %>" style="margin-right: 10px;"><%= buttons[bt].text %></button>',
'<% } %>',
'</div>',
'<% } %>'
].join('');

View file

@ -95,6 +95,7 @@ define([
});
});
}
me._isSetEvents = true;
}
return {
@ -119,14 +120,14 @@ define([
if ( this.appConfig.isPasswordSupport ) {
this.btnAddPwd = new Common.UI.Button({
cls: 'btn-toolbar x-huge icon-top',
iconCls: 'btn-ic-protect',
iconCls: 'toolbar__icon btn-ic-protect',
caption: this.txtEncrypt
});
this.btnsAddPwd.push(this.btnAddPwd);
this.btnPwd = new Common.UI.Button({
cls: 'btn-toolbar x-huge icon-top',
iconCls: 'btn-ic-protect',
iconCls: 'toolbar__icon btn-ic-protect',
caption: this.txtEncrypt,
menu: true,
visible: false
@ -135,7 +136,7 @@ define([
if (this.appConfig.isSignatureSupport) {
this.btnSignature = new Common.UI.Button({
cls: 'btn-toolbar x-huge icon-top',
iconCls: 'btn-ic-signature',
iconCls: 'toolbar__icon btn-ic-signature',
caption: this.txtSignature,
menu: (this.appPrefix !== 'pe-')
});
@ -221,6 +222,7 @@ define([
},
getButton: function(type, parent) {
var me = this;
if ( type == 'signature' ) {
var button = new Common.UI.Button({
cls: 'btn-text-default',
@ -229,7 +231,11 @@ define([
disabled: this._state.invisibleSignDisabled
});
this.btnsInvisibleSignature.push(button);
if (this._isSetEvents) {
button.on('click', function (b, e) {
me.fireEvent('protect:signature', ['invisible']);
});
}
return button;
} else if ( type == 'add-password' ) {
var button = new Common.UI.Button({
@ -240,7 +246,11 @@ define([
visible: !this._state.hasPassword
});
this.btnsAddPwd.push(button);
if (this._isSetEvents) {
button.on('click', function (b, e) {
me.fireEvent('protect:password', [b, 'add']);
});
}
return button;
} else if ( type == 'del-password' ) {
var button = new Common.UI.Button({
@ -251,7 +261,11 @@ define([
visible: this._state.hasPassword
});
this.btnsDelPwd.push(button);
if (this._isSetEvents) {
button.on('click', function (b, e) {
me.fireEvent('protect:password', [b, 'delete']);
});
}
return button;
} else if ( type == 'change-password' ) {
var button = new Common.UI.Button({
@ -262,7 +276,11 @@ define([
visible: this._state.hasPassword
});
this.btnsChangePwd.push(button);
if (this._isSetEvents) {
button.on('click', function (b, e) {
me.fireEvent('protect:password', [b, 'add']);
});
}
return button;
}
},

View file

@ -47,7 +47,8 @@ define([
width: 330,
header: false,
cls: 'modal-dlg',
filename: ''
filename: '',
buttons: ['ok', 'cancel']
},
initialize : function(options) {
@ -59,10 +60,6 @@ define([
'<label>' + this.textName + '</label>',
'</div>',
'<div id="id-dlg-newname" class="input-row"></div>',
'</div>',
'<div class="footer right">',
'<button class="btn normal dlg-btn primary" result="ok" style="margin-right: 10px;">' + this.okButtonText + '</button>',
'<button class="btn normal dlg-btn" result="cancel">' + this.cancelButtonText + '</button>',
'</div>'
].join('');
@ -128,8 +125,6 @@ define([
},
textName : 'File name',
cancelButtonText: 'Cancel',
okButtonText : 'Ok',
txtInvalidName : 'The file name cannot contain any of the following characters: '
}, Common.Views.RenameDialog || {}));
});

View file

@ -64,6 +64,7 @@ define([
'<div class="separator long sharing"/>' +
'<div class="group">' +
'<span class="btn-slot text x-huge slot-comment"></span>' +
'<span class="btn-slot text x-huge" id="slot-comment-remove"></span>' +
'</div>' +
'<div class="separator long comments"/>' +
'<div class="group">' +
@ -79,6 +80,10 @@ define([
'<span id="btn-change-reject" class="btn-slot text x-huge"></span>' +
'</div>' +
'<div class="separator long review"/>' +
'<div class="group">' +
'<span id="btn-compare" class="btn-slot text x-huge"></span>' +
'</div>' +
'<div class="separator long compare"/>' +
'<div class="group no-group-mask">' +
'<span id="slot-btn-chat" class="btn-slot text x-huge"></span>' +
'</div>' +
@ -115,6 +120,16 @@ define([
me.fireEvent('reviewchange:reject', [menu, item]);
});
if (me.appConfig.canFeatureComparison) {
this.btnCompare.on('click', function (e) {
me.fireEvent('reviewchange:compare', ['file']);
});
this.btnCompare.menu.on('item:click', function (menu, item, e) {
me.fireEvent('reviewchange:compare', [item.value]);
});
}
this.btnsTurnReview.forEach(function (button) {
button.on('click', _click_turnpreview.bind(me));
});
@ -129,7 +144,7 @@ define([
});
this.btnReviewView && this.btnReviewView.menu.on('item:click', function (menu, item, e) {
me.fireEvent('reviewchanges:view', [menu, item]);
me.fireEvent('reviewchange:view', [menu, item]);
});
}
@ -161,6 +176,16 @@ define([
this.btnChat && this.btnChat.on('click', function (btn, e) {
me.fireEvent('collaboration:chat', [btn.pressed]);
});
if (this.btnCommentRemove) {
this.btnCommentRemove.on('click', function (e) {
me.fireEvent('comment:removeComments', ['current']);
});
this.btnCommentRemove.menu.on('item:click', function (menu, item, e) {
me.fireEvent('comment:removeComments', [item.value]);
});
}
}
return {
@ -178,19 +203,27 @@ define([
cls: 'btn-toolbar x-huge icon-top',
caption: this.txtAccept,
split: true,
iconCls: 'review-save'
iconCls: 'toolbar__icon btn-review-save'
});
this.btnReject = new Common.UI.Button({
cls: 'btn-toolbar x-huge icon-top',
caption: this.txtReject,
split: true,
iconCls: 'review-deny'
iconCls: 'toolbar__icon btn-review-deny'
});
if (this.appConfig.canFeatureComparison)
this.btnCompare = new Common.UI.Button({
cls : 'btn-toolbar x-huge icon-top',
caption : this.txtCompare,
split : true,
iconCls: 'toolbar__icon btn-compare'
});
this.btnTurnOn = new Common.UI.Button({
cls: 'btn-toolbar x-huge icon-top',
iconCls: 'btn-ic-review',
iconCls: 'toolbar__icon btn-ic-review',
caption: this.txtTurnon,
enableToggle: true
});
@ -199,13 +232,13 @@ define([
if (this.appConfig.canViewReview) {
this.btnPrev = new Common.UI.Button({
cls: 'btn-toolbar x-huge icon-top',
iconCls: 'review-prev',
iconCls: 'toolbar__icon btn-review-prev',
caption: this.txtPrev
});
this.btnNext = new Common.UI.Button({
cls: 'btn-toolbar x-huge icon-top',
iconCls: 'review-next',
iconCls: 'toolbar__icon btn-review-next',
caption: this.txtNext
});
@ -216,7 +249,7 @@ define([
this.btnReviewView = new Common.UI.Button({
cls: 'btn-toolbar x-huge icon-top',
iconCls: 'btn-ic-reviewview',
iconCls: 'toolbar__icon btn-ic-reviewview',
caption: this.txtView,
menu: new Common.UI.Menu({
cls: 'ppm-toolbar',
@ -254,10 +287,10 @@ define([
}
}
if (!!this.appConfig.sharingSettingsUrl && this.appConfig.sharingSettingsUrl.length && this._readonlyRights!==true) {
if ((!!this.appConfig.sharingSettingsUrl && this.appConfig.sharingSettingsUrl.length || this.appConfig.canRequestSharingSettings) && this._readonlyRights!==true) {
this.btnSharing = new Common.UI.Button({
cls: 'btn-toolbar x-huge icon-top',
iconCls: 'btn-ic-sharing',
iconCls: 'toolbar__icon btn-ic-sharing',
caption: this.txtSharing
});
}
@ -265,7 +298,7 @@ define([
if (this.appConfig.isEdit && !this.appConfig.isOffline && this.appConfig.canCoAuthoring) {
this.btnCoAuthMode = new Common.UI.Button({
cls: 'btn-toolbar x-huge icon-top',
iconCls: 'btn-ic-coedit',
iconCls: 'toolbar__icon btn-ic-coedit',
caption: this.txtCoAuthMode,
menu: true
});
@ -277,7 +310,7 @@ define([
if (this.appConfig.canUseHistory && !this.appConfig.isDisconnected) {
this.btnHistory = new Common.UI.Button({
cls: 'btn-toolbar x-huge icon-top',
iconCls: 'btn-ic-history',
iconCls: 'toolbar__icon btn-ic-history',
caption: this.txtHistory
});
}
@ -285,12 +318,21 @@ define([
if (this.appConfig.canCoAuthoring && this.appConfig.canChat) {
this.btnChat = new Common.UI.Button({
cls: 'btn-toolbar x-huge icon-top',
iconCls: 'btn-ic-chat',
iconCls: 'toolbar__icon btn-ic-chat',
caption: this.txtChat,
enableToggle: true
});
}
if ( this.appConfig.canCoAuthoring && this.appConfig.canComments ) {
this.btnCommentRemove = new Common.UI.Button({
cls: 'btn-toolbar x-huge icon-top',
caption: this.txtCommentRemove,
split: true,
iconCls: 'toolbar__icon btn-rem-comment'
});
}
var filter = Common.localStorage.getKeysFilter();
this.appPrefix = (filter && filter.length) ? filter.split(',')[0] : '';
@ -348,6 +390,20 @@ define([
);
me.btnReject.updateHint([me.tipRejectCurrent, me.txtRejectChanges]);
if (config.canFeatureComparison) {
me.btnCompare.setMenu(new Common.UI.Menu({
items: [
{caption: me.mniFromFile, value: 'file'},
{caption: me.mniFromUrl, value: 'url'},
{caption: me.mniFromStorage, value: 'storage'}
// ,{caption: '--'},
// {caption: me.mniSettings, value: 'settings'}
]
}));
me.btnCompare.menu.items[2].setVisible(me.appConfig.canRequestCompareFile || me.appConfig.fileChoiceUrl && me.appConfig.fileChoiceUrl.indexOf("{documentType}")>-1);
me.btnCompare.updateHint(me.tipCompare);
}
me.btnAccept.setDisabled(config.isReviewOnly);
me.btnReject.setDisabled(config.isReviewOnly);
}
@ -397,9 +453,32 @@ define([
me.turnCoAuthMode((value===null || parseInt(value) == 1) && !(config.isDesktopApp && config.isOffline) && config.canCoAuthoring);
}
if (me.btnCommentRemove) {
var items = [
{
caption: config.canEditComments ? me.txtCommentRemCurrent : me.txtCommentRemMyCurrent,
value: 'current'
},
{
caption: me.txtCommentRemMy,
value: 'my'
}
];
if (config.canEditComments)
items.push({
caption: me.txtCommentRemAll,
value: 'all'
});
me.btnCommentRemove.setMenu(
new Common.UI.Menu({items: items})
);
me.btnCommentRemove.updateHint([me.tipCommentRemCurrent, me.tipCommentRem]);
}
var separator_sharing = !(me.btnSharing || me.btnCoAuthMode) ? me.$el.find('.separator.sharing') : '.separator.sharing',
separator_comments = !(config.canComments && config.canCoAuthoring) ? me.$el.find('.separator.comments') : '.separator.comments',
separator_review = !(config.canReview || config.canViewReview) ? me.$el.find('.separator.review') : '.separator.review',
separator_compare = !(config.canReview && config.canFeatureComparison) ? me.$el.find('.separator.compare') : '.separator.compare',
separator_chat = !me.btnChat ? me.$el.find('.separator.chat') : '.separator.chat',
separator_last;
@ -418,6 +497,11 @@ define([
else
separator_last = separator_review;
if (typeof separator_compare == 'object')
separator_compare.hide().prev('.group').hide();
else
separator_last = separator_compare;
if (typeof separator_chat == 'object')
separator_chat.hide().prev('.group').hide();
else
@ -426,7 +510,7 @@ define([
if (!me.btnHistory && separator_last)
me.$el.find(separator_last).hide();
Common.NotificationCenter.trigger('tab:visible', 'review', config.isEdit || config.canViewReview);
Common.NotificationCenter.trigger('tab:visible', 'review', config.isEdit || config.canViewReview || config.canCoAuthoring && config.canComments);
setEvents.call(me);
});
@ -438,6 +522,7 @@ define([
if ( this.appConfig.canReview ) {
this.btnAccept.render(this.$el.find('#btn-change-accept'));
this.btnReject.render(this.$el.find('#btn-change-reject'));
this.appConfig.canFeatureComparison && this.btnCompare.render(this.$el.find('#btn-compare'));
this.btnTurnOn.render(this.$el.find('#btn-review-on'));
}
this.btnPrev && this.btnPrev.render(this.$el.find('#btn-change-prev'));
@ -448,6 +533,7 @@ define([
this.btnCoAuthMode && this.btnCoAuthMode.render(this.$el.find('#slot-btn-coauthmode'));
this.btnHistory && this.btnHistory.render(this.$el.find('#slot-btn-history'));
this.btnChat && this.btnChat.render(this.$el.find('#slot-btn-chat'));
this.btnCommentRemove && this.btnCommentRemove.render(this.$el.find('#slot-comment-remove'));
return this.$el;
},
@ -461,7 +547,7 @@ define([
if ( type == 'turn' && parent == 'statusbar' ) {
var button = new Common.UI.Button({
cls : 'btn-toolbar',
iconCls : 'btn-ic-review',
iconCls : 'toolbar__icon btn-ic-review',
hintAnchor : 'top',
hint : this.tipReview,
enableToggle: true
@ -474,7 +560,7 @@ define([
if ( type == 'spelling' ) {
button = new Common.UI.Button({
cls: 'btn-toolbar',
iconCls: 'btn-ic-docspell',
iconCls: 'toolbar__icon btn-ic-docspell',
hintAnchor : 'top',
hint: this.tipSetSpelling,
enableToggle: true
@ -485,7 +571,7 @@ define([
} else if (type == 'doclang' && parent == 'statusbar' ) {
button = new Common.UI.Button({
cls: 'btn-toolbar',
iconCls: 'btn-ic-doclang',
iconCls: 'toolbar__icon btn-ic-doclang',
hintAnchor : 'top',
hint: this.tipSetDocLang,
disabled: true
@ -561,6 +647,7 @@ define([
}
}, this);
this.btnChat && this.btnChat.setDisabled(state);
this.btnCommentRemove && this.btnCommentRemove.setDisabled(state);
},
onLostEditRights: function() {
@ -609,7 +696,20 @@ define([
txtFinalCap: 'Final',
txtOriginalCap: 'Original',
strFastDesc: 'Real-time co-editing. All changes are saved automatically.',
strStrictDesc: 'Use the \'Save\' button to sync the changes you and others make.'
strStrictDesc: 'Use the \'Save\' button to sync the changes you and others make.',
txtCompare: 'Compare',
tipCompare: 'Compare current document with another one',
mniFromFile: 'Document from File',
mniFromUrl: 'Document from URL',
mniFromStorage: 'Document from Storage',
mniSettings: 'Comparison Settings',
txtCommentRemove: 'Remove',
tipCommentRemCurrent: 'Remove current comments',
tipCommentRem: 'Remove comments',
txtCommentRemCurrent: 'Remove Current Comments',
txtCommentRemMyCurrent: 'Remove My Current Comments',
txtCommentRemMy: 'Remove My Comments',
txtCommentRemAll: 'Remove All Comments'
}
}()), Common.Views.ReviewChanges || {}));

View file

@ -102,6 +102,7 @@ define([
this.reviewStore = options.reviewStore;
this.canRequestUsers = options.canRequestUsers;
this.canRequestSendNotify = options.canRequestSendNotify;
this.mentionShare = options.mentionShare;
this.externalUsers = [];
this._state = {commentsVisible: false, reviewVisible: false};
@ -244,7 +245,7 @@ define([
textReply: me.textReply,
textClose: me.textClose,
maxCommLength: Asc.c_oAscMaxCellOrCommentLength,
textMention: me.canRequestSendNotify ? me.textMention : ''
textMention: me.canRequestSendNotify ? (me.mentionShare ? me.textMention : me.textMentionNotify) : ''
})
)
});
@ -469,7 +470,7 @@ define([
});
this.emailMenu = new Common.UI.Menu({
maxHeight: 190,
maxHeight: 200,
cyclic: false,
items: []
}).on('render:after', function(mnu) {
@ -945,7 +946,7 @@ define([
$this.val($this.val().substring(0, start) + '\t' + $this.val().substring(end));
this.selectionStart = this.selectionEnd = start + 1;
event.stopImmediatePropagation();
// event.stopImmediatePropagation();
event.preventDefault();
}
@ -954,28 +955,30 @@ define([
if (this.canRequestUsers) {
textBox && textBox.keydown(function (event) {
if ( event.keyCode == Common.UI.Keys.SPACE ||
if ( event.keyCode == Common.UI.Keys.SPACE || event.keyCode === Common.UI.Keys.TAB ||
event.keyCode == Common.UI.Keys.HOME || event.keyCode == Common.UI.Keys.END || event.keyCode == Common.UI.Keys.RIGHT ||
event.keyCode == Common.UI.Keys.LEFT || event.keyCode == Common.UI.Keys.UP) {
// hide email menu
me.onEmailListMenu();
} else if (event.keyCode == Common.UI.Keys.DOWN) {
if (me.emailMenu && me.emailMenu.rendered && me.emailMenu.isVisible())
_.delay(function() {
if (me.emailMenu && me.emailMenu.rendered && me.emailMenu.isVisible()) {
_.delay(function () {
var selected = me.emailMenu.cmpEl.find('li:not(.divider):first');
selected = selected.find('a');
selected.focus();
}, 10);
event.preventDefault();
}
}
me.e = event;
});
textBox && textBox.on('input', function (event) {
var $this = $(this),
start = this.selectionStart,
val = $this.val().replace(/[\n]$/, ""),
val = $this.val(),
left = 0, right = val.length-1;
for (var i=start-1; i>=0; i--) {
if (val.charCodeAt(i) == 32 /*space*/ || val.charCodeAt(i) == 13 || val.charCodeAt(i) == 10 || val.charCodeAt(i) == 9) {
if (val.charCodeAt(i) == 32 /*space*/ || val.charCodeAt(i) == 13 /*enter*/ || val.charCodeAt(i) == 10 /*new line*/ || val.charCodeAt(i) == 9 /*tab*/) {
left = i+1; break;
}
}
@ -989,7 +992,8 @@ define([
if (res && res.length>1) {
str = res[1]; // send to show email menu
me.onEmailListMenu(str, left, right);
}
} else
me.onEmailListMenu(); // hide email menu
});
}
},
@ -1011,6 +1015,8 @@ define([
});
}
}, this);
if (this.emailMenu && this.emailMenu.rendered)
this.emailMenu.cmpEl.css('display', 'none');
},
isCommentsViewMouseOver: function () {
@ -1118,7 +1124,10 @@ define([
return (item.email && 0 === item.email.toLowerCase().indexOf(str) || item.name && 0 === item.name.toLowerCase().indexOf(str))
});
}
var tpl = _.template('<a id="<%= id %>" tabindex="-1" type="menuitem" style="font-size: 12px;"><div><%= Common.Utils.String.htmlEncode(caption) %></div><div style="color: #909090;"><%= Common.Utils.String.htmlEncode(options.value) %></div></a>'),
var tpl = _.template('<a id="<%= id %>" tabindex="-1" type="menuitem" style="font-size: 12px;">' +
'<div style="overflow: hidden; text-overflow: ellipsis; max-width: 195px;"><%= Common.Utils.String.htmlEncode(caption) %></div>' +
'<div style="overflow: hidden; text-overflow: ellipsis; max-width: 195px; color: #909090;"><%= Common.Utils.String.htmlEncode(options.value) %></div>' +
'</a>'),
divider = false;
_.each(users, function(menuItem, index) {
if (divider && !menuItem.hasAccess) {
@ -1157,11 +1166,13 @@ define([
},
insertEmailToTextbox: function(str, left, right) {
var textBox = this.commentsView.getTextBox(),
val = textBox.val();
textBox.val(val.substring(0, left) + '+' + str + val.substring(right+1, val.length));
var textBox = this.commentsView.getTextBox();
if (!textBox) return;
var val = textBox.val();
textBox.val(val.substring(0, left) + '+' + str + ' ' + val.substring(right+1, val.length));
setTimeout(function(){
textBox[0].selectionStart = textBox[0].selectionEnd = left + str.length + 1;
textBox[0].selectionStart = textBox[0].selectionEnd = left + str.length + 2;
}, 10);
},
@ -1174,6 +1185,7 @@ define([
textResolve : 'Resolve',
textOpenAgain : "Open Again",
textFollowMove : 'Follow Move',
textMention : '+mention will provide access to the document and send an email'
textMention : '+mention will provide access to the document and send an email',
textMentionNotify : '+mention will notify the user via email'
}, Common.Views.ReviewPopover || {}))
});

View file

@ -122,6 +122,8 @@ define([
if (msg && msg.Referer == "onlyoffice") {
if ( !_.isEmpty(msg.error) ) {
this.trigger('saveaserror', this, msg.error);
} else if (!_.isEmpty(msg.message)) {
Common.NotificationCenter.trigger('showmessage', {msg: msg.message});
}
// if ( !_.isEmpty(msg.folder) ) {
// this.trigger('saveasfolder', this, msg.folder); // save last folder url

View file

@ -87,10 +87,10 @@
'<div class="box">',
'<div class="input-row">',
'<span class="btn-placeholder" id="search-placeholder-btn-options"></span>',
'<input type="text" id="sd-text-search" class="form-control" maxlength="255" placeholder="'+this.textSearchStart+'">',
'<input type="text" id="sd-text-search" class="input-field form-control" maxlength="255" placeholder="'+this.textSearchStart+'">',
'</div>',
'<div class="input-row">',
'<input type="text" id="sd-text-replace" class="form-control" maxlength="255" placeholder="'+this.textReplaceDef+'">',
'<input type="text" id="sd-text-replace" class="input-field form-control" maxlength="255" placeholder="'+this.textReplaceDef+'">',
'</div>',
'<div class="input-row">',
'<label class="link" id="search-label-replace" result="replaceshow">'+this.txtBtnReplace+'</label>',
@ -98,10 +98,10 @@
'</div>',
'<div class="separator horizontal"/>',
'<div class="footer right">',
'<button class="btn normal dlg-btn" result="replace" style="margin-right: 6px;">'+this.txtBtnReplace+'</button>',
'<button class="btn normal dlg-btn" result="replaceall" style="margin-right: 10px;">'+this.txtBtnReplaceAll+'</button>',
'<button class="btn normal dlg-btn iconic" result="back" style="margin-right: 6px;"><span class="icon img-commonctrl back" /></button>',
'<button class="btn normal dlg-btn iconic" result="next"><span class="icon img-commonctrl next" /></button>',
'<button class="btn normal dlg-btn" result="replace">'+this.txtBtnReplace+'</button>',
'<button class="btn normal dlg-btn" result="replaceall" style="margin-left: 6px;">'+this.txtBtnReplaceAll+'</button>',
'<button class="btn normal dlg-btn iconic" result="back"><span class="icon img-commonctrl back" /></button>',
'<button class="btn normal dlg-btn iconic" result="next" style="margin-left: 6px;"><span class="icon img-commonctrl next" /></button>',
'</div>'
].join('');
@ -131,7 +131,7 @@
this.btnOptions = new Common.UI.Button({
id : 'search-btn-options',
cls : 'btn-toolbar',
iconCls : 'btn-settings',
iconCls : 'toolbar__icon btn-settings',
// hint : me.tipMerge,
menu : new Common.UI.Menu({
items : [

View file

@ -53,7 +53,8 @@ define([
options: {
width: 370,
style: 'min-width: 350px;',
cls: 'modal-dlg'
cls: 'modal-dlg',
buttons: ['ok', 'cancel']
},
initialize : function(options) {
@ -106,10 +107,6 @@ define([
'</tr>',
'<tr><td><div id="id-dlg-sign-certificate" class="hidden" style="max-width: 212px;overflow: hidden;"></td></tr>',
'</table>',
'</div>',
'<div class="footer center">',
'<button class="btn normal dlg-btn primary" result="ok" style="margin-right: 10px;">' + this.okButtonText + '</button>',
'<button class="btn normal dlg-btn" result="cancel">' + this.cancelButtonText + '</button>',
'</div>'
].join('');
@ -342,8 +339,6 @@ define([
textCertificate: 'Certificate',
textValid: 'Valid from %1 to %2',
textChange: 'Change',
cancelButtonText: 'Cancel',
okButtonText: 'Ok',
textInputName: 'Input signer name',
textUseImage: 'or click \'Select Image\' to use a picture as signature',
textSelectImage: 'Select Image',

View file

@ -86,7 +86,7 @@ define([
'<div id="id-dlg-sign-settings-date"></div>',
'</div>',
'<div class="footer center">',
'<button class="btn normal dlg-btn primary" result="ok" style="margin-right: 10px;">' + this.okButtonText + '</button>',
'<button class="btn normal dlg-btn primary" result="ok">' + this.okButtonText + '</button>',
'<% if (type == "edit") { %>',
'<button class="btn normal dlg-btn" result="cancel">' + this.cancelButtonText + '</button>',
'<% } %>',
@ -200,8 +200,6 @@ define([
textInfoTitle: 'Signer Title',
textInfoEmail: 'E-mail',
textInstructions: 'Instructions for Signer',
cancelButtonText: 'Cancel',
okButtonText: 'Ok',
txtEmpty: 'This field is required',
textAllowComment: 'Allow signer to add comment in the signature dialog',
textShowDate: 'Show sign date in signature line',

File diff suppressed because it is too large Load diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 9.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 124 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 124 B

View file

@ -21,11 +21,8 @@
<polygon points="14.243,7.585 11,10.829 11,4 9,4 9,10.827 5.758,7.585 4.344,9 10.001,14.656 15.657,9 "/>
</symbol>
<symbol id="svg-btn-print" viewBox="0 0 20 20">
<rect x="7" y="12" width="5" height="1"/>
<rect x="7" y="14" width="5" height="1"/>
<path d="M16,7h-2V5c0-0.552-0.447-1-1-1H6C5.448,4,5,4.448,5,5v2H3C2.448,7,2,7.448,2,8v5c0,0.553,0.448,1,1,1h2v2
c0,0.553,0.448,1,1,1h7c0.553,0,1-0.447,1-1v-2h2c0.553,0,1-0.447,1-1V8C17,7.448,16.553,7,16,7z M6,5h7v2H6V5z M5,13H3v-2h2V13z
M13,16H6v-5h7V16z M16,13h-2v-2h2V13z M3,10V8h13v2H3z"/>
<rect x="4" y="8" width="1" height="1"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M14 4H6V6H14V4ZM5 4V6H3C2.44772 6 2 6.44772 2 7V12V13H3H5V15C5 15.5523 5.44772 16 6 16H14C14.5523 16 15 15.5523 15 15V13H17H18V12V7C18 6.44772 17.5523 6 17 6H15V4C15 3.44772 14.5523 3 14 3H6C5.44772 3 5 3.44772 5 4ZM15 12H17V7H14H6H3V12H5V11C5 10.4477 5.44772 10 6 10H14C14.5523 10 15 10.4477 15 11V12ZM6 11H14V15H6V11Z"/>
</symbol>
<symbol id="svg-btn-edit" viewBox="0 0 20 20">
<polygon points="11.738,7.891 6.434,13.195 5.02,14.859 4.5,17.5 7,17.5 8.555,15.566 13.859,10.137"/>
@ -33,26 +30,23 @@
c0.391,0.391,0.391,1.023,0,1.414L15.273,8.598z"/>
</symbol>
<symbol id="svg-btn-save" viewBox="0 0 20 20">
<rect x="7" y="13" width="6" height="1"/>
<rect x="7" y="11" width="6" height="1"/>
<path d="M13,4H5C4.447,4,4,4.447,4,5v10c0,0.553,0.447,1,1,1h10c0.553,0,1-0.447,1-1V7L13,4z M11,5v2h-1V5H11z
M15,15H5V5h2v3h5V5h0.5L15,7.5V15z"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M15 15H4V4H6V7H12V4H12.5858L15 6.41421V15ZM11 4H10V6H11V4ZM4 3H13L16 6V15C16 15.5523 15.5523 16 15 16H4C3.44772 16 3 15.5523 3 15V4C3 3.44772 3.44772 3 4 3Z"/>
<rect x="6" y="10" width="7" height="1"/>
<rect x="6" y="12" width="7" height="1"/>
</symbol>
<symbol id="svg-btn-save-coauth" viewBox="0 0 20 20">
<path d="M14,9c-2.209,0-4,1.791-4,4c0,0.348,0.059,0.679,0.142,1h1.043C11.072,13.686,11,13.353,11,13
c0-1.654,1.346-3,3-3s3,1.346,3,3s-1.346,3-3,3v-1l-2,1.5l2,1.5v-1c2.209,0,4-1.791,4-4S16.209,9,14,9z"/>
<rect x="6" y="13" width="3" height="1"/>
<rect x="6" y="11" width="3" height="1"/>
<path d="M9,15H4V5h2v3h3h2V5h0.5L14,7.5V8h1V7l-3-3H4C3.447,4,3,4.447,3,5v10c0,0.553,0.447,1,1,1h5V15z M9,5h1v2H9 V5z"/>
<rect x="6" y="10" width="3" height="1" fill="#ffffff"/>
<rect x="6" y="12" width="2" height="1" fill="#ffffff"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M16 12.9996C16 11.3427 14.6569 9.99957 13 9.99957C11.3431 9.99957 10 11.3427 10 12.9996C10 14.3058 10.8348 15.417 12 15.8289V16.8736C10.2748 16.4295 9 14.8634 9 12.9996C9 10.7904 10.7909 8.99957 13 8.99957C15.2091 8.99957 17 10.7904 17 12.9996C17 14.1945 16.476 15.2671 15.6453 16H17V17H14L14 16.8736V15.8289L14 14H15V15.2357C15.6137 14.6864 16 13.8881 16 12.9996Z" fill="#ffffff"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M8 15H4V4H6V7H12V4H12.5858L15 6.41421V8H16V6L13 3H4C3.44772 3 3 3.44772 3 4V15C3 15.5523 3.44772 16 4 16H8V15ZM10 4H11V6H10V4Z" fill="#ffffff"/>
</symbol>
<symbol id="svg-btn-save-sync" viewBox="0 0 20 20">
<path fill="#FFD112" d="M18,16c0.553,0,1-0.447,1-1v-5c0-0.553-0.447-1-1-1h-7c-0.553,0-1,0.447-1,1v5c0,0.553,0.447,1,1,1h1
l1.5,2l1.5-2H18z"/>
<rect x="12" y="11" fill="#444444" width="5" height="1"/>
<rect x="12" y="13" fill="#444444" width="5" height="1"/>
<rect x="6" y="13" width="3" height="1"/>
<rect x="6" y="11" width="3" height="1"/>
<path d="M9,15H4V5h2v3h3h2V5h0.5L14,7.5V8h1V7l-3-3H4C3.447,4,3,4.447,3,5v10c0,0.553,0.447,1,1,1h5V15z M9,5h1v2H9 V5z"/>
<rect x="6" y="10" width="3" height="1" fill="#ffffff"/>
<rect x="6" y="12" width="3" height="1" fill="#ffffff"/>
<rect x="10" y="10" width="9" height="7" rx="1" fill="#FFD114"/>
<rect x="12" y="12" width="5" height="1" fill="#444444"/>
<rect x="12" y="14" width="5" height="1" fill="#444444"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M4 15H9V16H4C3.44772 16 3 15.5523 3 15V4C3 3.44772 3.44772 3 4 3H13L16 6V9H15V6.41421L12.5858 4H12V7H6V4H4V15ZM10 4H11V6H10V4Z" fill="#ffffff"/>
</symbol>
<symbol id="svg-btn-undo" viewBox="0 0 20 20">
<path d="M11.355,7.625c-1.965,0-3.864,0.777-5.151,2.033L4,7.625V14h6.407l-2.091-2.219
@ -73,4 +67,118 @@
<path fill-rule="evenodd" clip-rule="evenodd" d="M9.64645 10.6464L14.1464 6.14642L14.8536 6.85353L10.3536 11.3535L9.64645 10.6464Z"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M14 6H11V7H14L14 10H15V7V6H14Z"/>
</symbol>
<symbol id="svg-btn-align-left" viewBox="0 0 20 20">
<path d="M16 5H4V6H16V5Z"/>
<path d="M11 7H4V8H11V7Z"/>
<path d="M14 9H4V10H14V9Z"/>
<path d="M11 11H4V12H11V11Z"/>
<path d="M11 13H4V14H11V13Z"/>
<path d="M16 15H4V16H16V15Z"/>
</symbol>
<symbol id="svg-btn-align-center" viewBox="0 0 20 20">
<path d="M16 5H4V6H16V5Z"/>
<path d="M13 7H7V8H13V7Z"/>
<path d="M15 9H5V10H15V9Z"/>
<path d="M13 11H7V12H13V11Z"/>
<path d="M13 13H7V14H13V13Z"/>
<path d="M16 15H4V16H16V15Z"/>
</symbol>
<symbol id="svg-btn-align-right" viewBox="0 0 20 20">
<path d="M16 5H4V6H16V5Z"/>
<path d="M16 7H9V8H16V7Z"/>
<path d="M16 9H6V10H16V9Z"/>
<path d="M16 11H9V12H16V11Z"/>
<path d="M16 13H9V14H16V13Z"/>
<path d="M16 15H4V16H16V15Z"/>
</symbol>
<symbol id="svg-btn-align-just" viewBox="0 0 20 20">
<path d="M16 15H4V16H16V15Z"/>
<path d="M16 13H4V14H16V13Z"/>
<path d="M16 11H4V12H16V11Z"/>
<path d="M16 9H4V10H16V9Z"/>
<path d="M16 7H4V8H16V7Z"/>
<path d="M16 5H4V6H16V5Z"/>
</symbol>
<symbol id="svg-btn-hidenchars" viewBox="0 0 20 20">
<path fill-rule="evenodd" clip-rule="evenodd" d="M8.5 11C8.66976 11 8.8367 10.9879 9 10.9646V16H10V5H12V16H13V5H14V4H9V4.03544C8.8367 4.01209 8.66976 4 8.5 4C6.567 4 5 5.567 5 7.5C5 9.433 6.567 11 8.5 11Z"/>
</symbol>
<symbol id="svg-btn-setmarkers" viewBox="0 0 20 20">
<circle cx="5.5" cy="5.5" r="1.5"/>
<circle cx="5.5" cy="10.5" r="1.5"/>
<circle cx="5.5" cy="15.5" r="1.5"/>
<path d="M16 5H8V6H16V5Z"/>
<path d="M16 10H8V11H16V10Z"/>
<path d="M16 15H8V16H16V15Z"/>
</symbol>
<symbol id="svg-btn-numbering" viewBox="0 0 20 20">
<path d="M16 5H8V6H16V5Z"/>
<path d="M16 10H8V11H16V10Z"/>
<path d="M16 15H8V16H16V15Z"/>
<path d="M7 12V11H5L7 9L6 8H5H4V9H6L4 11V12H7Z"/>
<path d="M5 7H6V3H5H4V4H5V7Z"/>
<path d="M6 16H4V17H6L7 16L6.5 15L7 14L6 13H4V14H5H6L5.5 15L6 16Z"/>
</symbol>
<symbol id="svg-btn-multilevels" viewBox="0 0 20 20">
<circle cx="4.5" cy="5.5" r="1.5"/>
<circle cx="6.5" cy="10.5" r="1.5"/>
<circle cx="8.5" cy="15.5" r="1.5"/>
<path d="M17 5H7V6H17V5Z"/>
<path d="M17 10H9V11H17V10Z"/>
<path d="M17 15H11V16H17V15Z"/>
</symbol>
<symbol id="svg-btn-decoffset" viewBox="0 0 20 20">
<path d="M16 5H4V6H16V5Z"/>
<path d="M16 7H10V8H16V7Z"/>
<path d="M16 9H10V10H16V9Z"/>
<path d="M16 11H10V12H16V11Z"/>
<path d="M16 13H10V14H16V13Z"/>
<path d="M16 15H4V16H16V15Z"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M5.70711 10L7.35355 8.35359L6.64645 7.64648L4.14645 10.1465L3.79289 10.5L4.14645 10.8536L6.64645 13.3536L7.35355 12.6465L5.70711 11H9V10H5.70711Z"/>
</symbol>
<symbol id="svg-btn-incoffset" viewBox="0 0 20 20">
<path d="M16 5H4V6H16V5Z"/>
<path d="M16 7H10V8H16V7Z"/>
<path d="M16 9H10V10H16V9Z"/>
<path d="M16 11H10V12H16V11Z"/>
<path d="M16 13H10V14H16V13Z"/>
<path d="M16 15H4V16H16V15Z"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M7.29289 11L5.64645 12.6465L6.35355 13.3536L8.85355 10.8536L9.20711 10.5L8.85355 10.1465L6.35355 7.64648L5.64645 8.35359L7.29289 10H4V11H7.29289Z"/>
</symbol>
<symbol id="svg-btn-linespace" viewBox="0 0 20 20">
<path fill-rule="evenodd" clip-rule="evenodd" d="M3.64645 6.64652L6.14645 4.14652L6.50001 3.79297L6.85356 4.14652L9.35356 6.64652L8.64645 7.35363L7.00001 5.70718V14.293L8.64645 12.6465L9.35356 13.3536L6.85356 15.8536L6.50001 16.2072L6.14645 15.8536L3.64645 13.3536L4.35356 12.6465L6.00001 14.293V5.70718L4.35356 7.35363L3.64645 6.64652Z"/>
<path d="M17 5H10V6H17V5Z"/>
<path d="M17 8H10V9H17V8Z"/>
<path d="M17 11H10V12H17V11Z"/>
<path d="M17 14H10V15H17V14Z"/>
</symbol>
<symbol id="svg-btn-insertimage" viewBox="0 0 28 28">
<path fill-rule="evenodd" clip-rule="evenodd" d="M5 5H23V18.2928L16.5 11.7928L10.5 17.7928L8.50001 15.7928L5 19.2929V5ZM5 20.7071V23H23V19.7071L16.5 13.2071L10.5 19.2071L8.50001 17.2071L5 20.7071ZM4 5C4 4.44772 4.44772 4 5 4H23C23.5523 4 24 4.44772 24 5V23C24 23.5523 23.5523 24 23 24H5C4.44772 24 4 23.5523 4 23V5Z"/>
<circle cx="9" cy="9" r="1.5"/>
</symbol>
<symbol id="svg-btn-insertchart" viewBox="0 0 28 28">
<path fill-rule="evenodd" clip-rule="evenodd" d="M4 24H8V18H4V24ZM8 25C8.6 25 9 24.6 9 24V18C9 17.4 8.6 17 8 17H4C3.4 17 3 17.4 3 18V24C3 24.6 3.4 25 4 25H8Z"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M15.9936 24C15.997 23.9822 16 23.9569 16 23.9231V12.0769C16 12.0431 15.997 12.0178 15.9936 12H12.0064C12.003 12.0178 12 12.0431 12 12.0769V23.9231C12 23.9569 12.003 23.9822 12.0064 24H15.9936ZM16 25C16.6 25 17 24.5692 17 23.9231V12.0769C17 11.4308 16.6 11 16 11H12C11.4 11 11 11.4308 11 12.0769V23.9231C11 24.5692 11.4 25 12 25H16Z"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M23.9892 24C23.9947 23.978 24 23.9441 24 23.8947V5.10526C24 5.05594 23.9947 5.02198 23.9892 5H20.0108C20.0053 5.02198 20 5.05594 20 5.10526V23.8947C20 23.9441 20.0053 23.978 20.0108 24H23.9892ZM23.9769 24.0335C23.9769 24.0335 23.9771 24.033 23.9778 24.0321ZM20.0231 24.0335C20.0231 24.0335 20.0228 24.0331 20.0222 24.0321ZM20.0231 4.96647C20.0231 4.96648 20.0229 4.96697 20.0222 4.9679ZM23.9769 4.96647C23.9769 4.96645 23.9772 4.96691 23.9778 4.9679ZM24 25C24.6 25 25 24.5579 25 23.8947V5.10526C25 4.44211 24.6 4 24 4H20C19.4 4 19 4.44211 19 5.10526V23.8947C19 24.5579 19.4 25 20 25H24Z"/>
</symbol>
<symbol id="svg-btn-insertshape" viewBox="0 0 28 28">
<path d="M5 17V5H17V8H18V5C18 4.4 17.6 4 17 4H5C4.4 4 4 4.4 4 5V17C4 17.6 4.4 18 5 18H8V17H5Z"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M16.5 23C20.0899 23 23 20.0899 23 16.5C23 12.9101 20.0899 10 16.5 10C12.9101 10 10 12.9101 10 16.5C10 20.0899 12.9101 23 16.5 23ZM16.5 24C20.6421 24 24 20.6421 24 16.5C24 12.3579 20.6421 9 16.5 9C12.3579 9 9 12.3579 9 16.5C9 20.6421 12.3579 24 16.5 24Z"/>
</symbol>
<symbol id="svg-btn-inserttable" viewBox="0 0 28 28">
<path fill-rule="evenodd" clip-rule="evenodd" d="M3 8C3 6.89543 3.89543 6 5 6H23C24.1046 6 25 6.89543 25 8C25 9.50659 25 11.1093 25 13V14V17V18V20C25 21.1046 24.1046 22 23 22H5C3.89543 22 3 21.1046 3 20V18V17V14V13C3 11.3333 3 9.66667 3 8ZM4 17H10V14H4V17ZM4 18H10V21H5C4.44771 21 4 20.5523 4 20V18ZM17 21H11V18H17V21ZM18 21H23C23.5523 21 24 20.5523 24 20V18H18V21ZM18 17H24V14H18V17ZM17 14H11V17H17V14ZM17 13H11V10H17V13ZM18 13H24V10H18V13ZM10 10V13H4V10H10Z"/>
</symbol>
<symbol id="svg-btn-editheader" viewBox="0 0 28 28">
<path d="M20 20H8V23H20V20Z"/>
<path d="M20 5H8V8H20V5Z"/>
<path d="M22 4V24H6V4H22ZM22 3H6C5.4 3 5 3.4 5 4V24C5 24.6 5.4 25 6 25H22C22.6 25 23 24.6 23 24V4C23 3.4 22.5 3 22 3Z"/>
</symbol>
<symbol id="svg-btn-pagebreak" viewBox="0 0 28 28">
<path d="M24 16H23V15H24V16ZM22 16H21V15H22V16ZM20 16H19V15H20V16ZM18 16H17V15H18V16ZM16 16H15V15H16V16ZM14 16H13V15H14V16ZM12 16H11V15H12V16ZM10 16H9V15H10V16ZM8 16H7V15H8V16ZM6 16H5V15H6V16ZM4 16H3V15H4V16Z"/>
<path d="M16 8H8V9H16V8Z"/>
<path d="M20 5H8V6H20V5Z"/>
<path d="M20 22H8V23H20V22Z"/>
<path d="M22 3V12H6V3H5V12C5 12.6 5.4 13 6 13H22C22.6 13 23 12.6 23 12V3H22Z"/>
<path d="M6 19H22V25H23V19C23 18.4 22.6 18 22 18H6C5.4 18 5 18.4 5 19V25H6V19Z"/>
</symbol>
</svg>

Before

Width:  |  Height:  |  Size: 5.4 KiB

After

Width:  |  Height:  |  Size: 13 KiB

View file

@ -0,0 +1,170 @@
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="30px"
height="30px" viewBox="0 0 30 30" enable-background="new 0 0 30 30" xml:space="preserve">
<symbol id="svg-btn-users-150" viewBox="0 0 30 30">
<path display="inline" d="M11.051,6c2.205,0,4,1.794,4,4s-1.795,4-4,4c-2.206,0-4-1.794-4-4S8.845,6,11.051,6 M11.051,5
c-2.761,0-5,2.238-5,5c0,2.76,2.239,5,5,5c2.762,0,5-2.24,5-5C16.051,7.238,13.813,5,11.051,5L11.051,5z"/>
<path display="inline" d="M11,18c6.825,0,7.887,3.874,8,4.407V25H3v-2.593C3.11,21.895,4.176,18,11,18 M11,17
c-8.216,0-9,5.316-9,5.316V26h18v-3.684C20,22.316,19.216,17,11,17L11,17z"/>
<circle cx="21.041" cy="13" r="4"/>
<path d="M21,18c-0.728,0-1,0-2,0c1.635,1.63,2,2,2,2v6h7v-3.146C28,22.854,27.572,18,21,18z"/>
</symbol>
<symbol id="svg-btn-goback-150" viewBox="0 0 28 28">
<path fill-rule="evenodd" clip-rule="evenodd" d="M15.1465 18.1465L15.8536 18.8536L19.2071 15.5L15.8536 12.1465L15.1465 12.8536L17.2929 15.0001H9V16.0001H17.2929L15.1465 18.1465Z"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M14 10V7H5V21H23V10H14ZM23 9C23.5523 9 24 9.44772 24 10V21C24 21.5523 23.5523 22 23 22H5C4.44771 22 4 21.5523 4 21V7C4 6.44772 4.44772 6 5 6H14C14.5523 6 15 6.44772 15 7V9H23Z"/>
</symbol>
<symbol id="svg-btn-comments-150" viewBox="0 0 30 30">
<rect x="9" y="11" width="12" height="1"/>
<rect x="9" y="14" width="12" height="1"/>
<rect x="9" y="17" width="9" height="1"/>
<path d="M23.375,8C23.65,8,24,8.386,24,8.641V20c0,0.448-0.552,1-1,1h-6h-0.333L16.4,21.2L13,23.75L9.6,21.2
L9.333,21H9H7c-0.449,0-1-0.552-1-1V8.656C6,8.401,6.318,8,6.594,8 M23.5,7h-17C5.671,7,5,7.653,5,8.462V20c0,1,1,2,2,2h2l4,3l4-3
h6c1,0,2-1,2-2V8.462C25,7.653,24.329,7,23.5,7L23.5,7z"/>
</symbol>
<symbol id="svg-btn-options-150" viewBox="0 0 28 28">
<path d="M24 8H4V9H24V8Z"/>
<path d="M24 14H4V15H24V14Z"/>
<path d="M24 20H4V21H24V20Z"/>
</symbol>
<symbol id="svg-btn-print-150" viewBox="0 0 28 28">
<path fill-rule="evenodd" clip-rule="evenodd" d="M7 4H21V8H7V4ZM6 8V4C6 3.44772 6.44772 3 7 3H21C21.5523 3 22 3.44772 22 4V8H25C25.5523 8 26 8.44772 26 9V19C26 19.5523 25.5523 20 25 20H22V23C22 23.5523 21.5523 24 21 24H7C6.44772 24 6 23.5523 6 23V20H3C2.44772 20 2 19.5523 2 19V9C2 8.44771 2.44772 8 3 8H6ZM6 19V15C6 14.4477 6.44772 14 7 14H21C21.5523 14 22 14.4477 22 15V19H25V9H21H7H3V19H6ZM21 19V15H7V23H21V20V19ZM5 10H4V11H5V10Z"/>
<rect x="9" y="17" width="10" height="1"/>
<rect x="9" y="20" width="10" height="1"/>
</symbol>
<symbol id="svg-btn-save-150" viewBox="0 0 28 28">
<path fill-rule="evenodd" clip-rule="evenodd" d="M20 22H22V8.79883L18.2012 5H18V9H9V5L5 5L5 22H7V14C7 13.4477 7.44772 13 8 13H19C19.5523 13 20 13.4477 20 14V22ZM19 23H22C22.5523 23 23 22.5523 23 22V8.79883C23 8.53361 22.8946 8.27926 22.7071 8.09172L18.9083 4.29289C18.7207 4.10536 18.4664 4 18.2012 4H5C4.44772 4 4 4.44771 4 5V22C4 22.5523 4.44771 23 5 23H8H19ZM19 22V14H8V22H19ZM15 5H17V8H15V5Z"/>
</symbol>
<symbol id="svg-btn-undo-150" viewBox="0 0 28 28">
<path d="M14.8966 9C12.1379 9 9.2931 10.7857 7.5 12.5L4 9V19H14L10.5 15.5C11.6034 13.6429 13.7931 12 16.1379 12C19.5862 12 23.5862 14.4286 24 17.8571C23.4483 12.8571 19.8621 9 14.8966 9Z"/>
</symbol>
<symbol id="svg-btn-redo-150" viewBox="0 0 28 28">
<path d="M13.1034 9C15.8621 9 18.7069 10.7857 20.5 12.5L24 9V19H14L17.5 15.5C16.3966 13.6429 14.2069 12 11.8621 12C8.41379 12 4.41379 14.4286 4 17.8571C4.55172 12.8571 8.13793 9 13.1034 9Z"/>
</symbol>
<symbol id="svg-btn-align-left-150" viewBox="0 0 28 28">
<path d="M23 6H5V7H23V6Z"/>
<path d="M13 9H5V10H13V9Z"/>
<path d="M19 12H5V13H19V12Z"/>
<path d="M13 15H5V16H13V15Z"/>
<path d="M13 18H5V19H13V18Z"/>
<path d="M23 21H5V22H23V21Z"/>
</symbol>
<symbol id="svg-btn-align-center-150" viewBox="0 0 28 28">
<path d="M23 6H5V7H23V6Z"/>
<path d="M18 9H10V10H18V9Z"/>
<path d="M21 12H7V13H21V12Z"/>
<path d="M18 15H10V16H18V15Z"/>
<path d="M18 18H10V19H18V18Z"/>
<path d="M23 21H5V22H23V21Z"/>
</symbol>
<symbol id="svg-btn-align-right-150" viewBox="0 0 28 28">
<path d="M23 6H5V7H23V6Z"/>
<path d="M23 9H15V10H23V9Z"/>
<path d="M23 12H9V13H23V12Z"/>
<path d="M23 15H15V16H23V15Z"/>
<path d="M23 18H15V19H23V18Z"/>
<path d="M23 21H5V22H23V21Z"/>
</symbol>
<symbol id="svg-btn-align-just-150" viewBox="0 0 28 28">
<path d="M23 6H5V7H23V6Z"/>
<path d="M23 21H5V22H23V21Z"/>
<path d="M23 18H5V19H23V18Z"/>
<path d="M23 15H5V16H23V15Z"/>
<path d="M23 12H5V13H23V12Z"/>
<path d="M23 9H5V10H23V9Z"/>
</symbol>
<symbol id="svg-btn-hidenchars-150" viewBox="0 0 28 28">
<path fill-rule="evenodd" clip-rule="evenodd" d="M13.25 16C13.5046 16 13.755 15.9827 14 15.9494V22H15V7H18V22H19V7H21V6H14V6.05063C13.755 6.01727 13.5046 6 13.25 6C10.3505 6 8 8.23858 8 11C8 13.7614 10.3505 16 13.25 16Z"/>
</symbol>
<symbol id="svg-btn-setmarkers-150" viewBox="0 0 28 28">
<path d="M23 8H9V9H23V8Z"/>
<path d="M23 14H9V15H23V14Z"/>
<circle cx="6.5" cy="8.5" r="1.5"/>
<circle cx="6.5" cy="14.5" r="1.5"/>
<path d="M23 20H9V21H23V20Z"/>
<circle cx="6.5" cy="20.5" r="1.5"/>
</symbol>
<symbol id="svg-btn-numbering-150" viewBox="0 0 28 28">
<path d="M22 8H10V9H22V8Z"/>
<path d="M22 14H10V15H22V14Z"/>
<path d="M9 17V16H7L9 14V13L8 12H7H6V13H8V14L6 16V17H9Z"/>
<path d="M22 20H10V21H22V20Z"/>
<path d="M7 21H8V22H6V23H8L9 22V20V19L8 18H6V19H7H8V20H7V21Z"/>
<path d="M7 11H8V6H7H6V7H7V11Z"/>
</symbol>
<symbol id="svg-btn-multilevels-150" viewBox="0 0 28 28">
<path d="M24 8H8V9H24V8Z"/>
<path d="M24 14H11V15H24V14Z"/>
<circle cx="5.5" cy="8.5" r="1.5"/>
<circle cx="8.5" cy="14.5" r="1.5"/>
<path d="M24 20H14V21H24V20Z"/>
<circle cx="11.5" cy="20.5" r="1.5"/>
</symbol>
<symbol id="svg-btn-decoffset-150" viewBox="0 0 28 28">
<path d="M6 7H22V8H6V7Z"/>
<path d="M6 10H14V11H6V10Z"/>
<path d="M6 13H14V14H6V13Z"/>
<path d="M6 16H14V17H6V16Z"/>
<path d="M6 19H22V20H6V19Z"/>
<path d="M22 13H16V14H22V13Z"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M16.2071 13.5L19.3536 16.6464L18.6464 17.3535L14.7929 13.5L18.6464 9.64641L19.3536 10.3535L16.2071 13.5Z"/>
</symbol>
<symbol id="svg-btn-incoffset-150" viewBox="0 0 28 28">
<path d="M22 8H6V9H22V8Z"/>
<path d="M22 11H14V12H22V11Z"/>
<path d="M22 14H14V15H22V14Z"/>
<path d="M22 17H14V18H22V17Z"/>
<path d="M22 20H6V21H22V20Z"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M11.2929 14H6V15H11.2929L8.64645 17.6465L9.35355 18.3536L12.8536 14.8536L13.2071 14.5L12.8536 14.1465L9.35355 10.6465L8.64645 11.3536L11.2929 14Z"/>
</symbol>
<symbol id="svg-btn-linespace-150" viewBox="0 0 28 28">
<path fill-rule="evenodd" clip-rule="evenodd" d="M4.64645 9.64652L8.14645 6.14652L8.50001 5.79297L8.85356 6.14652L12.3536 9.64652L11.6465 10.3536L9.00001 7.70718V19.293L11.6465 16.6465L12.3536 17.3536L8.85356 20.8536L8.50001 21.2072L8.14645 20.8536L4.64645 17.3536L5.35356 16.6465L8.00001 19.293V7.70718L5.35356 10.3536L4.64645 9.64652Z"/>
<path d="M24 7H14V8H24V7Z"/>
<path d="M24 11H14V12H24V11Z"/>
<path d="M24 15H14V16H24V15Z"/>
<path d="M24 19H14V20H24V19Z"/>
</symbol>
<symbol id="svg-btn-insertimage-150" viewBox="0 0 40 40">
<path fill-rule="evenodd" clip-rule="evenodd" d="M8 7H32C32.5523 7 33 7.44772 33 8V27.2929L23.8536 18.1464L23.5 17.7929L23.1464 18.1464L14.5 26.7929L11.8536 24.1464L11.5 23.7929L11.1464 24.1464L7 28.2929V8C7 7.44772 7.44772 7 8 7ZM7 29.7071V32C7 32.5523 7.44772 33 8 33H32C32.5523 33 33 32.5523 33 32V28.7071L23.5 19.2071L14.8536 27.8536L14.5 28.2071L14.1464 27.8536L11.5 25.2071L7 29.7071ZM6 8C6 6.89543 6.89543 6 8 6H32C33.1046 6 34 6.89543 34 8V32C34 33.1046 33.1046 34 32 34H8C6.89543 34 6 33.1046 6 32V8Z"/>
<circle cx="12" cy="12" r="2.5"/>
</symbol>
<symbol id="svg-btn-insertchart-150" viewBox="0 0 40 40">
<path fill-rule="evenodd" clip-rule="evenodd" d="M12.0048 33.067C12.049 33.0256 12.1111 32.9356 12.1111 32.75V25.25C12.1111 25.0644 12.049 24.9744 12.0048 24.933C11.9606 24.8916 11.8647 24.8333 11.6667 24.8333H6.33333C6.13533 24.8333 6.0394 24.8916 5.99521 24.933C5.95101 24.9744 5.88889 25.0644 5.88889 25.25V32.75C5.88889 32.9356 5.95101 33.0256 5.99521 33.067C6.0394 33.1084 6.13533 33.1667 6.33333 33.1667H11.6667C11.8647 33.1667 11.9606 33.1084 12.0048 33.067ZM11.6667 34C12.4667 34 13 33.5 13 32.75V25.25C13 24.5 12.4667 24 11.6667 24H6.33333C5.53333 24 5 24.5 5 25.25V32.75C5 33.5 5.53333 34 6.33333 34H11.6667Z"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M23.013 32.9407C23.0538 32.8983 23.1111 32.808 23.1111 32.6154V17.3846C23.1111 17.192 23.0538 17.1017 23.013 17.0593C22.9701 17.0148 22.8715 16.9474 22.6667 16.9474H17.3333C17.1285 16.9474 17.0299 17.0148 16.987 17.0593C16.9462 17.1017 16.8889 17.192 16.8889 17.3846V32.6154C16.8889 32.808 16.9462 32.8983 16.987 32.9407C17.0299 32.9852 17.1285 33.0526 17.3333 33.0526H22.6667C22.8715 33.0526 22.9701 32.9852 23.013 32.9407ZM22.6667 34C23.4667 34 24 33.4462 24 32.6154V17.3846C24 16.5538 23.4667 16 22.6667 16H17.3333C16.5333 16 16 16.5538 16 17.3846V32.6154C16 33.4462 16.5333 34 17.3333 34H22.6667Z"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M34.0104 32.8814C34.0522 32.8351 34.1111 32.7358 34.1111 32.5263V7.47368C34.1111 7.2642 34.0522 7.16487 34.0104 7.1186C33.9671 7.07077 33.8693 7 33.6667 7H28.3333C28.1307 7 28.0329 7.07077 27.9896 7.1186C27.9478 7.16487 27.8889 7.2642 27.8889 7.47368V32.5263C27.8889 32.7358 27.9478 32.8351 27.9896 32.8814C28.0329 32.9292 28.1307 33 28.3333 33H33.6667C33.8693 33 33.9671 32.9292 34.0104 32.8814ZM33.6667 34C34.4667 34 35 33.4105 35 32.5263V7.47368C35 6.58947 34.4667 6 33.6667 6H28.3333C27.5333 6 27 6.58947 27 7.47368V32.5263C27 33.4105 27.5333 34 28.3333 34H33.6667Z"/>
</symbol>
<symbol id="svg-btn-insertshape-150" viewBox="0 0 40 40">
<path fill-rule="evenodd" clip-rule="evenodd" d="M24 34C29.5228 34 34 29.5228 34 24C34 18.4772 29.5228 14 24 14C18.4772 14 14 18.4772 14 24C14 29.5228 18.4772 34 24 34ZM24 35C30.0751 35 35 30.0751 35 24C35 17.9249 30.0751 13 24 13C17.9249 13 13 17.9249 13 24C13 30.0751 17.9249 35 24 35Z"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M7 6H24C24.5523 6 25 6.44772 25 7V12H26V7C26 5.89543 25.1046 5 24 5H7C5.89543 5 5 5.89543 5 7V24C5 25.1046 5.89543 26 7 26H12V25H7C6.44772 25 6 24.5523 6 24V7C6 6.44772 6.44772 6 7 6Z"/>
</symbol>
<symbol id="svg-btn-inserttable-150" viewBox="0 0 40 40">
<path fill-rule="evenodd" clip-rule="evenodd" d="M4 10C4 8.89543 4.89543 8 6 8H34C35.1046 8 36 8.89543 36 10C36 13.1616 36 15.5994 36 19V20V25V26V30C36 31.1046 35.1046 32 34 32H6C4.89543 32 4 31.1046 4 30V26V25V20V19C4 15.5994 4 13.1616 4 10ZM5 25H14V20H5V25ZM5 26H14V31H6C5.44772 31 5 30.5523 5 30V26ZM25 31H15V26H25V31ZM26 31H34C34.5523 31 35 30.5523 35 30V26H26V31ZM26 25H35V20H26V25ZM25 20H15V25H25V20ZM25 19H15V14H25V19ZM26 19H35V14H26V19ZM14 14V19H5V14H14Z"/>
</symbol>
<symbol id="svg-btn-editheader-150" viewBox="0 0 40 40">
<path d="M30 28H10V33H30V28Z"/>
<path d="M30 7H10V12H30V7Z"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M31 5H9C8.44772 5 8 5.44772 8 6V34C8 34.5523 8.44772 35 9 35H31C31.5523 35 32 34.5523 32 34V6C32 5.44772 31.5523 5 31 5ZM9 4C7.89543 4 7 4.89543 7 6V34C7 35.1046 7.89543 36 9 36H31C32.1046 36 33 35.1046 33 34V6C33 4.89543 32.1046 4 31 4H9Z"/>
</symbol>
<symbol id="svg-btn-pagebreak-150" viewBox="0 0 40 40">
<path d="M24 13H10V14H24V13Z"/>
<path d="M30 8H10V9H30V8Z"/>
<path d="M30 31H10V32H30V31Z"/>
<path d="M5 22H6V23H5V22Z"/>
<path d="M7 22H8V23H7V22Z"/>
<path d="M9 22H10V23H9V22Z"/>
<path d="M11 22H12V23H11V22Z"/>
<path d="M13 22H14V23H13V22Z"/>
<path d="M15 22H16V23H15V22Z"/>
<path d="M17 22H18V23H17V22Z"/>
<path d="M19 22H20V23H19V22Z"/>
<path d="M21 22H22V23H21V22Z"/>
<path d="M23 22H24V23H23V22Z"/>
<path d="M25 22H26V23H25V22Z"/>
<path d="M27 22H28V23H27V22Z"/>
<path d="M29 22H30V23H29V22Z"/>
<path d="M31 22H32V23H31V22Z"/>
<path d="M33 22H34V23H33V22Z"/>
<path d="M35 22H36V23H35V22Z"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M6 5V19C6 19.5523 6.44771 20 7 20H33C33.5523 20 34 19.5523 34 19V5H33V19H7L7 5H6Z"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M7 26H33V35H34V26C34 25.4477 33.5523 25 33 25H7C6.44772 25 6 25.4477 6 26V35H7L7 26Z"/>
</symbol>
</svg>

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 577 B

View file

@ -0,0 +1,13 @@
{{#spritesheet}}
@media only screen {
@media (-webkit-min-device-pixel-ratio: 1.5) and (-webkit-max-device-pixel-ratio: 1.9),
(min-resolution: 1.5dppx) and (max-resolution: 1.9dppx),
(min-resolution: 144dpi) and (max-resolution: 191dpi)
{
.toolbar__icon, .menu__icon {
background-image: url(resources/{{{escaped_image}}});
background-size: {{scaled width 1.5}}px auto;
}
}
}
{{/spritesheet}}

Binary file not shown.

After

Width:  |  Height:  |  Size: 320 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 175 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 156 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 156 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 186 B

View file

@ -0,0 +1,13 @@
{{#spritesheet}}
@media only screen {
@media (-webkit-min-device-pixel-ratio: 1.5) and (-webkit-max-device-pixel-ratio: 1.9),
(min-resolution: 1.5dppx) and (max-resolution: 1.9dppx),
(min-resolution: 144dpi) and (max-resolution: 191dpi)
{
.x-huge .toolbar__icon {
background-image: url(resources/{{{escaped_image}}});
background-size: {{scaled width 1.5}}px auto;
}
}
}
{{/spritesheet}}

Binary file not shown.

After

Width:  |  Height:  |  Size: 201 B

Some files were not shown because too many files have changed in this diff Show more