Skillpedia
المواقع والواجهات (frontend)8.1k · #12577

webiny-new-entry-wizard

ما الذي تفعله

ترشد هذه المهارة ذكاءك عند بناء معالج يظهر قبل محرر الإدخالات في Webiny Headless CMS. وهي لمطورين يريدون أن تبدأ الإدخالات الجديدة بحقول قليلة مجموعة مسبقًا.

متى تستخدمها

  • ✓عندما تريد أن يظهر نموذج قصير قبل إنشاء إدخال CMS جديد، مثل العنوان أو الـslug.
  • ✓عندما تحتاج إلى معالج مخصص عند الإنشاء لنماذج محتوى محددة.
  • ✓عندما تريد أن يُملأ نموذج الإدخال مسبقًا من إجابات المعالج.

رابط المهارة

https://github.com/webiny/webiny-js/blob/next/skills/user-skills/admin/new-entry-wizard/SKILL.md

انسخه والصقه في الذكاء الاصطناعي الذي تستخدمه (Claude أو ChatGPT أو Cursor) واطلب منه اتباع التعليمات.

طريقة الاستخدام

أسهل طريقة: انسخ الرسالة والصقها في الذكاء الاصطناعي الذي تستخدمه. سيقرأ المهارة وينفّذ تعليماتها.

رسالة جاهزة للصق

استخدم هذه المهارة لمساعدتي: https://github.com/webiny/webiny-js/blob/next/skills/user-skills/admin/new-entry-wizard/SKILL.md اقرأ ملف SKILL.md في هذا الرابط ونفّذ تعليماته لمهمتي.
تريد أن يجد الذكاء الاصطناعي مهارات مثل هذه بنفسه؟ثبّت خادم Skillpedia MCP المجاني: سطر واحد، ويبحث في 15,000+ مهارة قبل كل مهمة.ثبّته في دقيقة واحدة →

مثال على ما تطلبه من الذكاء الاصطناعي

“أضف معالجًا إلى نموذج المحتوى الخاص بالمدونة، يسأل عن العنوان والـslug والتصنيف قبل أن يُفتح الإدخال.”

5 مهارات جديدة كل أسبوع. قراءة في دقيقة واحدة.

كيف تعمل

تُعدّ المهارة معالج إضافة فيه واجهة مشتركة، وميزة، وpresenter يملك النموذج، وعرضًا، وخطوة تسجيل. وتُمرَّر إجابات المعالج إلى نموذج الإدخال، الذي يفتح ومعه علامة التغييرات غير المحفوظة.

المحتوى التقني (ملف SKILL.md الأصلي)

النص الأصلي من المؤلف، مباشرة من GitHub.

New Entry Wizard

TL;DR

A New Entry Wizard intercepts the "create new entry" flow in the Headless CMS and shows a custom form before the full entry editor. The wizard collects initial values (title, slug, category, etc.), then calls formPresenter.newEntry(initialValues) to pre-fill the entry form and transition to the editor. The form is automatically marked as dirty so the user sees unsaved changes.

A wizard extension has five files:

  1. abstractions.ts -- DI token and presenter interface (ALWAYS a standalone file)
  2. feature.ts -- createFeature wiring (ALWAYS a standalone file)
  3. Presenter -- owns the wizard form (fields, layout, validation) via FormModelFactory
  4. View -- renders the wizard UI using FormView and FormErrors
  5. Registration -- plugs the wizard into specific content models via ContentEntryEditorConfig.NewEntryWizard

Registration

// extensions/myWizard/index.tsx
import React from "react";
import { RegisterFeature } from "webiny/admin";
import { ContentEntryEditorConfig } from "webiny/admin/cms/entry/editor";
import { MyWizardFeature } from "./feature.js";
import { MyWizardForm } from "./MyWizardForm.js";

const MyWizardExtension = () => {
  return (
    <>
      <RegisterFeature feature={MyWizardFeature} />
      <ContentEntryEditorConfig>
        <ContentEntryEditorConfig.NewEntryWizard
          element={<MyWizardForm />}
          modelIds={["article", "blogPost"]}
        />
      </ContentEntryEditorConfig>
    </>
  );
};

