From 35d7e50027e85598c3cb06122883aa96b6644f9f Mon Sep 17 00:00:00 2001 From: Daniel Lockyer Date: Thu, 28 Sep 2023 14:02:49 +0200 Subject: [PATCH] Deleted Lexical sandbox page refs https://ghost.slack.com/archives/C02G9E68C/p1695900212734549?thread_ts=1695035790.122589&cid=C02G9E68C - this is no longer needed as we have Storybook to demo the components --- .../app/components/koenig-lexical-sandbox.hbs | 1 - .../app/components/koenig-lexical-sandbox.js | 95 ------------------- ghost/admin/app/router.js | 1 - ghost/admin/app/templates/lexicalsandbox.hbs | 11 --- 4 files changed, 108 deletions(-) delete mode 100644 ghost/admin/app/components/koenig-lexical-sandbox.hbs delete mode 100644 ghost/admin/app/components/koenig-lexical-sandbox.js delete mode 100644 ghost/admin/app/templates/lexicalsandbox.hbs diff --git a/ghost/admin/app/components/koenig-lexical-sandbox.hbs b/ghost/admin/app/components/koenig-lexical-sandbox.hbs deleted file mode 100644 index ed901509b3..0000000000 --- a/ghost/admin/app/components/koenig-lexical-sandbox.hbs +++ /dev/null @@ -1 +0,0 @@ -
\ No newline at end of file diff --git a/ghost/admin/app/components/koenig-lexical-sandbox.js b/ghost/admin/app/components/koenig-lexical-sandbox.js deleted file mode 100644 index afbdf208c5..0000000000 --- a/ghost/admin/app/components/koenig-lexical-sandbox.js +++ /dev/null @@ -1,95 +0,0 @@ -import Component from '@glimmer/component'; -import React, {Suspense} from 'react'; - -class ErrorHandler extends React.Component { - state = { - hasError: false - }; - - static getDerivedStateFromError() { - return {hasError: true}; - } - - render() { - if (this.state.hasError) { - return ( -

Loading has failed. Try refreshing the browser!

- ); - } - - return this.props.children; - } -} - -const fetchKoenig = function () { - let status = 'pending'; - let response; - - const fetchPackage = async () => { - if (window['@tryghost/koenig-lexical']) { - return window['@tryghost/koenig-lexical']; - } - - // the manual specification of the protocol in the import template string is - // required to work around ember-auto-import complaining about an unknown dynamic import - // during the build step - const GhostAdmin = window.GhostAdmin || window.Ember.Namespace.NAMESPACES.find(ns => ns.name === 'ghost-admin'); - const urlTemplate = GhostAdmin.__container__.lookup('config:main').editor?.url; - const urlVersion = GhostAdmin.__container__.lookup('config:main').editor?.version; - - const url = new URL(urlTemplate.replace('{version}', urlVersion)); - - if (url.protocol === 'http:') { - await import(`http://${url.host}${url.pathname}`); - } else { - await import(`https://${url.host}${url.pathname}`); - } - - return window['@tryghost/koenig-lexical']; - }; - - const suspender = fetchPackage().then( - (res) => { - status = 'success'; - response = res; - }, - (err) => { - status = 'error'; - response = err; - } - ); - - const read = () => { - switch (status) { - case 'pending': - throw suspender; - case 'error': - throw response; - default: - return response; - } - }; - - return {read}; -}; - -const koenigResource = fetchKoenig(); - -const KoenigSandbox = (props) => { - const {DesignSandbox: _DesignSandbox} = koenigResource.read(); - return <_DesignSandbox {...props} />; -}; - -export default class LexicalSandbox extends Component { - ReactComponent = () => { - return ( -
- - Loading editor...

}> - -
-
-
- ); - }; -} diff --git a/ghost/admin/app/router.js b/ghost/admin/app/router.js index de73858075..62e534487e 100644 --- a/ghost/admin/app/router.js +++ b/ghost/admin/app/router.js @@ -44,7 +44,6 @@ Router.map(function () { this.route('new', {path: ':type'}); this.route('edit', {path: ':type/:post_id'}); }); - this.route('lexicalsandbox'); this.route('tags'); this.route('tag.new', {path: '/tags/new'}); diff --git a/ghost/admin/app/templates/lexicalsandbox.hbs b/ghost/admin/app/templates/lexicalsandbox.hbs deleted file mode 100644 index 4904a21b6f..0000000000 --- a/ghost/admin/app/templates/lexicalsandbox.hbs +++ /dev/null @@ -1,11 +0,0 @@ -
- -

- Lexical editor components -

-
- -
- -
-
\ No newline at end of file