diff --git a/apps/common/mobile/lib/controller/ContextMenu.jsx b/apps/common/mobile/lib/controller/ContextMenu.jsx index 61ddbd04f..9b05db8a8 100644 --- a/apps/common/mobile/lib/controller/ContextMenu.jsx +++ b/apps/common/mobile/lib/controller/ContextMenu.jsx @@ -103,7 +103,7 @@ class ContextMenuController extends Component { } onApiOpenContextMenu(x, y) { - if ( !this.state.opened ) { + if ( !this.state.opened && $$('.dialog.modal-in').length < 1) { this.setState({ items: this.initMenuItems(), extraItems: this.initExtraItems() diff --git a/apps/common/mobile/lib/controller/Plugins.jsx b/apps/common/mobile/lib/controller/Plugins.jsx new file mode 100644 index 000000000..d01ac617f --- /dev/null +++ b/apps/common/mobile/lib/controller/Plugins.jsx @@ -0,0 +1,283 @@ +import React, { useEffect, useState } from 'react'; +import { inject, observer } from 'mobx-react'; +import { f7 } from 'framework7-react'; +import { Device } from '../../utils/device'; + +const PluginsController = inject('storeAppOptions')(observer(props => { + const { storeAppOptions } = props; + let configPlugins = {autostart:[]}, + serverPlugins = {autostart:[]}, + modal, + iframe; + + useEffect(() => { + const onDocumentReady = () => { + Common.Notifications.on('engineCreated', api => { + api.asc_registerCallback("asc_onPluginShow", showPluginModal); + api.asc_registerCallback("asc_onPluginClose", pluginClose); + api.asc_registerCallback("asc_onPluginResize", pluginResize); + api.asc_registerCallback('asc_onPluginsInit', registerPlugins); + + if(!storeAppOptions.customization || storeAppOptions.plugins !== false) { + loadPlugins(); + } + }); + + Common.Gateway.on('init', loadConfig); + }; + + onDocumentReady(); + + return () => { + const api = Common.EditorApi.get(); + + api.asc_unregisterCallback("asc_onPluginShow", showPluginModal); + api.asc_unregisterCallback("asc_onPluginClose", pluginClose); + api.asc_unregisterCallback("asc_onPluginResize", pluginResize); + api.asc_unregisterCallback('asc_onPluginsInit', registerPlugins); + + Common.Gateway.off('init', loadConfig); + }; + }); + + const onDlgBtnClick = e => { + const api = Common.EditorApi.get(); + let index = $$(e.currentTarget).index(); + api.asc_pluginButtonClick(index); + }; + + + const showPluginModal = (plugin, variationIndex, frameId, urlAddition) => { + let isAndroid = Device.android; + let variation = plugin.get_Variations()[variationIndex]; + + if (variation.get_Visual()) { + let url = variation.get_Url(); + url = ((plugin.get_BaseUrl().length == 0) ? url : plugin.get_BaseUrl()) + url; + + if (urlAddition) + url += urlAddition; + + let isCustomWindow = variation.get_CustomWindow(), + arrBtns = variation.get_Buttons(), + newBtns = [], + size = variation.get_Size(); + + if (arrBtns.length) { + arrBtns.forEach((b, index) => { + if ((storeAppOptions.isEdit || b.isViewer !== false)) { + newBtns[index] = { + text: b.text, + attributes: {result: index} + }; + } + }); + } + + f7.popover.close('.document-menu.modal-in', false); + + modal = f7.dialog.create({ + title: '', + text: '', + content: '
'+'
', + buttons : isCustomWindow ? undefined : newBtns + }).open(); + + iframe = document.createElement("iframe"); + + iframe.id = frameId; + iframe.name = 'pluginFrameEditor'; + iframe.width = '100%'; + iframe.height = '100%'; + iframe.align = "top"; + iframe.frameBorder = 0; + iframe.scrolling = "no"; + iframe.src = url; + + $$('#plugin-frame').append(iframe); + + modal.$el.find('.dialog-button').on('click', onDlgBtnClick); + + modal.$el.css({ + margin: '0', + width: '90%', + left: '5%', + height: 'auto' + }); + + modal.$el.find('.dialog-inner').css({padding: '0'}); + + if (Device.phone) { + let height = Math.min(size[1], 240); + modal.$el.find('#plugin-frame').css({height: height + 'px'}); + } else { + let height = Math.min(size[1], 500); + modal.$el.find('#plugin-frame').css({height: height + 'px'}); + } + + if (isAndroid) { + $$('.view.collaboration-root-view.navbar-through').removeClass('navbar-through').addClass('navbar-fixed'); + $$('.view.collaboration-root-view .navbar').prependTo('.view.collaboration-root-view > .pages > .page'); + } + } + }; + + const pluginClose = plugin => { + if (iframe) { + iframe = null; + } + }; + + const pluginResize = size => { + if (Device.phone) { + let height = Math.min(size[1], 240); + modal.$el.find('#plugin-frame').css({height: height + 'px'}); + } else { + let height = Math.min(size[1], 500); + modal.$el.find('#plugin-frame').css({height: height + 'px'}); + } + }; + + const getPlugins = (pluginsData, fetchFunction) => { + if (!pluginsData || pluginsData.length < 1) + return Promise.resolve([]); + + fetchFunction = fetchFunction || function (url) { + return fetch(url) + .then(function(response) { + if (response.ok) return response.json(); + else return Promise.reject(url); + }).then(function(json) { + json.baseUrl = url.substring(0, url.lastIndexOf("config.json")); + return json; + }); + }; + + let loaded = []; + + return pluginsData.map(fetchFunction).reduce(function (previousPromise, currentPromise) { + return previousPromise + .then(function() + { + return currentPromise; + }) + .then(function(item) + { + loaded.push(item); + return Promise.resolve(item); + }) + .catch(function(item) + { + return Promise.resolve(item); + }); + + }, Promise.resolve()) + .then(function () + { + return Promise.resolve(loaded); + }); + }; + + const loadConfig = data => { + configPlugins.config = data.config.plugins; + }; + + const registerPlugins = plugins => { + let arr = []; + + plugins.forEach(item => { + let plugin = new Asc.CPlugin(); + + plugin.set_Name(item['name']); + plugin.set_Guid(item['guid']); + plugin.set_BaseUrl(item['baseUrl']); + + 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); + arr.push(plugin); + }); + + const api = Common.EditorApi.get(); + api.asc_pluginsRegister('', arr); + }; + + const mergePlugins = () => { + if (serverPlugins.plugins !== undefined && configPlugins.plugins !== undefined) { + let arr = [], + plugins = configPlugins; + + if (plugins.plugins && plugins.plugins.length > 0) { + arr = plugins.plugins; + } + + plugins = serverPlugins; + + if (plugins.plugins && plugins.plugins.length > 0) { + arr = arr.concat(plugins.plugins); + } + + registerPlugins(arr); + } + }; + + const loadPlugins = () => { + if (configPlugins.config) { + getPlugins(configPlugins.config.pluginsData) + .then(function(loaded) + { + configPlugins.plugins = loaded; + mergePlugins(); + }); + } else { + configPlugins.plugins = false; + } + + let server_plugins_url = '../../../../plugins.json'; + + Common.Utils.loadConfig(server_plugins_url, function (obj) { + if (obj != 'error') { + serverPlugins.config = obj; + getPlugins(serverPlugins.config.pluginsData) + .then(function(loaded) + { + serverPlugins.plugins = loaded; + mergePlugins(); + }); + } else + serverPlugins.plugins = false; + }); + }; + + return <> +})); + +export default PluginsController; + + + diff --git a/apps/common/mobile/lib/view/Search.jsx b/apps/common/mobile/lib/view/Search.jsx index ae026d894..72f69836c 100644 --- a/apps/common/mobile/lib/view/Search.jsx +++ b/apps/common/mobile/lib/view/Search.jsx @@ -9,7 +9,8 @@ import { observable, runInAction } from "mobx"; import { observer } from "mobx-react"; const searchOptions = observable({ - usereplace: false + usereplace: false, + isReplaceAll: false }); const popoverStyle = { @@ -31,15 +32,20 @@ class SearchSettingsView extends Component { searchBy: 1, lookIn: 1, isMatchCase: false, - isMatchCell: false + isMatchCell: false, + isReplaceAll: false }; } onFindReplaceClick(action) { - runInAction(() => searchOptions.usereplace = action == 'replace'); + runInAction(() => { + searchOptions.usereplace = action == 'replace'; + searchOptions.isReplaceAll = action == 'replace-all'; + }); this.setState({ - useReplace: searchOptions.usereplace + useReplace: searchOptions.usereplace, + isReplaceAll: searchOptions.isReplaceAll }); if (this.onReplaceChecked) {} @@ -251,14 +257,15 @@ class SearchView extends Component { render() { const usereplace = searchOptions.usereplace; + const isReplaceAll = searchOptions.isReplaceAll; const hidden = {display: "none"}; const searchQuery = this.state.searchQuery; - const replaceQuery = this.state.replaceQuery; + // const replaceQuery = this.state.replaceQuery; const isIos = Device.ios; const { _t } = this.props; if(this.searchbar && this.searchbar.enabled) { - usereplace ? this.searchbar.el.classList.add('replace') : this.searchbar.el.classList.remove('replace'); + usereplace || isReplaceAll ? this.searchbar.el.classList.add('replace') : this.searchbar.el.classList.remove('replace'); } return ( @@ -272,22 +279,30 @@ class SearchView extends Component {
- {this.changeSearchQuery(e.target.value)}} /> {isIos ? : null} - -
-
- {this.changeReplaceQuery(e.target.value)}} /> - {isIos ? : null} - + this.changeSearchQuery('')} />
+ {/* {usereplace || isReplaceAll ? */} +
+ {/* style={!usereplace ? hidden: null} */} + {this.changeReplaceQuery(e.target.value)}} /> + {isIos ? : null} + this.changeReplaceQuery('')} /> +
+ {/* */}
- this.onReplaceClick()}>{_t.textReplace} - this.onReplaceAllClick()}>{_t.textReplaceAll} + {/* this.onReplaceClick()}>{_t.textReplace} + this.onReplaceAllClick()}>{_t.textReplaceAll} */} + {isReplaceAll ? ( + this.onReplaceAllClick()}>{_t.textReplaceAll} + ) : usereplace ? ( + this.onReplaceClick()}>{_t.textReplace} + ) : null}
this.onSearchClick(SEARCH_BACKWARD)}> diff --git a/apps/common/mobile/lib/view/collaboration/Collaboration.jsx b/apps/common/mobile/lib/view/collaboration/Collaboration.jsx index 8511f9c85..f87e36b16 100644 --- a/apps/common/mobile/lib/view/collaboration/Collaboration.jsx +++ b/apps/common/mobile/lib/view/collaboration/Collaboration.jsx @@ -134,7 +134,7 @@ class CollaborationView extends Component { const show_popover = this.props.usePopover; return ( show_popover ? - this.props.onclosed()}> + this.props.onclosed()} closeByOutsideClick={false}> : this.props.onclosed()}> diff --git a/apps/common/mobile/lib/view/collaboration/Comments.jsx b/apps/common/mobile/lib/view/collaboration/Comments.jsx index 2fd0dbdfa..dd1c5d031 100644 --- a/apps/common/mobile/lib/view/collaboration/Comments.jsx +++ b/apps/common/mobile/lib/view/collaboration/Comments.jsx @@ -292,6 +292,12 @@ const EditCommentDialog = inject("storeComments")(observer(({storeComments, comm done.classList.remove('disabled'); } }); + }, + open: () => { + $$('.dialog-backdrop.backdrop-in')[0].classList.add('over-popover'); + }, + closed: () => { + $$('.dialog-backdrop.backdrop-in')[0].classList.remove('over-popover'); } } }).open(); @@ -411,6 +417,12 @@ const AddReplyDialog = inject("storeComments")(observer(({storeComments, userInf } }); done.classList.add('disabled'); + }, + open: () => { + $$('.dialog-backdrop.backdrop-in')[0].classList.add('over-popover'); + }, + closed: () => { + $$('.dialog-backdrop.backdrop-in')[0].classList.remove('over-popover'); } } }).open(); @@ -536,6 +548,12 @@ const EditReplyDialog = inject("storeComments")(observer(({storeComments, commen done.classList.remove('disabled'); } }); + }, + open: () => { + $$('.dialog-backdrop.backdrop-in')[0].classList.add('over-popover'); + }, + closed: () => { + $$('.dialog-backdrop.backdrop-in')[0].classList.remove('over-popover'); } } }).open(); @@ -825,7 +843,7 @@ const ViewCommentPopover = ({onCommentMenuClick, onResolveComment}) => { f7.popover.open('#view-comment-popover', '#btn-coauth'); }); return ( - + ) diff --git a/apps/common/mobile/resources/less/comments.less b/apps/common/mobile/resources/less/comments.less index 1387992e9..bf433122a 100644 --- a/apps/common/mobile/resources/less/comments.less +++ b/apps/common/mobile/resources/less/comments.less @@ -23,6 +23,7 @@ #add-comment-dialog, #edit-comment-dialog, #add-reply-dialog, #edit-reply-dialog { .dialog { --f7-dialog-width: 400px; + z-index: 13700; .dialog-inner { padding: 0; height: 400px; @@ -194,4 +195,10 @@ } } } +} + +.dialog-backdrop.backdrop-in { + &.over-popover { + z-index: 13600; + } } \ No newline at end of file diff --git a/apps/common/mobile/resources/less/common-ios.less b/apps/common/mobile/resources/less/common-ios.less index 2dc225ede..5bea40077 100644 --- a/apps/common/mobile/resources/less/common-ios.less +++ b/apps/common/mobile/resources/less/common-ios.less @@ -435,6 +435,9 @@ // Find and Replace .navbar { + .searchbar { + background: var(--f7-navbar-bg-color); + } .searchbar-input-wrap { margin-right: 10px; height: 28px; @@ -462,6 +465,10 @@ } .searchbar-inner { + &__left { + margin-right: 10px; + justify-content: center; + } &__right { .buttons-row a.next { margin-left: 15px; @@ -469,14 +476,25 @@ } } - @media(max-width: 550px) - { + .searchbar-expandable.searchbar-enabled { + &.replace { + .searchbar-inner { + &__right { + width: 28%; + } + } + } + } + + @media(max-width: 550px) { + .navbar { + .searchbar-input-wrap { + margin-right: 0; + } + } .searchbar-expandable.searchbar-enabled { top: 0; .searchbar-inner { - &__left { - margin-right: 15px; - } &__center { flex-direction: column; } @@ -494,6 +512,14 @@ margin: 8px 0; } } + &__right { + width: auto; + height: 100%; + justify-content: space-between; + .buttons-row-replace { + height: 50%; + } + } } } } diff --git a/apps/common/mobile/resources/less/common-material.less b/apps/common/mobile/resources/less/common-material.less index 4bec965e1..512fe7a08 100644 --- a/apps/common/mobile/resources/less/common-material.less +++ b/apps/common/mobile/resources/less/common-material.less @@ -344,13 +344,9 @@ &__center { flex-wrap: wrap; } - &__left { - padding-top: 4px; - } - } - - .buttons-row-replace a { - color: @white; + // &__left { + // padding-top: 4px; + // } } .navbar { @@ -434,6 +430,7 @@ } .buttons-row-replace a { color: @white; + padding: 0; } .searchbar .buttons-row { align-self: flex-start; diff --git a/apps/common/mobile/resources/less/common.less b/apps/common/mobile/resources/less/common.less index 21eedf3e6..51ddd56ca 100644 --- a/apps/common/mobile/resources/less/common.less +++ b/apps/common/mobile/resources/less/common.less @@ -133,12 +133,6 @@ } } -.dialog { - .content-block { - padding: 0; - } -} - .about { .content-block { margin: 0 auto 15px; @@ -750,23 +744,28 @@ input[type="number"]::-webkit-inner-spin-button { } } - -.picker-3d { - .picker-item { +.dlg-adv-options { + z-index: 13700; + .content-block { padding: 0; - text-align: left; - font-size: 16px; - span { + } + .picker-3d { + .picker-item { padding: 0; + text-align: left; + font-size: 16px; + span { + padding: 0; + } } } + .picker-center-highlight { + width: 100%; + left: 0; + right: 0; + } } -.picker-center-highlight { - width: 100%; - left: 0; - right: 0; -} diff --git a/apps/common/mobile/resources/less/icons.less b/apps/common/mobile/resources/less/icons.less index fdea10609..234485c7a 100644 --- a/apps/common/mobile/resources/less/icons.less +++ b/apps/common/mobile/resources/less/icons.less @@ -20,4 +20,9 @@ i.icon { &.icon-prev:after, &.icon-next:after { content: none; } + &.icon-collaboration { + width: 24px; + height: 24px; + .encoded-svg-background(''); + } } diff --git a/apps/common/mobile/resources/less/material/icons.less b/apps/common/mobile/resources/less/material/icons.less index c5ddd519b..d13a8b631 100644 --- a/apps/common/mobile/resources/less/material/icons.less +++ b/apps/common/mobile/resources/less/material/icons.less @@ -25,4 +25,13 @@ } } } + .navbar { + i.icon { + &.icon-collaboration { + width: 24px; + height: 24px; + .encoded-svg-background(''); + } + } + } } diff --git a/apps/common/mobile/resources/less/search.less b/apps/common/mobile/resources/less/search.less index caf870f49..f322929d1 100644 --- a/apps/common/mobile/resources/less/search.less +++ b/apps/common/mobile/resources/less/search.less @@ -15,10 +15,11 @@ } .searchbar-inner { + justify-content: space-between; &__center { display: flex; align-items: center; - width: 100%; + width: 81%; } &__right { display: flex; @@ -34,7 +35,9 @@ display: flex; flex-direction: column; align-items: center; - width: max-content; + // width: max-content; + width: 100%; + justify-content: center; a { font-size: 15px; height: auto; diff --git a/apps/documenteditor/mobile/locale/en.json b/apps/documenteditor/mobile/locale/en.json index 7b1269c24..6bd1dfcf8 100644 --- a/apps/documenteditor/mobile/locale/en.json +++ b/apps/documenteditor/mobile/locale/en.json @@ -336,7 +336,9 @@ "textHighlightResults": "Highlight Results", "textSearch": "Search", "textMarginsW": "Left and right margins are too high for a given page width", - "textMarginsH": "Top and bottom margins are too high for a given page height" + "textMarginsH": "Top and bottom margins are too high for a given page height", + "textCollaboration": "Collaboration", + "textFindAndReplaceAll": "Find and Replace All" }, "Edit": { "textClose": "Close", diff --git a/apps/documenteditor/mobile/src/controller/LongActions.jsx b/apps/documenteditor/mobile/src/controller/LongActions.jsx index 740351164..94dca84c8 100644 --- a/apps/documenteditor/mobile/src/controller/LongActions.jsx +++ b/apps/documenteditor/mobile/src/controller/LongActions.jsx @@ -7,6 +7,9 @@ const LongActionsController = () => { const {t} = useTranslation(); const _t = t("LongActions", { returnObjects: true }); + const ApplyEditRights = -255; + const LoadingDocument = -256; + const stackLongActions = new IrregularStack({ strongCompare : function(obj1, obj2){return obj1.id === obj2.id && obj1.type === obj2.type;}, weakCompare : function(obj1, obj2){return obj1.type === obj2.type;} @@ -18,7 +21,7 @@ const LongActionsController = () => { if (loadMask && loadMask.el) { f7.dialog.close(loadMask.el); } - } + }; useEffect( () => { Common.Notifications.on('engineCreated', (api) => { diff --git a/apps/documenteditor/mobile/src/controller/Main.jsx b/apps/documenteditor/mobile/src/controller/Main.jsx index 85c254249..1fae868f3 100644 --- a/apps/documenteditor/mobile/src/controller/Main.jsx +++ b/apps/documenteditor/mobile/src/controller/Main.jsx @@ -15,6 +15,7 @@ import About from '../../../../common/mobile/lib/view/About'; import EditorUIController from '../lib/patch'; import ErrorController from "./Error"; import LongActionsController from "./LongActions"; +import PluginsController from '../../../../common/mobile/lib/controller/Plugins.jsx'; @inject( "storeAppOptions", @@ -799,6 +800,7 @@ class MainController extends Component { {EditorUIController.getEditCommentControllers && EditorUIController.getEditCommentControllers()} + ) } diff --git a/apps/documenteditor/mobile/src/controller/Search.jsx b/apps/documenteditor/mobile/src/controller/Search.jsx index 4184133cc..a61230b9f 100644 --- a/apps/documenteditor/mobile/src/controller/Search.jsx +++ b/apps/documenteditor/mobile/src/controller/Search.jsx @@ -35,6 +35,8 @@ class SearchSettings extends SearchSettingsView { this.onFindReplaceClick('find')} /> this.onFindReplaceClick('replace')} /> + this.onFindReplaceClick('replace-all')}> diff --git a/apps/documenteditor/mobile/src/controller/settings/Settings.jsx b/apps/documenteditor/mobile/src/controller/settings/Settings.jsx index 26e0c638d..aecd11e22 100644 --- a/apps/documenteditor/mobile/src/controller/settings/Settings.jsx +++ b/apps/documenteditor/mobile/src/controller/settings/Settings.jsx @@ -71,7 +71,7 @@ const Settings = props => { window.open(url, "_blank"); }; - return + return }; export default inject("storeAppOptions")(observer(Settings)); \ No newline at end of file diff --git a/apps/documenteditor/mobile/src/less/icons-ios.less b/apps/documenteditor/mobile/src/less/icons-ios.less index 7b6d085ae..fef0d3c13 100644 --- a/apps/documenteditor/mobile/src/less/icons-ios.less +++ b/apps/documenteditor/mobile/src/less/icons-ios.less @@ -20,11 +20,6 @@ height: 22px; .encoded-svg-background(''); } - &.icon-collaboration { - width: 24px; - height: 24px; - .encoded-svg-background(''); - } &.icon-settings { width: 24px; height: 24px; diff --git a/apps/documenteditor/mobile/src/less/icons-material.less b/apps/documenteditor/mobile/src/less/icons-material.less index a388db33f..79eaa86d6 100644 --- a/apps/documenteditor/mobile/src/less/icons-material.less +++ b/apps/documenteditor/mobile/src/less/icons-material.less @@ -26,11 +26,6 @@ height: 22px; .encoded-svg-background(''); } - &.icon-collaboration { - width: 24px; - height: 24px; - .encoded-svg-background(''); - } &.icon-expand-down { width: 22px; height: 22px; @@ -57,6 +52,11 @@ height: 24px; .encoded-svg-background(''); } + &.icon-search { + width: 22px; + height: 22px; + .encoded-svg-background(''); + } } } i.icon { diff --git a/apps/documenteditor/mobile/src/page/main.jsx b/apps/documenteditor/mobile/src/page/main.jsx index 89125f721..2a32a5103 100644 --- a/apps/documenteditor/mobile/src/page/main.jsx +++ b/apps/documenteditor/mobile/src/page/main.jsx @@ -93,7 +93,7 @@ class MainPage extends Component { } { !this.state.settingsVisible ? null : - + } { !this.state.collaborationVisible ? null : diff --git a/apps/documenteditor/mobile/src/store/textSettings.js b/apps/documenteditor/mobile/src/store/textSettings.js index 9c794163c..44fd4cd43 100644 --- a/apps/documenteditor/mobile/src/store/textSettings.js +++ b/apps/documenteditor/mobile/src/store/textSettings.js @@ -36,7 +36,8 @@ export class storeTextSettings { resetTextColor: action, changeCustomTextColors: action, resetLineSpacing: action, - resetBackgroundColor: action + resetBackgroundColor: action, + changeFontFamily: action }); } @@ -156,6 +157,10 @@ export class storeTextSettings { this.customTextColors = colors; } + changeFontFamily(name) { + this.fontName = name; + } + resetLineSpacing (vc) { let line = (vc.get_Line() === null || vc.get_LineRule() === null || vc.get_LineRule() != 1) ? -1 : vc.get_Line(); this.lineSpacing = line; diff --git a/apps/documenteditor/mobile/src/view/Toolbar.jsx b/apps/documenteditor/mobile/src/view/Toolbar.jsx index 6dd921194..a49d002a8 100644 --- a/apps/documenteditor/mobile/src/view/Toolbar.jsx +++ b/apps/documenteditor/mobile/src/view/Toolbar.jsx @@ -9,7 +9,7 @@ const ToolbarView = props => { {props.isShowBack && } - {props.isEdit && EditorUIController.getUndoRedo && EditorUIController.getUndoRedo({ + {Device.ios && props.isEdit && EditorUIController.getUndoRedo && EditorUIController.getUndoRedo({ disabledUndo: !props.isCanUndo, disabledRedo: !props.isCanRedo, onUndoClick: props.onUndo, @@ -18,13 +18,19 @@ const ToolbarView = props => { {!Device.phone && {props.docTitle}} + {Device.android && props.isEdit && EditorUIController.getUndoRedo && EditorUIController.getUndoRedo({ + disabledUndo: !props.isCanUndo, + disabledRedo: !props.isCanRedo, + onUndoClick: props.onUndo, + onRedoClick: props.onRedo + })} {props.isEdit && EditorUIController.getToolbarOptions && EditorUIController.getToolbarOptions({ disabled: disableEditBtn || props.disabledControls, onEditClick: e => props.openOptions('edit'), onAddClick: e => props.openOptions('add') })} { Device.phone ? null : } - {props.displayCollaboration && props.openOptions('coauth')}>} + {props.displayCollaboration && window.matchMedia("(min-width: 390px)").matches ? props.openOptions('coauth')}> : null} props.openOptions('settings')}> diff --git a/apps/documenteditor/mobile/src/view/edit/EditShape.jsx b/apps/documenteditor/mobile/src/view/edit/EditShape.jsx index bbea37e37..122e3b4f4 100644 --- a/apps/documenteditor/mobile/src/view/edit/EditShape.jsx +++ b/apps/documenteditor/mobile/src/view/edit/EditShape.jsx @@ -1,6 +1,7 @@ import React, {Fragment, useState} from 'react'; import {observer, inject} from "mobx-react"; import {List, ListItem, Icon, Row, Page, Navbar, BlockTitle, Toggle, Range, ListButton, Link, Tabs, Tab} from 'framework7-react'; +import { f7 } from 'framework7-react'; import { useTranslation } from 'react-i18next'; import {Device} from '../../../../../common/mobile/utils/device'; import {CustomColorPicker, ThemeColorPalette} from "../../../../../common/mobile/lib/component/ThemeColorPalette.jsx"; @@ -119,14 +120,19 @@ const PageStyle = props => { const _t = t('Edit', {returnObjects: true}); const storeShapeSettings = props.storeShapeSettings; const shapeObject = props.storeFocusObjects.shapeObject; - const stroke = shapeObject.get_ShapeProperties().get_stroke(); + + let borderSize, borderType, transparent; + if (shapeObject) { + const stroke = shapeObject.get_ShapeProperties().get_stroke(); + borderSize = stroke.get_width() * 72.0 / 25.4; + borderType = stroke.get_type(); + transparent = shapeObject.get_ShapeProperties().get_fill().asc_getTransparent(); + } // Init border size const borderSizeTransform = storeShapeSettings.borderSizeTransform(); - const borderSize = stroke.get_width() * 72.0 / 25.4; - const borderType = stroke.get_type(); - const displayBorderSize = (borderType == Asc.c_oAscStrokeType.STROKE_NONE) ? 0 : borderSizeTransform.indexSizeByValue(borderSize); - const displayTextBorderSize = (borderType == Asc.c_oAscStrokeType.STROKE_NONE) ? 0 : borderSizeTransform.sizeByValue(borderSize); + const displayBorderSize = (borderType == Asc.c_oAscStrokeType.STROKE_NONE || borderType === undefined) ? 0 : borderSizeTransform.indexSizeByValue(borderSize); + const displayTextBorderSize = (borderType == Asc.c_oAscStrokeType.STROKE_NONE || borderType === undefined) ? 0 : borderSizeTransform.sizeByValue(borderSize); const [stateBorderSize, setBorderSize] = useState(displayBorderSize); const [stateTextBorderSize, setTextBorderSize] = useState(displayTextBorderSize); @@ -135,10 +141,14 @@ const PageStyle = props => { const displayBorderColor = borderColor !== 'transparent' ? `#${(typeof borderColor === "object" ? borderColor.color : borderColor)}` : borderColor; // Init opacity - const transparent = shapeObject.get_ShapeProperties().get_fill().asc_getTransparent(); const opacity = transparent !== null && transparent !== undefined ? transparent / 2.55 : 100; const [stateOpacity, setOpacity] = useState(Math.round(opacity)); + if (!shapeObject && Device.phone) { + $$('.sheet-modal.modal-in').length > 0 && f7.sheet.close(); + return null; + } + return ( @@ -202,14 +212,17 @@ const PageStyleNoFill = props => { const _t = t('Edit', {returnObjects: true}); const storeShapeSettings = props.storeShapeSettings; const shapeObject = props.storeFocusObjects.shapeObject; - const stroke = shapeObject.get_ShapeProperties().get_stroke(); + let borderSize, borderType; + if (shapeObject) { + const stroke = shapeObject.get_ShapeProperties().get_stroke(); + borderSize = stroke.get_width() * 72.0 / 25.4; + borderType = stroke.get_type(); + } // Init border size const borderSizeTransform = storeShapeSettings.borderSizeTransform(); - const borderSize = stroke.get_width() * 72.0 / 25.4; - const borderType = stroke.get_type(); - const displayBorderSize = (borderType == Asc.c_oAscStrokeType.STROKE_NONE) ? 0 : borderSizeTransform.indexSizeByValue(borderSize); - const displayTextBorderSize = (borderType == Asc.c_oAscStrokeType.STROKE_NONE) ? 0 : borderSizeTransform.sizeByValue(borderSize); + const displayBorderSize = (borderType == Asc.c_oAscStrokeType.STROKE_NONE || borderType === undefined) ? 0 : borderSizeTransform.indexSizeByValue(borderSize); + const displayTextBorderSize = (borderType == Asc.c_oAscStrokeType.STROKE_NONE || borderType === undefined) ? 0 : borderSizeTransform.sizeByValue(borderSize); const [stateBorderSize, setBorderSize] = useState(displayBorderSize); const [stateTextBorderSize, setTextBorderSize] = useState(displayTextBorderSize); @@ -217,6 +230,11 @@ const PageStyleNoFill = props => { const borderColor = !storeShapeSettings.borderColorView ? storeShapeSettings.initBorderColorView(shapeObject) : storeShapeSettings.borderColorView; const displayBorderColor = borderColor !== 'transparent' ? `#${(typeof borderColor === "object" ? borderColor.color : borderColor)}` : borderColor; + if (!shapeObject && Device.phone) { + $$('.sheet-modal.modal-in').length > 0 && f7.sheet.close(); + return null; + } + return ( @@ -252,13 +270,20 @@ const PageWrap = props => { const _t = t('Edit', {returnObjects: true}); const storeShapeSettings = props.storeShapeSettings; const shapeObject = props.storeFocusObjects.shapeObject; - const wrapType = storeShapeSettings.getWrapType(shapeObject); - const align = storeShapeSettings.getAlign(shapeObject); - const moveText = storeShapeSettings.getMoveText(shapeObject); - const overlap = storeShapeSettings.getOverlap(shapeObject); - const distance = Common.Utils.Metric.fnRecalcFromMM(storeShapeSettings.getWrapDistance(shapeObject)); + let wrapType, align, moveText, overlap, distance; + if (shapeObject) { + wrapType = storeShapeSettings.getWrapType(shapeObject); + align = storeShapeSettings.getAlign(shapeObject); + moveText = storeShapeSettings.getMoveText(shapeObject); + overlap = storeShapeSettings.getOverlap(shapeObject); + distance = Common.Utils.Metric.fnRecalcFromMM(storeShapeSettings.getWrapDistance(shapeObject)); + } const metricText = Common.Utils.Metric.getCurrentMetricName(); const [stateDistance, setDistance] = useState(distance); + if (!shapeObject && Device.phone) { + $$('.sheet-modal.modal-in').length > 0 && f7.sheet.close(); + return null; + } return ( @@ -352,6 +377,13 @@ const PageReplace = props => { const storeShapeSettings = props.storeShapeSettings; let shapes = storeShapeSettings.getStyleGroups(); shapes.splice(0, 1); // Remove line shapes + + const shapeObject = props.storeFocusObjects.shapeObject; + if (!shapeObject && Device.phone) { + $$('.sheet-modal.modal-in').length > 0 && f7.sheet.close(); + return null; + } + return ( @@ -377,6 +409,13 @@ const PageReplace = props => { const PageReorder = props => { const { t } = useTranslation(); const _t = t('Edit', {returnObjects: true}); + + const shapeObject = props.storeFocusObjects.shapeObject; + if (!shapeObject && Device.phone) { + $$('.sheet-modal.modal-in').length > 0 && f7.sheet.close(); + return null; + } + return ( diff --git a/apps/documenteditor/mobile/src/view/edit/EditTable.jsx b/apps/documenteditor/mobile/src/view/edit/EditTable.jsx index 3e663f609..94c8c178c 100644 --- a/apps/documenteditor/mobile/src/view/edit/EditTable.jsx +++ b/apps/documenteditor/mobile/src/view/edit/EditTable.jsx @@ -1,6 +1,7 @@ import React, {Fragment, useState} from 'react'; import {observer, inject} from "mobx-react"; import {Page, Navbar, List, ListItem, ListButton, Row, BlockTitle, Range, Toggle, Icon, Link, Tabs, Tab} from 'framework7-react'; +import { f7 } from 'framework7-react'; import { useTranslation } from 'react-i18next'; import {Device} from '../../../../../common/mobile/utils/device'; import {CustomColorPicker, ThemeColorPalette} from "../../../../../common/mobile/lib/component/ThemeColorPalette.jsx"; @@ -12,10 +13,20 @@ const PageTableOptions = props => { const storeFocusObjects = props.storeFocusObjects; const tableObject = storeFocusObjects.tableObject; const storeTableSettings = props.storeTableSettings; - const distance = Common.Utils.Metric.fnRecalcFromMM(storeTableSettings.getCellMargins(tableObject)); + + let distance, isRepeat, isResize; + if (tableObject) { + distance = Common.Utils.Metric.fnRecalcFromMM(storeTableSettings.getCellMargins(tableObject)); + isRepeat = storeTableSettings.getRepeatOption(tableObject); + isResize = storeTableSettings.getResizeOption(tableObject); + } const [stateDistance, setDistance] = useState(distance); - const isRepeat = storeTableSettings.getRepeatOption(tableObject); - const isResize = storeTableSettings.getResizeOption(tableObject); + + if (!tableObject && Device.phone) { + $$('.sheet-modal.modal-in').length > 0 && f7.sheet.close(); + return null; + } + return ( @@ -60,12 +71,21 @@ const PageWrap = props => { const _t = t('Edit', {returnObjects: true}); const storeTableSettings = props.storeTableSettings; const tableObject = props.storeFocusObjects.tableObject; - const wrapType = storeTableSettings.getWrapType(tableObject); - const align = storeTableSettings.getAlign(tableObject); - const moveText = storeTableSettings.getMoveText(tableObject); - const distance = Common.Utils.Metric.fnRecalcFromMM(storeTableSettings.getWrapDistance(tableObject)); + let wrapType, align, moveText, distance; + if (tableObject) { + wrapType = storeTableSettings.getWrapType(tableObject); + align = storeTableSettings.getAlign(tableObject); + moveText = storeTableSettings.getMoveText(tableObject); + distance = Common.Utils.Metric.fnRecalcFromMM(storeTableSettings.getWrapDistance(tableObject)); + } const metricText = Common.Utils.Metric.getCurrentMetricName(); const [stateDistance, setDistance] = useState(distance); + + if (!tableObject && Device.phone) { + $$('.sheet-modal.modal-in').length > 0 && f7.sheet.close(); + return null; + } + return ( @@ -177,13 +197,17 @@ const StyleTemplates = inject("storeFocusObjects")(observer(({templates, onStyle const PageStyleOptions = props => { const { t } = useTranslation(); const _t = t('Edit', {returnObjects: true}); - const tableLook = props.storeFocusObjects.tableObject.get_TableLook(); - const isFirstRow = tableLook.get_FirstRow(); - const isLastRow = tableLook.get_LastRow(); - const isBandHor = tableLook.get_BandHor(); - const isFirstCol = tableLook.get_FirstCol(); - const isLastCol = tableLook.get_LastCol(); - const isBandVer = tableLook.get_BandVer(); + const tableObject = props.storeFocusObjects.tableObject; + let tableLook, isFirstRow, isLastRow, isBandHor, isFirstCol, isLastCol, isBandVer; + if (tableObject) { + tableLook = tableObject.get_TableLook(); + isFirstRow = tableLook.get_FirstRow(); + isLastRow = tableLook.get_LastRow(); + isBandHor = tableLook.get_BandHor(); + isFirstCol = tableLook.get_FirstCol(); + isLastCol = tableLook.get_LastCol(); + isBandVer = tableLook.get_BandVer(); + } return ( @@ -217,9 +241,12 @@ const PageCustomFillColor = props => { const { t } = useTranslation(); const _t = t('Edit', {returnObjects: true}); const tableObject = props.storeFocusObjects.tableObject; - let fillColor = props.storeTableSettings.getFillColor(tableObject); - if (typeof fillColor === 'object') { - fillColor = fillColor.color; + let fillColor; + if (tableObject) { + fillColor = props.storeTableSettings.getFillColor(tableObject); + if (typeof fillColor === 'object') { + fillColor = fillColor.color; + } } const onAddNewColor = (colors, color) => { props.storePalette.changeCustomColors(colors); @@ -405,6 +432,13 @@ const PageStyle = props => { const _t = t('Edit', {returnObjects: true}); const storeTableSettings = props.storeTableSettings; const templates = storeTableSettings.styles; + + const tableObject = props.storeFocusObjects.tableObject; + if (!tableObject && Device.phone) { + $$('.sheet-modal.modal-in').length > 0 && f7.sheet.close(); + return null; + } + return ( diff --git a/apps/documenteditor/mobile/src/view/edit/EditText.jsx b/apps/documenteditor/mobile/src/view/edit/EditText.jsx index 5e6810182..3cad9d774 100644 --- a/apps/documenteditor/mobile/src/view/edit/EditText.jsx +++ b/apps/documenteditor/mobile/src/view/edit/EditText.jsx @@ -28,6 +28,9 @@ const PageFonts = props => { }} }); }; + + console.log(curFontName); + return ( @@ -60,7 +63,7 @@ const PageFonts = props => { checked={curFontName === item.name} title={item.name} style={{fontFamily: `${item.name}`}} - onClick={() => {props.changeFontFamily(item.name)}} + onClick={() => {storeTextSettings.changeFontFamily(item.name); props.changeFontFamily(item.name)}} > ))} diff --git a/apps/documenteditor/mobile/src/view/settings/Settings.jsx b/apps/documenteditor/mobile/src/view/settings/Settings.jsx index 151e7ee25..957ac1ea4 100644 --- a/apps/documenteditor/mobile/src/view/settings/Settings.jsx +++ b/apps/documenteditor/mobile/src/view/settings/Settings.jsx @@ -71,12 +71,17 @@ const SettingsList = inject("storeAppOptions")(observer(props => { const closeModal = () => { if (Device.phone) { - f7.sheet.close('.settings-popup', true); + f7.sheet.close('.settings-popup', false); } else { - f7.popover.close('#settings-popover'); + f7.popover.close('#settings-popover', false); } }; + const onOpenCollaboration = async () => { + await closeModal(); + await props.openOptions('coauth'); + } + useEffect(() => { }); @@ -117,6 +122,11 @@ const SettingsList = inject("storeAppOptions")(observer(props => { } + {window.matchMedia("(max-width: 389px)").matches ? + + + + : null} {_canReader && {/*ToDo*/} @@ -182,10 +192,10 @@ class SettingsView extends Component { return ( show_popover ? this.props.onclosed()}> - + : this.props.onclosed()}> - + ) } diff --git a/apps/presentationeditor/mobile/locale/en.json b/apps/presentationeditor/mobile/locale/en.json index 44a1aa35b..768aafced 100644 --- a/apps/presentationeditor/mobile/locale/en.json +++ b/apps/presentationeditor/mobile/locale/en.json @@ -123,7 +123,9 @@ "txtEditingMode": "Set editing mode...", "loadingDocumentTitleText": "Loading document", "loadingDocumentTextText": "Loading document...", - "textLoadingDocument": "Loading document" + "textLoadingDocument": "Loading document", + "loadThemeTitleText": "Loading Theme", + "loadThemeTextText": "Loading theme..." }, "ContextMenu": { "menuViewComment": "View Comment", @@ -148,7 +150,8 @@ "Settings": { "textDone": "Done", "textSettings": "Settings", - "textFindAndReplace": "Find and replace", + "textFindAndReplace": "Find and Replace", + "textFindAndReplaceAll": "Find and Replace All", "textPresentationSettings": "Presentation Settings", "textApplicationSettings": "Application Settings", "textDownload": "Download", @@ -198,7 +201,8 @@ "textCaseSensitive": "Case Sensitive", "textHighlight": "Highlight Results", "textReplace": "Replace", - "textNoTextFound": "Text not Found" + "textNoTextFound": "Text not Found", + "textCollaboration": "Collaboration" }, "Add": { "textSlide": "Slide", diff --git a/apps/presentationeditor/mobile/src/controller/LongActions.jsx b/apps/presentationeditor/mobile/src/controller/LongActions.jsx index 4dbb515cf..f5b5e50b7 100644 --- a/apps/presentationeditor/mobile/src/controller/LongActions.jsx +++ b/apps/presentationeditor/mobile/src/controller/LongActions.jsx @@ -7,6 +7,9 @@ const LongActionsController = () => { const {t} = useTranslation(); const _t = t("LongActions", {returnObjects: true}); + const ApplyEditRights = -255; + const LoadingDocument = -256; + const stackLongActions = new IrregularStack({ strongCompare : function(obj1, obj2){return obj1.id === obj2.id && obj1.type === obj2.type;}, weakCompare : function(obj1, obj2){return obj1.type === obj2.type;} @@ -118,6 +121,11 @@ const LongActionsController = () => { text = _t.uploadImageTextText; break; + case Asc.c_oAscAsyncAction['LoadTheme']: + title = _t.loadThemeTitleText; + text = _t.loadThemeTextText; + break; + case Asc.c_oAscAsyncAction['ApplyChanges']: title = _t.applyChangesTitleText; text = _t.applyChangesTextText; @@ -151,7 +159,7 @@ const LongActionsController = () => { } if (action.type === Asc.c_oAscAsyncActionType['BlockInteraction']) { - if (action.id === Asc.c_oAscAsyncAction['ApplyChanges']) { + if (action.id === Asc.c_oAscAsyncAction['ApplyChanges'] || action.id === Asc.c_oAscAsyncAction['LoadDocumentFonts']) { return; } @@ -161,7 +169,6 @@ const LongActionsController = () => { loadMask = f7.dialog.preloader(title); } } - }; const onOpenDocument = (progress) => { diff --git a/apps/presentationeditor/mobile/src/controller/Main.jsx b/apps/presentationeditor/mobile/src/controller/Main.jsx index aa626e48e..aa19b3374 100644 --- a/apps/presentationeditor/mobile/src/controller/Main.jsx +++ b/apps/presentationeditor/mobile/src/controller/Main.jsx @@ -13,6 +13,7 @@ import ErrorController from "./Error"; import LongActionsController from "./LongActions"; import {LocalStorage} from "../../../../common/mobile/utils/LocalStorage"; import About from '../../../../common/mobile/lib/view/About'; +import PluginsController from '../../../../common/mobile/lib/controller/Plugins.jsx'; @inject( "storeFocusObjects", @@ -779,6 +780,7 @@ class MainController extends Component { {EditorUIController.getEditCommentControllers && EditorUIController.getEditCommentControllers()} + ) } diff --git a/apps/presentationeditor/mobile/src/controller/Search.jsx b/apps/presentationeditor/mobile/src/controller/Search.jsx index d99567a2d..3f9706fb2 100644 --- a/apps/presentationeditor/mobile/src/controller/Search.jsx +++ b/apps/presentationeditor/mobile/src/controller/Search.jsx @@ -28,6 +28,8 @@ class SearchSettings extends SearchSettingsView { this.onFindReplaceClick('find')} /> this.onFindReplaceClick('replace')} /> + this.onFindReplaceClick('replace-all')}> diff --git a/apps/presentationeditor/mobile/src/less/icons-ios.less b/apps/presentationeditor/mobile/src/less/icons-ios.less index 2b1302da0..d08a23aaf 100644 --- a/apps/presentationeditor/mobile/src/less/icons-ios.less +++ b/apps/presentationeditor/mobile/src/less/icons-ios.less @@ -458,12 +458,6 @@ } // Collaboration - &.icon-collaboration { - width: 24px; - height: 24px; - .encoded-svg-background(''); - } - &.icon-users { width: 24px; height: 24px; diff --git a/apps/presentationeditor/mobile/src/less/icons-material.less b/apps/presentationeditor/mobile/src/less/icons-material.less index 94411dd12..199f3c59c 100644 --- a/apps/presentationeditor/mobile/src/less/icons-material.less +++ b/apps/presentationeditor/mobile/src/less/icons-material.less @@ -416,12 +416,6 @@ } // Collaboration - &.icon-collaboration { - width: 24px; - height: 24px; - .encoded-svg-background(''); - } - &.icon-users { width: 24px; height: 24px; @@ -482,6 +476,11 @@ height: 24px; .encoded-svg-background(''); } + &.icon-plus { + width: 22px; + height: 22px; + .encoded-svg-background(''); + } } // Overwrite color for toolbar @@ -559,12 +558,6 @@ .encoded-svg-background(''); } - &.icon-collaboration { - width: 24px; - height: 24px; - .encoded-svg-background(''); - } - &.icon-add-slide { width: 24px; height: 24px; diff --git a/apps/presentationeditor/mobile/src/page/main.jsx b/apps/presentationeditor/mobile/src/page/main.jsx index 4739278e2..c7f0400e4 100644 --- a/apps/presentationeditor/mobile/src/page/main.jsx +++ b/apps/presentationeditor/mobile/src/page/main.jsx @@ -95,7 +95,7 @@ class MainPage extends Component { } { !this.state.settingsVisible ? null : - + } { !this.state.collaborationVisible ? null : diff --git a/apps/presentationeditor/mobile/src/view/Toolbar.jsx b/apps/presentationeditor/mobile/src/view/Toolbar.jsx index a97919f9e..cc053e6ae 100644 --- a/apps/presentationeditor/mobile/src/view/Toolbar.jsx +++ b/apps/presentationeditor/mobile/src/view/Toolbar.jsx @@ -8,7 +8,7 @@ const ToolbarView = props => { {props.isShowBack && } - {props.isEdit && EditorUIController.getUndoRedo && EditorUIController.getUndoRedo({ + {Device.ios && props.isEdit && EditorUIController.getUndoRedo && EditorUIController.getUndoRedo({ disabledUndo: !props.isCanUndo, disabledRedo: !props.isCanRedo, onUndoClick: props.onUndo, @@ -17,6 +17,12 @@ const ToolbarView = props => { {!Device.phone && {props.docTitle}} + {Device.android && props.isEdit && EditorUIController.getUndoRedo && EditorUIController.getUndoRedo({ + disabledUndo: !props.isCanUndo, + disabledRedo: !props.isCanRedo, + onUndoClick: props.onUndo, + onRedoClick: props.onRedo + })} {props.openOptions('preview')}}> {props.isEdit && EditorUIController.getToolbarOptions && EditorUIController.getToolbarOptions({ disabledAdd: props.disabledAdd || props.disabledControls, @@ -25,7 +31,7 @@ const ToolbarView = props => { onAddClick: () => props.openOptions('add') })} { Device.phone ? null : } - {props.displayCollaboration && props.openOptions('coauth')}>} + {props.displayCollaboration && window.matchMedia("(min-width: 390px)").matches ? props.openOptions('coauth')}> : null} props.openOptions('settings')}> diff --git a/apps/presentationeditor/mobile/src/view/settings/Settings.jsx b/apps/presentationeditor/mobile/src/view/settings/Settings.jsx index fafbf0711..714f8a245 100644 --- a/apps/presentationeditor/mobile/src/view/settings/Settings.jsx +++ b/apps/presentationeditor/mobile/src/view/settings/Settings.jsx @@ -70,12 +70,17 @@ const SettingsList = withTranslation()(props => { const closeModal = () => { if (Device.phone) { - f7.sheet.close('.settings-popup', true); + f7.sheet.close('.settings-popup', false); } else { - f7.popover.close('#settings-popover'); + f7.popover.close('#settings-popover', false); } }; + const onOpenCollaboration = async () => { + await closeModal(); + await props.openOptions('coauth'); + } + const onPrint = () => { closeModal(); const api = Common.EditorApi.get(); @@ -112,6 +117,11 @@ const SettingsList = withTranslation()(props => { } + {window.matchMedia("(max-width: 389px)").matches ? + + + + : null} @@ -152,13 +162,14 @@ class SettingsView extends Component { render() { const show_popover = this.props.usePopover; + return ( show_popover ? this.props.onclosed()}> - + : this.props.onclosed()}> - + ) } @@ -174,13 +185,12 @@ const Settings = props => { } }); - const onviewclosed = () => { - if ( props.onclosed ) + if (props.onclosed) props.onclosed(); }; - return + return }; export default Settings; \ No newline at end of file diff --git a/apps/spreadsheeteditor/mobile/locale/en.json b/apps/spreadsheeteditor/mobile/locale/en.json index 9b308263c..53cd61ec1 100644 --- a/apps/spreadsheeteditor/mobile/locale/en.json +++ b/apps/spreadsheeteditor/mobile/locale/en.json @@ -2,8 +2,64 @@ "Controller" : { "Main" : { "SDK": { + "txtStyle_Normal": "Normal", + "txtStyle_Heading_1": "Heading 1", + "txtStyle_Heading_2": "Heading 2", + "txtStyle_Heading_3": "Heading 3", + "txtStyle_Heading_4": "Heading 4", + "txtStyle_Title": "Title", + "txtStyle_Neutral": "Neutral", + "txtStyle_Bad": "Bad", + "txtStyle_Good": "Good", + "txtStyle_Input": "Input", + "txtStyle_Output": "Output", + "txtStyle_Calculation": "Calculation", + "txtStyle_Check_Cell": "Check Cell", + "txtStyle_Explanatory_Text": "Explanatory Text", + "txtStyle_Note": "Note", + "txtStyle_Linked_Cell": "Linked Cell", + "txtStyle_Warning_Text": "Warning Text", + "txtStyle_Total": "Total", + "txtStyle_Currency": "Currency", + "txtStyle_Percent": "Percent", + "txtStyle_Comma": "Comma", + "txtSeries": "Series", + "txtDiagramTitle": "Chart Title", + "txtXAxis": "X Axis", + "txtYAxis": "Y Axis", + "txtArt": "Your text here", + "txtAccent": "Accent" }, - "textAnonymous": "Anonymous" + "textGuest": "Guest", + "textAnonymous": "Anonymous", + "warnLicenseExceeded": "You've reached the limit for simultaneous connections to %1 editors. This document will be opened for viewing only. Contact your administrator to learn more.", + "warnLicenseUsersExceeded": "You've reached the user limit for %1 editors. Contact your administrator to learn more.", + "warnNoLicense": "You've reached the limit for simultaneous connections to %1 editors. This document will be opened for viewing only. Contact %1 sales team for personal upgrade terms.", + "warnNoLicenseUsers": "You've reached the user limit for %1 editors. Contact %1 sales team for personal upgrade terms.", + "textNoLicenseTitle": "License limit reached", + "warnLicenseLimitedNoAccess": "License expired. You have no access to document editing functionality. Please contact your administrator.", + "warnLicenseLimitedRenewed": "License needs to be renewed. You have a limited access to document editing functionality.
Please contact your administrator to get full access", + "textBuyNow": "Visit website", + "textContactUs": "Contact sales", + "textPaidFeature": "Paid feature", + "textCustomLoader": "Please note that according to the terms of the license you are not entitled to change the loader. Please contact our Sales Department to get a quote.", + "textClose": "Close", + + "notcriticalErrorTitle": "Warning", + "textHasMacros": "The file contains automatic macros.
Do you want to run macros?", + "textRemember": "Remember my choice", + "textYes": "Yes", + "textNo": "No", + + "leavePageText": "You have unsaved changes in this document. Click 'Stay on this Page' to await the autosave of the document. Click 'Leave this Page' to discard all the unsaved changes.", + "errorUpdateVersion": "The file version has been changed. The page will be reloaded.", + "titleUpdateVersion": "Version changed", + "errorServerVersion": "The editor version has been updated. The page will be reloaded to apply the changes.", + "titleServerVersion": "Editor updated", + "errorProcessSaveResult": "Saving is failed.", + "criticalErrorTitle": "Error", + "warnProcessRightsChange": "You have been denied the right to edit the file.", + "errorAccessDeny": "You are trying to perform an action you do not have rights for.
Please contact your Document Server administrator." } }, "LongActions": { @@ -346,6 +402,7 @@ }, "Settings": { "textFindAndReplace": "Find and Replace", + "textFindAndReplaceAll": "Find and Replace All", "textSpreadsheetSettings": "Spreadsheet Settings", "textApplicationSettings": "Application Settings", "textDownload": "Download", @@ -434,7 +491,8 @@ "textFormulas": "Formulas", "textValues": "Values", "textNoTextFound": "Text not found", - "textReplaceAll": "Replace All" + "textReplaceAll": "Replace All", + "textCollaboration": "Collaboration" } }, "Statusbar": { diff --git a/apps/spreadsheeteditor/mobile/src/controller/LongActions.jsx b/apps/spreadsheeteditor/mobile/src/controller/LongActions.jsx index 0f2fb50f7..08127984b 100644 --- a/apps/spreadsheeteditor/mobile/src/controller/LongActions.jsx +++ b/apps/spreadsheeteditor/mobile/src/controller/LongActions.jsx @@ -7,6 +7,9 @@ const LongActionsController = () => { const {t} = useTranslation(); const _t = t("LongActions", { returnObjects: true }); + const ApplyEditRights = -255; + const LoadingDocument = -256; + const stackLongActions = new IrregularStack({ strongCompare : function(obj1, obj2){return obj1.id === obj2.id && obj1.type === obj2.type;}, weakCompare : function(obj1, obj2){return obj1.type === obj2.type;} @@ -18,7 +21,7 @@ const LongActionsController = () => { if (loadMask && loadMask.el) { f7.dialog.close(loadMask.el); } - } + }; useEffect( () => { Common.Notifications.on('engineCreated', (api) => { diff --git a/apps/spreadsheeteditor/mobile/src/controller/Main.jsx b/apps/spreadsheeteditor/mobile/src/controller/Main.jsx index c64810f94..034d235c0 100644 --- a/apps/spreadsheeteditor/mobile/src/controller/Main.jsx +++ b/apps/spreadsheeteditor/mobile/src/controller/Main.jsx @@ -12,16 +12,39 @@ import { EditCommentController, ViewCommentsController } from "../../../../common/mobile/lib/controller/collaboration/Comments"; +import {LocalStorage} from "../../../../common/mobile/utils/LocalStorage"; import LongActionsController from "./LongActions"; import ErrorController from "./Error"; +import app from "../page/app"; +import About from "../../../../common/mobile/lib/view/About"; +import PluginsController from '../../../../common/mobile/lib/controller/Plugins.jsx'; -@inject("storeAppOptions", "storeFocusObjects", "storeCellSettings", "storeTextSettings", "storeChartSettings", "storeSpreadsheetSettings", "storeSpreadsheetInfo") +@inject( + "storeAppOptions", + "storeFocusObjects", + "storeCellSettings", + "storeTextSettings", + "storeChartSettings", + "storeSpreadsheetSettings", + "storeSpreadsheetInfo", + "storeApplicationSettings" + ) class MainController extends Component { constructor(props) { super(props); window.editorType = 'sse'; this.LoadingDocument = -256; + + this._state = { + licenseType: false, + isDocModified: false + }; + + this.defaultTitleText = __APP_TITLE_TEXT__; + + const { t } = this.props; + this._t = t('Controller.Main', {returnObjects:true}); } initSdk() { @@ -56,46 +79,52 @@ class MainController extends Component { }; const loadConfig = data => { + const _t = this._t; + EditorUIController.isSupportEditFeature(); - let me = this; + this.editorConfig = Object.assign({}, this.editorConfig, data.config); + this.appOptions.lang = this.editorConfig.lang; - me.editorConfig = Object.assign({}, this.editorConfig, data.config); - me.appOptions.user = Common.Utils.fillUserInfo(me.editorConfig.user, me.editorConfig.lang, "Local.User"/*me.textAnonymous*/); -/**/ - me.editorConfig.user = - me.appOptions.user = Common.Utils.fillUserInfo(me.editorConfig.user, me.editorConfig.lang, me.textAnonymous); - me.appOptions.lang = me.editorConfig.lang; + const appOptions = this.props.storeAppOptions; + appOptions.setConfigOptions(this.editorConfig, _t); - this.props.storeAppOptions.setConfigOptions(this.editorConfig); + let value; + if (appOptions.canRenameAnonymous) { + value = LocalStorage.getItem("guest-username"); + //Common.Utils.InternalSettings.set("guest-username", value); + //Common.Utils.InternalSettings.set("save-guest-username", !!value); + } - // var value = Common.localStorage.getItem("sse-settings-regional"); - // if (value!==null) - // this.api.asc_setLocale(parseInt(value)); - // else { - // value = me.appOptions.region; - // value = Common.util.LanguageInfo.getLanguages().hasOwnProperty(value) ? value : Common.util.LanguageInfo.getLocalLanguageCode(value); - // if (value!==null) - // value = parseInt(value); - // else - // value = (this.editorConfig.lang) ? parseInt(Common.util.LanguageInfo.getLocalLanguageCode(me.editorConfig.lang)) : 0x0409; - // this.api.asc_setLocale(value); - // } + value = LocalStorage.getItem("sse-settings-regional"); + if (value !== null) { + this.api.asc_setLocale(parseInt(value)); + } else { + value = appOptions.region; + value = Common.util.LanguageInfo.getLanguages().hasOwnProperty(value) ? value : Common.util.LanguageInfo.getLocalLanguageCode(value); + if (value !== null) { + value = parseInt(value); + } else { + value = (appOptions.lang) ? parseInt(Common.util.LanguageInfo.getLocalLanguageCode(appOptions.lang)) : 0x0409; + } + this.api.asc_setLocale(value); + } - // if (me.appOptions.location == 'us' || me.appOptions.location == 'ca') - // Common.Utils.Metric.setDefaultMetric(Common.Utils.Metric.c_MetricUnits.inch); - // - // if (!me.editorConfig.customization || !(me.editorConfig.customization.loaderName || me.editorConfig.customization.loaderLogo)) - // $('#editor_sdk').append('
' + '
'.repeat(2) + '
'); - // - // var value = Common.localStorage.getItem("sse-mobile-macros-mode"); - // if (value === null) { - // value = this.editorConfig.customization ? this.editorConfig.customization.macrosMode : 'warn'; - // value = (value == 'enable') ? 1 : (value == 'disable' ? 2 : 0); - // } else - // value = parseInt(value); - // Common.Utils.InternalSettings.set("sse-mobile-macros-mode", value); + if (appOptions.location == 'us' || appOptions.location == 'ca') { + Common.Utils.Metric.setDefaultMetric(Common.Utils.Metric.c_MetricUnits.inch); + } + //if (!appOptions.customization || !(appOptions.customization.loaderName || appOptions.customization.loaderLogo)) + //$('#editor_sdk').append('
' + '
'.repeat(2) + '
'); + + value = LocalStorage.getItem("sse-mobile-macros-mode"); + if (value === null) { + value = appOptions.customization ? appOptions.customization.macrosMode : 'warn'; + value = (value === 'enable') ? 1 : (value === 'disable' ? 2 : 0); + } else { + value = parseInt(value); + } + this.props.storeApplicationSettings.changeMacrosSettings(value); }; const loadDocument = data => { @@ -127,17 +156,16 @@ class MainController extends Component { docInfo.put_Permissions(_permissions); docInfo.put_EncryptedInfo(this.editorConfig.encryptionKeys); - // var enable = !this.editorConfig.customization || (this.editorConfig.customization.macros!==false); - // docInfo.asc_putIsEnabledMacroses(!!enable); - // enable = !this.editorConfig.customization || (this.editorConfig.customization.plugins!==false); - // docInfo.asc_putIsEnabledPlugins(!!enable); - - // SSE.getController('Toolbar').setDocumentTitle(data.doc.title); + const appOptions = this.props.storeAppOptions; + let enable = !appOptions.customization || (appOptions.customization.macros !== false); + docInfo.asc_putIsEnabledMacroses(!!enable); + enable = !appOptions.customization || (appOptions.customization.plugins!==false); + docInfo.asc_putIsEnabledPlugins(!!enable); } this.api.asc_registerCallback('asc_onGetEditorPermissions', onEditorPermissions); - // this.api.asc_registerCallback('asc_onLicenseChanged', _.bind(this.onLicenseChanged, this)); - // this.api.asc_registerCallback('asc_onRunAutostartMacroses', _.bind(this.onRunAutostartMacroses, this)); + this.api.asc_registerCallback('asc_onLicenseChanged', this.onLicenseChanged.bind(this)); + this.api.asc_registerCallback('asc_onRunAutostartMacroses', this.onRunAutostartMacroses.bind(this)); this.api.asc_setDocInfo(docInfo); this.api.asc_getEditorPermissions(this.editorConfig.licenseUrl, this.editorConfig.customerId); this.api.asc_enableKeyEvents(true); @@ -152,21 +180,20 @@ class MainController extends Component { }; const onEditorPermissions = params => { - let me = this; const licType = params.asc_getLicenseType(); + this.appOptions.canLicense = (licType === Asc.c_oLicenseResult.Success || licType === Asc.c_oLicenseResult.SuccessLimit); - me.appOptions.canLicense = (licType === Asc.c_oLicenseResult.Success || licType === Asc.c_oLicenseResult.SuccessLimit); + const appOptions = this.props.storeAppOptions; + appOptions.setPermissionOptions(this.document, licType, params, this.permissions); - this.props.storeAppOptions.setPermissionOptions(this.document, licType, params, this.permissions); - // me.appOptions.canEdit = (me.permissions.edit !== false || me.permissions.review === true) && // can edit or review - // (me.editorConfig.canRequestEditRights || me.editorConfig.mode !== 'view') && // if mode=="view" -> canRequestEditRights must be defined - // (!me.appOptions.isReviewOnly || me.appOptions.canLicense) && // if isReviewOnly==true -> canLicense must be true - // me.isSupportEditFeature(); - // me.appOptions.isEdit = me.appOptions.canLicense && me.appOptions.canEdit && me.editorConfig.mode !== 'view'; + this.applyMode(appOptions); - // me.api.asc_setViewMode(!me.appOptions.isEdit); - me.api.asc_setViewMode(false); - me.api.asc_LoadDocument(); + this.api.asc_LoadDocument(); + + //if (!me.appOptions.isEdit) { + //me.hidePreloader(); + //me.onLongActionBegin(Asc.c_oAscAsyncActionType.BlockInteraction, LoadingDocument); + //} }; const _process_array = (array, fn) => { @@ -184,30 +211,64 @@ class MainController extends Component { _process_array(dep_scripts, promise_get_script) .then ( result => { const {t} = this.props; + const _t = t('Controller.Main.SDK', {returnObjects:true}) + const styleNames = ['Normal', 'Neutral', 'Bad', 'Good', 'Input', 'Output', 'Calculation', 'Check Cell', 'Explanatory Text', 'Note', 'Linked Cell', 'Warning Text', + 'Heading 1', 'Heading 2', 'Heading 3', 'Heading 4', 'Title', 'Total', 'Currency', 'Percent', 'Comma']; + const translate = { + 'Series': _t.txtSeries, + 'Diagram Title': _t.txtDiagramTitle, + 'X Axis': _t.txtXAxis, + 'Y Axis': _t.txtYAxis, + 'Your text here': _t.txtArt + }; + styleNames.forEach(function(item){ + translate[item] = _t['txtStyle_' + item.replace(/ /g, '_')] || item; + }); + translate['Currency [0]'] = _t.txtStyle_Currency + ' [0]'; + translate['Comma [0]'] = _t.txtStyle_Comma + ' [0]'; + + for (let i=1; i<7; i++) { + translate['Accent'+i] = _t.txtAccent + i; + translate['20% - Accent'+i] = '20% - ' + _t.txtAccent + i; + translate['40% - Accent'+i] = '40% - ' + _t.txtAccent + i; + translate['60% - Accent'+i] = '60% - ' + _t.txtAccent + i; + } this.api = new Asc.spreadsheet_api({ 'id-view': 'editor_sdk', 'id-input': 'idx-cell-content', - 'mobile': true - // 'translate': translate + 'mobile': true, + 'translate': translate }); + Common.Notifications.trigger('engineCreated', this.api); Common.EditorApi = {get: () => this.api}; this.appOptions = {}; this.bindEvents(); - let value = null /*Common.localStorage.getItem("sse-settings-fontrender")*/; - if (value===null) value = window.devicePixelRatio > 1 ? '1' : '3'; + let value = LocalStorage.getItem("sse-settings-fontrender"); + if (value === null) value = window.devicePixelRatio > 1 ? '1' : '3'; this.api.asc_setFontRenderingMode(parseInt(value)); Common.Utils.Metric.setCurrentMetric(Common.Utils.Metric.c_MetricUnits.pt); // TODO: beautify c_MetricUnits - Common.Gateway.on('init', loadConfig); - // Common.Gateway.on('showmessage', _.bind(me.onExternalMessage, me)); + Common.Gateway.on('init', loadConfig); + Common.Gateway.on('showmessage', this.onExternalMessage.bind(this)); Common.Gateway.on('opendocument', loadDocument); Common.Gateway.appReady(); - Common.Notifications.trigger('engineCreated', this.api); + Common.Gateway.on('internalcommand', function(data) { + if (data.command === 'hardBack') { + if ($$('.modal-in').length > 0) { + if ( !($$('.error-dialog.modal-in').length > 0) ) { + f7.dialog.close(); + } + Common.Gateway.internalMessage('hardBack', false); + } else + Common.Gateway.internalMessage('hardBack', true); + } + }); + Common.Gateway.internalMessage('listenHardBack'); }, error => { console.log('promise failed ' + error); }); @@ -221,18 +282,12 @@ class MainController extends Component { } bindEvents() { - const me = this; - - // me.api.asc_registerCallback('asc_onError', _.bind(me.onError, me)); - me.api.asc_registerCallback('asc_onOpenDocumentProgress', me._onOpenDocumentProgress.bind(me)); - // me.api.asc_registerCallback('asc_onAdvancedOptions', _.bind(me.onAdvancedOptions, me)); - // me.api.asc_registerCallback('asc_onDocumentUpdateVersion', _.bind(me.onUpdateVersion, me)); - // me.api.asc_registerCallback('asc_onServerVersion', _.bind(me.onServerVersion, me)); - // me.api.asc_registerCallback('asc_onPrintUrl', _.bind(me.onPrintUrl, me)); - // me.api.asc_registerCallback('asc_onDocumentName', _.bind(me.onDocumentName, me)); - me.api.asc_registerCallback('asc_onEndAction', me._onLongActionEnd.bind(me)); - - EditorUIController.initThemeColors && EditorUIController.initThemeColors(); + this.api.asc_registerCallback('asc_onDocumentUpdateVersion', this.onUpdateVersion.bind(this)); + this.api.asc_registerCallback('asc_onServerVersion', this.onServerVersion.bind(this)); + this.api.asc_registerCallback('asc_onPrintUrl', this.onPrintUrl.bind(this)); + this.api.asc_registerCallback('asc_onPrint', this.onPrint.bind(this)); + this.api.asc_registerCallback('asc_onDocumentName', this.onDocumentName.bind(this)); + this.api.asc_registerCallback('asc_onEndAction', this._onLongActionEnd.bind(this)); EditorUIController.initCellInfo && EditorUIController.initCellInfo(this.props); @@ -263,42 +318,431 @@ class MainController extends Component { if ( type === Asc.c_oAscAsyncActionType.BlockInteraction && id == Asc.c_oAscAsyncAction.Open ) { Common.Gateway.internalMessage('documentReady', {}); Common.Notifications.trigger('document:ready'); - this._onDocumentContentReady(); + this.onDocumentContentReady(); } } - _onDocumentContentReady() { - const me = this; + onDocumentContentReady() { + if (this._isDocReady) + return; - me.api.asc_Resize(); + const appOptions = this.props.storeAppOptions; + const appSettings = this.props.storeApplicationSettings; - let value = null /*(this.appOptions.isEditMailMerge || this.appOptions.isEditDiagram) ? 100 : Common.localStorage.getItem("sse-settings-zoom")*/; - var zf = (value !== null) ? parseInt(value)/100 : (this.appOptions.customization && this.appOptions.customization.zoom ? parseInt(this.appOptions.customization.zoom)/100 : 1); + this._isDocReady = true; + + this.api.asc_showWorksheet(this.api.asc_getActiveWorksheetIndex()); + this.api.asc_Resize(); + + Common.Notifications.trigger('preloader:close'); + Common.Notifications.trigger('preloader:endAction', Asc.c_oAscAsyncActionType['BlockInteraction'], this.LoadingDocument); + + let value = (appOptions.isEditMailMerge || appOptions.isEditDiagram) ? 100 : LocalStorage.getItem("sse-settings-zoom"); + var zf = (value !== null) ? parseInt(value)/100 : (appOptions.customization && appOptions.customization.zoom ? parseInt(appOptions.customization.zoom)/100 : 1); this.api.asc_setZoom(zf>0 ? zf : 1); - // this.api.asc_SetFastCollaborative(false); + this.updateWindowTitle(true); - me.api.asc_enableKeyEvents(true); - me.api.asc_getWorksheetsCount(); - me.api.asc_showWorksheet(me.api.asc_getActiveWorksheetIndex()); + if (appOptions.isEdit) { + if (this.needToUpdateVersion) { + Common.Notifications.trigger('api:disconnect'); + } + } + + if (appOptions.canAnalytics && false) { + Common.component.Analytics.initialize('UA-12442749-13', 'Spreadsheet Editor'); + } + + Common.Gateway.on('processsaveresult', this.onProcessSaveResult.bind(this)); + Common.Gateway.on('processrightschange', this.onProcessRightsChange.bind(this)); + Common.Gateway.on('downloadas', this.onDownloadAs.bind(this)); + Common.Gateway.on('requestclose', this.onRequestClose.bind(this)); + + Common.Gateway.sendInfo({ + mode: appOptions.isEdit ? 'edit' : 'view' + }); this.applyLicense(); + //R1C1 reference style + value = LocalStorage.getBool('sse-settings-r1c1', false); + appSettings.changeRefStyle(value); + this.api.asc_setR1C1Mode(value); + Common.Gateway.documentReady(); f7.emit('resize'); } - _onOpenDocumentProgress(progress) { - // if (this.loadMask) { - // var $title = $$(this.loadMask).find('.modal-title'), - // const proc = (progress.asc_getCurrentFont() + progress.asc_getCurrentImage())/(progress.asc_getFontsCount() + progress.asc_getImagesCount()); + applyMode (appOptions) { + this.api.asc_enableKeyEvents(appOptions.isEdit); - // $title.text(this.textLoadingDocument + ': ' + Math.min(Math.round(proc * 100), 100) + '%'); - // } + if (!appOptions.isEditMailMerge && !appOptions.isEditDiagram) { + EditorUIController.initThemeColors && EditorUIController.initThemeColors(); + this.api.asc_registerCallback('asc_onDownloadUrl', this.onDownloadUrl.bind(this)); + } + + this.api.asc_setViewMode(!appOptions.isEdit && !appOptions.isRestrictedEdit); + (appOptions.isRestrictedEdit && appOptions.canComments) && this.api.asc_setRestriction(Asc.c_oAscRestrictionType.OnlyComments); + + let value = LocalStorage.getItem('sse-mobile-settings-unit'); + value = (value !== null) ? parseInt(value) : (appOptions.customization && appOptions.customization.unit ? Common.Utils.Metric.c_MetricUnits[appOptions.customization.unit.toLocaleLowerCase()] : Common.Utils.Metric.getDefaultMetric()); + (value === undefined) && (value = Common.Utils.Metric.getDefaultMetric()); + Common.Utils.Metric.setCurrentMetric(value); + + this.api.asc_registerCallback('asc_onDocumentModifiedChanged', this.onDocumentModifiedChanged.bind(this)); + this.api.asc_registerCallback('asc_onDocumentCanSaveChanged', this.onDocumentCanSaveChanged.bind(this)); + + //if (me.stackLongActions.exist({id: ApplyEditRights, type: Asc.c_oAscAsyncActionType.BlockInteraction})) { + //me.onLongActionEnd(Asc.c_oAscAsyncActionType.BlockInteraction, ApplyEditRights); + //} else if (!this._isDocReady) { + //me.hidePreloader(); + //me.onLongActionBegin(Asc.c_oAscAsyncActionType.BlockInteraction, LoadingDocument); + //} + + // Message on window close + window.onbeforeunload = this.onBeforeUnload.bind(this); + window.onunload = this.onUnload.bind(this); + } + + onLicenseChanged (params) { + const appOptions = this.props.storeAppOptions; + if (appOptions.isEditDiagram || appOptions.isEditMailMerge) return; + + const licType = params.asc_getLicenseType(); + if (licType !== undefined && appOptions.canEdit && appOptions.config.mode !== 'view' && + (licType === Asc.c_oLicenseResult.Connections || licType === Asc.c_oLicenseResult.UsersCount || licType === Asc.c_oLicenseResult.ConnectionsOS || licType === Asc.c_oLicenseResult.UsersCountOS + || licType === Asc.c_oLicenseResult.SuccessLimit && (appOptions.trialMode & Asc.c_oLicenseMode.Limited) !== 0)) + this._state.licenseType = licType; + + if (this._isDocReady && this._state.licenseType) + this.applyLicense(); } applyLicense () { - Common.Notifications.trigger('toolbar:activatecontrols'); + const _t = this._t; + const warnNoLicense = _t.warnNoLicense.replace(/%1/g, __COMPANY_NAME__); + const warnNoLicenseUsers = _t.warnNoLicenseUsers.replace(/%1/g, __COMPANY_NAME__); + const textNoLicenseTitle = _t.textNoLicenseTitle.replace(/%1/g, __COMPANY_NAME__); + const warnLicenseExceeded = _t.warnLicenseExceeded.replace(/%1/g, __COMPANY_NAME__); + const warnLicenseUsersExceeded = _t.warnLicenseUsersExceeded.replace(/%1/g, __COMPANY_NAME__); + + const appOptions = this.props.storeAppOptions; + if (appOptions.config.mode !== 'view' && !EditorUIController.isSupportEditFeature()) { + let value = LocalStorage.getItem("sse-opensource-warning"); + value = (value !== null) ? parseInt(value) : 0; + const now = (new Date).getTime(); + if (now - value > 86400000) { + LocalStorage.setItem("sse-opensource-warning", now); + f7.dialog.create({ + title: _t.notcriticalErrorTitle, + text : _t.errorOpensource, + buttons: [{text: 'OK'}] + }).open(); + } + Common.Notifications.trigger('toolbar:activatecontrols'); + return; + } + + if (this._state.licenseType) { + let license = this._state.licenseType; + let buttons = [{text: 'OK'}]; + if ((appOptions.trialMode & Asc.c_oLicenseMode.Limited) !== 0 && + (license === Asc.c_oLicenseResult.SuccessLimit || + license === Asc.c_oLicenseResult.ExpiredLimited || + appOptions.permissionsLicense === Asc.c_oLicenseResult.SuccessLimit) + ) { + license = (license === Asc.c_oLicenseResult.ExpiredLimited) ? _t.warnLicenseLimitedNoAccess : _t.warnLicenseLimitedRenewed; + } else if (license === Asc.c_oLicenseResult.Connections || license === Asc.c_oLicenseResult.UsersCount) { + license = (license===Asc.c_oLicenseResult.Connections) ? warnLicenseExceeded : warnLicenseUsersExceeded; + } else { + license = (license === Asc.c_oLicenseResult.ConnectionsOS) ? warnNoLicense : warnNoLicenseUsers; + buttons = [{ + text: _t.textBuyNow, + bold: true, + onClick: function() { + window.open(`${__PUBLISHER_URL__}`, "_blank"); + } + }, + { + text: _t.textContactUs, + onClick: function() { + window.open(`mailto:${__SALES_EMAIL__}`, "_blank"); + } + }]; + } + if (this._state.licenseType === Asc.c_oLicenseResult.SuccessLimit) { + Common.Notifications.trigger('toolbar:activatecontrols'); + } else { + Common.Notifications.trigger('toolbar:activatecontrols'); + Common.Notifications.trigger('toolbar:deactivateeditcontrols'); + Common.Notifications.trigger('api:disconnect'); + } + + let value = LocalStorage.getItem("sse-license-warning"); + value = (value !== null) ? parseInt(value) : 0; + const now = (new Date).getTime(); + + if (now - value > 86400000) { + LocalStorage.setItem("sse-license-warning", now); + f7.dialog.create({ + title: textNoLicenseTitle, + text : license, + buttons: buttons + }).open(); + } + } else { + if (!appOptions.isDesktopApp && !appOptions.canBrandingExt && + appOptions.config && appOptions.config.customization && (appOptions.config.customization.loaderName || appOptions.config.customization.loaderLogo)) { + f7.dialog.create({ + title: _t.textPaidFeature, + text : _t.textCustomLoader, + buttons: [{ + text: _t.textContactUs, + bold: true, + onClick: () => { + window.open(`mailto:${__SALES_EMAIL__}`, "_blank"); + } + }, + { text: _t.textClose }] + }).open(); + } + Common.Notifications.trigger('toolbar:activatecontrols'); + } + } + + onExternalMessage (msg) { + if (msg && msg.msg) { + msg.msg = (msg.msg).toString(); + f7.notification.create({ + //title: uiApp.params.modalTitle, + text: [msg.msg.charAt(0).toUpperCase() + msg.msg.substring(1)], + closeButton: true + }).open(); + + Common.component.Analytics.trackEvent('External Error'); + } + } + + onRunAutostartMacroses () { + const appOptions = this.props.storeAppOptions; + const enable = !appOptions.customization || (appOptions.customization.macros !== false); + if (enable) { + const value = this.props.storeApplicationSettings.macrosMode; + if (value === 1) { + this.api.asc_runAutostartMacroses(); + } else if (value === 0) { + const _t = this._t; + f7.dialog.create({ + title: _t.notcriticalErrorTitle, + text: _t.textHasMacros, + content: `
+ + ${_t.textRemember} +
`, + buttons: [{ + text: _t.textYes, + onClick: () => { + const dontshow = $$('input[name="checkbox-show-macros"]').prop('checked'); + if (dontshow) { + this.props.storeApplicationSettings.changeMacrosSettings(1); + LocalStorage.setItem("sse-mobile-macros-mode", 1); + } + setTimeout(() => { + this.api.asc_runAutostartMacroses(); + }, 1); + }}, + { + text: _t.textNo, + onClick: () => { + const dontshow = $$('input[name="checkbox-show-macros"]').prop('checked'); + if (dontshow) { + this.props.storeApplicationSettings.changeMacrosSettings(2); + LocalStorage.setItem("sse-mobile-macros-mode", 2); + } + } + }] + }).open(); + } + } + } + + onDownloadUrl () { + if (this._state.isFromGatewayDownloadAs) { + Common.Gateway.downloadAs(url); + } + + this._state.isFromGatewayDownloadAs = false; + } + + onBeforeUnload () { + const _t = this._t; + + LocalStorage.save(); + + const config = this.props.storeAppOptions.config; + const isEdit = this.permissions.edit !== false && config.mode !== 'view' && config.mode !== 'editdiagram'; + if (isEdit && this.api.asc_isDocumentModified()) { + this.api.asc_stopSaving(); + this.continueSavingTimer = window.setTimeout(() => { + this.api.asc_continueSaving(); + }, 500); + + return _t.leavePageText; + } + } + + onUnload () { + if (this.continueSavingTimer) + clearTimeout(this.continueSavingTimer); + } + + onUpdateVersion (callback) { + const _t = this._t; + + this.needToUpdateVersion = true; + Common.Notifications.trigger('preloader:endAction', Asc.c_oAscAsyncActionType['BlockInteraction'], this.LoadingDocument); + + f7.dialog.alert( + _t.errorUpdateVersion, + _t.titleUpdateVersion, + () => { + Common.Gateway.updateVersion(); + if (callback) { + callback.call(this); + } + Common.Notifications.trigger('preloader:beginAction', Asc.c_oAscAsyncActionType['BlockInteraction'], this.LoadingDocument); + }); + } + + onServerVersion (buildVersion) { + if (this.changeServerVersion) return true; + const _t = this._t; + + if (About.appVersion() !== buildVersion && !About.compareVersions()) { + this.changeServerVersion = true; + f7.dialog.alert( + _t.errorServerVersion, + _t.titleServerVersion, + () => { + setTimeout(() => {Common.Gateway.updateVersion()}, 0); + }); + return true; + } + return false; + } + + onPrintUrl (url) { + if (this.iframePrint) { + this.iframePrint.parentNode.removeChild(this.iframePrint); + this.iframePrint = null; + } + + if (!this.iframePrint) { + this.iframePrint = document.createElement("iframe"); + this.iframePrint.id = "id-print-frame"; + this.iframePrint.style.display = 'none'; + this.iframePrint.style.visibility = "hidden"; + this.iframePrint.style.position = "fixed"; + this.iframePrint.style.right = "0"; + this.iframePrint.style.bottom = "0"; + document.body.appendChild(this.iframePrint); + this.iframePrint.onload = function() { + this.iframePrint.contentWindow.focus(); + this.iframePrint.contentWindow.print(); + this.iframePrint.contentWindow.blur(); + window.focus(); + }; + } + + if (url) { + this.iframePrint.src = url; + } + } + + onDocumentName (name) { + this.updateWindowTitle(true); + } + + updateWindowTitle (force) { + const isModified = this.api.asc_isDocumentModified(); + if (this._state.isDocModified !== isModified || force) { + const title = this.defaultTitleText; + + if (window.document.title !== title) { + window.document.title = title; + } + + this._isDocReady && (this._state.isDocModified !== isModified) && Common.Gateway.setDocumentModified(isModified); + this._state.isDocModified = isModified; + } + } + + onDocumentModifiedChanged () { + const isModified = this.api.asc_isDocumentCanSave(); + if (this._state.isDocModified !== isModified) { + this._isDocReady && Common.Gateway.setDocumentModified(this.api.asc_isDocumentModified()); + } + + this.updateWindowTitle(); + } + + onDocumentCanSaveChanged (isCanSave) { + // + } + + onPrint () { + if (!this.props.storeAppOptions.canPrint) return; + + if (this.api) + this.api.asc_Print(); + Common.component.Analytics.trackEvent('Print'); + } + + onProcessSaveResult (data) { + this.api.asc_OnSaveEnd(data.result); + + if (data && data.result === false) { + const _t = this._t; + f7.dialog.alert( + (!data.message) ? _t.errorProcessSaveResult : data.message, + _t.criticalErrorTitle + ); + } + } + + onProcessRightsChange (data) { + if (data && data.enabled === false) { + const appOptions = this.props.storeAppOptions; + const old_rights = appOptions.lostEditingRights; + appOptions.changeEditingRights(!old_rights); + this.api.asc_coAuthoringDisconnect(); + Common.Notifications.trigger('api:disconnect'); + + if (!old_rights) { + const _t = this._t; + f7.dialog.alert( + (!data.message) ? _t.warnProcessRightsChange : data.message, + _t.notcriticalErrorTitle, + () => { appOptions.changeEditingRights(false); } + ); + } + } + } + + onDownloadAs () { + if ( this.props.storeAppOptions.canDownload) { + Common.Gateway.reportError(Asc.c_oAscError.ID.AccessDeny, this._t.errorAccessDeny); + return; + } + this._state.isFromGatewayDownloadAs = true; + this.api.asc_DownloadAs(new Asc.asc_CDownloadOptions(Asc.c_oAscFileType.XLSX, true)); + } + + onRequestClose () { + Common.Gateway.requestClose(); } render() { @@ -311,6 +755,7 @@ class MainController extends Component { + ) } diff --git a/apps/spreadsheeteditor/mobile/src/controller/Search.jsx b/apps/spreadsheeteditor/mobile/src/controller/Search.jsx index c5da9a6b1..6deb8480e 100644 --- a/apps/spreadsheeteditor/mobile/src/controller/Search.jsx +++ b/apps/spreadsheeteditor/mobile/src/controller/Search.jsx @@ -36,6 +36,8 @@ class SearchSettings extends SearchSettingsView { this.onFindReplaceClick('find')} /> this.onFindReplaceClick('replace')} /> + this.onFindReplaceClick('replace-all')}> {_t.textSearchIn} diff --git a/apps/spreadsheeteditor/mobile/src/less/icons-ios.less b/apps/spreadsheeteditor/mobile/src/less/icons-ios.less index 589e9d3c6..26229adbb 100644 --- a/apps/spreadsheeteditor/mobile/src/less/icons-ios.less +++ b/apps/spreadsheeteditor/mobile/src/less/icons-ios.less @@ -350,11 +350,6 @@ .encoded-svg-background(''); } // Collaboration - &.icon-collaboration { - width: 24px; - height: 24px; - .encoded-svg-background(''); - } &.icon-users { width: 24px; height: 24px; diff --git a/apps/spreadsheeteditor/mobile/src/less/icons-material.less b/apps/spreadsheeteditor/mobile/src/less/icons-material.less index c77235c01..046876ee2 100644 --- a/apps/spreadsheeteditor/mobile/src/less/icons-material.less +++ b/apps/spreadsheeteditor/mobile/src/less/icons-material.less @@ -324,11 +324,6 @@ .encoded-svg-background(''); } // Collaboration - &.icon-collaboration { - width: 24px; - height: 24px; - .encoded-svg-background(''); - } &.icon-users { width: 24px; height: 24px; @@ -396,6 +391,11 @@ height: 24px; .encoded-svg-background(''); } + &.icon-plus { + width: 22px; + height: 22px; + .encoded-svg-background(''); + } } // Overwrite color for toolbar @@ -456,11 +456,6 @@ height: 22px; .encoded-svg-background(''); } - &.icon-collaboration { - width: 24px; - height: 24px; - .encoded-svg-background(''); - } &.icon-add-chart { width: 24px; height: 24px; diff --git a/apps/spreadsheeteditor/mobile/src/page/main.jsx b/apps/spreadsheeteditor/mobile/src/page/main.jsx index e02028e24..356e4859b 100644 --- a/apps/spreadsheeteditor/mobile/src/page/main.jsx +++ b/apps/spreadsheeteditor/mobile/src/page/main.jsx @@ -88,7 +88,7 @@ class MainPage extends Component { } { !this.state.settingsVisible ? null : - + } { !this.state.collaborationVisible ? null : diff --git a/apps/spreadsheeteditor/mobile/src/store/appOptions.js b/apps/spreadsheeteditor/mobile/src/store/appOptions.js index 75900a131..f33a3736f 100644 --- a/apps/spreadsheeteditor/mobile/src/store/appOptions.js +++ b/apps/spreadsheeteditor/mobile/src/store/appOptions.js @@ -14,9 +14,18 @@ export class storeAppOptions { config = {}; canViewComments = false; - setConfigOptions (config) { + setConfigOptions (config, _t) { this.config = config; - this.user = Common.Utils.fillUserInfo(config.user, config.lang, "Local.User"/*me.textAnonymous*/); + this.customization = config.customization; + this.canRenameAnonymous = !((typeof (this.customization) == 'object') && (typeof (this.customization.anonymous) == 'object') && (this.customization.anonymous.request===false)); + this.guestName = (typeof (this.customization) == 'object') && (typeof (this.customization.anonymous) == 'object') && + (typeof (this.customization.anonymous.label) == 'string') && this.customization.anonymous.label.trim()!=='' ? + Common.Utils.String.htmlEncode(this.customization.anonymous.label) : _t.textGuest; + + const value = this.canRenameAnonymous ? Common.localStorage.getItem("guest-username") : null; + this.user = Common.Utils.fillUserInfo(config.user, config.lang, value ? (value + ' (' + this.guestName + ')' ) : _t.textAnonymous); + + config.user = this.user; this.isDesktopApp = config.targetApp == 'desktop'; this.canCreateNew = !!config.createUrl && !this.isDesktopApp; this.canOpenRecent = config.recent !== undefined && !this.isDesktopApp; diff --git a/apps/spreadsheeteditor/mobile/src/view/Toolbar.jsx b/apps/spreadsheeteditor/mobile/src/view/Toolbar.jsx index 26887d95b..2680d752b 100644 --- a/apps/spreadsheeteditor/mobile/src/view/Toolbar.jsx +++ b/apps/spreadsheeteditor/mobile/src/view/Toolbar.jsx @@ -4,26 +4,28 @@ import { Device } from '../../../../common/mobile/utils/device'; import EditorUIController from '../lib/patch' const ToolbarView = props => { + const undo_box = props.isEdit && EditorUIController.toolbarOptions ? EditorUIController.toolbarOptions.getUndoRedo({ + disabledUndo: !props.isCanUndo, + disabledRedo: !props.isCanRedo, + onUndoClick: props.onUndo, + onRedoClick: props.onRedo + }) : null; return ( {props.isShowBack && } - {props.isEdit && EditorUIController.toolbarOptions && EditorUIController.toolbarOptions.getUndoRedo({ - disabledUndo: !props.isCanUndo, - disabledRedo: !props.isCanRedo, - onUndoClick: props.onUndo, - onRedoClick: props.onRedo - })} + {Device.ios && undo_box} {!Device.phone && {props.docTitle}} + {Device.android && undo_box} {props.isEdit && EditorUIController.toolbarOptions && EditorUIController.toolbarOptions.getEditOptions({ disabled: props.disabledEditControls || props.disabledControls, onEditClick: () => props.openOptions('edit'), onAddClick: () => props.openOptions('add') })} { Device.phone ? null : } - {props.displayCollaboration && props.openOptions('coauth')}>} + {props.displayCollaboration && window.matchMedia("(min-width: 390px)").matches ? props.openOptions('coauth')}> : null} props.openOptions('settings')}> diff --git a/apps/spreadsheeteditor/mobile/src/view/settings/Settings.jsx b/apps/spreadsheeteditor/mobile/src/view/settings/Settings.jsx index f1a3ba84e..52ad39199 100644 --- a/apps/spreadsheeteditor/mobile/src/view/settings/Settings.jsx +++ b/apps/spreadsheeteditor/mobile/src/view/settings/Settings.jsx @@ -78,12 +78,17 @@ const SettingsList = withTranslation()(props => { const closeModal = () => { if (Device.phone) { - f7.sheet.close('.settings-popup', true); + f7.sheet.close('.settings-popup', false); } else { - f7.popover.close('#settings-popover'); + f7.popover.close('#settings-popover', false); } }; + const onOpenCollaboration = async () => { + await closeModal(); + await props.openOptions('coauth'); + } + const onPrint = () => { closeModal(); const api = Common.EditorApi.get(); @@ -121,6 +126,11 @@ const SettingsList = withTranslation()(props => {
} + {window.matchMedia("(max-width: 389px)").matches ? + + + + : null} @@ -164,10 +174,10 @@ class SettingsView extends Component { return ( show_popover ? this.props.onclosed()}> - + : this.props.onclosed()}> - + ) } @@ -189,7 +199,7 @@ const Settings = props => { props.onclosed(); }; - return + return }; export default Settings; \ No newline at end of file diff --git a/build/Gruntfile.js b/build/Gruntfile.js index 74ebe193c..663778d31 100644 --- a/build/Gruntfile.js +++ b/build/Gruntfile.js @@ -102,6 +102,7 @@ module.exports = function(grunt) { grunt.loadNpmTasks('grunt-mocha'); grunt.loadNpmTasks('grunt-inline'); grunt.loadNpmTasks('grunt-svgmin'); + grunt.loadNpmTasks('grunt-exec'); function doRegisterTask(name, callbackConfig) { return grunt.registerTask(name + '-init', function() { @@ -483,7 +484,10 @@ module.exports = function(grunt) { files:[] .concat(packageFile['mobile']['copy']['images-app']) .concat(packageFile['mobile']['copy']['images-common']) - } + }, + 'webpack-dist': { + files: packageFile.mobile.copy['assets'] + }, }, replace: { @@ -508,6 +512,25 @@ module.exports = function(grunt) { to: '../mobile' }] } + }, + + exec: { + webpack_app_build: { + options: { + cwd: '../vendor/framework7-react', + }, + cmd: function() { + const editor = packageFile.name == 'presentationeditor' ? 'slide' : + packageFile.name == 'spreadsheeteditor' ? 'cell' : 'word'; + return `npm run deploy-${editor}`; + }, + }, + webpack_install: { + options: { + cwd: '../vendor/framework7-react', + }, + cmd: 'npm i', + }, } }); @@ -597,10 +620,10 @@ module.exports = function(grunt) { 'requirejs', 'concat', 'copy', 'svgmin', 'inline:index-page', 'inline:old-loader-page', 'json-minify', 'replace:writeVersion', 'replace:prepareHelp', 'clean:postbuild']); - grunt.registerTask('deploy-app-mobile', ['mobile-app-init', 'clean:deploy', 'cssmin', 'copy:template-backup', - 'htmlmin', 'requirejs', 'concat', 'copy:template-restore', - 'clean:template-backup', 'copy:localization', 'copy:index-page', - 'copy:images-app', 'json-minify', + grunt.registerTask('deploy-app-mobile', ['mobile-app-init', 'clean:deploy', /*'cssmin',*/ /*'copy:template-backup',*/ + 'htmlmin', /*'requirejs',*/ 'exec:webpack_install', 'exec:webpack_app_build', /*'concat',*/ /*'copy:template-restore',*/ + /*'clean:template-backup',*/ 'copy:localization', 'copy:index-page', + /*'copy:images-app',*/ 'copy:webpack-dist', 'json-minify', 'replace:writeVersion', 'replace:fixResourceUrl']); grunt.registerTask('deploy-app-embed', ['embed-app-init', 'clean:prebuild', 'uglify', 'less', 'copy', diff --git a/build/documenteditor.json b/build/documenteditor.json index 13c6c8be6..54332dd7e 100644 --- a/build/documenteditor.json +++ b/build/documenteditor.json @@ -353,8 +353,7 @@ } ], "index-page": { - "../deploy/web-apps/apps/documenteditor/mobile/index.html": "../apps/documenteditor/mobile/index.html.deploy", - "../deploy/web-apps/apps/documenteditor/mobile/index_loader.html": "../apps/documenteditor/mobile/index_loader.html.deploy" + "../deploy/web-apps/apps/documenteditor/mobile/index.html": "../apps/documenteditor/mobile/index.html" }, "localization": [ { @@ -379,6 +378,18 @@ "src": "**", "dest": "../deploy/web-apps/apps/documenteditor/mobile/resources/img/" } + ], + "assets": [ + { + "src": "../apps/documenteditor/mobile/css/app.css", + "dest": "../deploy/web-apps/apps/documenteditor/mobile/css/app.css" + }, + { + "expand": true, + "cwd": "../apps/documenteditor/mobile/dist", + "src": "**", + "dest": "../deploy/web-apps/apps/documenteditor/mobile/dist" + } ] } }, diff --git a/build/package.json b/build/package.json index 44961d8c8..6fee65bc8 100644 --- a/build/package.json +++ b/build/package.json @@ -27,6 +27,7 @@ }, "devDependencies": { "chai": "1.9.1", + "grunt-exec": "^3.0.0", "mocha": "^6.2.2", "grunt-mocha": "^1.0.0" } diff --git a/build/presentationeditor.json b/build/presentationeditor.json index 29bf6d14c..159842fcc 100644 --- a/build/presentationeditor.json +++ b/build/presentationeditor.json @@ -337,6 +337,18 @@ "files": "../deploy/web-apps/apps/presentationeditor/mobile/**/*.json" }, "copy": { + "assets": [ + { + "src": "../apps/presentationeditor/mobile/css/app.css", + "dest": "../deploy/web-apps/apps/presentationeditor/mobile/css/app.css" + }, + { + "expand": true, + "cwd": "../apps/presentationeditor/mobile/dist", + "src": "**", + "dest": "../deploy/web-apps/apps/presentationeditor/mobile/dist" + } + ], "template-backup": [ { "expand": true, @@ -356,8 +368,7 @@ } ], "index-page": { - "../deploy/web-apps/apps/presentationeditor/mobile/index.html": "../apps/presentationeditor/mobile/index.html.deploy", - "../deploy/web-apps/apps/presentationeditor/mobile/index_loader.html": "../apps/presentationeditor/mobile/index_loader.html.deploy" + "../deploy/web-apps/apps/presentationeditor/mobile/index.html": "../apps/presentationeditor/mobile/index.html", }, "localization": [ { diff --git a/build/spreadsheeteditor.json b/build/spreadsheeteditor.json index 9001b3643..1d5bd7de5 100644 --- a/build/spreadsheeteditor.json +++ b/build/spreadsheeteditor.json @@ -343,6 +343,18 @@ "files": "../deploy/web-apps/apps/spreadsheeteditor/mobile/**/*.json" }, "copy": { + "assets": [ + { + "src": "../apps/spreadsheeteditor/mobile/css/app.css", + "dest": "../deploy/web-apps/apps/spreadsheeteditor/mobile/css/app.css" + }, + { + "expand": true, + "cwd": "../apps/spreadsheeteditor/mobile/dist", + "src": "**", + "dest": "../deploy/web-apps/apps/spreadsheeteditor/mobile/dist" + } + ], "template-backup": [ { "expand": true, @@ -362,8 +374,7 @@ } ], "index-page": { - "../deploy/web-apps/apps/spreadsheeteditor/mobile/index.html": "../apps/spreadsheeteditor/mobile/index.html.deploy", - "../deploy/web-apps/apps/spreadsheeteditor/mobile/index_loader.html": "../apps/spreadsheeteditor/mobile/index_loader.html.deploy" + "../deploy/web-apps/apps/spreadsheeteditor/mobile/index.html": "../apps/spreadsheeteditor/mobile/index.html" }, "localization": [ { diff --git a/vendor/framework7-react/build/webpack.config.js b/vendor/framework7-react/build/webpack.config.js index d0ca26d72..9f07b7020 100644 --- a/vendor/framework7-react/build/webpack.config.js +++ b/vendor/framework7-react/build/webpack.config.js @@ -41,7 +41,7 @@ module.exports = { }, modules: [path.resolve(__dirname, '..', 'node_modules'), 'node_modules'], }, - watch: true, + watch: env == 'development', watchOptions: { aggregateTimeout: 600, poll: 1000, @@ -50,7 +50,7 @@ module.exports = { jquery: 'jQuery' }, - devtool: env === 'production' ? 'source-map' : 'source-map', + devtool: env === 'production' ? false : 'source-map', optimization: { minimizer: [new TerserPlugin({ sourceMap: true, diff --git a/vendor/framework7-react/package.json b/vendor/framework7-react/package.json index 4f10dcfef..3dc653b35 100644 --- a/vendor/framework7-react/package.json +++ b/vendor/framework7-react/package.json @@ -10,6 +10,9 @@ "dev": "cross-env NODE_ENV=development webpack-dev-server --config ./build/webpack.config.js", "build-dev": "cross-env NODE_ENV=development node ./build/build.js", "build-prod": "cross-env NODE_ENV=production node ./build/build.js", + "deploy-word": "cross-env TARGET_EDITOR=word NODE_ENV=production node ./build/build.js", + "deploy-cell": "cross-env TARGET_EDITOR=cell NODE_ENV=production node ./build/build.js", + "deploy-slide": "cross-env TARGET_EDITOR=slide NODE_ENV=production node ./build/build.js", "postinstall": "cpy ./node_modules/framework7-icons/fonts/*.* ./src/fonts/", "build-word": "cross-env NODE_ENV=development node ./build/build.js", "build-slide": "cross-env NODE_ENV=development TARGET_EDITOR=slide node ./build/build.js",