emdash 0.7.0 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{adapters-Di31kZ28.d.mts → adapters-DoNJiveC.d.mts} +1 -1
- package/dist/{adapters-Di31kZ28.d.mts.map → adapters-DoNJiveC.d.mts.map} +1 -1
- package/dist/{apply-5uslYdUu.mjs → apply-BzltprvY.mjs} +90 -139
- package/dist/apply-BzltprvY.mjs.map +1 -0
- package/dist/astro/index.d.mts +6 -6
- package/dist/astro/index.d.mts.map +1 -1
- package/dist/astro/index.mjs +194 -17
- package/dist/astro/index.mjs.map +1 -1
- package/dist/astro/middleware/auth.d.mts +6 -7
- package/dist/astro/middleware/auth.d.mts.map +1 -1
- package/dist/astro/middleware/auth.mjs +34 -57
- package/dist/astro/middleware/auth.mjs.map +1 -1
- package/dist/astro/middleware/redirect.d.mts.map +1 -1
- package/dist/astro/middleware/redirect.mjs +17 -12
- package/dist/astro/middleware/redirect.mjs.map +1 -1
- package/dist/astro/middleware/request-context.d.mts.map +1 -1
- package/dist/astro/middleware/request-context.mjs +9 -6
- package/dist/astro/middleware/request-context.mjs.map +1 -1
- package/dist/astro/middleware/setup.mjs +1 -1
- package/dist/astro/middleware.d.mts.map +1 -1
- package/dist/astro/middleware.mjs +301 -165
- package/dist/astro/middleware.mjs.map +1 -1
- package/dist/astro/types.d.mts +34 -10
- package/dist/astro/types.d.mts.map +1 -1
- package/dist/{base64-MBPo9ozB.mjs → base64-BRICGH2l.mjs} +1 -1
- package/dist/{base64-MBPo9ozB.mjs.map → base64-BRICGH2l.mjs.map} +1 -1
- package/dist/{byline-C4OVd8b3.mjs → byline-BSaNL1w7.mjs} +5 -5
- package/dist/byline-BSaNL1w7.mjs.map +1 -0
- package/dist/bylines-CvJ3PYz2.mjs +113 -0
- package/dist/bylines-CvJ3PYz2.mjs.map +1 -0
- package/dist/cache-C6N_hhN7.mjs +65 -0
- package/dist/cache-C6N_hhN7.mjs.map +1 -0
- package/dist/{chunks-HGz06Soa.mjs → chunks-NBQVDOci.mjs} +8 -2
- package/dist/{chunks-HGz06Soa.mjs.map → chunks-NBQVDOci.mjs.map} +1 -1
- package/dist/cli/index.mjs +229 -31
- package/dist/cli/index.mjs.map +1 -1
- package/dist/client/cf-access.d.mts +1 -1
- package/dist/client/index.d.mts +1 -1
- package/dist/client/index.mjs +3 -3
- package/dist/client/index.mjs.map +1 -1
- package/dist/{config-BXwuX8Bx.mjs → config-BI0V3ICQ.mjs} +1 -1
- package/dist/{config-BXwuX8Bx.mjs.map → config-BI0V3ICQ.mjs.map} +1 -1
- package/dist/{content-D7J5y73J.mjs → content-8lOYF0pr.mjs} +43 -28
- package/dist/content-8lOYF0pr.mjs.map +1 -0
- package/dist/db/index.d.mts +3 -3
- package/dist/db/index.mjs +2 -2
- package/dist/db/libsql.d.mts +1 -1
- package/dist/db/libsql.d.mts.map +1 -1
- package/dist/db/libsql.mjs +7 -2
- package/dist/db/libsql.mjs.map +1 -1
- package/dist/db/postgres.d.mts +1 -1
- package/dist/db/sqlite.d.mts +1 -1
- package/dist/db/sqlite.d.mts.map +1 -1
- package/dist/db/sqlite.mjs +8 -3
- package/dist/db/sqlite.mjs.map +1 -1
- package/dist/{db-errors-D0UT85nC.mjs → db-errors-WRezodiz.mjs} +1 -1
- package/dist/{db-errors-D0UT85nC.mjs.map → db-errors-WRezodiz.mjs.map} +1 -1
- package/dist/{default-CME5YdZ3.mjs → default-D8ksjWhO.mjs} +1 -1
- package/dist/{default-CME5YdZ3.mjs.map → default-D8ksjWhO.mjs.map} +1 -1
- package/dist/{dialect-helpers-DhTzaUxP.mjs → dialect-helpers-BKCvISIQ.mjs} +19 -2
- package/dist/dialect-helpers-BKCvISIQ.mjs.map +1 -0
- package/dist/{error-CiYn9yDu.mjs → error-D_-tqP-I.mjs} +1 -1
- package/dist/error-D_-tqP-I.mjs.map +1 -0
- package/dist/{index-De6_Xv3v.d.mts → index-BFRaVcD6.d.mts} +243 -40
- package/dist/index-BFRaVcD6.d.mts.map +1 -0
- package/dist/index.d.mts +11 -11
- package/dist/index.mjs +29 -25
- package/dist/{load-CBcmDIot.mjs → load-DDqMMvZL.mjs} +2 -2
- package/dist/{load-CBcmDIot.mjs.map → load-DDqMMvZL.mjs.map} +1 -1
- package/dist/{loader-DeiBJEMe.mjs → loader-CKLbBnhK.mjs} +32 -10
- package/dist/loader-CKLbBnhK.mjs.map +1 -0
- package/dist/{manifest-schema-V30qsMft.mjs → manifest-schema-DqWNC3lM.mjs} +45 -3
- package/dist/manifest-schema-DqWNC3lM.mjs.map +1 -0
- package/dist/media/index.d.mts +1 -1
- package/dist/media/index.mjs +1 -1
- package/dist/media/local-runtime.d.mts +7 -7
- package/dist/media/local-runtime.mjs +3 -3
- package/dist/{media-DqHVh136.mjs → media-BW32b4gi.mjs} +4 -7
- package/dist/media-BW32b4gi.mjs.map +1 -0
- package/dist/{mode-CpNnGkPz.mjs → mode-ier8jbBk.mjs} +1 -1
- package/dist/mode-ier8jbBk.mjs.map +1 -0
- package/dist/options-BVp3UsTS.mjs +117 -0
- package/dist/options-BVp3UsTS.mjs.map +1 -0
- package/dist/page/index.d.mts +2 -2
- package/dist/{placeholder-tzpqGWII.d.mts → placeholder-BE4o_2dc.d.mts} +1 -1
- package/dist/{placeholder-tzpqGWII.d.mts.map → placeholder-BE4o_2dc.d.mts.map} +1 -1
- package/dist/{placeholder-C-fk5hYI.mjs → placeholder-CIJejMlK.mjs} +1 -1
- package/dist/placeholder-CIJejMlK.mjs.map +1 -0
- package/dist/plugins/adapt-sandbox-entry.d.mts +5 -5
- package/dist/plugins/adapt-sandbox-entry.d.mts.map +1 -1
- package/dist/plugins/adapt-sandbox-entry.mjs +6 -5
- package/dist/plugins/adapt-sandbox-entry.mjs.map +1 -1
- package/dist/public-url-DByxYjUw.mjs +51 -0
- package/dist/public-url-DByxYjUw.mjs.map +1 -0
- package/dist/{query-g4Ug-9j9.mjs → query-Cg9ZKRQ0.mjs} +114 -16
- package/dist/query-Cg9ZKRQ0.mjs.map +1 -0
- package/dist/{redirect-CN0Rt9Ob.mjs → redirect-BhUBKRc1.mjs} +13 -8
- package/dist/redirect-BhUBKRc1.mjs.map +1 -0
- package/dist/{registry-Ci3WxVAr.mjs → registry-Dw70ChxB.mjs} +69 -11
- package/dist/registry-Dw70ChxB.mjs.map +1 -0
- package/dist/{request-cache-DiR961CV.mjs → request-cache-B-bmkipQ.mjs} +1 -1
- package/dist/request-cache-B-bmkipQ.mjs.map +1 -0
- package/dist/runner-Bnoj7vjK.d.mts +44 -0
- package/dist/runner-Bnoj7vjK.d.mts.map +1 -0
- package/dist/{runner-tQ7BJ4T7.mjs → runner-C7ADox5q.mjs} +185 -55
- package/dist/{runner-tQ7BJ4T7.mjs.map → runner-C7ADox5q.mjs.map} +1 -1
- package/dist/runtime.d.mts +6 -6
- package/dist/runtime.mjs +4 -4
- package/dist/{search-B0effn3j.mjs → search-dOGEccMa.mjs} +341 -152
- package/dist/search-dOGEccMa.mjs.map +1 -0
- package/dist/secrets-CW3reAnU.mjs +314 -0
- package/dist/secrets-CW3reAnU.mjs.map +1 -0
- package/dist/seed/index.d.mts +2 -2
- package/dist/seed/index.mjs +15 -14
- package/dist/seo/index.d.mts +1 -1
- package/dist/storage/local.d.mts +1 -1
- package/dist/storage/local.mjs +1 -1
- package/dist/storage/s3.d.mts +1 -1
- package/dist/storage/s3.d.mts.map +1 -1
- package/dist/storage/s3.mjs +4 -4
- package/dist/storage/s3.mjs.map +1 -1
- package/dist/{taxonomies-K2z0Uhnj.mjs → taxonomies-ZlRtD6AG.mjs} +14 -7
- package/dist/taxonomies-ZlRtD6AG.mjs.map +1 -0
- package/dist/{tokens-BFPFx3CA.mjs → tokens-D7zMmWi2.mjs} +2 -2
- package/dist/{tokens-BFPFx3CA.mjs.map → tokens-D7zMmWi2.mjs.map} +1 -1
- package/dist/{transport-BykRfpyy.mjs → transport-BeMCmin1.mjs} +6 -5
- package/dist/{transport-BykRfpyy.mjs.map → transport-BeMCmin1.mjs.map} +1 -1
- package/dist/{transport-H4Iwx7tC.d.mts → transport-DNEfeMaU.d.mts} +1 -1
- package/dist/{transport-H4Iwx7tC.d.mts.map → transport-DNEfeMaU.d.mts.map} +1 -1
- package/dist/types-4fVtCIm0.mjs +68 -0
- package/dist/types-4fVtCIm0.mjs.map +1 -0
- package/dist/{types-CnZYHyLW.d.mts → types-BSyXeCFW.d.mts} +24 -2
- package/dist/{types-CnZYHyLW.d.mts.map → types-BSyXeCFW.d.mts.map} +1 -1
- package/dist/{types-DgrIP0tF.d.mts → types-BuBIptGk.d.mts} +80 -106
- package/dist/types-BuBIptGk.d.mts.map +1 -0
- package/dist/{types-BH2L167P.mjs → types-CDbKp7ND.mjs} +1 -1
- package/dist/{types-BH2L167P.mjs.map → types-CDbKp7ND.mjs.map} +1 -1
- package/dist/{types-DDS4MxsT.mjs → types-CIOg5AR8.mjs} +1 -1
- package/dist/{types-DDS4MxsT.mjs.map → types-CIOg5AR8.mjs.map} +1 -1
- package/dist/{types-6CUZRrZP.d.mts → types-CJsYGpco.d.mts} +24 -2
- package/dist/{types-6CUZRrZP.d.mts.map → types-CJsYGpco.d.mts.map} +1 -1
- package/dist/types-CRxNbK-Z.mjs +68 -0
- package/dist/types-CRxNbK-Z.mjs.map +1 -0
- package/dist/{types-C2v0c34j.d.mts → types-CrtWgIvl.d.mts} +1 -1
- package/dist/{types-C2v0c34j.d.mts.map → types-CrtWgIvl.d.mts.map} +1 -1
- package/dist/{types-CFWjXmus.d.mts → types-M78DQ1lx.d.mts} +1 -1
- package/dist/{types-CFWjXmus.d.mts.map → types-M78DQ1lx.d.mts.map} +1 -1
- package/dist/{validate-CqsNItbt.mjs → validate-Baqf0slj.mjs} +3 -3
- package/dist/{validate-CqsNItbt.mjs.map → validate-Baqf0slj.mjs.map} +1 -1
- package/dist/{validate-kM8Pjuf7.d.mts → validate-BfQh_C_y.d.mts} +4 -4
- package/dist/{validate-kM8Pjuf7.d.mts.map → validate-BfQh_C_y.d.mts.map} +1 -1
- package/dist/validation-BfEI7tNe.mjs +144 -0
- package/dist/validation-BfEI7tNe.mjs.map +1 -0
- package/dist/version-DoxrVdYf.mjs +7 -0
- package/dist/{version-BnTKdfam.mjs.map → version-DoxrVdYf.mjs.map} +1 -1
- package/dist/zod-generator-CC0xNe_K.mjs +132 -0
- package/dist/zod-generator-CC0xNe_K.mjs.map +1 -0
- package/locals.d.ts +1 -6
- package/package.json +21 -7
- package/src/api/auth-storage.ts +37 -0
- package/src/api/error.ts +6 -0
- package/src/api/errors.ts +8 -0
- package/src/api/handlers/comments.ts +19 -4
- package/src/api/handlers/content.ts +151 -4
- package/src/api/handlers/device-flow.ts +5 -0
- package/src/api/handlers/index.ts +2 -0
- package/src/api/handlers/marketplace.ts +11 -4
- package/src/api/handlers/media.ts +8 -1
- package/src/api/handlers/menus.ts +160 -21
- package/src/api/handlers/oauth-authorization.ts +72 -33
- package/src/api/handlers/redirects.ts +16 -3
- package/src/api/handlers/revision.ts +23 -14
- package/src/api/handlers/sections.ts +8 -1
- package/src/api/handlers/taxonomies.ts +131 -22
- package/src/api/handlers/validation.ts +212 -0
- package/src/api/openapi/document.ts +4 -1
- package/src/api/public-url.ts +54 -5
- package/src/api/route-utils.ts +14 -0
- package/src/api/schemas/comments.ts +2 -2
- package/src/api/schemas/common.ts +1 -1
- package/src/api/schemas/content.ts +17 -0
- package/src/api/schemas/sections.ts +3 -3
- package/src/api/schemas/setup.ts +8 -0
- package/src/api/schemas/users.ts +1 -1
- package/src/api/schemas/widgets.ts +12 -10
- package/src/api/setup-complete.ts +40 -0
- package/src/api/types.ts +5 -1
- package/src/astro/integration/index.ts +30 -2
- package/src/astro/integration/routes.ts +28 -0
- package/src/astro/integration/runtime.ts +49 -1
- package/src/astro/integration/virtual-modules.ts +73 -2
- package/src/astro/integration/vite-config.ts +49 -13
- package/src/astro/middleware/auth.ts +34 -6
- package/src/astro/middleware/redirect.ts +29 -16
- package/src/astro/middleware/request-context.ts +15 -5
- package/src/astro/middleware.ts +41 -10
- package/src/astro/routes/PluginRegistry.tsx +10 -1
- package/src/astro/routes/api/auth/invite/complete.ts +6 -1
- package/src/astro/routes/api/auth/mode.ts +57 -0
- package/src/astro/routes/api/auth/oauth/[provider]/callback.ts +23 -3
- package/src/astro/routes/api/auth/oauth/[provider].ts +10 -4
- package/src/astro/routes/api/auth/passkey/register/verify.ts +6 -1
- package/src/astro/routes/api/auth/passkey/verify.ts +6 -1
- package/src/astro/routes/api/auth/signup/complete.ts +6 -1
- package/src/astro/routes/api/comments/[collection]/[contentId]/index.ts +2 -2
- package/src/astro/routes/api/content/[collection]/[id]/discard-draft.ts +4 -2
- package/src/astro/routes/api/content/[collection]/[id]/preview-url.ts +34 -12
- package/src/astro/routes/api/content/[collection]/[id]/publish.ts +32 -2
- package/src/astro/routes/api/content/[collection]/[id]/restore.ts +4 -2
- package/src/astro/routes/api/content/[collection]/[id]/revisions.ts +3 -2
- package/src/astro/routes/api/content/[collection]/[id]/terms/[taxonomy].ts +8 -4
- package/src/astro/routes/api/content/[collection]/[id]/translations.ts +1 -1
- package/src/astro/routes/api/content/[collection]/[id].ts +12 -0
- package/src/astro/routes/api/content/[collection]/index.ts +1 -9
- package/src/astro/routes/api/import/wordpress/execute.ts +3 -1
- package/src/astro/routes/api/import/wordpress/media.ts +2 -7
- package/src/astro/routes/api/import/wordpress/prepare.ts +9 -0
- package/src/astro/routes/api/import/wordpress-plugin/execute.ts +3 -1
- package/src/astro/routes/api/manifest.ts +62 -45
- package/src/astro/routes/api/media/[id]/confirm.ts +10 -1
- package/src/astro/routes/api/media/providers/[providerId]/index.ts +12 -3
- package/src/astro/routes/api/openapi.json.ts +27 -10
- package/src/astro/routes/api/redirects/404s/index.ts +10 -4
- package/src/astro/routes/api/redirects/404s/summary.ts +4 -2
- package/src/astro/routes/api/redirects/[id].ts +10 -4
- package/src/astro/routes/api/redirects/index.ts +7 -3
- package/src/astro/routes/api/revisions/[revisionId]/index.ts +1 -1
- package/src/astro/routes/api/schema/collections/[slug]/fields/[fieldSlug].ts +0 -2
- package/src/astro/routes/api/schema/collections/[slug]/fields/index.ts +0 -1
- package/src/astro/routes/api/schema/collections/[slug]/fields/reorder.ts +0 -1
- package/src/astro/routes/api/schema/collections/[slug]/index.ts +2 -2
- package/src/astro/routes/api/schema/collections/index.ts +1 -1
- package/src/astro/routes/api/search/index.ts +10 -2
- package/src/astro/routes/api/sections/[slug].ts +10 -4
- package/src/astro/routes/api/sections/index.ts +7 -3
- package/src/astro/routes/api/settings/email.ts +4 -9
- package/src/astro/routes/api/setup/admin-verify.ts +6 -1
- package/src/astro/routes/api/setup/admin.ts +8 -2
- package/src/astro/routes/api/setup/index.ts +2 -2
- package/src/astro/routes/api/setup/status.ts +3 -1
- package/src/astro/routes/api/snapshot.ts +44 -18
- package/src/astro/routes/api/taxonomies/index.ts +0 -1
- package/src/astro/routes/api/themes/preview.ts +11 -5
- package/src/astro/routes/api/widget-areas/[name]/widgets/[id].ts +4 -1
- package/src/astro/routes/api/widget-areas/[name]/widgets.ts +4 -1
- package/src/astro/routes/api/widget-areas/[name].ts +4 -1
- package/src/astro/routes/api/widget-areas/index.ts +4 -1
- package/src/astro/types.ts +32 -3
- package/src/auth/allowed-origins.ts +168 -0
- package/src/auth/mode.ts +15 -3
- package/src/auth/passkey-config.ts +35 -13
- package/src/auth/providers/github-admin.tsx +29 -0
- package/src/auth/providers/github.ts +31 -0
- package/src/auth/providers/google-admin.tsx +44 -0
- package/src/auth/providers/google.ts +31 -0
- package/src/auth/types.ts +114 -4
- package/src/bylines/index.ts +37 -88
- package/src/cli/commands/auth.ts +28 -6
- package/src/cli/commands/bundle-utils.ts +11 -2
- package/src/cli/commands/bundle.ts +31 -9
- package/src/cli/commands/content.ts +13 -0
- package/src/cli/commands/login.ts +8 -1
- package/src/cli/commands/publish.ts +24 -0
- package/src/cli/commands/secrets.ts +183 -0
- package/src/cli/credentials.ts +1 -1
- package/src/cli/index.ts +5 -1
- package/src/client/index.ts +4 -4
- package/src/client/transport.ts +17 -7
- package/src/components/Break.astro +2 -2
- package/src/components/EmDashHead.astro +18 -13
- package/src/components/EmDashImage.astro +7 -6
- package/src/components/Embed.astro +1 -1
- package/src/components/Gallery.astro +6 -4
- package/src/components/Image.astro +9 -4
- package/src/components/InlinePortableTextEditor.tsx +106 -19
- package/src/components/LiveSearch.astro +5 -14
- package/src/config/secrets.ts +528 -0
- package/src/database/dialect-helpers.ts +50 -0
- package/src/database/migrations/034_published_at_index.ts +1 -1
- package/src/database/migrations/035_bounded_404_log.ts +56 -39
- package/src/database/migrations/runner.ts +156 -23
- package/src/database/repositories/audit.ts +6 -8
- package/src/database/repositories/byline.ts +6 -8
- package/src/database/repositories/comment.ts +12 -16
- package/src/database/repositories/content.ts +76 -52
- package/src/database/repositories/index.ts +1 -1
- package/src/database/repositories/media.ts +10 -13
- package/src/database/repositories/plugin-storage.ts +4 -6
- package/src/database/repositories/redirect.ts +26 -19
- package/src/database/repositories/taxonomy.ts +40 -3
- package/src/database/repositories/types.ts +57 -8
- package/src/database/repositories/user.ts +6 -8
- package/src/db/libsql.ts +1 -3
- package/src/db/sqlite.ts +2 -5
- package/src/emdash-runtime.ts +388 -247
- package/src/index.ts +14 -1
- package/src/loader.ts +30 -6
- package/src/mcp/server.ts +781 -141
- package/src/media/normalize.ts +1 -1
- package/src/media/url.ts +78 -0
- package/src/page/site-identity.ts +58 -0
- package/src/plugins/adapt-sandbox-entry.ts +22 -10
- package/src/plugins/context.ts +13 -10
- package/src/plugins/define-plugin.ts +40 -12
- package/src/plugins/email-console.ts +10 -3
- package/src/plugins/hooks.ts +34 -19
- package/src/plugins/index.ts +9 -0
- package/src/plugins/manifest-schema.ts +49 -2
- package/src/plugins/types.ts +174 -13
- package/src/preview/urls.ts +23 -3
- package/src/query.ts +149 -6
- package/src/redirects/cache.ts +38 -18
- package/src/request-cache.ts +3 -0
- package/src/schema/registry.ts +97 -5
- package/src/schema/zod-generator.ts +27 -5
- package/src/search/fts-manager.ts +0 -2
- package/src/search/query.ts +111 -26
- package/src/search/types.ts +8 -1
- package/src/sections/index.ts +7 -9
- package/src/seed/apply.ts +2 -0
- package/src/settings/index.ts +80 -6
- package/src/settings/types.ts +23 -1
- package/src/storage/s3.ts +12 -6
- package/src/taxonomies/index.ts +11 -1
- package/src/virtual-modules.d.ts +21 -1
- package/src/widgets/index.ts +1 -1
- package/dist/apply-5uslYdUu.mjs.map +0 -1
- package/dist/byline-C4OVd8b3.mjs.map +0 -1
- package/dist/bylines-hPTW79hw.mjs +0 -157
- package/dist/bylines-hPTW79hw.mjs.map +0 -1
- package/dist/cache-BkKBuIvS.mjs +0 -56
- package/dist/cache-BkKBuIvS.mjs.map +0 -1
- package/dist/chunk-ClPoSABd.mjs +0 -21
- package/dist/content-D7J5y73J.mjs.map +0 -1
- package/dist/dialect-helpers-DhTzaUxP.mjs.map +0 -1
- package/dist/error-CiYn9yDu.mjs.map +0 -1
- package/dist/index-De6_Xv3v.d.mts.map +0 -1
- package/dist/loader-DeiBJEMe.mjs.map +0 -1
- package/dist/manifest-schema-V30qsMft.mjs.map +0 -1
- package/dist/media-DqHVh136.mjs.map +0 -1
- package/dist/mode-CpNnGkPz.mjs.map +0 -1
- package/dist/placeholder-C-fk5hYI.mjs.map +0 -1
- package/dist/query-g4Ug-9j9.mjs.map +0 -1
- package/dist/redirect-CN0Rt9Ob.mjs.map +0 -1
- package/dist/registry-Ci3WxVAr.mjs.map +0 -1
- package/dist/request-cache-DiR961CV.mjs.map +0 -1
- package/dist/runner-BR2xKwhn.d.mts +0 -34
- package/dist/runner-BR2xKwhn.d.mts.map +0 -1
- package/dist/search-B0effn3j.mjs.map +0 -1
- package/dist/taxonomies-K2z0Uhnj.mjs.map +0 -1
- package/dist/types-CMMN0pNg.mjs +0 -31
- package/dist/types-CMMN0pNg.mjs.map +0 -1
- package/dist/types-DgrIP0tF.d.mts.map +0 -1
- package/dist/version-BnTKdfam.mjs +0 -7
package/src/cli/index.ts
CHANGED
|
@@ -11,7 +11,8 @@
|
|
|
11
11
|
* - dev: Run dev server with local D1
|
|
12
12
|
* - seed: Apply a seed file to the database
|
|
13
13
|
* - export-seed: Export database schema and content as a seed file
|
|
14
|
-
* -
|
|
14
|
+
* - secrets: Generate and inspect EmDash secrets (encryption keys, etc.)
|
|
15
|
+
* - auth: [DEPRECATED] Generate auth secret (use `secrets` instead)
|
|
15
16
|
* - login/logout/whoami: Session management
|
|
16
17
|
* - content: Create, read, update, delete content
|
|
17
18
|
* - schema: Manage collections and fields
|
|
@@ -36,6 +37,7 @@ import { menuCommand } from "./commands/menu.js";
|
|
|
36
37
|
import { pluginCommand } from "./commands/plugin.js";
|
|
37
38
|
import { schemaCommand } from "./commands/schema.js";
|
|
38
39
|
import { searchCommand } from "./commands/search-cmd.js";
|
|
40
|
+
import { secretsCommand } from "./commands/secrets.js";
|
|
39
41
|
import { seedCommand } from "./commands/seed.js";
|
|
40
42
|
import { taxonomyCommand } from "./commands/taxonomy.js";
|
|
41
43
|
import { typesCommand } from "./commands/types.js";
|
|
@@ -53,6 +55,8 @@ const main = defineCommand({
|
|
|
53
55
|
doctor: doctorCommand,
|
|
54
56
|
seed: seedCommand,
|
|
55
57
|
"export-seed": exportSeedCommand,
|
|
58
|
+
secrets: secretsCommand,
|
|
59
|
+
// Deprecated alias kept for backwards compat; will be removed in a future minor.
|
|
56
60
|
auth: authCommand,
|
|
57
61
|
login: loginCommand,
|
|
58
62
|
logout: logoutCommand,
|
package/src/client/index.ts
CHANGED
|
@@ -723,8 +723,8 @@ export class EmDashClient {
|
|
|
723
723
|
|
|
724
724
|
/** List taxonomies */
|
|
725
725
|
async taxonomies(): Promise<Taxonomy[]> {
|
|
726
|
-
const data = await this.request<{
|
|
727
|
-
return data.
|
|
726
|
+
const data = await this.request<{ taxonomies: Taxonomy[] }>("GET", "/taxonomies");
|
|
727
|
+
return data.taxonomies;
|
|
728
728
|
}
|
|
729
729
|
|
|
730
730
|
/** List terms in a taxonomy */
|
|
@@ -757,8 +757,8 @@ export class EmDashClient {
|
|
|
757
757
|
|
|
758
758
|
/** List menus */
|
|
759
759
|
async menus(): Promise<Menu[]> {
|
|
760
|
-
|
|
761
|
-
return
|
|
760
|
+
// Handler returns a bare array, not { items: [...] }
|
|
761
|
+
return this.request<Menu[]>("GET", "/menus");
|
|
762
762
|
}
|
|
763
763
|
|
|
764
764
|
/** Get a menu with its items */
|
package/src/client/transport.ts
CHANGED
|
@@ -155,24 +155,34 @@ export function refreshInterceptor(options: {
|
|
|
155
155
|
|
|
156
156
|
if (!res.ok) return null;
|
|
157
157
|
|
|
158
|
-
|
|
158
|
+
interface TokenFields {
|
|
159
159
|
access_token: string;
|
|
160
160
|
refresh_token?: string;
|
|
161
161
|
expires_in?: number;
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
const json = (await res.json()) as Record<string, unknown>;
|
|
165
|
+
|
|
166
|
+
// The token endpoint wraps the response in { data: ... } via apiSuccess.
|
|
167
|
+
// Handle both wrapped and bare shapes for robustness.
|
|
168
|
+
const tokenData: TokenFields =
|
|
169
|
+
json.data && typeof json.data === "object" && "access_token" in json.data
|
|
170
|
+
? (json.data as TokenFields)
|
|
171
|
+
: (json as unknown as TokenFields);
|
|
172
|
+
|
|
173
|
+
const expiresAt = tokenData.expires_in
|
|
174
|
+
? new Date(Date.now() + tokenData.expires_in * 1000).toISOString()
|
|
165
175
|
: new Date(Date.now() + 3600_000).toISOString();
|
|
166
176
|
|
|
167
177
|
if (options.onTokenRefreshed) {
|
|
168
178
|
options.onTokenRefreshed(
|
|
169
|
-
|
|
170
|
-
|
|
179
|
+
tokenData.access_token,
|
|
180
|
+
tokenData.refresh_token ?? options.refreshToken,
|
|
171
181
|
expiresAt,
|
|
172
182
|
);
|
|
173
183
|
}
|
|
174
184
|
|
|
175
|
-
return
|
|
185
|
+
return tokenData.access_token;
|
|
176
186
|
}
|
|
177
187
|
|
|
178
188
|
return async (request, next) => {
|
|
@@ -32,11 +32,11 @@ const style = node?.style || "line";
|
|
|
32
32
|
}
|
|
33
33
|
.emdash-break-line {
|
|
34
34
|
border: none;
|
|
35
|
-
border-top: 1px solid #e0e0e0;
|
|
35
|
+
border-top: 1px solid var(--emdash-break-color, var(--color-border, #e0e0e0));
|
|
36
36
|
}
|
|
37
37
|
.emdash-break-dots {
|
|
38
38
|
text-align: center;
|
|
39
|
-
color: #999;
|
|
39
|
+
color: var(--emdash-break-dots-color, var(--color-muted, #999));
|
|
40
40
|
letter-spacing: 0.5em;
|
|
41
41
|
}
|
|
42
42
|
.emdash-break-space {
|
|
@@ -20,8 +20,9 @@ import {
|
|
|
20
20
|
generateBaseSeoContributions,
|
|
21
21
|
generateSiteSeoContributions,
|
|
22
22
|
} from "../page/seo-contributions.js";
|
|
23
|
+
import { renderSiteIdentity } from "../page/site-identity.js";
|
|
23
24
|
import { getPageRuntime } from "../page/index.js";
|
|
24
|
-
import {
|
|
25
|
+
import { getSiteSettings } from "../settings/index.js";
|
|
25
26
|
|
|
26
27
|
interface Props {
|
|
27
28
|
page: PublicPageContext;
|
|
@@ -34,29 +35,32 @@ const runtime = getPageRuntime(Astro.locals as Record<string, unknown>);
|
|
|
34
35
|
const baseContributions: PageMetadataContribution[] = generateBaseSeoContributions(page);
|
|
35
36
|
|
|
36
37
|
let metadataHtml = "";
|
|
38
|
+
let siteIdentityHtml = "";
|
|
37
39
|
let fragmentsHtml = "";
|
|
38
40
|
|
|
39
41
|
if (runtime) {
|
|
40
|
-
// Run independent async loads in parallel: site
|
|
41
|
-
//
|
|
42
|
-
// contributions
|
|
43
|
-
//
|
|
44
|
-
//
|
|
42
|
+
// Run independent async loads in parallel: site settings (SEO meta
|
|
43
|
+
// tags + favicon) and plugin page-metadata contributions. Plugin
|
|
44
|
+
// contributions come BEFORE site/base in the contribution array,
|
|
45
|
+
// so resolvePageMetadata's first-wins dedup lets plugins override
|
|
46
|
+
// defaults.
|
|
45
47
|
//
|
|
46
|
-
// `
|
|
47
|
-
//
|
|
48
|
-
//
|
|
49
|
-
//
|
|
50
|
-
|
|
51
|
-
|
|
48
|
+
// `getSiteSettings()` is request-cached and worker-cached, so when
|
|
49
|
+
// a parent template has already called it (the standard pattern in
|
|
50
|
+
// `Base.astro`), this is free. Otherwise it's a single batched
|
|
51
|
+
// query that supersedes any per-key fetch this component would
|
|
52
|
+
// otherwise have done.
|
|
53
|
+
const [siteSettings, pluginContributions, fragments] = await Promise.all([
|
|
54
|
+
getSiteSettings(),
|
|
52
55
|
runtime.collectPageMetadata(page),
|
|
53
56
|
runtime.collectPageFragments(page),
|
|
54
57
|
]);
|
|
55
58
|
|
|
56
|
-
const siteContributions = generateSiteSeoContributions(
|
|
59
|
+
const siteContributions = generateSiteSeoContributions(siteSettings.seo);
|
|
57
60
|
const allContributions = [...pluginContributions, ...siteContributions, ...baseContributions];
|
|
58
61
|
const resolved = resolvePageMetadata(allContributions);
|
|
59
62
|
metadataHtml = renderPageMetadata(resolved);
|
|
63
|
+
siteIdentityHtml = renderSiteIdentity({ favicon: siteSettings.favicon });
|
|
60
64
|
fragmentsHtml = renderFragments(fragments, "head");
|
|
61
65
|
} else {
|
|
62
66
|
// No runtime (EmDash not initialized) — still render base SEO
|
|
@@ -66,4 +70,5 @@ if (runtime) {
|
|
|
66
70
|
---
|
|
67
71
|
|
|
68
72
|
<Fragment set:html={metadataHtml} />
|
|
73
|
+
<Fragment set:html={siteIdentityHtml} />
|
|
69
74
|
<Fragment set:html={fragmentsHtml} />
|
|
@@ -20,6 +20,7 @@ import type { MediaValue } from "../fields/types.js";
|
|
|
20
20
|
import type { HTMLAttributes } from "astro/types";
|
|
21
21
|
import type { ImageEmbed } from "../media/types.js";
|
|
22
22
|
import { getMediaProvider } from "../media/provider-loader.js";
|
|
23
|
+
import { buildRenderMediaUrl } from "../media/url.js";
|
|
23
24
|
// Standard responsive breakpoints
|
|
24
25
|
const BREAKPOINTS = [640, 750, 828, 960, 1080, 1280, 1600, 1920];
|
|
25
26
|
|
|
@@ -53,14 +54,14 @@ function normalizeImage(
|
|
|
53
54
|
}
|
|
54
55
|
|
|
55
56
|
/**
|
|
56
|
-
* Build the URL for a local image
|
|
57
|
+
* Build the URL for a local image. Prefers `meta.storageKey`; falls back to
|
|
58
|
+
* the internal proxy with `img.id` when no storage key is available.
|
|
57
59
|
*/
|
|
58
60
|
function buildLocalImageUrl(img: MediaValue): string {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
}
|
|
63
|
-
return "";
|
|
61
|
+
return buildRenderMediaUrl(Astro.locals.emdash?.getPublicMediaUrl, {
|
|
62
|
+
storageKey: img.meta?.storageKey as string | undefined,
|
|
63
|
+
id: img.id,
|
|
64
|
+
});
|
|
64
65
|
}
|
|
65
66
|
|
|
66
67
|
/**
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
* Uses Astro's Image component for optimization when dimensions are available.
|
|
7
7
|
*/
|
|
8
8
|
import { Image as AstroImage } from "astro:assets";
|
|
9
|
+
import { buildRenderMediaUrl } from "../media/url.js";
|
|
9
10
|
|
|
10
11
|
export interface Props {
|
|
11
12
|
node: {
|
|
@@ -39,9 +40,10 @@ if (!images.length) {
|
|
|
39
40
|
<div class="emdash-gallery" style={`--columns: ${columns}`}>
|
|
40
41
|
{
|
|
41
42
|
images.map((image) => {
|
|
42
|
-
const src =
|
|
43
|
-
image.asset.url
|
|
44
|
-
|
|
43
|
+
const src = buildRenderMediaUrl(Astro.locals.emdash?.getPublicMediaUrl, {
|
|
44
|
+
url: image.asset.url,
|
|
45
|
+
id: image.asset._ref,
|
|
46
|
+
});
|
|
45
47
|
const hasSize = image.width && image.height;
|
|
46
48
|
return (
|
|
47
49
|
<figure class="emdash-gallery-item">
|
|
@@ -81,7 +83,7 @@ if (!images.length) {
|
|
|
81
83
|
}
|
|
82
84
|
.emdash-gallery-item figcaption {
|
|
83
85
|
font-size: 0.75rem;
|
|
84
|
-
color: #666;
|
|
86
|
+
color: var(--emdash-caption-color, var(--color-muted, #666));
|
|
85
87
|
margin-top: 0.25rem;
|
|
86
88
|
text-align: center;
|
|
87
89
|
}
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import type { ImageEmbed } from "../media/types.js";
|
|
9
9
|
import { getMediaProvider } from "../media/provider-loader.js";
|
|
10
|
+
import { buildRenderMediaUrl } from "../media/url.js";
|
|
10
11
|
// Standard responsive breakpoints
|
|
11
12
|
const BREAKPOINTS = [640, 750, 828, 960, 1080, 1280, 1600, 1920];
|
|
12
13
|
|
|
@@ -122,10 +123,14 @@ if (providerId && providerId !== "local") {
|
|
|
122
123
|
}
|
|
123
124
|
}
|
|
124
125
|
|
|
125
|
-
// Fallback for local provider
|
|
126
|
-
//
|
|
126
|
+
// Fallback for local provider. `asset.url` carries the storage key with
|
|
127
|
+
// extension when present; `asset._ref` is a bare ULID that only the internal
|
|
128
|
+
// `/file/{id}` route can resolve. `buildRenderMediaUrl` picks the right shape.
|
|
127
129
|
if (!src) {
|
|
128
|
-
src =
|
|
130
|
+
src = buildRenderMediaUrl(Astro.locals.emdash?.getPublicMediaUrl, {
|
|
131
|
+
url: asset.url,
|
|
132
|
+
id: asset._ref,
|
|
133
|
+
});
|
|
129
134
|
}
|
|
130
135
|
|
|
131
136
|
// Build placeholder background style
|
|
@@ -171,7 +176,7 @@ const imgStyle = placeholderStyle ? `${baseStyle} ${placeholderStyle}` : baseSty
|
|
|
171
176
|
}
|
|
172
177
|
.emdash-image figcaption {
|
|
173
178
|
font-size: 0.875rem;
|
|
174
|
-
color: #666;
|
|
179
|
+
color: var(--emdash-caption-color, var(--color-muted, #666));
|
|
175
180
|
margin-top: 0.5rem;
|
|
176
181
|
text-align: center;
|
|
177
182
|
}
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
12
|
import { autoUpdate, flip, offset, shift, useFloating } from "@floating-ui/react";
|
|
13
|
-
import { Extension, type JSONContent, type Range } from "@tiptap/core";
|
|
13
|
+
import { Extension, Node, mergeAttributes, type JSONContent, type Range } from "@tiptap/core";
|
|
14
14
|
import Focus from "@tiptap/extension-focus";
|
|
15
15
|
import Image from "@tiptap/extension-image";
|
|
16
16
|
import Link from "@tiptap/extension-link";
|
|
@@ -202,12 +202,18 @@ function convertPMNode(node: PMNode): PTBlock | PTBlock[] | null {
|
|
|
202
202
|
}
|
|
203
203
|
case "horizontalRule":
|
|
204
204
|
return { _type: "break", _key: k(), style: "lineBreak" };
|
|
205
|
-
case "pluginBlock":
|
|
205
|
+
case "pluginBlock": {
|
|
206
|
+
// Spread the captured data back out so the block round-trips losslessly.
|
|
207
|
+
// `data` holds every field except _type / _key / id (which live on
|
|
208
|
+
// dedicated attrs).
|
|
209
|
+
const { blockType, id, data } = node.attrs ?? {};
|
|
206
210
|
return {
|
|
207
|
-
|
|
211
|
+
...(data && typeof data === "object" ? data : {}),
|
|
212
|
+
_type: typeof blockType === "string" ? blockType : "embed",
|
|
208
213
|
_key: k(),
|
|
209
|
-
id:
|
|
214
|
+
id: typeof id === "string" ? id : "",
|
|
210
215
|
};
|
|
216
|
+
}
|
|
211
217
|
default:
|
|
212
218
|
return null;
|
|
213
219
|
}
|
|
@@ -412,21 +418,23 @@ function convertPTBlock(block: PTBlock): JSONContent | null {
|
|
|
412
418
|
},
|
|
413
419
|
};
|
|
414
420
|
}
|
|
415
|
-
// Unknown block types — treat as plugin blocks
|
|
416
|
-
|
|
417
|
-
if
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
}
|
|
426
|
-
// Truly unknown — render as code-marked text
|
|
421
|
+
// Unknown block types — treat as plugin blocks. Capture every field other
|
|
422
|
+
// than the well-known ones into `data` so the block round-trips losslessly,
|
|
423
|
+
// even if no plugin currently registers this type. Matches the admin
|
|
424
|
+
// editor's behaviour at PortableTextEditor.tsx:572-588.
|
|
425
|
+
const { _type, _key, id, url, ...rest } = block as { _type: string; _key: string } & Record<
|
|
426
|
+
string,
|
|
427
|
+
unknown
|
|
428
|
+
>;
|
|
429
|
+
// Filter out _-prefixed keys to prevent accumulation across edit cycles.
|
|
430
|
+
const data = Object.fromEntries(Object.entries(rest).filter(([key]) => !key.startsWith("_")));
|
|
427
431
|
return {
|
|
428
|
-
type: "
|
|
429
|
-
|
|
432
|
+
type: "pluginBlock",
|
|
433
|
+
attrs: {
|
|
434
|
+
blockType: typeof _type === "string" ? _type : "embed",
|
|
435
|
+
id: typeof id === "string" ? id : typeof url === "string" ? url : "",
|
|
436
|
+
data,
|
|
437
|
+
},
|
|
430
438
|
};
|
|
431
439
|
}
|
|
432
440
|
|
|
@@ -762,6 +770,61 @@ const initialSlashMenuState: SlashMenuState = {
|
|
|
762
770
|
range: null,
|
|
763
771
|
};
|
|
764
772
|
|
|
773
|
+
/**
|
|
774
|
+
* Minimal `pluginBlock` TipTap node for the inline (visual-editing) editor.
|
|
775
|
+
*
|
|
776
|
+
* Plugin-contributed Portable Text block types (e.g. `marketing.hero`) are
|
|
777
|
+
* editable in the admin via a Block Kit modal. The visual-editing surface
|
|
778
|
+
* deliberately does NOT offer that UX — it would need to fetch the manifest,
|
|
779
|
+
* mount the modal, and round-trip through plugin-block plumbing that lives in
|
|
780
|
+
* `@emdash-cms/admin`. Instead, the inline editor renders these blocks as a
|
|
781
|
+
* read-only placeholder so editors can see they exist and edit the surrounding
|
|
782
|
+
* content without losing the block's data.
|
|
783
|
+
*
|
|
784
|
+
* The full block payload is preserved on `data` and round-tripped losslessly
|
|
785
|
+
* through PT ↔ PM conversion (see convertPTBlock/convertPMNode). Without this
|
|
786
|
+
* extension, ProseMirror's schema would silently filter unknown nodes on load
|
|
787
|
+
* and the next save would persist the block's disappearance.
|
|
788
|
+
*/
|
|
789
|
+
const PluginBlockNode = Node.create({
|
|
790
|
+
name: "pluginBlock",
|
|
791
|
+
group: "block",
|
|
792
|
+
atom: true,
|
|
793
|
+
selectable: true,
|
|
794
|
+
draggable: true,
|
|
795
|
+
|
|
796
|
+
addAttributes() {
|
|
797
|
+
// All three attributes are stored on the ProseMirror node but not
|
|
798
|
+
// rendered as DOM attributes — they're metadata for the round-trip,
|
|
799
|
+
// not styling or behaviour the placeholder DOM needs to expose.
|
|
800
|
+
const noDom = { rendered: false, parseHTML: () => null };
|
|
801
|
+
return {
|
|
802
|
+
blockType: { default: "", ...noDom },
|
|
803
|
+
id: { default: "", ...noDom },
|
|
804
|
+
data: { default: {}, ...noDom },
|
|
805
|
+
};
|
|
806
|
+
},
|
|
807
|
+
|
|
808
|
+
parseHTML() {
|
|
809
|
+
return [{ tag: 'div[data-emdash-plugin-block="true"]' }];
|
|
810
|
+
},
|
|
811
|
+
|
|
812
|
+
renderHTML({ HTMLAttributes, node }) {
|
|
813
|
+
const blockType = typeof node.attrs.blockType === "string" ? node.attrs.blockType : "";
|
|
814
|
+
const label = blockType || "Block";
|
|
815
|
+
return [
|
|
816
|
+
"div",
|
|
817
|
+
mergeAttributes(HTMLAttributes, {
|
|
818
|
+
"data-emdash-plugin-block": "true",
|
|
819
|
+
"data-block-type": blockType,
|
|
820
|
+
class: "emdash-plugin-block-placeholder",
|
|
821
|
+
contenteditable: "false",
|
|
822
|
+
}),
|
|
823
|
+
`Plugin block: ${label} (edit in admin)`,
|
|
824
|
+
];
|
|
825
|
+
},
|
|
826
|
+
});
|
|
827
|
+
|
|
765
828
|
function createSlashCommandsExtension(options: {
|
|
766
829
|
filterCommands: (query: string) => SlashCommandItem[];
|
|
767
830
|
onStateChange: React.Dispatch<React.SetStateAction<SlashMenuState>>;
|
|
@@ -1734,6 +1797,7 @@ export function InlinePortableTextEditor({
|
|
|
1734
1797
|
mode: "all",
|
|
1735
1798
|
}),
|
|
1736
1799
|
Typography,
|
|
1800
|
+
PluginBlockNode,
|
|
1737
1801
|
slashCommandsExtension,
|
|
1738
1802
|
],
|
|
1739
1803
|
content: initialContent,
|
|
@@ -1741,6 +1805,7 @@ export function InlinePortableTextEditor({
|
|
|
1741
1805
|
editorProps: {
|
|
1742
1806
|
attributes: {
|
|
1743
1807
|
class: "prose prose-sm sm:prose-base dark:prose-invert max-w-none emdash-inline-editor",
|
|
1808
|
+
dir: "auto",
|
|
1744
1809
|
},
|
|
1745
1810
|
},
|
|
1746
1811
|
onUpdate: () => {
|
|
@@ -1795,7 +1860,7 @@ export function InlinePortableTextEditor({
|
|
|
1795
1860
|
// Don't save if focus moved to the slash menu (portalled to body)
|
|
1796
1861
|
if (related?.closest(".emdash-slash-menu")) return;
|
|
1797
1862
|
if (related?.closest(".emdash-media-picker")) return;
|
|
1798
|
-
save();
|
|
1863
|
+
void save();
|
|
1799
1864
|
},
|
|
1800
1865
|
[save, mediaPickerOpen],
|
|
1801
1866
|
);
|
|
@@ -1931,7 +1996,29 @@ export function InlinePortableTextEditor({
|
|
|
1931
1996
|
.emdash-inline-editor:focus {
|
|
1932
1997
|
outline: none;
|
|
1933
1998
|
}
|
|
1999
|
+
.emdash-plugin-block-placeholder {
|
|
2000
|
+
margin: 0.75rem 0;
|
|
2001
|
+
padding: 0.625rem 0.875rem;
|
|
2002
|
+
border: 1px dashed #d1d5db;
|
|
2003
|
+
border-radius: 0.5rem;
|
|
2004
|
+
background: #f9fafb;
|
|
2005
|
+
color: #4b5563;
|
|
2006
|
+
font-size: 0.875rem;
|
|
2007
|
+
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
|
|
2008
|
+
user-select: none;
|
|
2009
|
+
}
|
|
2010
|
+
@media (prefers-color-scheme: dark) {
|
|
2011
|
+
.emdash-plugin-block-placeholder {
|
|
2012
|
+
border-color: #374151;
|
|
2013
|
+
background: #111827;
|
|
2014
|
+
color: #9ca3af;
|
|
2015
|
+
}
|
|
2016
|
+
}
|
|
1934
2017
|
`}</style>
|
|
1935
2018
|
</div>
|
|
1936
2019
|
);
|
|
1937
2020
|
}
|
|
2021
|
+
|
|
2022
|
+
// Test-only exports for unit tests of the conversion functions.
|
|
2023
|
+
export { pmToPortableText as _pmToPortableText };
|
|
2024
|
+
export { portableTextToPM as _portableTextToPM };
|
|
@@ -109,13 +109,6 @@ const config = {
|
|
|
109
109
|
</emdash-live-search>
|
|
110
110
|
|
|
111
111
|
<script>
|
|
112
|
-
// Sanitization patterns for search snippets (allow only <mark> tags from FTS5)
|
|
113
|
-
const SNIPPET_AMP_RE = /&/g;
|
|
114
|
-
const SNIPPET_LT_RE = /</g;
|
|
115
|
-
const SNIPPET_GT_RE = />/g;
|
|
116
|
-
const SNIPPET_MARK_OPEN_RE = /<mark>/g;
|
|
117
|
-
const SNIPPET_MARK_CLOSE_RE = /<\/mark>/g;
|
|
118
|
-
|
|
119
112
|
interface SearchResult {
|
|
120
113
|
collection: string;
|
|
121
114
|
id: string;
|
|
@@ -396,17 +389,15 @@ const config = {
|
|
|
396
389
|
collectionEl.textContent = result.collection;
|
|
397
390
|
}
|
|
398
391
|
|
|
399
|
-
//
|
|
392
|
+
// Snippets returned by /api/search are already sanitised
|
|
393
|
+
// server-side by sanitizeSnippet() — they contain only
|
|
394
|
+
// HTML-escaped text plus literal <mark>...</mark> tags
|
|
395
|
+
// around matched terms.
|
|
400
396
|
const snippetEl = link.querySelector(
|
|
401
397
|
".emdash-live-search-result-snippet"
|
|
402
398
|
);
|
|
403
399
|
if (snippetEl && this.config.showSnippets && result.snippet) {
|
|
404
|
-
snippetEl.innerHTML = result.snippet
|
|
405
|
-
.replace(SNIPPET_AMP_RE, "&")
|
|
406
|
-
.replace(SNIPPET_LT_RE, "<")
|
|
407
|
-
.replace(SNIPPET_GT_RE, ">")
|
|
408
|
-
.replace(SNIPPET_MARK_OPEN_RE, "<mark>")
|
|
409
|
-
.replace(SNIPPET_MARK_CLOSE_RE, "</mark>");
|
|
400
|
+
snippetEl.innerHTML = result.snippet;
|
|
410
401
|
} else if (snippetEl) {
|
|
411
402
|
snippetEl.remove();
|
|
412
403
|
}
|