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 2c9d42f commit fdea396
Show file tree
Hide file tree
Showing 6 changed files with 95 additions and 81 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
8 changes: 4 additions & 4 deletions ghost/admin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@
"@tryghost/color-utils": "0.2.0",
"@tryghost/ember-promise-modals": "2.0.1",
"@tryghost/helpers": "1.1.88",
"@tryghost/kg-clean-basic-html": "3.0.39",
"@tryghost/kg-converters": "0.0.21",
"@tryghost/koenig-lexical": "0.5.12",
"@tryghost/kg-clean-basic-html": "3.0.40",
"@tryghost/kg-converters": "0.0.22",
"@tryghost/koenig-lexical": "0.5.14",
"@tryghost/limit-service": "1.2.12",
"@tryghost/members-csv": "0.0.0",
"@tryghost/nql": "0.11.0",
Expand Down Expand Up @@ -199,4 +199,4 @@
}
}
}
}
}
16 changes: 8 additions & 8 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-nodes": "0.2.6",
"@tryghost/kg-html-to-lexical": "0.1.7",
"@tryghost/kg-lexical-html-renderer": "0.3.42",
"@tryghost/kg-mobiledoc-html-renderer": "6.0.14",
"@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.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
134 changes: 67 additions & 67 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7726,12 +7726,12 @@
dependencies:
lodash-es "^4.17.11"

"@tryghost/html-to-mobiledoc@2.0.40":
version "2.0.40"
resolved "https://registry.yarnpkg.com/@tryghost/html-to-mobiledoc/-/html-to-mobiledoc-2.0.40.tgz#5ec7117dd34bea856d22080050cbf0d94ef6b1a9"
integrity sha512-z2dfhBmgMDxIhPIPSmQYrlI8LAnuJkINFHpy628yLvtEl1skPO3zK9/pejK+PjgRiJTwMkRb9HOtcH0d2j4qOQ==
"@tryghost/html-to-mobiledoc@2.0.41":
version "2.0.41"
resolved "https://registry.yarnpkg.com/@tryghost/html-to-mobiledoc/-/html-to-mobiledoc-2.0.41.tgz#d1860f26b26934e729e1aa99a640eb56a36d17f6"
integrity sha512-Gnae7igk9bYp4CpxL8ePa2heB/cnPCTimEO0466XTzkg9jFSjFg5zLC+fOHscu66ICEI3YvYdnqbsPtmdHfRyg==
dependencies:
"@tryghost/kg-parser-plugins" "^3.0.40"
"@tryghost/kg-parser-plugins" "^3.0.41"
"@tryghost/mobiledoc-kit" "^0.12.4-ghost.1"
jsdom "^22.0.0"

Expand Down Expand Up @@ -7768,20 +7768,20 @@
"@tryghost/errors" "^1.2.26"
jest-snapshot "^29.0.0"

"@tryghost/kg-card-factory@4.0.14":
version "4.0.14"
resolved "https://registry.yarnpkg.com/@tryghost/kg-card-factory/-/kg-card-factory-4.0.14.tgz#4fdbd7e45926f26c1b96c9f6315e9294e576cb4c"
integrity sha512-riIhtlHJhspvwf+9JATawIayNqzIdaZE3DEXoRwQF4Cbdyk3ksuNJ+w4iBo7cvSbQg6s30TZpjFHQ21W1AROzg==
"@tryghost/kg-card-factory@4.0.15":
version "4.0.15"
resolved "https://registry.yarnpkg.com/@tryghost/kg-card-factory/-/kg-card-factory-4.0.15.tgz#9f5cd81add5a35b05b7502846eb6369aadfaf4af"
integrity sha512-E4lLTAbuT/qAwa08nNLe/6l+G5zFCq4/RLjO3nIoX8aivEAJ2sGFzpXlr3txY3tTowoaXI5q+GsifboY4R5QhQ==

