Added accentColour to KoenigReactEditor as prop. (#15231)

no issue
This commit is contained in:
Ronald Langeveld 2022-08-15 11:29:09 +02:00 committed by GitHub
parent 2a07b94bd4
commit 5e98c78493
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 0 deletions

View File

@ -40,6 +40,7 @@
@didCreateEditor={{this.onEditorCreated}}
@onChange={{@onBodyChange}}
@uploadUrl={{this.uploadUrl}}
@accentColor={{this.accentColor}}
/>
{{!-- <KoenigEditor

View File

@ -1,9 +1,12 @@
import Component from '@glimmer/component';
import ghostPaths from 'ghost-admin/utils/ghost-paths';
import {action} from '@ember/object';
import {inject as service} from '@ember/service';
import {tracked} from '@glimmer/tracking';
export default class GhKoenigEditorReactComponent extends Component {
@service settings;
containerElement = null;
titleElement = null;
koenigEditor = null;
@ -17,6 +20,14 @@ export default class GhKoenigEditorReactComponent extends Component {
return this.args.title === '(Untitled)' ? '' : this.args.title;
}
get accentColor() {
const color = this.settings.get('accentColor');
if (color && color[0] === '#') {
return color.slice(1);
}
return color;
}
@action
registerElement(element) {
this.containerElement = element;

View File

@ -88,6 +88,7 @@ export default class KoenigReactEditor extends Component {
didCreateEditor={this.args.didCreateEditor}
onChange={this.args.onChange}
uploadUrl={this.args.uploadUrl}
accentColor={this.args.accentColor}
/>
</Suspense>
</ErrorHandler>