Create a Block Tutorial | Block Editor Handbook - WordPress ...

文章推薦指數: 80 %
投票人數:10人

Create a Block Tutorial Edit. Let's get you started creating your first block for the WordPress Block Editor. We will create a simple block that allows the ... AboutWordPressAboutWordPressWordPress.orgDocumentationSupportFeedbackSearchLogInRegister Skiptocontent Searchfor: Searchplugins Chapters BlockEditorHandbook GettingStarted DevelopmentEnvironment HowtosetuplocalWordPressenvironmentonUbuntu CreateaBlockTutorial WordPressPlugin AnatomyofaBlock BlockAttributes CodeImplementation AuthoringExperience FinishingTouches ShareyourBlockwiththeWorld FullSiteEditing Outreach How-toGuides Accessibility Blocks Createabasicblock Usestylesandstylesheets IntroducingAttributesandEditableFields BlockControls:BlockToolbarandSettingsSidebar BlockSupports Creatingdynamicblocks BlockSupportsindynamicblocks GenerateBlockswithWP-CLI NestedBlocks:UsingInnerBlocks DevelopmentPlatform Buildingacustomblockeditor Tutorial:buildingacustomblockeditor CreateyourFirstAppwithGutenbergData Setup Buildingalistofpages Buildinganeditform FeatureFlags FormattingToolbarAPI GettingStartedwithJavaScript PluginsBackground LoadingJavaScript ExtendingtheBlockEditor Troubleshooting JavaScriptVersionsandBuildStep ScopeYourCode JavaScriptBuildSetup ESNextSyntax Internationalization MetaBoxes Notices PluginSidebar Themes BlockTheme Createablocktheme GlobalSettings&Styles(theme.json) ThemeSupport ThunksinCore-Data Widgets WidgetsBlockEditoroverview RestoringtheclassicWidgetsEditor AbouttheLegacyWidgetblock ReferenceGuides BlockAPIReference Annotations APIVersions Attributes Context Deprecation EditandSave Metadata Patterns Registration Styles Supports Templates Transforms Variations CoreBlocksReference FilterReference BlockFilters EditorFilters i18nFilters ParserFilters Autocomplete SlotFillsReference MainDashboardButton PluginBlockSettingsMenuItem PluginDocumentSettingPanel PluginMoreMenuItem PluginPostPublishPanel PluginPostStatusInfo PluginPrePublishPanel PluginSidebar PluginSidebarMoreMenuItem RichTextReference Theme.jsonReference Version2(livingreference) Version1Reference MigratingtoNewerVersions ComponentReference AlignmentMatrixControl AnglePickerControl Animate Autocomplete BaseControl BaseField BorderBoxControl BorderControl BoxControl ButtonGroup Button CardBody CardDivider CardFooter CardHeader CardMedia Card CheckboxControl ClipboardButton ColorIndicator ColorPalette ColorPicker ComboboxControl ConfirmDialog CustomSelectControl Dashicon DateTime DimensionControl Disabled Divider Draggable DropZone DropdownMenu Dropdown DuotonePicker Elevation ExternalLink FlexBlock FlexItem Flex Flyout FocalPointPicker FocusableIframe FontSizePicker FormFileUpload FormToggle FormTokenField GradientPicker Grid Guide HStack Heading NavigateRegions HigherOrder WithConstrainedTabbing WithFallbackStyles WithFilters WithFocusOutside WithFocusReturn WithNotices WithSpokenMessages Icon InputControl IsolatedEventContainer ItemGroup Item KeyboardShortcuts MenuGroup MenuItem MenuItemsChoice Modal NavigableContainer Navigation NavigatorBackButton NavigatorButton NavigatorProvider NavigatorScreen Notice NumberControl Panel Placeholder Popover Navigator QueryControls RadioControl RadioGroup RangeControl ResizableBox ResizeTooltip ResponsiveWrapper Sandbox ScrollLock Scrollable SearchControl SelectControl SlotFill Snackbar Spacer Spinner Surface TabPanel TextControl TextHighlight Text TextareaControl ToggleControl ToggleGroupControlOptionBase ToggleGroupControlOptionIcon ToggleGroupControlOption ToggleGroupControl ToolbarButton ToolbarDropdownMenu ToolbarGroup ToolbarItem Toolbar ToolsPanelHeader ToolsPanelItem ToolsPanel Tooltip TreeGrid TreeSelect Truncate UnitControl VStack VisuallyHidden ZStack PackageReference @wordpress/admin-manifest @wordpress/a11y @wordpress/annotations @wordpress/api-fetch @wordpress/autop @wordpress/babel-plugin-import-jsx-pragma @wordpress/babel-plugin-makepot @wordpress/babel-preset-default @wordpress/base-styles @wordpress/blob @wordpress/block-directory @wordpress/block-editor @wordpress/block-library @wordpress/block-serialization-default-parser @wordpress/block-serialization-spec-parser @wordpress/blocks @wordpress/browserslist-config @wordpress/components @wordpress/compose @wordpress/core-data @wordpress/create-block-tutorial-template @wordpress/create-block @wordpress/custom-templated-path-webpack-plugin @wordpress/customize-widgets @wordpress/data-controls @wordpress/data @wordpress/date @wordpress/dependency-extraction-webpack-plugin @wordpress/deprecated @wordpress/docgen @wordpress/dom-ready @wordpress/edit-navigation @wordpress/dom @wordpress/e2e-test-utils @wordpress/e2e-tests @wordpress/edit-post @wordpress/edit-site @wordpress/edit-widgets @wordpress/editor @wordpress/element @wordpress/env @wordpress/escape-html @wordpress/eslint-plugin @wordpress/format-library @wordpress/hooks @wordpress/html-entities @wordpress/i18n @wordpress/icons @wordpress/interface @wordpress/is-shallow-equal @wordpress/jest-console @wordpress/jest-preset-default @wordpress/jest-puppeteer-axe @wordpress/keyboard-shortcuts @wordpress/keycodes @wordpress/lazy-import @wordpress/library-export-default-webpack-plugin @wordpress/list-reusable-blocks @wordpress/media-utils @wordpress/notices @wordpress/npm-package-json-lint-config @wordpress/nux @wordpress/plugins @wordpress/postcss-plugins-preset @wordpress/postcss-themes @wordpress/preferences @wordpress/prettier-config @wordpress/primitives @wordpress/react-native-aztec @wordpress/priority-queue @wordpress/react-native-bridge @wordpress/project-management-automation @wordpress/react-native-editor @wordpress/react-i18n @wordpress/readable-js-assets-webpack-plugin @wordpress/redux-routine @wordpress/reusable-blocks @wordpress/rich-text @wordpress/scripts @wordpress/server-side-render @wordpress/shortcode @wordpress/style-engine @wordpress/stylelint-config @wordpress/token-list @wordpress/url @wordpress/viewport @wordpress/warning @wordpress/widgets @wordpress/wordcount DataModuleReference WordPressCoreData Annotations BlockTypesData TheBlockEditor’sData ThePostEditor’sData TheEditor’sUIData NoticesData TheNUX(NewUserExperience)Data TheViewportData Explanations Architecture KeyConcepts DataFlowandDataFormat Modularity Performance AutomatedTesting FullSiteEditingTemplates Styles UserInterface BlockDesign Animation Resources FrequentlyAskedQuestions Glossary History ContributorGuide CodeContributions GettingStartedWithCodeContribution GitWorkflow CodingGuidelines TestingOverview BlockGrammar Scripts ManagingPackages GutenbergReleaseProcess ReactNativemobileeditor GettingStartedfortheReactNativebasedMobileGutenberg SetupguideforReactNativedevelopment(macOS) ReactNativeIntegrationTestGuide ReactNativeInternationalizationGuide BackwardCompatibility Deprecations DesignContributions BlocksaretheInterface Reference DocumentationContributions CopyGuidelines Triage LocalizingGutenbergPlugin AccessibilityTesting RepositoryManagement FolderStructure VersionsinWordPress UpcomingProjects&Roadmap Browse: Home/ BlockEditorHandbook/ GettingStarted/CreateaBlockTutorial CreateaBlockTutorialEdit Let’sgetyoustartedcreatingyourfirstblockfortheWordPressBlockEditor.Wewillcreateasimpleblockthatallowstheusertotypeamessageandstyleit. Thetutorialincludessettingupyourdevelopmentenvironment,tools,andgettingcomfortablewiththenewdevelopmentmodel.Ifyouarealreadycomfortable,trythequickstartbelow,otherwisestepthroughwhateverpartofthetutorialyouneed. Prerequisites Thefirstthingyouneedisadevelopmentenvironmentandtools.ThisincludessettingupyourWordPressenvironment,Node,NPM,andyourcodeeditor.Ifyouneedhelp,seethesettingupyourdevelopmentenvironmentdocumentation. Top↑QuickStart The@wordpress/create-blockpackageexiststocreatethenecessaryblockscaffoldingtogetyoustarted.Seecreate-blockpackagedocumentationforadditionalfeatures.Thisquickstartassumesyouhaveadevelopmentenvironmentwithnodeinstalled,andaWordPresssite. Fromyourpluginsdirectory,tocreateyourblockrun: npx@wordpress/create-blockgutenpride--template@wordpress/create-block-tutorial-template Thenpxcommandrunsacommandfromaremotepackage,inthiscaseourcreate-blockpackagethatwillcreateanewdirectorycalledgutenpride,installsthenecessaryfiles,andbuildstheblockplugin.Ifyouwantaninteractivemodethatpromptsyoufordetails,runthecommandwithoutthegutenpridename. Younowneedtoactivatethepluginfrominsidewp-adminpluginspage. Afteractivated,gototheblockeditorandusetheinsertertosearchandaddyournewblock. Top↑TableofContents Thecreateablocktutorialsbreaksdowntothefollowingsections. WordPressPlugin AnatomyofaGutenbergBlock BlockAttributes CodeImplementation AuthoringExperience FinishingTouches ShareyourBlockwiththeWorld   Handbooknavigation ←DevelopmentEnvironmentWordPressPlugin→



請為這篇文章評分?