"@tryghost/kg-clean-basic-html@3.0.39", "@tryghost/kg-clean-basic-html@^3.0.39":
version "3.0.39"
resolved "https://registry.yarnpkg.com/@tryghost/kg-clean-basic-html/-/kg-clean-basic-html-3.0.39.tgz#aedfa732e8ad85846d673352f0b8e4b519ab9638"
integrity sha512-47n/D1PrWoJgRP3R62fnJeVP7YEojnlm9Sf7vGKXG2wXIsxgwhBBI6r7D7euB/t3OsRrTp5t1LMksNwoyQoO0g==
"@tryghost/kg-clean-basic-html@3.0.40", "@tryghost/kg-clean-basic-html@^3.0.40":
version "3.0.40"
resolved "https://registry.yarnpkg.com/@tryghost/kg-clean-basic-html/-/kg-clean-basic-html-3.0.40.tgz#ff9fbcae37f659136673d38347a08ab8f39c13c0"
integrity sha512-K8Q1Slg7E9oJHZ41Aqwqfxkaly0uJ0ygfdCFWVPCVCLMyAkzR0E04DoWXO+T7sZRuTOk80yi1TyyMIKN1Ylfag==

"@tryghost/kg-converters@0.0.21":
version "0.0.21"
resolved "https://registry.yarnpkg.com/@tryghost/kg-converters/-/kg-converters-0.0.21.tgz#1e66ab6b199b296b4d4e71fd6c7e55e757b383da"
integrity sha512-t7ZXlUQITz3kXcNxyPUsCDX47mkvnjgpcB14Q44P1iwJYu8Gp5+i6BtoH6xHVYatJp0uEDEhKLMZKMjzNbi7mw==
"@tryghost/kg-converters@0.0.22":
version "0.0.22"
resolved "https://registry.yarnpkg.com/@tryghost/kg-converters/-/kg-converters-0.0.22.tgz#3f95d9e71d2b5fa1083a45119cf22a8e755471c3"
integrity sha512-wxvlgRJuuskFu7zPOMQM6gAIk4R9I3gGKknM6oOvFCX2xi1Vlv2yO1U5786v2d+05ACN9SIj3fkg7Fe9WjC2tw==
dependencies:
lodash "^4.17.21"

Expand All @@ -7790,82 +7790,82 @@
resolved "https://registry.yarnpkg.com/@tryghost/kg-default-atoms/-/kg-default-atoms-4.0.3.tgz#a565a08ee55736065154f435d51b392f9a15455d"
integrity sha512-EZ43abMvUr7cV5aAD4w7OVUOtaGdfj4HpvQRkZkAqB7/S4prRl7dWIlatxiYX379AXQ+hjI+cSrw5UV0yHaRhA==

"@tryghost/kg-default-cards@9.1.8":
version "9.1.8"
resolved "https://registry.yarnpkg.com/@tryghost/kg-default-cards/-/kg-default-cards-9.1.8.tgz#96100ffe923fab98de5b2403ae06d53bc4d2610c"
integrity sha512-zwopCvpcBb6YgbxfT5h/9zetntIVXJaoJFVYSvpONH5EIXA1sG76PdFnboZCigOIYAaFBm1jM16ogat9/wL1Jw==
"@tryghost/kg-default-cards@9.1.9":
version "9.1.9"
resolved "https://registry.yarnpkg.com/@tryghost/kg-default-cards/-/kg-default-cards-9.1.9.tgz#46388d46ea9b05e001958116c93bf0e7720f65e6"
integrity sha512-VhhgwOKSfeBep0LlzIIqh2k7LIuaHkiD/4t75WKp7hG4tNhWj+NYMb0vQDnJtoVnNfeNVjor1zEAnDoHzf4rFQ==
dependencies:
"@tryghost/kg-markdown-html-renderer" "^6.0.14"
"@tryghost/kg-markdown-html-renderer" "^6.0.15"
"@tryghost/string" "^0.2.0"
"@tryghost/url-utils" "^4.0.0"
handlebars "^4.7.6"
juice "^9.0.0"
lodash "^4.17.21"
luxon "^3.0.0"

