Commit Graph

526 Commits

Author SHA1 Message Date
djordje vlaisavljevic
520a8bad04 Added accordion plus menu icon 2021-11-18 21:49:18 +01:00
Kevin Ansfield
9655b76610 Added cleanup of emoji picker
no issue

- housekeeping when the callout card component is destroyed
2021-11-18 18:57:22 +00:00
Kevin Ansfield
d1e1c8b11c Fixed "Enter" in callout card throwing an error if text has been changed
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
2021-11-18 18:57:21 +00:00
Kevin Ansfield
0295cf2707 Fixed callout card display in non-edit mode
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
2021-11-18 18:56:23 +00:00
Peter Zimon
b3f74c1d88 GIF card refinements 2021-11-18 19:08:01 +01:00
Peter Zimon
9150af46e6 Removed Button indicator icon 2021-11-18 17:53:51 +01:00
Peter Zimon
5c5fd1cff4 Added NFT icon to card menu 2021-11-18 17:38:28 +01:00
Peter Zimon
07b1ac62dd NFT card refinements 2021-11-18 17:29:16 +01:00
Peter Zimon
f69930f0af Added Opensea logo to NFT cards 2021-11-18 17:29:16 +01:00
Thibaut Patel
ca70c5e0dc Moved the callout editor to KoenigBasicHtmlInput
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.
2021-11-18 16:12:39 +01:00
Fabien O'Carroll
8dd02d2ed3 Removed unused NFT Card files
https://github.com/TryGhost/Team/issues/1211

These were added before we made the NFT card a subset of the Embed card.
2021-11-18 14:29:23 +02:00
Kevin Ansfield
c4643314f3 Fixed issues with special formats not closing properly in <KoenigBasicHtmlInput>
no issue

- added missing special markup definitions for formats that are allowed via markdown text expansions
2021-11-18 12:24:56 +00:00
Kevin Ansfield
72ce1648a2 Fixed function name typo
refs 3d55bc2797
2021-11-18 11:59:22 +00:00
Kevin Ansfield
3d55bc2797 Fixed <KoenigBasicHtmlTextarea> using <KoenigTextReplacementInput> text expansions
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
2021-11-18 11:57:41 +00:00
Kevin Ansfield
ca89bc9522 Added code formatting key command support to <KoenigBasicHtmlTextarea>
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
2021-11-18 11:28:41 +00:00
Thibaut Patel
8d1c1731eb Restore the latest callout emoji when toggled off/on
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
2021-11-18 11:16:31 +01:00
Thibaut Patel
3024868250 Exit callout/toggle cards on pressing enter
refs https://github.com/TryGhost/Team/issues/1206

-  When editing, pressing enter exists the edit mode and adds a new paragraph after the card.
2021-11-18 11:00:18 +01:00
djordje vlaisavljevic
43d1981d73 Updated Accordion card styles in editor 2021-11-18 09:58:32 +01:00
Rishabh
e4b3beee75 Updated focus to toggle card heading in edit mode
refs https://github.com/TryGhost/Team/issues/1209
2021-11-18 11:47:02 +05:30
Thibaut Patel
e6fa0bc449 Removed the default editor placeholder on edit
refs https://github.com/TryGhost/Team/issues/1206

- Because we allow <br> in the editor, the editor placeholder was remaining when editing (<p><br></p>). This clean the editor placeholder.
2021-11-17 18:26:34 +01:00
Thibaut Patel
042a772ebe Fixed an error on the KoenigBasicHtmlTextarea
refs https://github.com/TryGhost/Team/issues/1206

- Backspace was triggering the error due to undefined `SPECIAL_MARKUPS`
2021-11-17 16:30:27 +01:00
Peter Zimon
67ec0318a2 NFT card refinements 2021-11-17 14:05:55 +01:00
Thibaut Patel
9cddf73ad6 Added an active class on the callout emoji picker
refs https://github.com/TryGhost/Team/issues/1206

- Enables changing the emoji picker button style conditionally
2021-11-17 12:38:28 +01:00
djordje vlaisavljevic
afe40c8792 Update Accordion editor styles 2021-11-17 12:14:10 +01:00
Kevin Ansfield
9a961a87a2 Fixed nft embed outline and missing snippet toolbar icon
refs https://github.com/TryGhost/Team/issues/1211

- the outline and snippet availability were toggled on `payload.html` presence which isn't set for nft embeds. Switched to toggling on `payload.type` instead as per the main rendered/blank slate conditional
2021-11-17 09:52:10 +00:00
Rishabh
4837249d89 Fixed paste not working in toggle card heading
refs https://github.com/TryGhost/Team/issues/1209
2021-11-17 15:12:31 +05:30
Sanne de Vries
69a7788f20 Added generic class to callout card
No ref

- The card needs the .kg-card class to be spaced correctly in themes
2021-11-17 08:56:18 +01:00
Fabien O'Carroll
6ef642a5e8 Updated NFT card handling in the editor
refs https://github.com/TryGhost/Team/issues/1211

Using `type` rather than `card_type` since that's been replaced in the
API.

Moves the rendering of the card in the template so that we get
access to the caption editor, and selectable card (rather than the
anchor tag redirecting us to OpenSea)

Updates the `isEmpty` property to take into account NFT cards.
2021-11-16 21:35:27 +02:00
Thibaut Patel
24d27f96f0 Fixed vanishing empty callout when changing emoji
refs https://github.com/TryGhost/Team/issues/1206

- Updated to consider a callout card empty only when both the emoji and the text is empty
2021-11-16 19:17:04 +01:00
Kevin Ansfield
45fec25930 Updated tenor API config keys and added contentfilter support
refs https://github.com/TryGhost/Team/issues/1217

