Web: Common/Doceditor: fixed name of init state of editor
This commit is contained in:
parent
42c42f19eb
commit
045c00b4ff
@ -1,6 +1,6 @@
|
||||
export const LANGUAGE = "language";
|
||||
export const ARTICLE_PINNED_KEY = "asc_article_pinned_key";
|
||||
export const EDITOR_STATE_NAME = "__ASC_INITIAL_EDITOR_STATE__";
|
||||
|
||||
/**
|
||||
* Enum for employee activation status.
|
||||
* @readonly
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { makeAutoObservable } from "mobx";
|
||||
import api from "../api";
|
||||
import { LANGUAGE, TenantStatus, EDITOR_STATE_NAME } from "../constants";
|
||||
import { LANGUAGE, TenantStatus } from "../constants";
|
||||
import { combineUrl } from "../utils";
|
||||
import FirebaseHelper from "../utils/firebase";
|
||||
import { AppServerConfig, ThemeKeys } from "../constants";
|
||||
@ -175,8 +175,8 @@ class SettingsStore {
|
||||
getSettings = async () => {
|
||||
let newSettings = null;
|
||||
|
||||
if (window[`${EDITOR_STATE_NAME}`]?.portalSettings)
|
||||
newSettings = window[`${EDITOR_STATE_NAME}`].portalSettings;
|
||||
if (window?.__ASC_INITIAL_EDITOR_STATE__?.portalSettings)
|
||||
newSettings = window.__ASC_INITIAL_EDITOR_STATE__.portalSettings;
|
||||
else newSettings = await api.settings.getSettings();
|
||||
|
||||
if (window["AscDesktopEditor"] !== undefined || this.personal) {
|
||||
@ -218,9 +218,9 @@ class SettingsStore {
|
||||
|
||||
getCurrentCustomSchema = async (id) => {
|
||||
let customNames = null;
|
||||
if (window[`${EDITOR_STATE_NAME}`]?.customNames) {
|
||||
customNames = window[`${EDITOR_STATE_NAME}`].customNames;
|
||||
window[`${EDITOR_STATE_NAME}`].customNames = null;
|
||||
if (window?.__ASC_INITIAL_EDITOR_STATE__?.customNames) {
|
||||
customNames = window.__ASC_INITIAL_EDITOR_STATE__.customNames;
|
||||
window.__ASC_INITIAL_EDITOR_STATE__.customNames = null;
|
||||
} else customNames = await api.settings.getCurrentCustomSchema(id);
|
||||
this.customNames = customNames;
|
||||
};
|
||||
@ -438,8 +438,8 @@ class SettingsStore {
|
||||
|
||||
getBuildVersionInfo = async () => {
|
||||
let versionInfo = null;
|
||||
if (window[`${EDITOR_STATE_NAME}`]?.versionInfo)
|
||||
versionInfo = window[`${EDITOR_STATE_NAME}`].versionInfo;
|
||||
if (window?.__ASC_INITIAL_EDITOR_STATE__?.versionInfo)
|
||||
versionInfo = window.__ASC_INITIAL_EDITOR_STATE__.versionInfo;
|
||||
else versionInfo = await api.settings.getBuildVersion();
|
||||
this.setBuildVersionInfo(versionInfo);
|
||||
};
|
||||
|
@ -1,6 +1,5 @@
|
||||
import { makeAutoObservable } from "mobx";
|
||||
import api from "../api";
|
||||
import { EDITOR_STATE_NAME } from "../constants";
|
||||
|
||||
class UserStore {
|
||||
user = null;
|
||||
@ -14,8 +13,8 @@ class UserStore {
|
||||
|
||||
loadCurrentUser = async () => {
|
||||
let user = null;
|
||||
if (window[`${EDITOR_STATE_NAME}`]?.user)
|
||||
user = window[`${EDITOR_STATE_NAME}`].user;
|
||||
if (window?.__ASC_INITIAL_EDITOR_STATE__?.user)
|
||||
user = window.__ASC_INITIAL_EDITOR_STATE__.user;
|
||||
else user = await api.people.getUser();
|
||||
|
||||
this.setUser(user);
|
||||
|
3
web/ASC.Web.Editor/src/client/bootstrap.js
vendored
3
web/ASC.Web.Editor/src/client/bootstrap.js
vendored
@ -4,9 +4,8 @@ import { registerSW } from "@appserver/common/sw/helper";
|
||||
import App from "./App.js";
|
||||
import pkg from "../../package.json";
|
||||
import { initI18n } from "./helpers/utils.js";
|
||||
import { EDITOR_STATE_NAME } from "@appserver/common/constants";
|
||||
|
||||
const propsObj = window[`${EDITOR_STATE_NAME}`];
|
||||
const propsObj = window.__ASC_INITIAL_EDITOR_STATE__;
|
||||
const initialI18nStoreASC = window.initialI18nStoreASC;
|
||||
const initialLanguage = window.initialLanguage;
|
||||
|
||||
|
@ -1,6 +1,5 @@
|
||||
import { getFavicon, getScripts } from "./helpers";
|
||||
import pkg from "../../../package.json";
|
||||
import { EDITOR_STATE_NAME } from "@appserver/common/constants";
|
||||
|
||||
export default function template(
|
||||
initialEditorState = {},
|
||||
@ -34,8 +33,10 @@ export default function template(
|
||||
}
|
||||
|
||||
const scripts = `
|
||||
<script id="${EDITOR_STATE_NAME}">
|
||||
window.${EDITOR_STATE_NAME} = ${JSON.stringify(initialEditorState)}
|
||||
<script id="__ASC_INITIAL_EDITOR_STATE__">
|
||||
window.__ASC_INITIAL_EDITOR_STATE__ = ${JSON.stringify(
|
||||
initialEditorState
|
||||
)}
|
||||
</script>
|
||||
<script id="__ASC_INITIAL_EDITOR_I18N__">
|
||||
window.initialI18nStoreASC = ${JSON.stringify(initialI18nStoreASC)}
|
||||
|
Loading…
Reference in New Issue
Block a user