"@tryghost/kg-default-nodes@0.2.6", "@tryghost/kg-default-nodes@^0.2.6":
version "0.2.6"
resolved "https://registry.yarnpkg.com/@tryghost/kg-default-nodes/-/kg-default-nodes-0.2.6.tgz#bf388c9342e25fbe8899e9eb93369e27f813e914"
integrity sha512-XlKq0BKHZk4NPBq/uYTMwIzrV4GFSiDU7Lh+N/3ugVq6kscwItUHVYkwXu2Mv3eLKvr2x0XTaaR91bPkpDnOBg==
"@tryghost/kg-default-nodes@0.2.7", "@tryghost/kg-default-nodes@^0.2.7":
version "0.2.7"
resolved "https://registry.yarnpkg.com/@tryghost/kg-default-nodes/-/kg-default-nodes-0.2.7.tgz#88ef265ebd872988328128897dd5479cd0a7f18e"
integrity sha512-67D8iXYyvoQsDcRN26DcZyVRV5USRaudRgyPd/wfLtHH1HHJrEPU/Put2GrBt0EVQU/Drf8COB6h1Uz08arygw==
dependencies:
"@lexical/rich-text" "^0.12.2"
"@tryghost/kg-clean-basic-html" "^3.0.39"
"@tryghost/kg-markdown-html-renderer" "^6.0.14"
"@tryghost/kg-clean-basic-html" "^3.0.40"
"@tryghost/kg-markdown-html-renderer" "^6.0.15"
html-minifier "^4.0.0"
jsdom "^22.0.0"
lexical "^0.12.2"
lodash "^4.17.21"
luxon "^3.3.0"

"@tryghost/kg-default-transforms@^0.0.3":
version "0.0.3"
resolved "https://registry.yarnpkg.com/@tryghost/kg-default-transforms/-/kg-default-transforms-0.0.3.tgz#7791f3912f32a8be63cf3d312c046bb0e5df36dc"
integrity sha512-YWYAWVUf83L2dmSGo37rxfmDYzBTSVfSXTGh9y2xm8f7ypCv/VnOIefXdtswYnxuyhP+/uZUyZOTzIM/xtQYhg==
"@tryghost/kg-default-transforms@^0.0.4":
version "0.0.4"
resolved "https://registry.yarnpkg.com/@tryghost/kg-default-transforms/-/kg-default-transforms-0.0.4.tgz#b2a53170032f33544596984ed39c9f29209d5431"
integrity sha512-cn+f0vteSHBVzLH2sBzBa3QNetkipXl1zhJsgqQA1CPFIQtncoMn0ucfUuSXrEk0ooyWRTJMVOk2Fxzj0rA3Ag==
dependencies:
"@lexical/list" "^0.12.2"
"@lexical/rich-text" "^0.12.2"
"@lexical/utils" "^0.12.2"
"@tryghost/kg-default-nodes" "^0.2.6"
"@tryghost/kg-default-nodes" "^0.2.7"
lexical "^0.12.2"

"@tryghost/kg-html-to-lexical@0.1.7":
version "0.1.7"
resolved "https://registry.yarnpkg.com/@tryghost/kg-html-to-lexical/-/kg-html-to-lexical-0.1.7.tgz#92cc6f2f2f1caec91003eb6ca9f037994aa77342"
integrity sha512-7+j7JZlF8HWt0FYCCb7+xvmlDWnYQwnkw7+RYXW7Ud5gUeFEmkg2UW/JV0XDbFgCw5QEahaRbE22Yi0Erfy78g==
"@tryghost/kg-html-to-lexical@0.1.8":
version "0.1.8"
resolved "https://registry.yarnpkg.com/@tryghost/kg-html-to-lexical/-/kg-html-to-lexical-0.1.8.tgz#92269a9986746e1d91e7bd37615ddbf116e91dc8"
integrity sha512-Sg6W6Skhnd/7hc2+zy4DNOYI7EDT6nf8yqWwbNvOjEXAmIH3nqzwyPGq9eSaxzL590BqHh0zF/a12QD5kvpUww==
dependencies:
"@lexical/clipboard" "^0.12.2"
"@lexical/headless" "^0.12.2"
"@lexical/html" "^0.12.2"
"@lexical/link" "^0.12.2"
"@lexical/list" "^0.12.2"
"@lexical/rich-text" "^0.12.2"
"@tryghost/kg-default-nodes" "^0.2.6"
"@tryghost/kg-default-transforms" "^0.0.3"
"@tryghost/kg-default-nodes" "^0.2.7"
"@tryghost/kg-default-transforms" "^0.0.4"
jsdom "^22.1.0"
lexical "^0.12.2"

