Skip to content

Commit

Permalink
Enabled emoji picker in feature image caption
Browse files Browse the repository at this point in the history
closes TryGhost/Koenig#1038

- updated `<KoenigLexicalEditorInput>` to load `<EmojiPickerPlugin>` and compose it into the editor unless used with `<KoenigLexicalEditorInput @emojipicker={{false}} />`
- bumped Koenig packages so `EmojiPickerPlugin` is available to import from `koenig-lexical`
  • Loading branch information
kevinansfield committed Nov 1, 2023
1 parent 8b57bf7 commit 5237089
Show file tree
Hide file tree
Showing 6 changed files with 165 additions and 107 deletions.
14 changes: 14 additions & 0 deletions ghost/admin/app/components/koenig-lexical-editor-input.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ const HtmlOutputPlugin = ({editorResource, ...props}) => {
return <_HtmlOutputPlugin {...props} />;
};

const EmojiPickerPlugin = ({editorResource, ...props}) => {
const {EmojiPickerPlugin: _EmojiPickerPlugin} = editorResource.read();
return <_EmojiPickerPlugin {...props} />;
};

export default class KoenigLexicalEditorInput extends Component {
@service ajax;
@service feature;
Expand All @@ -50,6 +55,14 @@ export default class KoenigLexicalEditorInput extends Component {

editorResource = this.koenig.resource;

get emojiPicker() {
if (!this.feature.editorEmojiPicker) {
return false;
}

return this.args.emojiPicker ?? true;
}

@action
onError(error) {
// ensure we're still showing errors in development
Expand Down Expand Up @@ -89,6 +102,7 @@ export default class KoenigLexicalEditorInput extends Component {
placeholderClassName="koenig-lexical-editor-input-placeholder"
>
<HtmlOutputPlugin editorResource={this.editorResource} html={props.html} setHtml={props.onChangeHtml} />
{this.emojiPicker ? <EmojiPickerPlugin editorResource={this.editorResource} /> : null}
</KoenigComposableEditor>
</KoenigComposer>
</Suspense>
Expand Down
2 changes: 1 addition & 1 deletion ghost/admin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
"@tryghost/ember-promise-modals": "2.0.1",
"@tryghost/helpers": "1.1.88",
"@tryghost/kg-clean-basic-html": "3.0.40",
"@tryghost/kg-converters": "0.0.21",
"@tryghost/kg-converters": "0.0.22",
"@tryghost/koenig-lexical": "0.5.14",
"@tryghost/limit-service": "1.2.12",
"@tryghost/members-csv": "0.0.0",
Expand Down
10 changes: 5 additions & 5 deletions ghost/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -98,14 +98,14 @@
"@tryghost/importer-handler-content-files": "0.0.0",
"@tryghost/importer-revue": "0.0.0",
"@tryghost/job-manager": "0.0.0",
"@tryghost/kg-card-factory": "4.0.14",
"@tryghost/kg-converters": "0.0.21",
"@tryghost/kg-card-factory": "4.0.15",
"@tryghost/kg-converters": "0.0.22",
"@tryghost/kg-default-atoms": "4.0.3",
"@tryghost/kg-default-cards": "9.1.8",
"@tryghost/kg-default-cards": "9.1.9",
"@tryghost/kg-default-nodes": "0.2.7",
"@tryghost/kg-html-to-lexical": "0.1.8",
"@tryghost/kg-lexical-html-renderer": "0.3.44",
"@tryghost/kg-mobiledoc-html-renderer": "6.0.14",
"@tryghost/kg-mobiledoc-html-renderer": "6.0.15",
"@tryghost/limit-service": "1.2.12",
"@tryghost/link-redirects": "0.0.0",
"@tryghost/link-replacer": "0.0.0",
Expand Down Expand Up @@ -225,7 +225,7 @@
"yjs": "13.6.8"
},
"optionalDependencies": {
"@tryghost/html-to-mobiledoc": "2.0.40",
"@tryghost/html-to-mobiledoc": "2.0.41",
"sqlite3": "5.1.6"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion ghost/email-service/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"@tryghost/email-events": "0.0.0",
"@tryghost/errors": "1.2.26",
"@tryghost/html-to-plaintext": "0.0.0",
"@tryghost/kg-default-cards": "9.1.8",
"@tryghost/kg-default-cards": "9.1.9",
"@tryghost/logging": "2.4.8",
"@tryghost/tpl": "0.1.26",
"@tryghost/validator": "0.2.6",
Expand Down
2 changes: 1 addition & 1 deletion ghost/importer-revue/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
},
"dependencies": {
"@tryghost/debug": "0.1.26",
"@tryghost/kg-default-cards": "9.1.8",
"@tryghost/kg-default-cards": "9.1.9",
"@tryghost/string": "0.2.10",
"lodash": "4.17.21",
"papaparse": "5.3.2",
Expand Down
Loading

0 comments on commit 5237089

Please sign in to comment.