refs https://github.com/TryGhost/Team/issues/1225
- if there's not enough space at the end of the editor canvas to fit the selector the browser adds extra space and pushes the scroll up making things feel janky
- added a scroll position reset as soon as the selector renders so nothing jumps around, the canvas just extends so it's possible to scroll the full selector into view
refs https://github.com/TryGhost/Team/issues/1225
Re-using the existing pattern of creating an image card and having it launch an image selector was proving to have a lot of edge cases when we wanted a more streamlined in-line image selector for gifs.
- added a new `'selector'` type to card definitions
- requires a `selectorComponent` argument that is the name of a component that renders the media and handles search
- updated card components to open the selector component when respective menu item is activated
- updated slash menu to instantly trigger the selector component when the slash command matches a card and is followed by a space so that searches continue inside the selector
- added `<KoenigMediaSelector>` component that wraps the card-definition provided component and handles escape key, clicks outside of the editor, and provides a stripped down API to the child component for selecting/closing
- added `<KoenigMediaSelectorTenor>` which mostly replicates the `<GhTenor>` component but has different styling and uses the provided media selector API
no issue
emoji-button uses focus-trap (https://www.npmjs.com/package/focus-trap) to gain/keep focus and allow clicks on the background to close the picker. Unfortunately when deactivating the focus-trap it attempts to return focus but it ends up putting the cursor back at the beginning of the post, deselecting the card and causing scroll jump.
- changed the `<div>` we were using as a button to trigger the emoji picker to `<button>` so that it's focusable meaning `focus-trap` returns focus there when the picker closes keeping focus inside the card
refs https://github.com/TryGhost/Team/issues/1206
Clicking inside the emoji picker was causing focus to be lost which then deselected the card causing an annoying jump between rendered/edit mode whilst working on the card's content. A secondary issue was the picker sticking around after you intentionally clicked elsewhere in the document to leave edit mode.
- before initiating the emoji-button instance, create a container that's appended at the bottom of the document body and that prevents any click events on elements inside the container from bubbling up and causing focus changes. Updated the emoji-button instance to render the picker inside that container
- added a call to hide the picker any time the card leaves edit mode
refs https://github.com/TryGhost/Team/issues/1211
Since we remove the kg-nft-card class from the anchor tag, we needed to
update the HTML parser to work with the new structure.
refs https://github.com/TryGhost/Team/issues/1206
- added `@allowBr` argument to `<KoenigBasicHtmlInput>` and used it in the callout card
- when enabled, adds `soft-break` atom and parser, enables `<br>` support in `cleanBasicHtml()`
no issue
- we had some code in `<KoenigEditor>` that was automatically saving a card when exiting edit mode based on some flawed logic, this meant we were making multiple editor updates simultaneously resulting in usage+change of the upstream `post` model within the same render loop (add paragraph code deselected the card, starts adding new paragraph, the deselection triggered the exit-edit mode which then caused a simultaneous post update)
- passed card env through to `<KoenigEditor>` so that it can compare current payload state against the "saved" payload state to determine if it should save when leaving edit mode
- renamed `_textReplacementEditor` to `_calloutTextEditor` to better match it's usage
- removed unnecessary `onNewline` handling, it wasn't being called because we overrode `ENTER` key
no issue
- switching to `<KoenigBasicHtmlInput>` means that the payload is no longer wrapped in `<p>` tags because the callout should not be a multi-paragraph input
refs https://github.com/TryGhost/Team/issues/1206
- The KoenigBasicHtmlTextarea wasn't an option as the `Enter` key was binded to a line return. And we want to use the `Enter` key to switch to the next paragraph outside of the callout card.
refs https://github.com/TryGhost/Team/issues/1211
This adds handling for the data=payload attriute on Ghost NFT cards as
ell as parsing for the default OpenSea Embed and the Substack NFT Card.
no issue
- text-replacement-input text expansions were customised to not use backticks for code and to have special format handling for `{}`
- switched to it's own set of text expansions that cover the standard expansions used in the main editor except for headings and card replacements
no issue
- the component was still using the text-replacement component's key commands which didn't include code formatting because code in text-replacement component is re-purposed for replacement string highlights
refs https://github.com/TryGhost/Team/issues/1206
- Store the latest emoji locally in the component
- Create a defaultEmoji method to ease retrieving the right emoji
- Use the default emoji when toggling the emoji back on in the card
- Still use 💡 as the default callout emoji