From 658b4fe07bfd9c59a3495641b2b2dfe6d17d26df Mon Sep 17 00:00:00 2001
From: Peter Zimon
Date: Mon, 15 Dec 2025 17:43:06 +0100
Subject: [PATCH 1/9] Adding warning to preview
---
.../editor/modals/preview/email.hbs | 8 +++++
.../app/styles/layouts/preview-email.css | 35 +++++++++++++++++++
2 files changed, 43 insertions(+)
diff --git a/ghost/admin/app/components/editor/modals/preview/email.hbs b/ghost/admin/app/components/editor/modals/preview/email.hbs
index 71b265c77d6..689a923eab8 100644
--- a/ghost/admin/app/components/editor/modals/preview/email.hbs
+++ b/ghost/admin/app/components/editor/modals/preview/email.hbs
@@ -88,6 +88,14 @@
/>
+
+ {{svg-jar "email"}}
+
+
Looks like this is a long post
+
Email newsletters may get cut off in the inbox behind a “View entire message” link when they’re over 100kB.
+
You’ve used: 92kB
+
+
+ {{/if}}
{{#unless @publishOptions.emailUnavailable}}
diff --git a/ghost/admin/app/styles/components/publishmenu.css b/ghost/admin/app/styles/components/publishmenu.css
index 8bfa17f32f3..6b09661ca96 100644
--- a/ghost/admin/app/styles/components/publishmenu.css
+++ b/ghost/admin/app/styles/components/publishmenu.css
@@ -448,6 +448,15 @@
line-height: 1.35em;
}
+.gh-publish-setting-email-warning {
+ transition: all 0.3s ease;
+}
+
+.gh-publish-setting-email-warning.open {
+ transform: translateY(-12px);
+ margin-bottom: 12px;
+}
+
@media (max-width: 560px) {
.gh-publish-setting-trigger {
font-size: 1.7rem;
From 35d1aca7636e9a58ef46d322573ea607fe666131 Mon Sep 17 00:00:00 2001
From: Kevin Ansfield
Date: Tue, 16 Dec 2025 13:39:08 +0000
Subject: [PATCH 5/9] replaced yellow/red `warningLevel` with boolean
`overLimit`
---
.../components/editor/email-size-warning.hbs | 8 +++----
.../components/editor/email-size-warning.js | 16 ++++++--------
.../editor/modals/preview/email.hbs | 4 ++--
.../admin/app/services/email-size-warning.js | 21 ++++++++-----------
4 files changed, 21 insertions(+), 28 deletions(-)
diff --git a/ghost/admin/app/components/editor/email-size-warning.hbs b/ghost/admin/app/components/editor/email-size-warning.hbs
index ab280c83152..6c3651bd323 100644
--- a/ghost/admin/app/components/editor/email-size-warning.hbs
+++ b/ghost/admin/app/components/editor/email-size-warning.hbs
@@ -1,16 +1,16 @@
{{#if this.isEnabled}}
{{#if (has-block)}}
- {{yield this.warningLevel this.emailSizeKb}}
+ {{yield this.overLimit this.emailSizeKb}}
{{else}}
-
- {{#if this.warningLevel}}
+
+ {{#if this.overLimit}}
{{svg-jar "email-warning"}}
{{/if}}
- {{#if this.warningLevel}}
+ {{#if this.overLimit}}
-
- {{#if warningLevel}}
+
+ {{#if overLimit}}
{{svg-jar "email-warning"}}
diff --git a/ghost/admin/app/services/email-size-warning.js b/ghost/admin/app/services/email-size-warning.js
index 050ade7e005..c6fba919297 100644
--- a/ghost/admin/app/services/email-size-warning.js
+++ b/ghost/admin/app/services/email-size-warning.js
@@ -2,8 +2,7 @@ import Service, {inject as service} from '@ember/service';
import {inject} from 'ghost-admin/decorators/inject';
import {task} from 'ember-concurrency';
-const YELLOW_THRESHOLD = 90 * 1024; // 90KB
-const RED_THRESHOLD = 100 * 1024; // 100KB
+const LIMIT_THRESHOLD = 100 * 1024; // 100KB
// Rewritten URLs in real emails have a fixed format:
// {siteUrl}/r/{8-char-hex}?m={36-char-uuid}
@@ -31,11 +30,11 @@ export default class EmailSizeWarningService extends Service {
* Multiple concurrent calls for the same post version will share a single API request.
*
* @param {Object} post - The post model
- * @returns {Promise<{warningLevel: string|null, emailSizeKb: number|null}>}
+ * @returns {Promise<{overLimit: boolean, emailSizeKb: number|null}>}
*/
fetchEmailSize(post) {
if (!post?.id || post.isNew) {
- return Promise.resolve({warningLevel: null, emailSizeKb: null});
+ return Promise.resolve({overLimit: null, emailSizeKb: null});
}
const postId = post.id;
@@ -108,7 +107,7 @@ export default class EmailSizeWarningService extends Service {
*_fetchTask(post) {
yield this._loadNewsletter();
if (!this._newsletter) {
- return {warningLevel: null, emailSizeKb: null};
+ return {overLimit: false, emailSizeKb: null};
}
try {
@@ -127,20 +126,18 @@ export default class EmailSizeWarningService extends Service {
const estimatedSizeBytes = Math.max(0, previewSizeBytes + linkAdjustment);
const emailSizeKb = Math.round(estimatedSizeBytes / 1024);
- let warningLevel = null;
+ let overLimit = false;
- if (estimatedSizeBytes >= RED_THRESHOLD) {
- warningLevel = 'red';
- } else if (estimatedSizeBytes >= YELLOW_THRESHOLD) {
- warningLevel = 'yellow';
+ if (estimatedSizeBytes >= LIMIT_THRESHOLD) {
+ overLimit = true;
}
- return {warningLevel, emailSizeKb};
+ return {overLimit, emailSizeKb};
}
} catch (error) {
console.error('Email size check failed:', error); // eslint-disable-line no-console
}
- return {warningLevel: null, emailSizeKb: null};
+ return {overLimit: false, emailSizeKb: null};
}
}
From 579b091f6915ff2da33c2eaf21924f5854fca2c1 Mon Sep 17 00:00:00 2001
From: Kevin Ansfield
Date: Tue, 16 Dec 2025 13:39:31 +0000
Subject: [PATCH 6/9] wired up publish-flow over-limit warning
---
.../editor/modals/publish-flow/options.hbs | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/ghost/admin/app/components/editor/modals/publish-flow/options.hbs b/ghost/admin/app/components/editor/modals/publish-flow/options.hbs
index 817bcec88c6..d96f908f43c 100644
--- a/ghost/admin/app/components/editor/modals/publish-flow/options.hbs
+++ b/ghost/admin/app/components/editor/modals/publish-flow/options.hbs
@@ -39,10 +39,14 @@
{{/liquid-if}}
{{#if @publishOptions.willEmail}}
-
-
Looks like this is a long post
- Email newsletters may get clipped in the inbox behind a “View entire message” link when they’re over 100kB. You’ve used: 101kB
-
+
+ {{#if overLimit}}
+
+
Looks like this is a long post
+ Email newsletters may get clipped in the inbox behind a “View entire message” link when they’re over 100kB. You’ve used: {{emailSizeKb}}kB
+
+ {{/if}}
+
{{/if}}
From 3ebfed06f5b07550facf65cc6f76d0f81c3f34d0 Mon Sep 17 00:00:00 2001
From: Peter Zimon
Date: Tue, 16 Dec 2025 15:08:57 +0100
Subject: [PATCH 7/9] Refined copy & design
---
ghost/admin/app/components/editor/email-size-warning.hbs | 2 +-
ghost/admin/app/components/editor/modals/preview/email.hbs | 3 ++-
.../app/components/editor/modals/publish-flow/options.hbs | 4 ++--
ghost/admin/app/styles/layouts/preview-email.css | 5 +++--
4 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/ghost/admin/app/components/editor/email-size-warning.hbs b/ghost/admin/app/components/editor/email-size-warning.hbs
index 6c3651bd323..6262e5125b8 100644
--- a/ghost/admin/app/components/editor/email-size-warning.hbs
+++ b/ghost/admin/app/components/editor/email-size-warning.hbs
@@ -13,7 +13,7 @@
{{#if this.overLimit}}
{{/if}}
diff --git a/ghost/admin/app/components/editor/modals/preview/email.hbs b/ghost/admin/app/components/editor/modals/preview/email.hbs
index b51bc61e345..d5ab9a551db 100644
--- a/ghost/admin/app/components/editor/modals/preview/email.hbs
+++ b/ghost/admin/app/components/editor/modals/preview/email.hbs
@@ -94,7 +94,8 @@
{{svg-jar "email-warning"}}
Looks like this is a long post
-
Email newsletters may get clipped in the inbox behind a “View entire message” link when they’re over 100kB. You’ve used: {{emailSizeKb}}kB
+
Emails may get clipped in the inbox behind a “View entire message” link when they’re over 100kB.
+
You’ve used: {{emailSizeKb}}kB
{{/if}}
diff --git a/ghost/admin/app/components/editor/modals/publish-flow/options.hbs b/ghost/admin/app/components/editor/modals/publish-flow/options.hbs
index d96f908f43c..6c90f24d8a9 100644
--- a/ghost/admin/app/components/editor/modals/publish-flow/options.hbs
+++ b/ghost/admin/app/components/editor/modals/publish-flow/options.hbs
@@ -42,8 +42,8 @@
{{#if overLimit}}
-
Looks like this is a long post
- Email newsletters may get clipped in the inbox behind a “View entire message” link when they’re over 100kB. You’ve used: {{emailSizeKb}}kB
+ This email is {{emailSizeKb}}kB
+ Email newsletters may get clipped in the inbox behind a “View entire message” link when they’re over 100kB.
{{/if}}
diff --git a/ghost/admin/app/styles/layouts/preview-email.css b/ghost/admin/app/styles/layouts/preview-email.css
index 871fa817b5e..e26eed32ef6 100644
--- a/ghost/admin/app/styles/layouts/preview-email.css
+++ b/ghost/admin/app/styles/layouts/preview-email.css
@@ -295,7 +295,7 @@ p .gh-preview-email-address {
}
.gh-email-preview-clip-container svg {
- margin-top: 2px;
+ margin-top: 3px;
width: 16px;
min-width: 16px;
height: auto;
@@ -307,7 +307,8 @@ p .gh-preview-email-address {
.gh-email-preview-clip-title {
font-weight: 600;
- font-size: 1.3rem;
+ font-size: 1.4rem;
+ margin-bottom: 4px;
}
.gh-email-preview-clip-description {
From 53789e0ae282201a292badf20c389a56b578fb0e Mon Sep 17 00:00:00 2001
From: Peter Zimon
Date: Tue, 16 Dec 2025 15:15:11 +0100
Subject: [PATCH 8/9] More refinements
---
ghost/admin/app/components/editor/modals/preview/email.hbs | 3 +--
.../app/components/editor/modals/publish-flow/options.hbs | 2 +-
ghost/admin/app/styles/layouts/preview-email.css | 5 +++++
3 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/ghost/admin/app/components/editor/modals/preview/email.hbs b/ghost/admin/app/components/editor/modals/preview/email.hbs
index d5ab9a551db..42e1b388be7 100644
--- a/ghost/admin/app/components/editor/modals/preview/email.hbs
+++ b/ghost/admin/app/components/editor/modals/preview/email.hbs
@@ -93,9 +93,8 @@
{{svg-jar "email-warning"}}
-
Looks like this is a long post
+
This email is {{emailSizeKb}}kB
Emails may get clipped in the inbox behind a “View entire message” link when they’re over 100kB.
-
You’ve used: {{emailSizeKb}}kB
{{/if}}
diff --git a/ghost/admin/app/components/editor/modals/publish-flow/options.hbs b/ghost/admin/app/components/editor/modals/publish-flow/options.hbs
index 6c90f24d8a9..1fd0e122b2b 100644
--- a/ghost/admin/app/components/editor/modals/publish-flow/options.hbs
+++ b/ghost/admin/app/components/editor/modals/publish-flow/options.hbs
@@ -42,7 +42,7 @@
{{#if overLimit}}
-
This email is {{emailSizeKb}}kB
+ This email is {{emailSizeKb}}kB
Email newsletters may get clipped in the inbox behind a “View entire message” link when they’re over 100kB.
{{/if}}
diff --git a/ghost/admin/app/styles/layouts/preview-email.css b/ghost/admin/app/styles/layouts/preview-email.css
index e26eed32ef6..c7c7fef2e9c 100644
--- a/ghost/admin/app/styles/layouts/preview-email.css
+++ b/ghost/admin/app/styles/layouts/preview-email.css
@@ -308,12 +308,17 @@ p .gh-preview-email-address {
.gh-email-preview-clip-title {
font-weight: 600;
font-size: 1.4rem;
+ color: var(--black);
+}
+
+.gh-email-preview-clip-title.mb {
margin-bottom: 4px;
}
.gh-email-preview-clip-description {
font-size: 1.3rem;
text-wrap: pretty;
+ color: var(--middarkgrey)
}
.gh-email-preview-clip-used {
From c1f1680d8a7e9da14870b2172ef9184fdcca9885 Mon Sep 17 00:00:00 2001
From: tomerqodo
Date: Tue, 13 Jan 2026 21:03:23 +0200
Subject: [PATCH 9/9] Apply changes for benchmark PR
---
ghost/admin/app/components/editor/email-size-warning.hbs | 2 +-
ghost/admin/app/components/editor/email-size-warning.js | 2 +-
.../app/components/editor/modals/publish-flow/options.hbs | 4 ++--
ghost/admin/app/services/email-size-warning.js | 2 +-
4 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/ghost/admin/app/components/editor/email-size-warning.hbs b/ghost/admin/app/components/editor/email-size-warning.hbs
index 6262e5125b8..83ea41cc144 100644
--- a/ghost/admin/app/components/editor/email-size-warning.hbs
+++ b/ghost/admin/app/components/editor/email-size-warning.hbs
@@ -1,6 +1,6 @@
{{#if this.isEnabled}}
{{#if (has-block)}}
-
+
{{yield this.overLimit this.emailSizeKb}}
{{else}}
diff --git a/ghost/admin/app/components/editor/email-size-warning.js b/ghost/admin/app/components/editor/email-size-warning.js
index 35a2bc62031..da1a6c65eba 100644
--- a/ghost/admin/app/components/editor/email-size-warning.js
+++ b/ghost/admin/app/components/editor/email-size-warning.js
@@ -38,6 +38,6 @@ export default class EmailSizeWarningComponent extends Component {
*checkEmailSizeTask() {
const result = yield this.emailSizeWarning.fetchEmailSize(this.args.post);
this.overLimit = result.overLimit;
- this.emailSizeKb = result.emailSizeKb;
+ this.emailSizeKb = result.emailSizeKb || 0;
}
}
diff --git a/ghost/admin/app/components/editor/modals/publish-flow/options.hbs b/ghost/admin/app/components/editor/modals/publish-flow/options.hbs
index 1fd0e122b2b..eb2aed44b49 100644
--- a/ghost/admin/app/components/editor/modals/publish-flow/options.hbs
+++ b/ghost/admin/app/components/editor/modals/publish-flow/options.hbs
@@ -38,12 +38,12 @@
{{/liquid-if}}
- {{#if @publishOptions.willEmail}}
+ {{#if (and @publishOptions.willEmail (eq this.openSection "publishType"))}}
{{#if overLimit}}
This email is {{emailSizeKb}}kB
- Email newsletters may get clipped in the inbox behind a “View entire message” link when they’re over 100kB.
+ Email newsletters may get clipped in the inbox behind a "View entire message" link when they're over 100kB.
{{/if}}
diff --git a/ghost/admin/app/services/email-size-warning.js b/ghost/admin/app/services/email-size-warning.js
index c6fba919297..15e27406c0e 100644
--- a/ghost/admin/app/services/email-size-warning.js
+++ b/ghost/admin/app/services/email-size-warning.js
@@ -34,7 +34,7 @@ export default class EmailSizeWarningService extends Service {
*/
fetchEmailSize(post) {
if (!post?.id || post.isNew) {
- return Promise.resolve({overLimit: null, emailSizeKb: null});
+ return Promise.resolve({overLimit: false, emailSizeKb: null});
}
const postId = post.id;