mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-20 22:42:53 -05:00
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
This commit is contained in:
parent
1f73028729
commit
35d7e50027
4 changed files with 0 additions and 108 deletions
|
@ -1 +0,0 @@
|
|||
<div {{react-render this.ReactComponent}}></div>
|
|
@ -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 (
|
||||
<p>Loading has failed. Try refreshing the browser!</p>
|
||||
);
|
||||
}
|
||||
|
||||
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 (
|
||||
<div className={[this.args.className].filter(Boolean).join(' ')}>
|
||||
<ErrorHandler>
|
||||
<Suspense fallback={<p className="koenig-react-editor-loading">Loading editor...</p>}>
|
||||
<KoenigSandbox />
|
||||
</Suspense>
|
||||
</ErrorHandler>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
}
|
|
@ -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'});
|
||||
|
|
|
@ -1,11 +0,0 @@
|
|||
<section class="gh-canvas">
|
||||
<GhCanvasHeader class="gh-canvas-header">
|
||||
<h2 class="gh-canvas-title" data-test-screen-title>
|
||||
Lexical editor components
|
||||
</h2>
|
||||
</GhCanvasHeader>
|
||||
|
||||
<div class="view-container">
|
||||
<KoenigLexicalSandbox />
|
||||
</div>
|
||||
</section>
|
Loading…
Add table
Reference in a new issue