Skip to content

Add block transform support from WordPress native core blocks to Sensei LMS blocks #7862

@fernandotellado

Description

@fernandotellado

Currently, it’s not possible to transform a standard WordPress list block (i.e., core/list) into a Sensei LMS block (i.e., sensei-lms/task-list) within the block editor. The transform option simply doesn’t appear, which limits content conversion workflows.

This is especially inconvenient when migrating or adapting lessons that were originally created with regular blocks and need to take advantage of Sensei’s blocks functionality for lessons or courses.

Proposed solution:
Add a transforms.from definition in blocks registration, so users can easily convert from core blocks.

Possible example:

transforms: {
    from: [
        {
            type: 'block',
            blocks: ['core/list'],
            transform: ({ values }) => createBlock('sensei-lms/task-list', { content: values }),
        },
    ],
},

Benefits:

  • Simplifies the content editing process.
  • Reduces manual recreation of Sensei blocks.
  • Makes Sensei LMS blocks more interoperable with core WordPress blocks.

I’ve already implemented a working version in a standalone plugin for reference and testing.
Happy to share it or open a PR if the team finds this addition useful.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions