Remove unused email editor core variables.
These variables are used by the core editor. We can remove them. MAILPOET-6430
This commit is contained in:
committed by
Oluwaseun Olorunsola
parent
1cb5eda659
commit
7dfdbef152
@@ -3,7 +3,6 @@
|
|||||||
namespace MailPoet\EmailEditor\Integrations\MailPoet;
|
namespace MailPoet\EmailEditor\Integrations\MailPoet;
|
||||||
|
|
||||||
use MailPoet\Analytics\Analytics;
|
use MailPoet\Analytics\Analytics;
|
||||||
use MailPoet\API\JSON\API;
|
|
||||||
use MailPoet\Config\Env;
|
use MailPoet\Config\Env;
|
||||||
use MailPoet\Config\Installer;
|
use MailPoet\Config\Installer;
|
||||||
use MailPoet\Config\ServicesChecker;
|
use MailPoet\Config\ServicesChecker;
|
||||||
@@ -136,9 +135,6 @@ class EditorPageRenderer {
|
|||||||
$assetsParams['version']
|
$assetsParams['version']
|
||||||
);
|
);
|
||||||
|
|
||||||
$jsonAPIRoot = rtrim($this->wp->escUrlRaw(admin_url('admin-ajax.php')), '/');
|
|
||||||
$token = $this->wp->wpCreateNonce('mailpoet_token');
|
|
||||||
$apiVersion = API::CURRENT_VERSION;
|
|
||||||
$currentUserEmail = $this->wp->wpGetCurrentUser()->user_email;
|
$currentUserEmail = $this->wp->wpGetCurrentUser()->user_email;
|
||||||
$this->wp->wpLocalizeScript(
|
$this->wp->wpLocalizeScript(
|
||||||
'mailpoet_email_editor',
|
'mailpoet_email_editor',
|
||||||
@@ -146,11 +142,6 @@ class EditorPageRenderer {
|
|||||||
[
|
[
|
||||||
'current_post_type' => esc_js($currentPostType),
|
'current_post_type' => esc_js($currentPostType),
|
||||||
'current_post_id' => $post->ID,
|
'current_post_id' => $post->ID,
|
||||||
'json_api_root' => esc_js($jsonAPIRoot),
|
|
||||||
'api_token' => esc_js($token),
|
|
||||||
'api_version' => esc_js($apiVersion),
|
|
||||||
'cdn_url' => esc_js($this->cdnAssetUrl->generateCdnUrl("")),
|
|
||||||
'is_premium_plugin_active' => (bool)$this->servicesChecker->isPremiumPluginActive(),
|
|
||||||
'current_wp_user_email' => esc_js($currentUserEmail),
|
'current_wp_user_email' => esc_js($currentUserEmail),
|
||||||
'editor_settings' => $this->settingsController->get_settings(),
|
'editor_settings' => $this->settingsController->get_settings(),
|
||||||
'editor_theme' => $this->themeController->get_base_theme()->get_raw_data(),
|
'editor_theme' => $this->themeController->get_base_theme()->get_raw_data(),
|
||||||
|
8
packages/js/email-editor/src/global.d.ts
vendored
8
packages/js/email-editor/src/global.d.ts
vendored
@@ -1,18 +1,12 @@
|
|||||||
interface Window {
|
interface Window {
|
||||||
MailPoetEmailEditor: {
|
MailPoetEmailEditor: {
|
||||||
json_api_root: string;
|
|
||||||
api_token: string;
|
|
||||||
api_version: string;
|
|
||||||
cdn_url: string;
|
|
||||||
is_premium_plugin_active: boolean;
|
|
||||||
current_wp_user_email: string;
|
current_wp_user_email: string;
|
||||||
user_theme_post_id: number;
|
user_theme_post_id: number;
|
||||||
urls: {
|
urls: {
|
||||||
listings: string;
|
listings: string;
|
||||||
|
send: string;
|
||||||
};
|
};
|
||||||
editor_settings: unknown; // Can't import type in global.d.ts. Typed in getEditorSettings() in store/settings.ts
|
editor_settings: unknown; // Can't import type in global.d.ts. Typed in getEditorSettings() in store/settings.ts
|
||||||
email_styles: unknown; // Can't import type in global.d.ts. Typed in getEmailStyles() in store/settings.ts
|
|
||||||
editor_layout: unknown; // Can't import type in global.d.ts. Typed in getEmailLayout() in store/settings.ts
|
|
||||||
editor_theme: unknown; // Can't import type in global.d.ts. Typed in getEditorTheme() in store/settings.ts
|
editor_theme: unknown; // Can't import type in global.d.ts. Typed in getEditorTheme() in store/settings.ts
|
||||||
current_post_type: string;
|
current_post_type: string;
|
||||||
current_post_id: string;
|
current_post_id: string;
|
||||||
|
@@ -3,13 +3,7 @@
|
|||||||
*/
|
*/
|
||||||
import { mainSidebarDocumentTab, editorCurrentPostId } from './constants';
|
import { mainSidebarDocumentTab, editorCurrentPostId } from './constants';
|
||||||
import { State } from './types';
|
import { State } from './types';
|
||||||
import {
|
import { getEditorSettings, getEditorTheme, getUrls } from './settings';
|
||||||
getEditorSettings,
|
|
||||||
getCdnUrl,
|
|
||||||
isPremiumPluginActive,
|
|
||||||
getEditorTheme,
|
|
||||||
getUrls,
|
|
||||||
} from './settings';
|
|
||||||
|
|
||||||
export function getInitialState(): State {
|
export function getInitialState(): State {
|
||||||
const postId = editorCurrentPostId;
|
const postId = editorCurrentPostId;
|
||||||
@@ -30,8 +24,6 @@ export function getInitialState(): State {
|
|||||||
globalStylesPostId: window.MailPoetEmailEditor.user_theme_post_id,
|
globalStylesPostId: window.MailPoetEmailEditor.user_theme_post_id,
|
||||||
},
|
},
|
||||||
autosaveInterval: 60,
|
autosaveInterval: 60,
|
||||||
cdnUrl: getCdnUrl(),
|
|
||||||
isPremiumPluginActive: isPremiumPluginActive(),
|
|
||||||
urls: getUrls(),
|
urls: getUrls(),
|
||||||
preview: {
|
preview: {
|
||||||
deviceType: 'Desktop',
|
deviceType: 'Desktop',
|
||||||
|
@@ -353,14 +353,6 @@ export function getAutosaveInterval(
|
|||||||
return state.autosaveInterval;
|
return state.autosaveInterval;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getCdnUrl( state: State ): State[ 'cdnUrl' ] {
|
|
||||||
return state.cdnUrl;
|
|
||||||
}
|
|
||||||
|
|
||||||
export function isPremiumPluginActive( state: State ): boolean {
|
|
||||||
return state.isPremiumPluginActive;
|
|
||||||
}
|
|
||||||
|
|
||||||
export function getTheme( state: State ): State[ 'theme' ] {
|
export function getTheme( state: State ): State[ 'theme' ] {
|
||||||
return state.theme;
|
return state.theme;
|
||||||
}
|
}
|
||||||
|
@@ -7,14 +7,6 @@ export function getEditorSettings(): EmailEditorSettings {
|
|||||||
return window.MailPoetEmailEditor.editor_settings as EmailEditorSettings;
|
return window.MailPoetEmailEditor.editor_settings as EmailEditorSettings;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getCdnUrl(): string {
|
|
||||||
return window.MailPoetEmailEditor.cdn_url;
|
|
||||||
}
|
|
||||||
|
|
||||||
export function isPremiumPluginActive(): boolean {
|
|
||||||
return window.MailPoetEmailEditor.is_premium_plugin_active;
|
|
||||||
}
|
|
||||||
|
|
||||||
export function getEditorTheme(): EmailTheme {
|
export function getEditorTheme(): EmailTheme {
|
||||||
return window.MailPoetEmailEditor.editor_theme as EmailTheme;
|
return window.MailPoetEmailEditor.editor_theme as EmailTheme;
|
||||||
}
|
}
|
||||||
|
@@ -195,9 +195,7 @@ export type State = {
|
|||||||
globalStylesPostId: number | null;
|
globalStylesPostId: number | null;
|
||||||
};
|
};
|
||||||
autosaveInterval: number;
|
autosaveInterval: number;
|
||||||
cdnUrl: string;
|
|
||||||
urls: EmailEditorUrls;
|
urls: EmailEditorUrls;
|
||||||
isPremiumPluginActive: boolean;
|
|
||||||
preview: {
|
preview: {
|
||||||
deviceType: string;
|
deviceType: string;
|
||||||
toEmail: string;
|
toEmail: string;
|
||||||
|
Reference in New Issue
Block a user