Skip to content

Commit

Permalink
Merge branch 'release/v8.1.0' into feature/quick-access-toolbar
Browse files Browse the repository at this point in the history
  • Loading branch information
maxkadushkin committed Apr 25, 2024
2 parents 1b235be + 8c7f0dd commit 74a088a
Show file tree
Hide file tree
Showing 293 changed files with 30,099 additions and 5,410 deletions.
11 changes: 7 additions & 4 deletions apps/api/documents/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -1076,15 +1076,18 @@
if (config.frameEditorId)
params += "&frameEditorId=" + config.frameEditorId;

var type = config.document ? /^(?:(pdf))$/.exec(config.document.fileType) : null;
if (!(type && typeof type[1] === 'string') && (config.editorConfig && config.editorConfig.mode == 'view' ||
var type = config.document ? /^(?:(pdf)|(oform|docxf))$/.exec(config.document.fileType) : null,
isPdf = type && typeof type[1] === 'string',
oldForm = type && typeof type[2] === 'string';

if (!(isPdf || oldForm) && (config.editorConfig && config.editorConfig.mode == 'view' ||
config.document && config.document.permissions && (config.document.permissions.edit === false && !config.document.permissions.review )))
params += "&mode=view";
if (type && typeof type[1] === 'string' && (config.document && config.document.permissions && config.document.permissions.edit === false || config.editorConfig && config.editorConfig.mode == 'view'))
if ((isPdf || oldForm) && (config.document && config.document.permissions && config.document.permissions.edit === false || config.editorConfig && config.editorConfig.mode == 'view'))
params += "&mode=fillforms";

if (config.document) {
config.document.isForm = (type && typeof type[1] === 'string') ? config.document.isForm : false;
config.document.isForm = isPdf ? config.document.isForm : oldForm;
(config.document.isForm===true || config.document.isForm===false) && (params += "&isForm=" + config.document.isForm);
}

Expand Down
16 changes: 9 additions & 7 deletions apps/common/main/lib/component/ColorButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,11 @@ define([
render: function(parentEl) {
Common.UI.Button.prototype.render.call(this, parentEl);

if (/huge/.test(this.options.cls) && this.options.split === true ) {
if (/huge/.test(this.options.cls) && this.options.split === true && !this.options.hideColorLine) {
var btnEl = $('button', this.cmpEl),
btnMenuEl = $(btnEl[1]);
btnMenuEl && btnMenuEl.append( $('<div class="btn-color-value-line"></div>'));
} else
} else if (!this.options.hideColorLine)
$('button:first-child', this.cmpEl).append( $('<div class="btn-color-value-line"></div>'));
this.colorEl = this.cmpEl.find('.btn-color-value-line');

Expand All @@ -69,6 +69,7 @@ define([
(this.options.themecolors!==undefined) && (config['themecolors'] = this.options.themecolors);
(this.options.effects!==undefined) && (config['effects'] = this.options.effects);
(this.options.colorHints!==undefined) && (config['colorHints'] = this.options.colorHints);
(this.options.paletteCls!==undefined) && (config['cls'] = this.options.paletteCls);

this.colorPicker = new Common.UI.ThemeColorPalette(config);
this.colorPicker.on('select', _.bind(this.onColorSelect, this));
Expand All @@ -95,6 +96,7 @@ define([
if (typeof this.menu !== 'object') {
options = options || this.options;
var height = options.paletteHeight ? options.paletteHeight + 'px' : 'auto',
width = options.paletteWidth ? options.paletteWidth + 'px' : '164px',
id = Common.UI.getId(),
auto = [],
eyedropper = [];
Expand All @@ -119,22 +121,22 @@ define([
id: id,
cls: 'color-menu ' + (options.eyeDropper ? 'shifted-right' : 'shifted-left'),
additionalAlign: options.additionalAlign,
items: (options.additionalItems ? options.additionalItems : []).concat(auto).concat([
{ template: _.template('<div id="' + id + '-color-menu" style="width: 164px; height:' + height + '; display: inline-block;"></div>') },
items: (options.additionalItemsBefore ? options.additionalItemsBefore : []).concat(auto).concat([
{ template: _.template('<div id="' + id + '-color-menu" style="width: ' + width + '; height:' + height + '; display: inline-block;"></div>') },
{caption: '--'}
]).concat(eyedropper).concat([
{
id: id + '-color-new',
template: _.template('<a tabindex="-1" type="menuitem" style="">' + this.textNewColor + '</a>')
}
])
]).concat(options.additionalItemsAfter ? options.additionalItemsAfter : [])
});
this.initInnerMenu();
var me = this;
menu.on('show:after', function(menu) {
me.colorPicker && _.delay(function() {
me.colorPicker.showLastSelected();
!(options.additionalItems || options.auto) && me.colorPicker.focus();
!(options.additionalItemsBefore || options.auto) && me.colorPicker.focus();
}, 10);
});
return menu;
Expand All @@ -145,7 +147,7 @@ define([
initInnerMenu: function() {
if (!this.colorPicker || typeof this.menu !== 'object') return;

var index = (this.options.additionalItems || []).length + (this.options.auto ? 2 : 0);
var index = (this.options.additionalItemsBefore || []).length + (this.options.auto ? 2 : 0);
this.colorPicker.outerMenu = {menu: this.menu, index: index};
this.menu.setInnerMenu([{menu: this.colorPicker, index: index}]);
},
Expand Down
2 changes: 2 additions & 0 deletions apps/common/main/lib/component/ThemeColorPalette.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ define([

colorRe: /(?:^|\s)color-(.{6})(?:\s|$)/,
selectedCls: 'selected',
cls : '',

initialize : function(options) {
Common.UI.BaseView.prototype.initialize.call(this, options);
Expand All @@ -128,6 +129,7 @@ define([
me.moveKeys = [Common.UI.Keys.UP, Common.UI.Keys.DOWN, Common.UI.Keys.LEFT, Common.UI.Keys.RIGHT];

el.addClass('theme-colorpalette');
me.options.cls && el.addClass(me.options.cls);
this.render();

if (this.options.updateColorsArr)
Expand Down
3 changes: 2 additions & 1 deletion apps/common/main/lib/controller/Comments.js
Original file line number Diff line number Diff line change
Expand Up @@ -1722,6 +1722,7 @@ define([

var lang = (this.mode ? this.mode.lang || 'en' : 'en').replace('_', '-').toLowerCase();
try {
if ( lang == 'ar-SA' ) lang = lang + '-u-nu-latn-ca-gregory'; // TODO: check Intl.Locale to support suitable options
return date.toLocaleString(lang, {dateStyle: 'short', timeStyle: 'short'});
} catch (e) {
lang = 'en';
Expand Down Expand Up @@ -1847,4 +1848,4 @@ define([
}

}, Common.Controllers.Comments || {}));
});
});
60 changes: 44 additions & 16 deletions apps/common/main/lib/controller/Plugins.js
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,7 @@ define([
storePlugins.each(function(item){
me.viewPlugins.updatePluginIcons(item);
var guid = item.get('guid');
if (me.viewPlugins.pluginPanels[guid]) {
if (me.viewPlugins.pluginPanels[guid] && item.get('parsedIcons')) {
var menu = me.viewPlugins.pluginPanels[guid].menu === 'right' ? iconsInRightMenu : iconsInLeftMenu;
menu.push({
guid: guid,
Expand All @@ -496,13 +496,15 @@ define([
}
});
for (var key in this.viewPlugins.customPluginPanels) {
var panel = this.viewPlugins.customPluginPanels[key],
menu = panel.menu === 'right' ? iconsInRightMenu : iconsInLeftMenu;
menu.push({
guid: panel.frameId,
baseUrl: panel.baseUrl,
parsedIcons: this.viewPlugins.parseIcons(panel.icons)
});
var panel = this.viewPlugins.customPluginPanels[key];
if (panel.icons) {
var menu = panel.menu === 'right' ? iconsInRightMenu : iconsInLeftMenu;
menu.push({
guid: panel.frameId,
baseUrl: panel.baseUrl,
parsedIcons: this.viewPlugins.parseIcons(panel.icons)
});
}
}
if (iconsInLeftMenu.length > 0) {
me.viewPlugins.fireEvent('pluginsleft:updateicons', [iconsInLeftMenu]);
Expand Down Expand Up @@ -599,14 +601,21 @@ define([
model = this.viewPlugins.storePlugins.findWhere({guid: pluginGuid}),
name = createUniqueName(plugin.get_Name('en'));
model.set({menu: menu});
var icon_url, icon_cls;
if (model.get('parsedIcons')) {
icon_url = model.get('baseUrl') + model.get('parsedIcons')['normal'];
} else {
icon_cls = 'icon toolbar__icon btn-plugin-panel-default';
}
var $button = $('<div id="slot-btn-plugins' + name + '"></div>'),
button = new Common.UI.Button({
parentEl: $button,
cls: 'btn-category plugin-buttons',
hint: langName,
enableToggle: true,
toggleGroup: menu === 'right' ? 'tabpanelbtnsGroup' : 'leftMenuGroup',
iconImg: model.get('baseUrl') + model.get('parsedIcons')['normal'],
iconCls: icon_cls,
iconImg: icon_url,
onlyIcon: true,
value: pluginGuid,
type: 'plugin'
Expand Down Expand Up @@ -861,11 +870,14 @@ define([
b.visible = (isEdit || b.isViewer !== false);
});

var icons = (typeof itemVar.icons === 'string' && itemVar.icons.indexOf('%') !== -1 || !itemVar.icons2) ? itemVar.icons : itemVar.icons2;
if (!icons) icons = '';

model.set({
description: description,
index: variationsArr.length,
url: itemVar.url,
icons: (typeof itemVar.icons === 'string' && itemVar.icons.indexOf('%') !== -1 || !itemVar.icons2) ? itemVar.icons : itemVar.icons2,
icons: icons,
buttons: itemVar.buttons,
visible: visible,
help: itemVar.help
Expand Down Expand Up @@ -1198,11 +1210,26 @@ define([
if (typeof variation.descriptionLocale == 'object')
description = variation.descriptionLocale[lang] || variation.descriptionLocale['en'] || description || '';

var model = this.viewPlugins.storePlugins.findWhere({guid: guid}),
modes = model.get('variations'),
icons = variation.icons ? variation.icons : modes[model.get('currentVariation')].get('icons'),
parsedIcons = this.viewPlugins.parseIcons(icons),
icon_url = model.get('baseUrl') + parsedIcons['normal'];
var baseUrl = variation.baseUrl || "";
var model = this.viewPlugins.storePlugins.findWhere({guid: guid});
var icons = variation.icons;
var icon_url, icon_cls;

if (model) {
if ("" === baseUrl)
baseUrl = model.get('baseUrl');
if (!icons) {
var modes = model.get('variations');
icons = modes[model.get('currentVariation')].get('icons');
}
}

if (!icons) {
icon_cls = 'icon toolbar__icon btn-plugin-panel-default';
} else {
var parsedIcons = this.viewPlugins.parseIcons(icons);
icon_url = baseUrl + parsedIcons['normal'];
}

var $button = $('<div id="slot-btn-plugins-' + frameId + '"></div>'),
button = new Common.UI.Button({
Expand All @@ -1211,6 +1238,7 @@ define([
hint: description,
enableToggle: true,
toggleGroup: menu === 'right' ? 'tabpanelbtnsGroup' : 'leftMenuGroup',
iconCls: icon_cls,
iconImg: icon_url,
onlyIcon: true,
value: frameId,
Expand All @@ -1222,7 +1250,7 @@ define([
el: '#panel-plugins-' + frameId,
menu: menu,
frameId: frameId,
baseUrl: model.get('baseUrl'),
baseUrl: baseUrl,
icons: icons
});
this.viewPlugins.customPluginPanels[frameId].on('render:after', _.bind(this.onAfterRender, this, this.viewPlugins.customPluginPanels[frameId], frameId));
Expand Down
13 changes: 13 additions & 0 deletions apps/common/main/lib/util/define.js
Original file line number Diff line number Diff line change
Expand Up @@ -1074,4 +1074,17 @@ define(function(){ 'use strict';
},
}
})(), Common.define.smartArt || {});

Common.define.simpleColorsConfig = {
colors: [
'1755A0', 'D43230', 'F5C346', 'EA3368', '12A489', '552F8B', '9D1F87', 'BB2765', '479ED2', '67C9FA',
'3D8A44', '80CA3D', '1C19B4', '7F4B0F', 'FF7E07', 'FFFFFF', 'D3D3D4', '879397', '575757', '000000'
],
dynamiccolors: 5,
themecolors: 0,
effects: 0,
columns: 5,
cls: 'palette-large',
paletteWidth: 174
};
});
24 changes: 13 additions & 11 deletions apps/common/main/lib/view/Header.js
Original file line number Diff line number Diff line change
Expand Up @@ -265,9 +265,9 @@ define([
var me = this;
config = config || appConfig;
if (!me.btnPDFMode || !config) return;
me.btnPDFMode.setIconCls('toolbar__icon icon--inverse ' + (config.isPDFEdit ? 'btn-edit' : (config.isPDFAnnotate ? 'btn-menu-comments' : 'btn-sheet-view')));
me.btnPDFMode.setCaption(config.isPDFEdit ? me.textEdit : (config.isPDFAnnotate ? me.textComment : me.textView));
me.btnPDFMode.updateHint(config.isPDFEdit ? me.tipEdit : (config.isPDFAnnotate ? me.tipComment : me.tipView));
me.btnPDFMode.setIconCls('toolbar__icon icon--inverse ' + (config.isPDFEdit ? 'btn-edit' : (config.isPDFAnnotate && config.canCoEditing ? 'btn-menu-comments' : 'btn-sheet-view')));
me.btnPDFMode.setCaption(config.isPDFEdit ? me.textEdit : (config.isPDFAnnotate && config.canCoEditing ? me.textComment : me.textView));
me.btnPDFMode.updateHint(config.isPDFEdit ? me.tipEdit : (config.isPDFAnnotate && config.canCoEditing ? me.tipComment : me.tipView));
}

function changeDocMode(type, lockEditing) {
Expand Down Expand Up @@ -570,18 +570,18 @@ define([
caption: me.textEdit,
iconCls : 'menu__icon btn-edit',
template: menuTemplate,
description: me.textEditDesc,
description: appConfig.canCoEditing ? me.textEditDesc : me.textEditDescNoCoedit,
value: 'edit'
});
arr.push({
caption: me.textComment,
iconCls : 'menu__icon btn-menu-comments',
caption: appConfig.canCoEditing ? me.textComment : me.textView,
iconCls : 'menu__icon ' + (appConfig.canCoEditing ? 'btn-menu-comments' : 'btn-sheet-view'),
template: menuTemplate,
description: me.textCommentDesc,
description: appConfig.canCoEditing ? me.textCommentDesc : me.textViewDescNoCoedit,
value: 'comment',
disabled: !appConfig.canPDFAnnotate
});
arr.push({
appConfig.canCoEditing && arr.push({
caption: me.textView,
iconCls : 'menu__icon btn-sheet-view',
template: menuTemplate,
Expand Down Expand Up @@ -885,9 +885,9 @@ define([
$html.find('#slot-btn-share').hide();
}

if (isPDFEditor && config.isEdit && !config.isOffline && config.canSwitchMode) {
if (isPDFEditor && config.isEdit && config.canSwitchMode) {
me.btnPDFMode = new Common.UI.Button({
cls: 'btn-header btn-header-pdf-mode no-caret',
cls: 'btn-header btn-header-pdf-mode',
iconCls: 'toolbar__icon icon--inverse btn-sheet-view',
caption: me.textView,
menu: true,
Expand All @@ -899,7 +899,7 @@ define([
changePDFMode.call(me, config);
} else if (isDocEditor && config.isEdit && config.canSwitchMode) {
me.btnDocMode = new Common.UI.Button({
cls: 'btn-header btn-header-pdf-mode no-caret',
cls: 'btn-header btn-header-pdf-mode ',
iconCls: 'toolbar__icon icon--inverse ' + (config.isReviewOnly ? 'btn-ic-review' : 'btn-edit'),
caption: config.isReviewOnly ? me.textReview : me.textEdit,
menu: true,
Expand Down Expand Up @@ -1275,6 +1275,8 @@ define([
textViewDesc: 'All changes will be saved locally',
textCommentDesc: 'All changes will be saved to the file. Real time collaboration',
textEditDesc: 'All changes will be saved to the file. Real time collaboration',
textViewDescNoCoedit: 'View or annotate',
textEditDescNoCoedit: 'Add or edit text, shapes, images etc.',
tipView: 'Viewing',
tipComment: 'Commenting',
tipEdit: 'Editing',
Expand Down
10 changes: 9 additions & 1 deletion apps/common/main/lib/view/ListSettingsDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -336,11 +336,19 @@ define([
}
});

var config = this.options.colorConfig || {};
this.btnColor = new Common.UI.ColorButton({
parentEl: $window.find('#id-dlg-list-color'),
style: "width:45px;",
additionalAlign: this.menuAddAlign,
color: this.color,
colors: config.colors,
dynamiccolors: config.dynamiccolors,
themecolors: config.themecolors,
effects: config.effects,
columns: config.columns,
paletteCls: config.cls,
paletteWidth: config.paletteWidth,
takeFocusOnClose: true
});
this.btnColor.on('color:select', _.bind(this.onColorsSelect, this));
Expand Down Expand Up @@ -400,7 +408,7 @@ define([
},

afterRender: function() {
this.updateThemeColors();
!this.options.colorConfig && this.updateThemeColors();
this._setDefaults(this.props);

var me = this;
Expand Down
Loading

0 comments on commit 74a088a

Please sign in to comment.