Added lexical editor feature flag

no issue

- adds `lexicalEditor` alpha labs flag and associated toggle in Admin
- when feature flag is enabled the new post/page routes will load the lexical editor instead of the mobiledoc editor
This commit is contained in:
Kevin Ansfield 2022-09-16 11:58:56 +01:00
parent e957c6d3a1
commit 48aaa53770
4 changed files with 29 additions and 2 deletions

View File

@ -1,6 +1,18 @@
import AuthenticatedRoute from 'ghost-admin/routes/authenticated';
import {inject as service} from '@ember/service';
export default class NewRoute extends AuthenticatedRoute {
@service feature;
@service router;
beforeModel(transition) {
super.beforeModel(...arguments);
if (this.feature.lexicalEditor) {
return this.transitionTo('lexical-editor.new', transition.to.params.type);
}
}
model(params, transition) {
let {type: modelName} = params;
@ -13,7 +25,7 @@ export default class NewRoute extends AuthenticatedRoute {
}
// there's no specific controller for this route, instead all editor
// handling is done on the editor route/controler
// handling is done on the editor route/controller
setupController(controller, newPost) {
let editor = this.controllerFor('editor');
editor.setPost(newPost);

View File

@ -66,6 +66,7 @@ export default class FeatureService extends Service {
@feature('emailAlerts') emailAlerts;
@feature('emailClicks') emailClicks;
@feature('sourceAttribution') sourceAttribution;
@feature('lexicalEditor') lexicalEditor;
_user = null;

View File

@ -265,6 +265,19 @@
</div>
</div>
</div>
<div class="gh-expandable-block">
<div class="gh-expandable-header">
<div>
<h4 class="gh-expandable-title">Lexical editor</h4>
<p class="gh-expandable-description">
Makes lexical editor the default when creating new posts/pages.
</p>
</div>
<div class="for-switch">
<GhFeatureFlag @flag="lexicalEditor" />
</div>
</div>
</div>
</div>
</div>
{{/if}}

View File

@ -33,7 +33,8 @@ const ALPHA_FEATURES = [
'urlCache',
'beforeAfterCard',
'emailClicks',
'sourceAttribution'
'sourceAttribution',
'lexicalEditor'
];
module.exports.GA_KEYS = [...GA_FEATURES];