diff --git a/ghost/admin/app/routes/lexical-editor.js b/ghost/admin/app/routes/lexical-editor.js index 485455ab76..8ebd41dd6e 100644 --- a/ghost/admin/app/routes/lexical-editor.js +++ b/ghost/admin/app/routes/lexical-editor.js @@ -17,7 +17,7 @@ export default AuthenticatedRoute.extend({ }, setupController(controller, model, transition) { - if (transition.from?.name === 'posts.analytics') { + if (transition.from?.name === 'posts.analytics' && transition.to?.name !== 'lexical-editor.new') { controller.fromAnalytics = true; } }, diff --git a/ghost/admin/tests/acceptance/editor-test.js b/ghost/admin/tests/acceptance/editor-test.js index 32cbb81cb8..235e243bf4 100644 --- a/ghost/admin/tests/acceptance/editor-test.js +++ b/ghost/admin/tests/acceptance/editor-test.js @@ -606,6 +606,23 @@ describe('Acceptance: Editor', function () { ).to.equal(`/ghost/posts/analytics/${post.id}`); }); + it('does not render analytics breadcrumb for a new post', async function () { + const post = this.server.create('post', { + authors: [author], + status: 'published', + title: 'Published Post' + }); + + // visit the analytics page for the post + await visit(`/posts/analytics/${post.id}`); + // start a new post + await visit('/editor/post'); + + // Breadcrumbs should not contain Analytics link + expect(find('[data-test-breadcrumb]'), 'breadcrumb text').to.contain.text('Posts'); + expect(find('[data-test-editor-post-status]')).to.contain.text('New'); + }); + it('handles TKs in title', async function () { let post = this.server.create('post', {authors: [author]});