export default MyWizardExtension;

Props

Prop Type Description
element React.ReactElement The wizard component to render
modelIds string[] Content model IDs this wizard applies to. Omit or pass [] to apply to all models.

Enabling the extension

// webiny.config.tsx
<Admin.Extension src={"@/extensions/myWizard/index.tsx"} />

Abstractions

Abstractions MUST live in a dedicated abstractions.ts file. This file defines the DI token for the presenter. It is imported by both the feature and the view.

// extensions/myWizard/abstractions.ts
import { createAbstraction } from "webiny/admin";
import type { FormModel } from "webiny/admin/form";

export interface MyWizardVM {
  form: FormModel.FormVM;
  data: Record<string, unknown>;
}

export interface IMyWizardPresenter {
  vm: MyWizardVM;
  submit(): Promise<Record<string, unknown> | false>;
  reset(): void;
}

export const MyWizardPresenter = createAbstraction<IMyWizardPresenter>("MyWizardPresenter");

Feature

The feature MUST live in a dedicated feature.ts file. It wires the presenter implementation to the abstraction and defines how the feature is resolved from the DI container.

// extensions/myWizard/feature.ts
import { createFeature, FormModelFactory } from "webiny/admin";
import { MyWizardPresenter } from "./abstractions.js";
import { MyWizardPresenterImpl } from "./MyWizardPresenter.js";

export const MyWizardFeature = createFeature({
  name: "MyWizard",
  register(container) {
    container.register(
      MyWizardPresenter.createImplementation({
        implementation: MyWizardPresenterImpl,
        dependencies: [FormModelFactory]
      })
    );
  },
  resolve(container) {
    return { presenter: container.resolve(MyWizardPresenter) };
  }
});

Presenter

The presenter owns a FormModel for the wizard's own fields. It is a plain class -- the DI token lives in abstractions.ts and the feature wiring lives in feature.ts.

// extensions/myWizard/MyWizardPresenter.ts
import type { FormModel } from "webiny/admin/form";
import { makeAutoObservable, toJS } from "mobx";
import { FormModelFactory } from "webiny/admin";
import type { IMyWizardPresenter, MyWizardVM } from "./abstractions.js";

export class MyWizardPresenterImpl implements IMyWizardPresenter {
  private form: FormModel.Interface;

  constructor(formFactory: FormModelFactory.Interface) {
    this.form = formFactory.create({
      fields: fields => ({
        title: fields.text().label("Title").required("Title is required"),
        slug: fields.text().label("Slug").required("Slug is required"),
        category: f
الأسئلة الشائعة

هل يحفظ المعالج الإدخال نيابة عني؟

لا. يملأ المعالج نموذج الإدخال، ثم يرى المستخدم تغييرات غير محفوظة ليحفظها.

كيف يُربط المعالج بنموذج محتوى؟

يُسجَّل لنماذج محتوى محددة من خلال إعدادات محرر الإدخالات.

ما الملفات التي يحتاجها المعالج؟

تذكر المهارة خمسة أجزاء: التجريدات، والميزة، والـpresenter، والعرض، والتسجيل.

التفاصيل

الوصف الأصلي من المؤلف

Building a New Entry Wizard for the Headless CMS. Use this skill when the developer wants to show a custom wizard UI before the entry form when creating new CMS entries -- collecting fields like title, slug, or category upfront, then pre-filling the entry form. Covers ContentEntryEditorConfig.NewEntryWizard, createFeature, FormModelFactory, createReactiveComponent, useContentEntryFormPresenter, and the dirty-flag on setData.

repo: webiny/webiny-js

الشعبية

نجوم GitHub
8.1k
الترتيب
#12577
الترخيص
—
آخر تحديث
2‏/11‏/2026

هل هذه المهارة مفيدة؟

0

سجّل الدخول للتصويت.

التعليقات

  • …

المزيد من المهارات من هذا المستودع

مهارات مشابهة