Skip to content
This repository was archived by the owner on Nov 28, 2022. It is now read-only.

Commit 5a54586

Browse files
committed
🐛 Koenig - Fixed error when clicking embed icons in /-menu
refs TryGhost/Ghost#9724 - `{{koenig-menu-content}}` does not pass any params through when an item is clicked - move the `params` fetching via the query string from `_performAction()` to `actions.itemClicked` so that it works for both <kbd>Enter</kbd> and icon clicks
1 parent 70f8d37 commit 5a54586

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

lib/koenig-editor/addon/components/koenig-slash-menu.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -88,12 +88,13 @@ export default Component.extend({
8888
},
8989

9090
actions: {
91-
itemClicked(item, params) {
91+
itemClicked(item) {
9292
let range = this._openRange.head.section.toRange();
93+
let [, ...params] = this._query.split(/\s/);
9394
let payload;
9495

9596
// params are order-dependent and listed in CARD_MENU for each card
96-
if (item.params) {
97+
if (!isEmpty(item.params) && !isEmpty(params)) {
9798
payload = {};
9899
item.params.forEach((param, i) => {
99100
payload[param] = params[i];
@@ -274,10 +275,9 @@ export default Component.extend({
274275

275276
_performAction() {
276277
let selectedItem = this._getSelectedItem();
277-
let [, ...params] = this._query.split(/\s/);
278278

279279
if (selectedItem) {
280-
this.send('itemClicked', selectedItem, params);
280+
this.send('itemClicked', selectedItem);
281281
}
282282
},
283283

0 commit comments

Comments
 (0)