Commit Graph

884 Commits

Author SHA1 Message Date
Djordje Vlaisavljevic
7a3bbfde10
Added ActivityPub playground (#20081)
ref MOM61

- Adds admin-x react app we’ll use as ActivityPub playground to the
sidebar nav behind the feature flag.
- Wired up routing to Ember
- Setup the project as `admin-x-activitypub`

---------

Co-authored-by: Ronald Langeveld <hi@ronaldlangeveld.com>
2024-04-25 16:44:29 +08:00
Daniel Lockyer
2ac8f39e77 Included all apps in asset-delivery output
- this should loop over all apps without us having to manually add them
  to the debug lines
2023-11-20 16:49:10 +01:00
Jono M
a93c665d20
Created a skeleton AdminX demo app (#19005)
refs https://github.com/TryGhost/Product/issues/4152

---

<!-- Leave the line below if you'd like GitHub Copilot to generate a
summary from your commit -->
<!--
copilot:summary
-->
### <samp>🤖[[deprecated]](https://githubnext.com/copilot-for-prs-sunset)
Generated by Copilot at a28462f</samp>

This pull request adds a new admin-x app called `admin-x-demo`, which
demonstrates how to use the shared packages `admin-x-framework` and
`admin-x-design-system` to create a simple app that renders a button and
a modal. It also improves the development workflow, the vite
integration, the dependency management, and the type checking for the
admin-x apps and packages. It modifies some files in the
`admin-x-framework` and `admin-x-design-system` packages to make the
modals prop optional, to introduce a new type for the props from the
Ember app, to fix the z-index of the modal backdrop, and to use
consistent file extensions and module syntax.
2023-11-20 13:30:15 +00:00
Chris Raible
8a0a9c07fb
Removed assets/ from sources in admin sourcemaps (#18852)
no issue

- Follow up to
85fca5891f
- With the `sourceRoot` key added in the commit above, the sourcemaps
were still failing validation
(https://sourcemaps.io/report/1698954693695_https%3A%2F%2Fassets.ghostfoundation.org%2Fadmin%2F1603%2Fassets%2Fchunk.143.ab029856ba6d72733dfa.js)
- With the `sourceRoot` key, the maps were pointing to
'<CDN_URL>/assets/../assets/...' which is invalid
- This change simply strips the leading `assets/` from any sources in
the sourcemaps
2023-11-02 13:12:45 -07:00
Chris Raible
85fca5891f
Added sourceRoot key to sourcemaps before asset-delivery runs (#18849)
no issue

- Follow up to
a382cd8a91
and
fb34e285fc
- The `sourcemap-postprocess` addon was ineffective because the assets
were being copied to `/ghost/core/core/built` before the addon was run,
so the changes weren't being applied in staging/production
- This change makes the required modifications to the sourcemaps before
copying them
2023-11-02 18:46:56 +00:00
Chris Raible
fb34e285fc
Removed assets/ from sources in admin sourcemaps (#18832)
no issue

- Follow up to https://github.com/TryGhost/Ghost/pull/18825
- Adding the sourceRoot key didn't seem to work, so I'm just removing
the `assets/` prefix from all the sources to hopefully correct the issue
2023-11-01 22:02:56 +00:00
Chris Raible
a382cd8a91
Added sourceRoot key to admin sourcemaps (#18825)
no issue

- The sourcemaps generated for the admin app use relative links to the
source code files e.g. `assets/ghost.js`
- Since the sourcemaps themselves are hosted at `/assets` already, this
was leading to issues with sourcemaps in Sentry and in the browser
looking for the sources at `/assets/assets/ghost.js`
- This commit adds a `sourceRoot` key to the sourcemaps, which should
allow Sentry and the Browser to find the source code files at
`../assets/ghost.js` instead of `assets/ghost.js`
- We may need to iterate on this — not 100% sure if this is the best way
to do this without trying it in staging. If the `../` doesn't work in
all environments, we can try including the CDN url directly
2023-11-01 18:42:09 +00:00
Kevin Ansfield
fa0b1c607b
Deleted all Admin code relating to the old editor (#18580)
no issue

- removed labs flag
- removed main editor component and all associated components
- switched usage of `<KoenigBasicHtmlInput>` and `<KoenigBasicHtmlTextarea>` over to use plain `textarea`, the only uses were in settings modals that have been replaced in AdminX
- cleaned up unused editor CSS
2023-10-12 13:17:39 +01:00
renovate[bot]
7764a73e11 Update dependency ember-cli-babel to v8.2.0 2023-10-11 08:36:43 +02:00
Daniel Lockyer
49dc6f8cdc Removed static conditional
- I actually wanted this to be a production-only check but forgot to
  change it before pushing
2023-10-06 13:46:17 +02:00
Daniel Lockyer
7a7d64b764 Removed unused variable 2023-10-06 13:46:17 +02:00
Daniel Lockyer
3e42d4b1be Implemented cachebuster for Admin-X Settings and Koenig-Lexical files
fixes https://github.com/TryGhost/DevOps/issues/86

- this will now hash the files and append a cachebuster, so we never
  serve stale files again
2023-10-06 10:41:37 +02:00
Daniel Lockyer
639be25f1d Updated Koenig-Lexical bundling
refs https://github.com/TryGhost/DevOps/issues/83

- this will now continue use the dev server assets if we tell it to,
  or copy the dependency package files to the built folder otherwise
- removes `editor` from config API because it's no longer needed
- removes dependency on `editor.url` in tests, as this no longer exists
- edits dev script to pass dev server URL as env var
- adds `@tryghost/koenig-lexical` dependency to Admin
2023-10-04 12:50:21 +02:00
Daniel Lockyer
2d1eddcb51 Removed relative path link
- this helps maintainability in the future because Admin doesn't need to
  care where Core is, as we just resolve to the path where the `ghost`
  package is
2023-10-02 21:36:33 +02:00
renovate[bot]
f87e3317f2 Update dependency ember-cli-babel to v8.1.0 2023-10-02 08:52:09 +02:00
renovate[bot]
aa8fa94b20 Update dependency ember-cli-babel to v8.0.1 2023-09-27 09:36:15 +02:00
Sag
a04c691fa0
Added recommendations as suggestions to the Button, Header, Email CTA cards (#18293)
closes https://github.com/TryGhost/Product/issues/3933
2023-09-22 09:58:44 +00:00
Daniel Lockyer
5e466a90be Removed libs/ from Admin-X-Settings file path
refs https://github.com/TryGhost/DevOps/issues/80

- this makes the URL a little cleaner by removing a superfluous folder
2023-09-19 13:42:57 +02:00
Daniel Lockyer
4c8458ef78 Fixed Admin-X path variable
refs https://github.com/TryGhost/DevOps/issues/80

- I'd previously used the wrong one
2023-09-19 11:58:53 +02:00
Daniel Lockyer
f705dda314 Updated Admin-X bundling process
refs https://github.com/TryGhost/DevOps/issues/80

- as part of moving Admin-X-Setting towards GA, we want to change it from
  loading the settings externally via a CDN, to bundling it in with
  Admin
- the bulk of the changes here are removing the config in Ghost, setting
  up the copy to the Admin assets dir, and loading the new path in Admin
- several other changes have come along the way as I've cleaned up
  unneeded code
2023-09-19 11:31:55 +02:00
renovate[bot]
a2d16ab7de Update dependency ember-cli-babel to v8 2023-08-31 17:46:50 +02:00
Sanne de Vries
c3a7e43286
Updated old Spirit class to stop overriding of Tailwind in editor (#17874)
No ref
2023-08-30 14:41:49 +00:00
Sag
02f4f11e7c
Reverted Offer links to absolute URLs (#17675)
refs https://github.com/TryGhost/Product/issues/3687

- We're not sure that relative URLs for Offers will work in production,
even though they seem to work locally. Reverting for now.
2023-08-10 12:14:11 +00:00
Sag
731773602c
Added relative URLs for Portal links in Button, Header, Email CTA url suggestions (#17669)
refs https://github.com/TryGhost/Product/issues/3687

- Today, in Button, Header, Email CTA cards, Portal links are used as
absolute URLs to the root, e.g. https://mysite.com/#/portal/signin. When
clicking on a Portal link, the reader is redirect to the homepage first,
loosing context of the post.
- With this change, the UX becomes smoother: clicking on a Portal link
keeps the reader in context, and open the Portal link on the same post
e.g., https://mysite.com/POST_URL/#/portal/signin
- Technically, this works by using relative URLs for Portal links.
Relative URLs work out of the box for web, but required changes on the
email side, cf. https://github.com/TryGhost/Ghost/pull/17630
2023-08-10 09:23:31 +00:00
Djordje Vlaisavljevic
df231b2459
Tips & donations feedback tweaks (#17633)
refs https://github.com/TryGhost/Product/issues/3666,
https://github.com/TryGhost/Product/issues/3667

- Updated copy in various places
- Added logic for displaying "Connect Stripe" button instead of "Expand"
if not already connected
2023-08-08 14:49:58 +01:00
Sag
9aef028c4c
Renamed Tips & Donations suggestion links (#17618)
refs https://github.com/TryGhost/Product/issues/3665
2023-08-07 17:04:26 +00:00
Sag
3254b8e149
Added Tips & Donations link to Button, Header and Email CTA cards suggestions (#17614)
closes https://github.com/TryGhost/Product/issues/3665

- added link suggestion feature to the Header card in Mobiledoc (missing
feature)
- Tips & Donations link is behind a feature flag atm, to be cleaned up
once the feature is ready to be released
2023-08-07 15:16:29 +00:00
Sanne de Vries
08fc96a077 Refined signup card frontend styles
Refs https://github.com/TryGhost/Team/issues/3246
2023-05-29 12:28:27 +02:00
Kevin Ansfield
2598097b36
Added lexical conversion when copying from mobiledoc
closes https://github.com/TryGhost/Team/issues/3311

- added event handler to the mobiledoc editor for cut and copy operations that reads mobiledoc from the event data, converts to lexical using `@tryghost/kg-converters` and stores the converted data on the event under the `application/x-lexical-editor` mimetype ready to be pasted into a lexical editor
2023-05-25 13:50:47 +01:00
Kevin Ansfield
365a143c64
Added paste support to mobiledoc when copying from lexical
refs https://github.com/TryGhost/Team/issues/3199

- when content is copied from the Lexical editor the converted mobiledoc post is placed in the clipboardData's `application/x-mobiledoc-editor` mimetype
- added custom paste handling to extract that data and place it into the html content in the same format as a typical mobiledoc copy/paste so that it can then be handled internally by mobiledoc
2023-05-25 13:50:44 +01:00
Chris Raible
27e4523aec
🐛 Improved error message for unauthorized YouTube embeds (#16374)
refs TryGhost/Ghost#16048

- When attempting to embed a Youtube video that has had embedding
disabled by its owner/author, Ghost displayed a generic error message
that didn't indicate the reason for the failed emebed.
- This change updated the error message when Youtube (or any provider)
returns 401: Unauthorized to indicate that the owner of the resource has
explicitly disabled embedding.
2023-05-04 16:04:58 -07:00
Kevin Ansfield
11cab899f0
🐛 Fixed images sometimes being stored as data: URLs when copy/pasting from other editors (#16707)
refs https://github.com/TryGhost/Team/issues/2887

Images could sometimes be pasted into the editor (noticed especially with Google Docs) with `data:` URLs rather than typical `https:` URLs. That causes problems because data URLs are large binary blobs that get stored in the `posts` table and passed through many areas of the system that doesn't expect large binary blobs, causing knock-on effects.

- added handling to our editor's image card to detect when the card is displayed in the editor with a `data:` URL and if it was then it converts it to a file and uploads it so the image can be stored and displayed the same way as any other image
 - handles uploads on both paste and opening a post in the editor that was previously saved with a `data:` URL
2023-04-25 15:58:07 +01:00
Simon Backx
ed1ae60bec
Fixed pasting links in koenig basic html input (#16584)
refs https://github.com/TryGhost/Team/issues/2680

When selecting a portion of text in KoenigBasicHtmlInput (caption input
for images, newsletter footer text input, new signup notice), and then
pasting a link, some funky things happen:
- Part of the text disappears
- The wrong part of the text is linked

The cause of this is that `KoenigBasicHtmlInput` deletes the selected
text range when pasting, even when pasting a link. so moving that part
below the code that detected a valid link, fixes the issue.

This also adds an option to not close an old style modal when pressing
the enter key (e.g. pressing enter when entering a link causes the modal
to close).
2023-04-07 11:19:37 +02:00
Chris Raible
8d4028bbb7
🐛 Fixed editor crashing with unknown cards in mobiledoc (#16430)
refs TryGhost/Team#2702

- adds a default handler for unknown cards: 
- logs a warning message to the console 
- removes the card from the mobiledoc
2023-03-16 16:06:56 -07:00
Ronald Langeveld
4407e8e49e
🐛 Added undefined error handling to failed uploads (#15982)
fixes https://github.com/TryGhost/Team/issues/2320

- Adds error handling when undefined objects are passed to certain upload
functions such as `videoUploadCompleted`.
2023-03-01 16:50:56 +08:00
Steve Larson
fe7253da1e
removed before after card (#16341)
refs TryGhost/Team#2405
-removed koenig before after card
-removed labs setting
-will rebuild in lexical if we want it in the future
2023-02-27 14:18:48 -06:00
Kevin Ansfield
5f5ae79897
Fixed template lint error
refs 7f1e970a0b

- `koenig-card-callout.hbs` was touched without fixing the lint errors or updating to todo list causing the lint todos to become out of sync
- fixed the lint error and updated the todo list
2023-02-02 13:12:03 +00:00
Tihomir Valkanov
7f1e970a0b
🐛 Fixed emoji causing page jump in safari (#16026)
fixes: https://github.com/TryGhost/Ghost/issues/15295

- By design Safari [does not support focus on a button
element](https://bugs.webkit.org/show_bug.cgi?id=22261). We have to keep
the focus somehow otherwise we cause page jump in Safari when changing
the emoji. Tabindex -1 is a good choice because it does not mess with a
tab sequence if we have one.
2023-02-02 12:59:24 +00:00
Kevin Ansfield
7e98f1b9f4 Fixed editor cards being accessible when their availability checks failed
no issue

Using the slash menu it was possible to insert cards that shouldn't have been accessible based on their availability checks. This was happening because we were only hiding the visibility of the cards in the template rather than completely removing them from the slash command matching logic.

- added `{{card-menu-items}}` helper that combines the availability matching and snippet section addition to return a complete array of sections+items that match the current system state and post type
- added `@menuItems` argument set to the output of `{{card-menu-items}}` to the two card menu components so they are working against a pre-filtered list of menu items
  - lets us remove duplication of code that handled pushing snippets section into the menus
- removed availability check conditionals from `<KoenigMenuContent>` as the menu items passed in are now pre-filtered
2023-01-19 12:38:49 +00:00
Sanne de Vries
f5d03409c9 Fixed video card thumbnail error message incorrectly shown
No ref
2023-01-18 15:17:16 +01:00
Sanne de Vries
1645f551bc Fixed error message display bug in video card
No ref
2023-01-13 09:56:36 +01:00
Kevin Ansfield
ea9c8c03fe
Update dependency ember-template-lint to v5.3.0 (#16062)
refs https://github.com/TryGhost/Ghost/pull/15550

Pulled out of the rolled up node+ember-js+ember-template rollup linter update PR as it required fairly extensive changes.

- bumped package
- renamed `no-down-event-binding` to `no-pointer-down-event-binding`
- disabled `no-pointer-down-event-binding` rule
- disabled `no-triple-curlies` rule
- ran `yarn lint:hbs --fix`
- updated integration tests to match Octane syntax
- fixed various one-off errors
- updated .lint-todo
2023-01-04 09:39:32 +00:00
Kevin Ansfield
b402b1643e Prevented throwing errors unnecessarily in editor plus menu and link toolbar
closes sentry Admin-423

- there may be times when the mousemove event handler fires when the document is not in a ready state resulting in an attempt to get a document position that doesn't exist
- should fix `Could not find parent section from element node` errors
2022-12-14 11:57:54 +00:00
Sanne de Vries
9b819698e8 Fixed title attributes on headings in editor toolbar
No ref
2022-12-09 10:10:34 +07:00
Kevin Ansfield
d4ea9c877d Fixed editor key commands throwing errors when range has no section
closes Sentry ADMIN-CC8
closes Sentry ADMIN-DDM
closes Sentry ADMIN-C9F

- there are situations where the editor range when key commands are triggered does not have a head section which then throws errors due to the commands assuming there will always be a section present
- added a guard to key commands that use the head section to abort early and fall back to default Mobiledoc behaviour when the section is missing
2022-11-25 08:56:38 +00:00
Kevin Ansfield
ef71d52ec0 Fixed Cannot read properties of null (reading 'offsetHeight') errors in markdown card
closes sentry ADMIN-CAV

- the mobile nav element is not always displayed so we should assume we can read it's `offsetHeight` property
2022-11-24 12:52:16 +00:00
Kevin Ansfield
3a9209b6a8 Fixed some minor formatting issues
no issue

- indented conditional template code
- grouped tracked properties together
2022-11-22 13:15:08 +00:00
Kevin Ansfield
f25cc00236 Fixed product card throwing "Cannot read properties of undefined (reading 'url')" errors
closes https://github.com/TryGhost/Team/issues/2295

Problem:
- `<GhUploader>` is not yet converted to an Octane component so it's arguments are not read-only
- when a file is selected it sets it's `files` property which in turn updates the tracked `files` property that was passed in, and then again updates it to an empty file list when the input field is cleared
- that tracked property was never cleared once the product image was uploaded resulting in a "re-upload" attempt with an empty file list every time the product card was put back into edit mode

Fix:
- added a guard in `<GhUploader>` so it doesn't try to upload an empty file list if one is passed in as an attribute
- added a reset of the tracked `files` property in the product card once the image upload is complete
2022-11-22 13:13:42 +00:00
Kevin Ansfield
9bdb25d184
Fixed hosting management screen not loading after sign-in process (#15763)
refs https://github.com/TryGhost/Team/issues/2110

- dynamically defined properties on the config service did not have
autotracking set up properly if they were accessed in any way before the
property was defined, this caused problems in a number of areas because
we have both "unauthed" and "authed" sets of config and when not logged
in we had parts of the app checking for authed config properties that
don't exist until after sign-in and subsequent config re-fetch
- renamed `config` service to `configManager` and updated to only
contain methods for fetching config data
- added a `config` instance initializer that sets up a `TrackedObject`
instance with some custom properties/methods and registers it on
`config:main`
- uses application instance initializer rather than a standard
initializer because standard initializers are only called once when
setting up the test suite so we'd end up with config leaking across
tests
- added an `@inject` decorator that when used takes the property name
and injects whatever is registered at `${propertyName}:main`, this
allows us to use dependency injection for any object rather than just
services or controllers
- using `application.inject()` in the initializer was initially used but
that only works for objects that extend from `EmberObject`, the
injections weren't available in native-class glimmer components so this
decorator keeps the injection syntax consistent
  - swapped all `@service config` uses to `@inject config`
2022-11-03 11:14:36 +00:00
Kevin Ansfield
7b443d4b63 Removed need for .get() with config service
no issue

The `config` service has been a source of confusion when writing with modern Ember patterns because it's use of the deprecated `ProxyMixin` forced all property access/setting to go via `.get()` and `.set()` whereas the rest of the system has mostly (there are a few other uses of ProxyObjects remaining) eliminated the use of the non-native get/set methods.

- removed use of `ProxyMixin` in the `config` service by grabbing the API response after fetching and using `Object.defineProperty()` to add native getters/setters that pass through to a tracked object holding the API response data. Ember's autotracking automatically works across the native getters/setters so we can then use the service as if it was any other native object
- updated all code to use `config.{attrName}` directly for getting/setting instead of `.get()` and `.set()`
- removed unnecessary async around `config.availableTimezones` which wasn't making any async calls
2022-10-07 16:14:57 +01:00