Skip to content

Releases

v0.2.2

Choose a tag to compare

@github-actions github-actions released this 03 Dec 18:57
135fddb

Patch Changes

  • #36 83c9ead Thanks @kriss145! - The Admin's document list takes a limit of 100 at most, and the plugin no longer has a health route.

    Behaviour changes - read before upgrading

    • GET /admin/cms/collections/:collection/documents answers 400 to a limit over 100, as the version and media lists do. Read more documents page by page with offset.
    • GET /admin/cms/health is removed and answers 404. Medusa's own GET /health checks the server. A CMS config that does not resolve shows on every CMS route as a 500 with its problem, and validateConfig(config) from @mostrajs/cms finds it in a test of your project.

v0.2.1

Choose a tag to compare

@github-actions github-actions released this 03 Dec 17:08
aba7821

Patch Changes

  • #31 2a8444a Thanks @kriss145! - The rich text editor gains Markdown shortcuts, a Markdown view and a drag handle, and each of its tools is a feature a field can leave out.

    Behaviour changes - read before upgrading

    • A field whose features is a list of its own shows no full-screen button until the list holds FullScreenFeature(). A field on the defaults, or with a function of defaultFeatures or rootFeatures, keeps it.

    Features

    • MarkdownShortcutsFeature() - Markdown typed or pasted, such as ## , - or **bold**, turns into what the field's features allow. On by default.
    • DragHandleFeature() - a paragraph, heading, list or quote moves above or below another by the handle beside it. On by default.
    • FullScreenFeature() - the button that opens the editor over the whole Admin. On by default.
    • MarkdownViewFeature() - the field edited as Markdown from the editor's Actions menu, and saved as the same document. Underline, subscript and superscript lose their format when the view opens, and undo brings it back. Off by default.
    • RichTextFeatureKey has the keys markdownShortcuts, dragHandle, fullScreen and markdownView, which an exhaustive switch handles.
  • #34 9c45ac5 Thanks @kriss145! - A rich text field can hold horizontal rules, which HorizontalRuleFeature() turns on.

    Features

    • HorizontalRuleFeature() - a toolbar button inserts a rule between blocks, and --- alone on a line makes one. Off by default.
    • The renderers write a rule as <hr>, under the component key horizontalRule.
    • RichTextFeatureKey has the key horizontalRule, which an exhaustive switch handles.

v0.2.0

Choose a tag to compare

@github-actions github-actions released this 02 Dec 13:45
d2e4ed9

Minor Changes

  • #26 298f915 Thanks @kriss145! - The plugin's exports drop the Cms prefix: CmsTableConfig is TableConfig, defineCmsOptionsHook is defineOptionsHook. Three take another name: CmsText is ConfigText, CmsDocument is DocumentRow, and CmsBlockPlace is BlockPlaceLevel. The workflows and steps keep their names. ConfigValue, DefaultsValue, RichTextTextFormat, ResolvedRichTextFeatureOf and CmsDocumentSource are no longer exported.

  • #26 24be38d Thanks @kriss145! - Rich text has an entry of its own, @mostrajs/cms/shared/rich-text, with shorter names, and @mostrajs/cms/shared keeps the sanitizers and the slug.

    Behaviour changes - read before upgrading

    • Import rich text from @mostrajs/cms/shared/rich-text, and rename what you use:

      Before, from @mostrajs/cms/shared Now, from @mostrajs/cms/shared/rich-text
      validateRichText validateDocument
      parseRichText parseDocument
      isRichTextEmpty isDocumentEmpty
      buildRichTextRenderTree buildRenderTree
      findRichTextFeature findFeature
      DEFAULT_RICH_TEXT_FEATURES DEFAULT_FEATURES
      RICH_TEXT_HEADINGS HEADINGS

      formatHtml, formatPlainText, the feature factories and the RichText* and Render* types keep their names and move to the new entry too. The package root exports findFeature in place of findRichTextFeature. RichText stays in @mostrajs/cms/shared/rich-text/renderers/react.

      // before
      import { escapeHtml, formatHtml, parseRichText } from "@mostrajs/cms/shared"
      // now
      import { escapeHtml } from "@mostrajs/cms/shared"
      import { formatHtml, parseDocument } from "@mostrajs/cms/shared/rich-text"