"@tryghost/kg-lexical-html-renderer@0.3.42":
version "0.3.42"
resolved "https://registry.yarnpkg.com/@tryghost/kg-lexical-html-renderer/-/kg-lexical-html-renderer-0.3.42.tgz#d433ab4af404d92e534f2cf25630aa338d1c81a5"
integrity sha512-j8QlbJDn5oIfoN+5rHLwrrfkXs1KhNuS0y8WvmA2tUq5N4XgLQvGbsEf9/E0cIs2t2CDSjfZjLx5tqXE7gw9/w==
"@tryghost/kg-lexical-html-renderer@0.3.44":
version "0.3.44"
resolved "https://registry.yarnpkg.com/@tryghost/kg-lexical-html-renderer/-/kg-lexical-html-renderer-0.3.44.tgz#a097b20dc16d8990c9d1f2430ced509629e018f7"
integrity sha512-8tm60RAY+jLHdxPXNEBBUY5Z5StoHe071KGHXUBa5NNj5T+R+9eEUTGKP4V83o0N4dVK4eJmc+15b91jqxP3aQ==
dependencies:
"@lexical/clipboard" "^0.12.2"
"@lexical/code" "^0.12.2"
"@lexical/headless" "^0.12.2"
"@lexical/link" "^0.12.2"
"@lexical/list" "^0.12.2"
"@lexical/rich-text" "^0.12.2"
"@tryghost/kg-default-nodes" "^0.2.6"
"@tryghost/kg-default-nodes" "^0.2.7"
jsdom "^22.1.0"
lexical "^0.12.2"
prettier "^3.0.0"

"@tryghost/kg-markdown-html-renderer@^6.0.14":
version "6.0.14"
resolved "https://registry.yarnpkg.com/@tryghost/kg-markdown-html-renderer/-/kg-markdown-html-renderer-6.0.14.tgz#eef03122e0a4919d370398c02727300cd93f2988"
integrity sha512-Cnxi5Ucn3o98o0pkJAVcJ2+h8lPf9uLi0x3Hq0INJV79f2fch28ILW6wQCbF052j52btFCf58a5dJBT1uqtiEg==
"@tryghost/kg-markdown-html-renderer@^6.0.15":
version "6.0.15"
resolved "https://registry.yarnpkg.com/@tryghost/kg-markdown-html-renderer/-/kg-markdown-html-renderer-6.0.15.tgz#ff314cad10d17ef87c201471066e158986c524d1"
integrity sha512-kK18d/Ert9QDU5aXUrv3C36RzwX3JHz8MlXYiVR4tpmiPgTa8r6bBMuUFkXQQjvP6P8+tJXDLaSMgFiF0Su8yg==
dependencies:
"@tryghost/kg-utils" "^1.0.22"
"@tryghost/kg-utils" "^1.0.23"
markdown-it "^13.0.0"
markdown-it-footnote "^3.0.3"
markdown-it-image-lazy-loading "^1.1.0"
Expand All @@ -7875,33 +7875,33 @@
markdown-it-sup "^1.0.0"
semver "^7.3.5"

"@tryghost/kg-mobiledoc-html-renderer@6.0.14":
version "6.0.14"
resolved "https://registry.yarnpkg.com/@tryghost/kg-mobiledoc-html-renderer/-/kg-mobiledoc-html-renderer-6.0.14.tgz#6cf06c29c99dc017946dd5bf1f7470cf12638cb6"
integrity sha512-gru9sCZPiOSgCGSCI9i1LEXxkpOJBmEuEVb0RUzOA+ftzPDfPiYCpSjyy4ykJ7ZWxbAZyBgDqiuBEguE1e9/mg==
"@tryghost/kg-mobiledoc-html-renderer@6.0.15":
version "6.0.15"
resolved "https://registry.yarnpkg.com/@tryghost/kg-mobiledoc-html-renderer/-/kg-mobiledoc-html-renderer-6.0.15.tgz#17fe6bb92393e0f559b9f45dd51320147ed032a3"
integrity sha512-CbbnkWyxmM0T4gyKKBvPWrhG+HV3CY/KhOKnzbIGmzOWOaFJw96MiJL0V8Sfnq0nu0bwKoD/2LGKn0RcAHOdFQ==
dependencies:
"@tryghost/kg-utils" "^1.0.22"
"@tryghost/kg-utils" "^1.0.23"
mobiledoc-dom-renderer "^0.7.0"
simple-dom "^1.4.0"