- tenor API config is now an object that lives at `config.tenor`
- updated gifs card gating to use the new config object
- added passthrough of `contentfilter` param from config when making Tenor API requests
2021-11-16 17:44:37 +00:00
Thibaut Patel
5696ee53fc Moved the localstorage utils to be where it's used
refs https://github.com/TryGhost/Team/issues/1206

- Fixes the previous commit (78540cabfd)
2021-11-16 18:18:19 +01:00
Thibaut Patel
78540cabfd Save the latest callout card emoji
refs https://github.com/TryGhost/Team/issues/1206

- Re-use the saved emoji as the default for future callout cards
- Introduced a localstorage util that ignores errors. Ignoring errors avoids issues with browsers that don't support localstorage
2021-11-16 18:10:27 +01:00
Thibaut Patel
a09d5ca14d Allow line-returns in callout card
refs https://github.com/TryGhost/Team/issues/1206

- Uses the `softReturn` parser to maintain line returns when editing the callout card
2021-11-16 17:11:00 +01:00
Thibaut Patel
568c523ff2 Allow line-returns in callout card
refs https://github.com/TryGhost/Team/issues/1206

- This only solves partially the line-returns being eaten by the editor. When editing a card with a line return, it will be removed.
2021-11-16 15:04:56 +01:00
Sanne de Vries
3ec39ae255 Styled emoji picker in callout card 2021-11-16 13:34:44 +01:00
Kevin Ansfield
cdf0565d3b Hid gifs card when tenor API config is not available
refs https://github.com/TryGhost/Team/issues/1220

- added array support to `{{card-is-available}}` helper where every key needs to be present for the card to be available
- changed gifs card `isAvailable` property to require both the feature flag and the tenor api key to be set in config
2021-11-16 12:14:21 +00:00
Peter Zimon
527043a89d Set Button alignment to center 2021-11-16 09:04:35 +01:00
Peter Zimon
77c2a9eba7 Button refinements 2021-11-16 08:59:28 +01:00
Sanne de Vries
430989d722 Updated callout card dark-mode 2021-11-15 20:48:02 +01:00
Thibaut Patel
8e3bce3c49 Updated the html textarea editor code shortcut
refs https://github.com/TryGhost/Team/issues/1206

- the editor will behave like the main Ghost editor and will wrap text between backticks with a <code> tag
2021-11-15 18:48:24 +01:00
Kevin Ansfield
04fe62012d Dropped deprecated {{action}} usage in callout card and removed
no issue

- `{{action}}` is deprecated and is only available for backwards compatibility with action hashes in non-Glimmer components
- for event handlers we should be using the `{{on}}` modifier to use `addEventListener` on an element rather than directly attaching JS functions using `onclick=` attributes to avoid subtle DOM event ordering bugs
2021-11-15 17:37:29 +00:00
Thibaut Patel
be60693189 Partially revert changes from previous commit
refs 35db77e342

- This wasn't affecting HTML replacement so it had no reason to go
2021-11-15 18:31:09 +01:00
Thibaut Patel
35db77e342 Removed email-specific code from the html textarea
refs https://github.com/TryGhost/Team/issues/1206

- prevents text in curly brakets from being wrapped into a <code> tag
- updated the callout card to this generic textarea editor instead of the email-specific editor
2021-11-15 17:58:01 +01:00
Kevin Ansfield
5268ad1f77 Swapped feature card setting for isAvailable
no issue

- the number of properties that cards have in their definition was growing so it made sense to drop the single-use `feature` property in favor of the `isAvailable` property that can perform the same functionality
2021-11-15 16:43:44 +00:00
Kevin Ansfield
4ca14b8eee 🐛 Fixed Unsplash image selector being available in editor when disabled
closes https://github.com/TryGhost/Team/issues/1223

It's possible to disable the Unsplash integration from the integration settings but when disabled the image selector was still available for post feature images and as an editor embed option.

- adds `isAvailable` property to card definitions, if it's set it should be a string that matches a config/setting that determines the card's availability
  - unsplash card updated to use `'settings.unsplash'` as it's `isAvailable` property
- adds conditional to `<GhEditorFeatureImage>` so the Unsplash selector is only shown when enabled to bring it inline with the `<GhImageUploader>` component that was used previously for post feature images
2021-11-15 16:38:57 +00:00
Fabien O'Carroll
747e6c9533 Handled missing html property for NFT Oembed response
refs https://github.com/TryGhost/Team/issues/1211

Since we have switched to rendering the NFT card outside of the OEmbed
response we no longer include a html property. This check would throw
for missing HTML so we've updated it to not include NFT cards
2021-11-15 15:49:42 +02:00
Fabien O'Carroll
b8dd7c6af2 Revert "Added support for no-iframed embeds"
This reverts commit 8e29e8de79.
2021-11-15 15:49:42 +02:00
Fabien O'Carroll
dad82ec463 Revert "Fixed embeds without iframe resizing iframe"
This reverts commit 85c8674299.
2021-11-15 15:49:42 +02:00
Thibaut Patel
82ccb36338 Added an emoji picker for the callout card
refs https://github.com/TryGhost/Team/issues/1206

- Uses https://emoji-button.js.org/ for the emoji panel and search
- Displayed when the callout card emoji is clicked
2021-11-15 14:19:20 +01:00
Sanne de Vries
e2f149ca45 Updated callout icon in card menu
Refs https://github.com/TryGhost/Team/issues/1206
2021-11-15 13:47:36 +01:00