Patch Changes

  • #26 e0268a2 Thanks @kriss145! - The rich text editor shows lists and bold italic text as they are saved on a project that installs the plugin from npm, and it follows a field that is disabled or enabled after it shows.

    Behaviour changes - read before upgrading

    • DEFAULT_FEATURES and the features a richText.features function gets are typed as read-only lists. A config that pushes into DEFAULT_FEATURES, defaultFeatures or rootFeatures, or types them as ResolvedRichTextFeature[], fails to compile. Build a new list instead:

      features: ({ defaultFeatures }) => [
        ...defaultFeatures.filter(({ key }) => key !== "heading"),
        HeadingFeature({ enabledHeadingSizes: ["h2"] }),
      ]

    Fixes

    • A bulleted list shows its bullets and a numbered list its numbers, where both showed no marker.
    • Text that is both bold and italic shows in italic too.
    • The last paragraph leaves no empty space below it.
    • A rich text field of the form toolkit that a form disables after it shows becomes read-only, and editable again once enabled, where only its toolbar changed.
    • A save refuses a rich text document nested more than 64 levels deep with a 400 at the field, where a very deep one failed with a 500. The renderers already drop what sits below that level.
    • A save refuses a link whose title holds a control character, and a text format holding a bit Lexical gives no format.
    • A rich text field whose editor fails, on a stored text it cannot read or a chunk that fails to load, shows a message in its place, and the rest of the form keeps its changes.
  • #26 b675367 Thanks @kriss145! - A rich text field offers underline, strikethrough, inline code, subscript, and superscript, and the plugin's renderers draw them as <u>, <s>, <code>, <sub>, and <sup>.

    Behaviour changes - read before upgrading

    • A rich text field that uses the default features shows the five new format buttons after the upgrade. So does a config whose richText.features is a function of defaultFeatures. To keep the fields as they were, filter the five out in the config's richText.features:

      features: ({ defaultFeatures }) =>
        defaultFeatures.filter(
          ({ key }) =>
            ![
              "underline",
              "strikethrough",
              "inlineCode",
              "subscript",
              "superscript",
            ].includes(key)
        )
    • A storefront that renders rich text by hand and ignores the new format bits shows such text unstyled. The rich text format lists every bit.

    Features

    • UnderlineFeature(), StrikethroughFeature(), InlineCodeFeature(), SubscriptFeature(), and SuperscriptFeature(), from the package root and @mostrajs/cms/shared/rich-text.
    • The render keys underline, strikethrough, inlineCode, subscript, and superscript, for your own component of each.
    • A save refuses a text that is both subscript and superscript.
  • #24 67e8a94 Thanks @kriss145! - The last button of a rich text toolbar opens the editor over the whole Admin, and Escape closes it with the text and undo kept.

  • #26 b1f2b03 Thanks @kriss145! - The bold and italic buttons of a rich text toolbar show their letters in bold and in italic on a project that installs the plugin from npm.

v0.1.3

Choose a tag to compare

@github-actions github-actions released this 29 Nov 14:42
6e0d20c

Patch Changes

  • #21 85c78da Thanks @kriss145! - In the document form, a field's description sits under its input, so the fields of a row line up whether or not each one has a description.

  • #19 0dcbdf2 Thanks @kriss145! - A storefront installs the plugin without Medusa's backend and renders a rich text field with the plugin's own code: RichText from @mostrajs/cms/shared/rich-text/renderers/react, or HTML from formatHtml in @mostrajs/cms/shared.

    Features

    • RichText, a React component that renders in a server or a client component, on React 18 or 19, and takes your own component for any element, such as a router's link.
    • formatHtml, for a storefront in any framework, and buildRichTextRenderTree for a renderer of your own.
    • Every text and attribute is escaped, and a link is written only when its URL is safe. A node the renderer does not know renders as its children, with a warning.
    • escapeHtml and isSafeLinkUrl in @mostrajs/cms/shared, for any value you write into HTML.
    • Every peer dependency is optional and react takes 18 or 19, so a storefront that installs the plugin gets no Medusa package and no Admin library.

v0.1.2

Choose a tag to compare

@github-actions github-actions released this 27 Nov 15:11
c518b53