"@tryghost/kg-parser-plugins@^3.0.40":
version "3.0.40"
resolved "https://registry.yarnpkg.com/@tryghost/kg-parser-plugins/-/kg-parser-plugins-3.0.40.tgz#0c3ac1c8911fbc53905f2a9d418b885986927605"
integrity sha512-OlFm8+jqV1YvlPTXRY21luqyCna0ZwMjFK+e8i0Kku9/wIydPyMqHC7osggfeGW6Z657F7ixMFSn97EGnM7Ymw==
"@tryghost/kg-parser-plugins@^3.0.41":
version "3.0.41"
resolved "https://registry.yarnpkg.com/@tryghost/kg-parser-plugins/-/kg-parser-plugins-3.0.41.tgz#1537df18116548fe18c7b36c22cf9960b88427f7"
integrity sha512-h90pIf0islXYw8acXGc/5D6/wV6vGQ4TxhNMrAcpmj6Wq02c9wyvzfl82H3N7JG0yxUWco4u8zSg1/4fGiZpfA==
dependencies:
"@tryghost/kg-clean-basic-html" "^3.0.39"
"@tryghost/kg-clean-basic-html" "^3.0.40"

"@tryghost/kg-utils@^1.0.22":
version "1.0.22"
resolved "https://registry.yarnpkg.com/@tryghost/kg-utils/-/kg-utils-1.0.22.tgz#bb24bcd7c97e5b2c46221d4a383160ea37926af5"
integrity sha512-glHSKw3+W6IeT1TIXJQuRXhlJhFIeSwRbbvFSG+3sSikeOHAR1boKXWeKRRnaGAwqOvJFvcwSD89BOhA7DNXGg==
"@tryghost/kg-utils@^1.0.23":
version "1.0.23"
resolved "https://registry.yarnpkg.com/@tryghost/kg-utils/-/kg-utils-1.0.23.tgz#89b45da20e51907e8b17c0f0aa7dc5613118ba32"
integrity sha512-Om2U7eeKPIZarGP9FLuhkW/0oIFdY/uWX2CI2BAsbWEp9zlH2at6ydC9vaLxYgVc7P2nGmK9sw2w9xWh3nz3EQ==
dependencies:
semver "^7.3.5"

"@tryghost/koenig-lexical@0.5.12":
version "0.5.12"
resolved "https://registry.yarnpkg.com/@tryghost/koenig-lexical/-/koenig-lexical-0.5.12.tgz#36e03a3d007dc71b243be1d81fcb1125e4f53970"
integrity sha512-9hLhQ/6X7OlicMkGqPdsY6PBu7RaZntSlLHGgIp48dxU8lzQOKk2Nycrrvv+3DdR9Bzk79mmEWrj7vx2g9ggdw==
"@tryghost/koenig-lexical@0.5.14":
version "0.5.14"
resolved "https://registry.yarnpkg.com/@tryghost/koenig-lexical/-/koenig-lexical-0.5.14.tgz#2f576a57cf5fccf6a465b25838085d963f051cfb"
integrity sha512-S8MEo67XaBpQZJl/6AaHK8IWxj2Pv6veflsQgzO1GcWzKUdm8PUosYCkqsNDQnK88tO0pO0FIluEy/QYhG97hg==

"@tryghost/limit-service@1.2.12", "@tryghost/limit-service@^1.2.10":
version "1.2.12"
Expand Down

0 comments on commit fdea396

Please sign in to comment.