diff --git a/packages/asc-web-common/store/SettingsStore.js b/packages/asc-web-common/store/SettingsStore.js index 2380457ec0..e766842dd8 100644 --- a/packages/asc-web-common/store/SettingsStore.js +++ b/packages/asc-web-common/store/SettingsStore.js @@ -217,7 +217,12 @@ class SettingsStore { }; getCurrentCustomSchema = async (id) => { - this.customNames = await api.settings.getCurrentCustomSchema(id); + let customNames = null; + if (window[`${EDITOR_STATE_NAME}`]?.customNames) { + customNames = window[`${EDITOR_STATE_NAME}`].customNames; + window[`${EDITOR_STATE_NAME}`].customNames = null; + } else customNames = await api.settings.getCurrentCustomSchema(id); + this.customNames = customNames; }; getCustomSchemaList = async () => { @@ -432,7 +437,10 @@ class SettingsStore { } getBuildVersionInfo = async () => { - const versionInfo = await api.settings.getBuildVersion(); + let versionInfo = null; + if (window[`${EDITOR_STATE_NAME}`]?.versionInfo) + versionInfo = window[`${EDITOR_STATE_NAME}`].versionInfo; + else versionInfo = await api.settings.getBuildVersion(); this.setBuildVersionInfo(versionInfo); }; diff --git a/web/ASC.Web.Editor/src/client/components/Editor.js b/web/ASC.Web.Editor/src/client/components/Editor.js index b9535cc48b..148748a8a2 100644 --- a/web/ASC.Web.Editor/src/client/components/Editor.js +++ b/web/ASC.Web.Editor/src/client/components/Editor.js @@ -82,7 +82,7 @@ function Editor({ mfReady, ...rest }) { - const [fileInfo, setFileInfo] = useState(config.file); + const [fileInfo, setFileInfo] = useState(config?.file); const [url, setUrl] = useState(rest.url); const [fileId, setFileId] = useState(rest.fileId); const [version, setVersion] = useState(rest.version); diff --git a/web/ASC.Web.Editor/src/client/helpers/withDialogs.js b/web/ASC.Web.Editor/src/client/helpers/withDialogs.js index e1fb5c2f26..4712acfcc9 100644 --- a/web/ASC.Web.Editor/src/client/helpers/withDialogs.js +++ b/web/ASC.Web.Editor/src/client/helpers/withDialogs.js @@ -30,7 +30,7 @@ const withDialogs = (WrappedComponent) => { const { t } = useTranslation(["Editor", "Common"]); const { config, fileId, mfReady, sharingSettings } = props; - const { file: fileInfo } = config; + const fileInfo = config?.file; useEffect(() => { if (window.authStore) { diff --git a/web/ASC.Web.Editor/src/server/lib/helpers/index.js b/web/ASC.Web.Editor/src/server/lib/helpers/index.js index f5c31df32c..4a6e968725 100644 --- a/web/ASC.Web.Editor/src/server/lib/helpers/index.js +++ b/web/ASC.Web.Editor/src/server/lib/helpers/index.js @@ -2,7 +2,11 @@ import path from "path"; import fs from "fs"; import { initSSR } from "@appserver/common/api/client"; import { getUser } from "@appserver/common/api/people"; -import { getSettings } from "@appserver/common/api/settings"; +import { + getSettings, + getBuildVersion, + getCurrentCustomSchema, +} from "@appserver/common/api/settings"; import combineUrl from "@appserver/common/utils/combineUrl"; import { AppServerConfig } from "@appserver/common/constants"; import { @@ -59,10 +63,18 @@ export const initDocEditor = async (req) => { const view = url.indexOf("action=view") !== -1; const fileVersion = version || null; - const [user, settings, filesSettings] = await Promise.all([ + const [ + user, + settings, + filesSettings, + versionInfo, + customNames, + ] = await Promise.all([ getUser(), getSettings(), getSettingsFiles(), + getBuildVersion(), + getCurrentCustomSchema("Common"), ]); const successAuth = !!user; @@ -82,6 +94,7 @@ export const initDocEditor = async (req) => { const config = await openEdit(fileId, fileVersion, doc, view); const sharingSettings = await getShareFiles([+fileId], []); + const isSharingAccess = config?.file && config?.file?.canShare; if (view) { @@ -105,6 +118,8 @@ export const initDocEditor = async (req) => { filesSettings, sharingSettings, portalSettings: settings, + versionInfo, + customNames, }; } catch (err) { error = { errorMessage: typeof err === "string" ? err : err.message }; diff --git a/web/ASC.Web.Editor/src/server/lib/template.js b/web/ASC.Web.Editor/src/server/lib/template.js index 4dae148041..94268b8679 100644 --- a/web/ASC.Web.Editor/src/server/lib/template.js +++ b/web/ASC.Web.Editor/src/server/lib/template.js @@ -12,7 +12,7 @@ export default function template( ) { const { title } = pkg; const { error } = initialEditorState; - const { editorUrl } = initialEditorState?.config; + const editorUrl = initialEditorState?.config?.editorUrl; const faviconHref = getFavicon(initialEditorState?.config?.documentType); let clientScripts =