diff --git a/apps/api/documents/api.js b/apps/api/documents/api.js index 8876075ac..c0a598c21 100644 --- a/apps/api/documents/api.js +++ b/apps/api/documents/api.js @@ -873,7 +873,8 @@ path += app + "/"; path += (config.type === "mobile" || isSafari_mobile) ? "mobile" - : (config.type === "embedded") + : (config.type === "embedded" || (app=='documenteditor') && config.document && config.document.permissions && (config.document.permissions.fillForms===true) && + (config.document.permissions.edit === false) && (config.document.permissions.review !== true) && (config.editorConfig.mode !== 'view')) ? "embed" : "main"; diff --git a/apps/common/main/lib/component/InputField.js b/apps/common/main/lib/component/InputField.js index 5d16292f6..8ea0d65a0 100644 --- a/apps/common/main/lib/component/InputField.js +++ b/apps/common/main/lib/component/InputField.js @@ -81,12 +81,11 @@ define([ template: _.template([ '
', ' { plugins.forEach(item => { let plugin = new Asc.CPlugin(); - - plugin.set_Name(item['name']); - plugin.set_Guid(item['guid']); - plugin.set_BaseUrl(item['baseUrl']); - plugin.set_MinVersion && plugin.set_MinVersion(item['minVersion']); - - let variations = item['variations'], - variationsArr = []; - - variations.forEach(itemVar => { - let variation = new Asc.CPluginVariation(); - - variation.set_Description(itemVar['description']); - variation.set_Url(itemVar['url']); - variation.set_Icons(itemVar['icons']); - variation.set_Visual(itemVar['isVisual']); - variation.set_CustomWindow(itemVar['isCustomWindow']); - variation.set_System(itemVar['isSystem']); - variation.set_Viewer(itemVar['isViewer']); - variation.set_EditorsSupport(itemVar['EditorsSupport']); - variation.set_Modal(itemVar['isModal']); - variation.set_InsideMode(itemVar['isInsideMode']); - variation.set_InitDataType(itemVar['initDataType']); - variation.set_InitData(itemVar['initData']); - variation.set_UpdateOleOnResize(itemVar['isUpdateOleOnResize']); - variation.set_Buttons(itemVar['buttons']); - variation.set_Size(itemVar['size']); - variation.set_InitOnSelectionChanged(itemVar['initOnSelectionChanged']); - variation.set_Events(itemVar['events']); - - variationsArr.push(variation); - }); - - plugin["set_Variations"](variationsArr); + plugin.deserialize(item); arr.push(plugin); }); diff --git a/apps/documenteditor/main/app/controller/Main.js b/apps/documenteditor/main/app/controller/Main.js index 7203a5038..89cfc517e 100644 --- a/apps/documenteditor/main/app/controller/Main.js +++ b/apps/documenteditor/main/app/controller/Main.js @@ -2610,7 +2610,7 @@ define([ value = Common.localStorage.getBool("de-settings-autoformat-hyperlink", true); Common.Utils.InternalSettings.set("de-settings-autoformat-hyperlink", value); - // me.api.asc_setAutoCorrectHyperlinks(value); + me.api.asc_SetAutoCorrectHyperlinks(value); }, showRenameUserDialog: function() { diff --git a/apps/documenteditor/main/app/controller/RightMenu.js b/apps/documenteditor/main/app/controller/RightMenu.js index 01f508e3e..1885894af 100644 --- a/apps/documenteditor/main/app/controller/RightMenu.js +++ b/apps/documenteditor/main/app/controller/RightMenu.js @@ -131,8 +131,8 @@ define([ this.rightmenu.fireEvent('editcomplete', this.rightmenu); }, - onFocusObject: function(SelectedObjects) { - if (!this.editMode) + onFocusObject: function(SelectedObjects, forceSignature) { + if (!this.editMode && !forceSignature) return; var open = this._initSettings ? !Common.localStorage.getBool("de-hide-right-settings", this.rightmenu.defaultHideRightMenu) : false; @@ -269,6 +269,7 @@ define([ if (priorityactive>-1) active = priorityactive; else if (lastactive>=0 && currentactive<0) active = lastactive; else if (currentactive>=0) active = currentactive; + else if (forceSignature && !this._settings[Common.Utils.documentSettingsType.Signature].hidden) active = Common.Utils.documentSettingsType.Signature; else if (!this._settings[Common.Utils.documentSettingsType.MailMerge].hidden) active = Common.Utils.documentSettingsType.MailMerge; if (active == undefined && open && lastactive>=0) @@ -423,8 +424,9 @@ define([ } this.rightmenu.chartSettings.disableControls(disabled); - if (!allowSignature && this.rightmenu.signatureSettings) { - this.rightmenu.btnSignature.setDisabled(disabled); + if (this.rightmenu.signatureSettings) { + !allowSignature && this.rightmenu.btnSignature.setDisabled(disabled); + allowSignature && disabled && this.onFocusObject([], true); // force press signature button } if (disabled) { diff --git a/apps/documenteditor/main/app/controller/Toolbar.js b/apps/documenteditor/main/app/controller/Toolbar.js index e3b20bdfd..8b7114bd4 100644 --- a/apps/documenteditor/main/app/controller/Toolbar.js +++ b/apps/documenteditor/main/app/controller/Toolbar.js @@ -1627,6 +1627,8 @@ define([ insertImage: function(data) { // gateway if (data && (data.url || data.images)) { + data.url && console.log("Obsolete: The 'url' parameter of the 'insertImage' method is deprecated. Please use 'images' parameter instead."); + var arr = []; if (data.images && data.images.length>0) { for (var i=0; i this.maxMarginsH || left + right > this.maxMarginsW) { + if(top + bottom > this.maxMarginsH) { + errorMsg = _t.textMarginsH; + } else { + errorMsg = _t.textMarginsH; + } + + f7.dialog.alert(errorMsg, _t.notcriticalErrorTitle); + api.change_DocSize(this.widthDocument, this.heightDocument); + return; + } + return { top, bottom, @@ -96,4 +122,4 @@ class DocumentSettingsController extends Component { } } -export default DocumentSettingsController; \ No newline at end of file +export default inject("storeDocumentSettings")(observer(withTranslation()(DocumentSettingsController))); \ No newline at end of file diff --git a/apps/presentationeditor/main/app/controller/Main.js b/apps/presentationeditor/main/app/controller/Main.js index 6935889a7..2de52dfd8 100644 --- a/apps/presentationeditor/main/app/controller/Main.js +++ b/apps/presentationeditor/main/app/controller/Main.js @@ -2232,7 +2232,7 @@ define([ value = Common.localStorage.getBool("pe-settings-autoformat-hyperlink", true); Common.Utils.InternalSettings.set("pe-settings-autoformat-hyperlink", value); - // me.api.asc_setAutoCorrectHyperlinks(value); + me.api.asc_SetAutoCorrectHyperlinks(value); }, showRenameUserDialog: function() { diff --git a/apps/presentationeditor/main/app/controller/RightMenu.js b/apps/presentationeditor/main/app/controller/RightMenu.js index c6f83d14a..8d6791d91 100644 --- a/apps/presentationeditor/main/app/controller/RightMenu.js +++ b/apps/presentationeditor/main/app/controller/RightMenu.js @@ -106,8 +106,8 @@ define([ this.rightmenu.fireEvent('editcomplete', this.rightmenu); }, - onFocusObject: function(SelectedObjects) { - if (!this.editMode) + onFocusObject: function(SelectedObjects, forceSignature) { + if (!this.editMode && !forceSignature) return; var open = this._initSettings ? !Common.localStorage.getBool("pe-hide-right-settings", this.rightmenu.defaultHideRightMenu) : false; @@ -194,6 +194,7 @@ define([ if (priorityactive>-1) active = priorityactive; else if (currentactive>=0) active = currentactive; else if (lastactive>=0) active = lastactive; + else if (forceSignature && !this._settings[Common.Utils.documentSettingsType.Signature].hidden) active = Common.Utils.documentSettingsType.Signature; else active = Common.Utils.documentSettingsType.Slide; if (active !== undefined) { @@ -226,8 +227,9 @@ define([ this.rightmenu.imageSettings.disableControls(disabled); this.rightmenu.chartSettings.disableControls(disabled); - if (!allowSignature && this.rightmenu.signatureSettings) { - this.rightmenu.btnSignature.setDisabled(disabled); + if (this.rightmenu.signatureSettings) { + !allowSignature && this.rightmenu.btnSignature.setDisabled(disabled); + allowSignature && disabled && this.onFocusObject([], true); // force press signature button } if (disabled) { diff --git a/apps/presentationeditor/main/app/controller/Toolbar.js b/apps/presentationeditor/main/app/controller/Toolbar.js index cfea951bc..c2e3935db 100644 --- a/apps/presentationeditor/main/app/controller/Toolbar.js +++ b/apps/presentationeditor/main/app/controller/Toolbar.js @@ -1627,6 +1627,8 @@ define([ insertImage: function(data) { // gateway if (data && (data.url || data.images)) { + data.url && console.log("Obsolete: The 'url' parameter of the 'insertImage' method is deprecated. Please use 'images' parameter instead."); + var arr = []; if (data.images && data.images.length>0) { for (var i=0; i-1) active = priorityactive; else if (lastactive>=0 && currentactive<0) active = lastactive; else if (currentactive>=0) active = currentactive; + else if (forceSignature && !this._settings[Common.Utils.documentSettingsType.Signature].hidden) active = Common.Utils.documentSettingsType.Signature; if (active == undefined && this._openRightMenu && lastactive>=0) active = lastactive; @@ -425,12 +426,9 @@ define([ this.rightmenu.cellSettings.disableControls(disabled); this.rightmenu.slicerSettings.disableControls(disabled); - if (!allowSignature && this.rightmenu.signatureSettings) { - this.rightmenu.btnSignature.setDisabled(disabled); - } - - if (!allowSignature && this.rightmenu.signatureSettings) { - this.rightmenu.btnSignature.setDisabled(disabled); + if (this.rightmenu.signatureSettings) { + !allowSignature && this.rightmenu.btnSignature.setDisabled(disabled); + allowSignature && disabled && this.onFocusObject([], undefined, undefined, undefined, undefined, true); // force press signature button } if (disabled) { diff --git a/apps/spreadsheeteditor/main/app/controller/Toolbar.js b/apps/spreadsheeteditor/main/app/controller/Toolbar.js index 993366fde..e045f7e44 100644 --- a/apps/spreadsheeteditor/main/app/controller/Toolbar.js +++ b/apps/spreadsheeteditor/main/app/controller/Toolbar.js @@ -908,6 +908,8 @@ define([ insertImage: function(data) { // gateway if (data && (data.url || data.images)) { + data.url && console.log("Obsolete: The 'url' parameter of the 'insertImage' method is deprecated. Please use 'images' parameter instead."); + var arr = []; if (data.images && data.images.length>0) { for (var i=0; i { @@ -180,7 +180,7 @@ const Statusbar = inject('sheets', 'storeAppOptions', 'users')(observer(props => if (index == api.asc_getActiveWorksheetIndex()) { if (!opened) { - if (isEdit && !sheets.isWorkbookLocked) { + if (isEdit && !isDisconnected) { api.asc_closeCellEditor(); f7.popover.open('#idx-tab-context-menu-popover', target); } diff --git a/apps/spreadsheeteditor/mobile/src/view/Statusbar.jsx b/apps/spreadsheeteditor/mobile/src/view/Statusbar.jsx index 0b566123f..6ae773384 100644 --- a/apps/spreadsheeteditor/mobile/src/view/Statusbar.jsx +++ b/apps/spreadsheeteditor/mobile/src/view/Statusbar.jsx @@ -8,22 +8,23 @@ const viewStyle = { height: 30 }; -const StatusbarView = inject('storeAppOptions', 'sheets')(observer(props => { +const StatusbarView = inject('storeAppOptions', 'sheets', 'users')(observer(props => { const { t } = useTranslation(); const _t = t('Statusbar', {returnObjects: true}); const isAndroid = Device.android; const isPhone = Device.isPhone; - const {sheets, storeAppOptions} = props; + const {sheets, storeAppOptions, users} = props; const allSheets = sheets.sheets; const hiddenSheets = sheets.hiddenWorksheets(); - const isWorkbookLocked = sheets.isWorkbookLocked; + // const isWorkbookLocked = sheets.isWorkbookLocked; const isEdit = storeAppOptions.isEdit; + const isDisconnected = users.isDisconnected; return ( -
- +
+
diff --git a/apps/spreadsheeteditor/mobile/src/view/edit/EditChart.jsx b/apps/spreadsheeteditor/mobile/src/view/edit/EditChart.jsx index 66e0d6e43..cb377eec2 100644 --- a/apps/spreadsheeteditor/mobile/src/view/edit/EditChart.jsx +++ b/apps/spreadsheeteditor/mobile/src/view/edit/EditChart.jsx @@ -816,7 +816,7 @@ const PageVerticalAxis = props => { props.onVerAxisMinValue(e.target.value)} onInput={e => setMinValue(e.target.value)} @@ -826,7 +826,7 @@ const PageVerticalAxis = props => { props.onVerAxisMaxValue(e.target.value)} onInput={e => setMaxValue(e.target.value)} diff --git a/build/Gruntfile.js b/build/Gruntfile.js index c386b41b2..a99ebc3cb 100644 --- a/build/Gruntfile.js +++ b/build/Gruntfile.js @@ -11,6 +11,7 @@ module.exports = function(grunt) { ' *\n' + ' * Version: <%= pkg.version %> (build:<%= pkg.build %>)\n' + ' */\n'; + global.copyright = copyright; let iconv_lite, encoding = process.env.SYSTEM_ENCODING; grunt.log.writeln('platform: ' + process.platform.green); @@ -91,6 +92,8 @@ module.exports = function(grunt) { addons.forEach((element,index,self) => self[index] = path.join('../..', element, '/build')); addons = addons.filter(element => grunt.file.isDir(element)); + require('./appforms')(grunt); + grunt.loadNpmTasks('grunt-contrib-clean'); grunt.loadNpmTasks('grunt-contrib-copy'); grunt.loadNpmTasks('grunt-contrib-uglify'); @@ -187,6 +190,8 @@ module.exports = function(grunt) { if ( !!_extConfig && _extConfig.name == packageFile.name ) { _merge(packageFile, _extConfig); } + + global.packageFile = packageFile; } else grunt.log.error().writeln('Could not load config file'.red); }); } @@ -537,7 +542,7 @@ module.exports = function(grunt) { options: { cwd: '../vendor/framework7-react', }, - cmd: 'npm i --include=dev', + cmd: 'npm i --include=dev --production=false', }, } }); diff --git a/build/appforms.js b/build/appforms.js new file mode 100644 index 000000000..bff5d8013 --- /dev/null +++ b/build/appforms.js @@ -0,0 +1,80 @@ + +module.exports = (grunt) => { + grunt.registerTask('forms-app-init', function() { + const packageFile = global.packageFile; + if ( !global.packageFile ) + grunt.log.ok('no package file'.red); + else { + const config = require('./appforms.json'); + if ( config ) { + //packageFile.tasks.deploy.push(...config.tasks.deploy); + packageFile.forms = config.forms; + } + } + + grunt.initConfig({ + pkg: packageFile, + + clean: { + options: { + force: true + }, + postbuild: packageFile.forms.clean.postbuild, + prebuild: packageFile.forms.clean.prebuild + }, + + requirejs: { + compile: { + options: packageFile.forms.js.requirejs.options + } + }, + + less: { + production: { + options: { + compress: true, + ieCompat: false, + modifyVars: packageFile.forms.less.vars, + plugins: [ + new (require('less-plugin-clean-css'))() + ] + }, + files: { + "<%= pkg.forms.less.files.dest %>": packageFile.forms.less.files.src + } + } + }, + + concat: { + options: { + stripBanners: true, + banner: global.copyright + }, + dist: { + src: [packageFile.forms.js.requirejs.options.out], + dest: packageFile.forms.js.requirejs.options.out + } + }, + + copy: { + localization: { + files: packageFile.forms.copy.localization + }, + indexhtml: { + files: packageFile.forms.copy.indexhtml + } + }, + + inline: { + dist: { + src: `${packageFile.forms.copy.indexhtml.dest}/index.html` + } + } + + }); + }); + + grunt.registerTask('deploy-app-forms', ['forms-app-init', 'clean:prebuild', /*'imagemin',*/ 'less', + 'requirejs', 'concat', 'copy', 'inline', /*'json-minify',*/ + /*'replace:writeVersion',*/ /*'replace:prepareHelp',*/ 'clean:postbuild']); +} \ No newline at end of file diff --git a/build/appforms.json b/build/appforms.json new file mode 100644 index 000000000..8b37c8813 --- /dev/null +++ b/build/appforms.json @@ -0,0 +1,140 @@ +{ + "name": "documenteditor", + "version": "4.3.0", + "build": 1149, + "homepage": "http://www.onlyoffice.com", + "private": true, + "forms": { + "clean": { + "prebuild": [ + "../deploy/web-apps/apps/documenteditor/forms" + ], + "postbuild": [ + "../deploy/web-apps/apps/documenteditor/forms/resources/img" + ] + }, + "js": { + "requirejs": { + "options": { + "name": "../apps/documenteditor/forms/app.js", + "out": "../deploy/web-apps/apps/documenteditor/forms/app.js", + "baseUrl": "../apps/", + "inlineText": true, + "findNestedDependencies": true, + "preserveLicenseComments": false, + "optimizeAllPluginResources": true, + "paths": { + "jquery": "../vendor/jquery/jquery", + "underscore": "../vendor/underscore/underscore", + "backbone": "../vendor/backbone/backbone", + "text": "../vendor/requirejs-text/text", + "bootstrap": "../vendor/bootstrap/dist/js/bootstrap", + "perfectscrollbar": "common/main/lib/mods/perfect-scrollbar", + "jmousewheel": "../vendor/perfect-scrollbar/src/jquery.mousewheel", + "xregexp": "empty:", + "sockjs": "empty:", + "jszip": "empty:", + "jszip-utils": "empty:", + "coapisettings": "empty:", + "allfonts": "empty:", + "sdk": "empty:", + "api": "empty:", + "core": "common/main/lib/core/application", + "notification": "common/main/lib/core/NotificationCenter", + "keymaster": "common/main/lib/core/keymaster", + "tip": "common/main/lib/util/Tip", + "analytics": "common/Analytics", + "gateway": "common/Gateway", + "locale": "common/locale", + "irregularstack": "common/IrregularStack" + }, + "shim": { + "underscore": { + "exports": "_" + }, + "backbone": { + "deps": [ + "underscore", + "jquery" + ], + "exports": "Backbone" + }, + "bootstrap": { + "deps": [ + "jquery" + ] + }, + "perfectscrollbar": { + "deps": [ + "jmousewheel" + ] + }, + "notification": { + "deps": [ + "backbone" + ] + }, + "core": { + "deps": [ + "backbone", + "notification" + ] + }, + "sdk": { + "deps": [ + "jquery", + "underscore", + "coapisettings", + "allfonts", + "xregexp", + "sockjs", + "jszip", + "jszip-utils" + ] + }, + "gateway": { + "deps": [ + "jquery" + ] + }, + "analytics": { + "deps": [ + "jquery" + ] + } + } + } + } + }, + "less": { + "files": { + "src": "../apps/documenteditor/forms/resources/less/application.less", + "dest": "../deploy/web-apps/apps/documenteditor/forms/resources/css/app.css" + }, + "vars": { + "app-image-const-path": "'../img'", + "common-image-const-path": "'../img'", + "app-image-path": "'../../../../../deploy/web-apps/apps/documenteditor/forms/resources/img'", + "common-image-path": "'../../../../../deploy/web-apps/apps/documenteditor/forms/resources/img'" + } + }, + "copy": { + "localization": [ + { + "expand": true, + "cwd": "../apps/documenteditor/forms/locale/", + "src": "*", + "dest": "../deploy/web-apps/apps/documenteditor/forms/locale/" + } + ], + "indexhtml": { + "../deploy/web-apps/apps/documenteditor/forms/index.html": "../apps/documenteditor/forms/index.html.deploy" + } + } + }, + "tasks": { + "deploy": [ + "deploy-app-forms" + ] + } +} \ No newline at end of file diff --git a/build/documenteditor.json b/build/documenteditor.json index 9f20bf075..2253ff379 100644 --- a/build/documenteditor.json +++ b/build/documenteditor.json @@ -368,6 +368,7 @@ "increment-build", "deploy-app-main", "deploy-app-mobile", + "deploy-app-forms", "deploy-app-embed" ] }