Patch Changes

  • #17 d297ebd Thanks @kriss145! - The Admin's forms, tabs and rich text editor look as intended in a project that installs the plugin from npm.

    Fixes

    • A form with tabs shows only the open tab's fields, where it showed every tab's fields at once.
    • The rich text editor keeps its height when empty, its redo button shows a mirrored arrow, and a quote shows its left border.
    • A link in the rich text editor takes Medusa's interactive colour on hover, in place of an underline the Admin never drew.
    • A block's sections are divided by a line, with none above the first.
  • #14 6d27584 Thanks @kriss145! - The package's description on npm is shorter and matches the README: a CMS inside your Medusa v2 project, with content as data models, edited in the Admin and served by the Store API.

  • #16 83d6e94 Thanks @kriss145! - translationKey(key, options?) names a translation as a text of the config, in place of a ({ t }) => t(key) function of your own.

    Features

    • translationKey is exported from @mostrajs/cms and takes the options of t, ns included: label: translationKey("page.singular").
    • The README's basic setup says that a label written as a string shows the same in every language, and links to the page on translations.

v0.1.1

Choose a tag to compare

@github-actions github-actions released this 26 Nov 17:20
5020a68

Patch Changes

  • #12 5c11c9d Thanks @kriss145! - Clearer error messages, and documentation that is easier to read.

    • Messages. These messages now say what is wrong in plainer words. If your code or tests match one of them, update the text:
      • The media provider "<identifier>" does not support search, when the Admin searches a provider without list
      • media "<field>" stores "url", but the media provider "<identifier>" stores only "id", at startup
      • admin "edit" needs "page" or "drawer", at startup
      • admin "edit" "drawer" takes no "drafts: true", as a drawer shows no status and cannot publish, at startup
      • a singleton takes no "drafts: true", as its page shows no status, publish actions, or version history, at startup
      • field "<name>" is filterable, but only a boolean field can be filterable, at startup
      • Options unavailable: no hook named "<name>" is registered, in the Admin, in English and Polish
    • Documentation. Every page is laid out for scanning, with options in tables, data shapes and responses in code blocks, and failures in lists, and it is written in plainer English. It now also covers the save checks of blocks, the startup checks of tables, singletons and store lists, the media routes' errors, and when serverPublishValidation runs.

v0.1.0

Choose a tag to compare

@github-actions github-actions released this 26 Nov 09:22
c040764

Minor Changes

  • #7 d325210 Thanks @kriss145! - The first release of Mostra as @mostrajs/cms: a CMS inside your Medusa v2 project, with content modelled as Medusa data models, edited in Medusa Admin and served through the store API.

    Moving from @codee-sh/medusa-plugin-cms

    • This is the plugin published as @codee-sh/medusa-plugin-cms up to 0.1.1, under its new name; that package is deprecated. No data, table, route or config key changes.
    • Swap the package: npm uninstall @codee-sh/medusa-plugin-cms and npm install @mostrajs/cms.
    • Rename every import and the plugin's resolve in medusa-config.ts from @codee-sh/medusa-plugin-cms to @mostrajs/cms, its /workflows, /admin-extensions and /shared entry points with it, then delete node_modules/.vite before starting the Admin.

    Features

    • Content model
      • Collections and singletons as Medusa data models in a module of your own, described by one typed config
      • Blocks in areas, ordered and nested, for page builders and repeated content
      • Fields: text, number, boolean, date, select, combobox, text list, slug, URL, rich text, media and relationships between collections
    • Editing in Medusa Admin
      • Pages under Content: routes that group collections, tables with filters and sorting, forms in sections and tabs, editing on a page or in a drawer
      • Drafts and versions per collection: Publish, Unpublish, Discard changes and a version history to restore from
      • Rich text edited with Lexical, with the features you allow per field
      • Validation with Zod schemas on the server, mirrored in the form, and your own rules in a validate hook
      • Extensions: your own field components, options loaded by a hook, widgets in the plugin's pages
      • Admin texts in English and Polish, and your config's texts translatable
    • Media
      • Media fields over Medusa's File Module, or a media provider of your own
    • Safe input
      • Links checked against a link policy, javascript: and data: never allowed, control characters refused
    • Store and backend
      • Store API for published documents: a list, by id or by slug, with field selection, filters and paging
      • Admin API, workflows, steps and document events exported for your own routes and subscribers

    Getting started

    • npm install @mostrajs/cms
    • Write a module with your content models and a CMS config with defineConfig, and register the plugin with options: { config } in medusa-config.ts
    • Run npx medusa db:generate <your module> and npx medusa db:migrate
    • The whole setup is in the README

    Documentation