Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Gutenbergで変わる エディタカスタマイズ / wco2018
Search
Hidetaka Okamoto
June 02, 2018
Technology
2.8k
3
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Gutenbergで変わる エディタカスタマイズ / wco2018
WordCamp Osaka 2018
Hidetaka Okamoto
June 02, 2018
More Decks by Hidetaka Okamoto
See All by Hidetaka Okamoto
OpenAI APIで API Changelogを要約してみた話 / chatgpt-osaka-1
hideokamoto
0
720
コミュニティ運営から 中の人に変わって感じたこと
hideokamoto
0
150
Developerが Developer Advocateになった話 / dev-rel-meetup-tokyo-71
hideokamoto
0
390
Jamstack開発者のための App Runner入門
hideokamoto
1
560
WordPressでの webサイト制作2022 / ngk2022s
hideokamoto
0
500
JavaScript(TypeScript)で メディアサイトを インフラから構築する方法 / jsconf-jp-2021
hideokamoto
2
4.4k
AWS上でStripeを利用したアプリをより安全にデプロイする方法 /jaws-pankration-2021
hideokamoto
1
250
Shifter Headlessと Headless WordPressの紹介
hideokamoto
0
2.2k
Stripe & Next.js + AWS Amplify で会員 + 定期課金機能 / JP_Stripes20210903
hideokamoto
7
3.3k
Other Decks in Technology
See All in Technology
多層防御と最⼩権限で実現する、安全なAIエージェント設計パターン
lycorptech_jp
PRO
1
250
AIとペアプロを始める。人とのペアプロをやめる。ペアプロの良さを改めて知る。もっと好きになった。 / Rediscovering Pair Programming
honyanya
1
330
AI活用の現在地、 ちゃんと見えてますか?/XPfest-2026
visional_engineering_and_design
0
180
GoにおけるFFIのこれまでとこれから
goccy
5
2.2k
2026-09-04 SRE Tech Talk #15 怠惰なTerraform / Lazy Terraform
masasuzu
0
230
Multica × 長期記憶:40個のミニプロジェクト管理
eiei114
1
230
omasushiというライブラリを作った
polidog
PRO
0
190
OpenTelemetryのメトリクスをCloudWatchに送ってPromQLで見てみた
ota1022
0
120
GuardDuty 検知対応を DevOps Agent で効率化しようとしている話 / GuardDuty Investigations with DevOps Agent
masahirokawahara
1
350
コスト最適化の「めんどくさい」を AWS FinOps Agent でチョット楽にする
classmethod_kaz
0
300
作品が生態系になった ─ Mini Tokyo 3D から世界へ
nagix
0
150
AIで開発は速くなったのに、なぜ現場は楽にならないのか 〜あなたの組織のボトルネックを突き止めるワークショップ〜
jacopen
1
310
Featured
See All Featured
Highjacked: Video Game Concept Design
rkendrick25
PRO
1
450
What the history of the web can teach us about the future of AI
inesmontani
PRO
1
680
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
333
23k
ラッコキーワード サービス紹介資料
rakko
1
4.8M
Navigating Team Friction
lara
192
16k
Tips & Tricks on How to Get Your First Job In Tech
honzajavorek
1
730
How to optimise 3,500 product descriptions for ecommerce in one day using ChatGPT
katarinadahlin
PRO
2
3.8k
Imperfection Machines: The Place of Print at Facebook
scottboms
270
14k
Noah Learner - AI + Me: how we built a GSC Bulk Export data pipeline
techseoconnect
PRO
0
430
How People are Using Generative and Agentic AI to Supercharge Their Products, Projects, Services and Value Streams Today
helenjbeal
1
310
Exploring the relationship between traditional SERPs and Gen AI search
raygrieselhuber
PRO
2
4.3k
Raft: Consensus for Rubyists
vanstee
141
7.7k
Transcript
GutenbergͰมΘΔ ΤσΟλΧελϚΠζ WordCamp Osaka 2018 Ԭຊलߴ
ࣗݾհ • Digitalcube Co. Ltd. • WordCamp Kyoto 2017࣮ߦҕ һ
• ྲྀ͠ͷJAWS-UGӡӦϝϯόʔ H i d e t a k a O k a m o t o
GutenbergίΞίϯτϦϏϡʔλʔʢओʹςετܥʣ
ࠓͷ
WordPressͷߘΤσΟλ
Զͨͪͷ͍ͬͯΔΤσΟλ
͜Ε͔ΒͷਓͨͪʹͱͬͯͷΤσΟλʢ༧ఆʣ
Կ͕มΘΔʁ ͜Ε·ͰͷΤσΟλ • PHPͱ͖Ͳ͖JavaScript • ΧελϜϑΟʔϧυΛͬͯը໘ΛΧελϚΠζ After Gutenberg • JavaScriptͱ͖Ͳ͖PHP
• ReactΛͬͯը໘ΛΧελϚΠζ
Զͨͪͷ͍ͬͯͨΤσΟλϓϥάΠϯ https://wordpress.org/plugins/classic-editor/
େมֵ
PHPʢWPؔʣͰͷΧελϚΠζ͔ΒJSϕʔε ͜Ε·ͰͷΤσΟλ • PHPͱ͖Ͳ͖JavaScript • ΧελϜϑΟʔϧυΛͬͯը໘ΛΧελϚΠζ After Gutenberg • JavaScriptͱ͖Ͳ͖PHP
• ReactΛͬͯը໘ΛΧελϚΠζ
GutenbergͰͷΤσΟλΧελϚΠζͷྑ͞ɾͭΒ͞ Gutenbergʹͳͬͯศརʹͳͬͨ͜ͱ • ReactͰΤσΟλΛΧελϚΠζͰ͖Δ͜ͱ Gutenbergʹͳͬͯେมʹͳͬͨ͜ͱ • ReactͰΤσΟλΛΧελϚΠζ͠ͳ͍ͱ͍͚ͳ͍͜ͱ
GutenbergͰͷΤσΟλΧελϚΠζͷྑ͞ɾͭΒ͞ Gutenbergʹͳͬͯศརʹͳͬͨ͜ͱ • ReactͰΤσΟλΛΧελϚΠζͰ͖Δ͜ͱ Gutenbergʹͳͬͯେมʹͳͬͨ͜ͱ • ReactͰΤσΟλΛΧελϚΠζ͠ͳ͍ͱ͍͚ͳ͍͜ͱ
Matt͕̏લʹग़ͨ॓͠@WordCamp US 2015 https://videopress.com/v/cmA03MuQ
GutenbergͰͰ͖Δ ͜ΜͳΤσΟλ
ྫ̍ɿදܗࣜͰͷใೖྗϑΥʔϜ https://gist.github.com/hideokamoto/7b9d77353bd324a6b1fead2a2caf9b7a
ྫ̍ɿೖྗදܗࣜͰɺग़ྗผʹͰ͖Δ https://gist.github.com/hideokamoto/7b9d77353bd324a6b1fead2a2caf9b7a
ྫ̎ɿStep by StepͰࣥචࢧԉ https://gist.github.com/hideokamoto/7b9d77353bd324a6b1fead2a2caf9b7a
ྫ̎ɿϓϨϏϡʔͷϚʔΫΞοϓΠϯλϥΫςΟϒʹ https://gist.github.com/hideokamoto/7b9d77353bd324a6b1fead2a2caf9b7a
ͦͷ΄͔Ͱ͖Δ͜Μͳ͜ͱʢྫʣ • withAPIData()ΛͬͯαΠτͷίϯςϯπΛऔಘ • ΦʔτίϯϓϦʔτͳͲͷೖྗิॿ • σϑΥϧτϒϩοΫΛΧελϜϒϩοΫʹมߋ • ಛఆͷߘλΠϓͰར༻Ͱ͖ΔϒϩοΫΛ੍ݶ
GutenbergͰศརͳ͜ͱɺͭΒ͍͜ͱ ศརͳ͜ͱ • JSϕʔεͳͷͰɺΠϯλϥΫςΟϒͳಈ͖͕͚͍ͭ͢ • ඇಉظ௨৴ɺೖྗʹԠͨ͡දࣔͷมߋಘҙ ͭΒ͍͜ͱ • ͜Ε·Ͱͷϊϋ͕͍͍ͩͨ׆͔ͤͳ͍ •
͝Γ͝ΓʹΧελϚΠζࡁΈͩͱϚΠάϨࣄҊʹͳΔ
Gutenberg Migration Guide https://github.com/danielbachhuber/gutenberg-migration-guide
GutenbergͰ͑Δػೳɾஔ͞Εͨػೳ͕ݟΕΔ https://github.com/danielbachhuber/gutenberg-migration-guide
Ͳ͏มΘΔ͔ͳͲͷΨΠυ͋Δʢਵ࣌Ճʣ https://github.com/danielbachhuber/gutenberg-migration-guide/blob/master/action-media- buttons.md
GutenbergͰ͡ΊΔ ΤσΟλΧελϚΠζ
ΤσΟλͷΧελϚΠζํ๏ • ϓϥάΠϯɾςʔϚͷػೳͱ࣮ͯ͠ • ʮΧελϜϒϩοΫʯͱ͍͏໊લ • PHPͰGutenberg༻ͷJSΛϩʔυ • ݪଇReactͰΤσΟλΛ࣮͢Δ •
Gutenberg͕༻ҙ͍ͯ͠Δཁૉ͕͑Δ • WP-CLIΛ͏ͷ͕Ұ൪ετϨεͳ͘͡ΊΕΔ
WP-CLIΛ͏ # 1.5.0Ҏ্͕custom blockରԠ $ wp cli version WP-CLI 1.5.1
# ϓϥάΠϯΛ࡞ $ wp scaffold plugin YOUR_PLUGIN_NAME --skip-tests —activate # σΟϨΫτϦʹҠಈ $ CD YOUR_PLUGIN_NAME # ΧελϜϒϩοΫΛՃ $ wp scaffold block BLOCK_NAME —category=formatting --title="hello custom" -- plugin=YOUR_PLUGIN_NAME
wp scaffold blockͰੜ͞ΕΔϑΝΠϧ new file: blocks/BLOCK_NAME.php new file: blocks/BLOCK_NAME/editor.css new
file: blocks/BLOCK_NAME/index.js new file: blocks/BLOCK_NAME/style.css
BLOCKΛϓϥάΠϯ͔ΒಡΈࠐΉ <?php /** * Plugin Name: Guten Blocks * <தུ>
*/ require_once(plugin_dir_path( __FILE__ ) . 'blocks/ BLOCK_NAME.php' );
ϓϥάΠϯ༗ޮԽͰɺ࠷ॳͷΧελϜϒϩοΫ͕ొ͞ΕΔ
wp scaffold blockͰੜ͞ΕΔϑΝΠϧ new file: blocks/BLOCK_NAME.php JSCSSͷϩʔυΛઃఆ͢ΔPHP new file: blocks/BLOCK_NAME/editor.css
ΤσΟλଆͷCSS new file: blocks/BLOCK_NAME/index.js ϒϩοΫఆٛΛॻ͘ϑΝΠϧ new file: blocks/BLOCK_NAME/style.css ϑϩϯτଆͷCSS
wp scaffold blockͰੜ͞ΕΔϑΝΠϧ new file: blocks/BLOCK_NAME.php JSCSSͷϩʔυΛઃఆ͢ΔPHP new file: blocks/BLOCK_NAME/editor.css
ΤσΟλଆͷCSS new file: blocks/BLOCK_NAME/index.js ϒϩοΫఆٛΛॻ͘ϑΝΠϧ new file: blocks/BLOCK_NAME/style.css ϑϩϯτଆͷCSS
JS (React)ͬͯΔਓతʹɺES NextͰΓͨ͘ͳΔ registerBlockType( 'guten-blocks/first-block', { title: __( 'Hello custom'
), edit: function( props ) { return el( 'p', { className: props.className }, __( 'Hello from the editor!' ) ); },
webpack / babelͳͲͷઃఆɺgutenberg-examplesΛ https://github.com/WordPress/gutenberg-examples/
ΧελϜϒϩοΫ࡞࣌ʹ ͍ͬͯΔͱศརͳͷ
registerBlockTypeͰొ͢Δ const { registerBlockType } = wp.blocks; registerBlockType( “ωʔϜεϖʔε/ϒϩοΫ໊”, ϒϩοΫఆٛ
);
ϒϩοΫఆٛʹ࠷ݶඞཁͳͷ const Block = { title: ‘ϒϩοΫ໊’, category: ‘ϒϩοΫΧςΰϦ໊’, edit
() { return <div>ΤσΟλଆϒϩοΫ</div>; }, save() { return <div>ϑϩϯτଆϒϩοΫ</div>; } }
ΧςΰϦҎԼ͔ΒબͿ • common • formatting • layout • widgets •
embed ɹ-> ϒϩοΫͷදࣔҐஔΛܾΊΔ
ଟݴޠରԠPHPͷ࣌ͱಉ͡Α͏ʹͰ͖Δɻ const { __ } = wp.i18n; const Title =
() => ( <p> { __( ‘༁͞ΕΔςΩετ’) } </p> );
࠷ݶ͓͖͍ͬͯͨίΞཁૉʢԶௐʣ • wp.editor.RichText - σϑΥϧτͷςΩετϑΥʔϜ • wp.editor.MediaUpload - ϝσΟΞΞοϓϩʔμʔ •
wp.components.Button - WPΤσΟλͷϘλϯཁૉ • wp.editor.InspectorControls - ӈଆͷΠϯεϖΫλఆٛ • wp.components.PanelBody - ΠϯεϖΫλͷbodyͳͲʹ͑Δ൚༻ίϯϙʔωϯτ
ೖྗͷऔΓѻ͍ɿࣄલఆٛ attributes: { name: { type: 'array', source: 'children', },
}, edit() {
ೖྗͷऔΓѻ͍ɿΤσΟλ / อଘॲཧ edit( { attributes, setAttributes } ) {
return ( <RichText tagName=‘div’ value={attributes.name} onChange={name => setAttributes({name})} ) }, save( { attributes } ) { return <div>{attributes.name}</div> }
attributesͱ͍͏stateΛߋ৽ attributesͷΛsaveͰrender
template ͰσϑΥϧτදࣔͷϒϩοΫΛมߋͰ͖Δ function myplugin_register_book_post_type() { $args = array( 'public' =>
true, 'label' => 'Books', 'show_in_rest' => true, 'template' => array( array( 'core/image', array( 'align' => ‘left', ) ), array( 'core/heading', array( 'placeholder' => 'Add Author…', ) ), ), ); register_post_type( 'book', $args ); } add_action( 'init', 'myplugin_register_book_post_type' );
ಛఆͷϑΥʔϚοτͰͷΈࣥචՄೳʹͰ͖Δ
template_lock = ‘all’ͰϒϩοΫͷՃNGʹͰ͖Δ function myplugin_register_book_post_type() { $args = array( 'public'
=> true, 'label' => 'Books', 'show_in_rest' => true, 'template_lock' => 'all', 'template' => array( array( 'core/image', array( 'align' => ‘left', ) ), array( 'core/heading', array( 'placeholder' => 'Add Author…', ) ), ), ); register_post_type( 'book', $args ); } add_action( 'init', 'myplugin_register_book_post_type' );
ͦͷ΄͔ͷใιʔε
Handbook https://wordpress.org/gutenberg/handbook/
Handbook - Design Principles https://wordpress.org/gutenberg/handbook/reference/ design-principles/
Handbook - Coding Guidelines https://wordpress.org/gutenberg/handbook/reference/ coding-guidelines/
ΧελϜϑΟʔϧυ or ΧελϜϒϩοΫ
࣌ͱ߹ʹΑΔ
ΧελϜϑΟʔϧυͱΧελϜϒϩοΫ ΧελϜϒϩοΫ • + μΠφϛοΫͳΤσΟλUI͕࡞ΕΔ • + ೖྗͱग़ྗΛςʔϚʹґଘͤͣʹΧελϚΠζՄೳ • −
the_contentʹೖΔͨΊɺෳࡶͳݕࡧʹ͍ͮΒ͍ • − JavaScript (React)ྗΛٻΊΒΕΔ ΧελϜϑΟʔϧυ • + ͜Ε·Ͱͷϊϋ͕ͦͷ··͑Δ • + ೖྗ͞ΕͨσʔλΛෳࡶͳݕࡧʹར༻͍͢͠ʢ্ΑΓʣ • − the_contentʹೖΒͳ͍ͨΊɺग़ྗଆͷΧελϚΠζ͕ඞཁ • − wp_postmetaͷσʔλྔ૿ՃʹΑΔύϑΥʔϚϯεԼ
ΧελϜϑΟʔϧυͱΧελϜϒϩοΫ ΧελϜϒϩοΫ • + μΠφϛοΫͳΤσΟλUI͕࡞ΕΔ • + ೖྗͱग़ྗΛςʔϚʹґଘͤͣʹΧελϚΠζՄೳ • −
the_contentʹೖΔͨΊɺෳࡶͳݕࡧʹ͍ͮΒ͍ • − JavaScript (React)ྗΛٻΊΒΕΔ ΧελϜϑΟʔϧυ • + ͜Ε·Ͱͷϊϋ͕ͦͷ··͑Δ • + ೖྗ͞ΕͨσʔλΛෳࡶͳݕࡧʹར༻͍͢͠ʢ্ΑΓʣ • − the_contentʹೖΒͳ͍ͨΊɺग़ྗଆͷΧελϚΠζ͕ඞཁ • − wp_postmetaͷσʔλྔ૿ՃʹΑΔύϑΥʔϚϯεԼ
ΧελϜϑΟʔϧυͱΧελϜϒϩοΫ ΧελϜϒϩοΫ • + μΠφϛοΫͳΤσΟλUI͕࡞ΕΔ • + ೖྗͱग़ྗΛςʔϚʹґଘͤͣʹΧελϚΠζՄೳ • −
the_contentʹೖΔͨΊɺෳࡶͳݕࡧʹ͍ͮΒ͍ • − JavaScript (React)ྗΛٻΊΒΕΔ ΧελϜϑΟʔϧυ • + ͜Ε·Ͱͷϊϋ͕ͦͷ··͑Δ • + ೖྗ͞ΕͨσʔλΛෳࡶͳݕࡧʹར༻͍͢͠ʢ্ΑΓʣ • − the_contentʹೖΒͳ͍ͨΊɺग़ྗଆͷΧελϚΠζ͕ඞཁ • − wp_postmetaͷσʔλྔ૿ՃʹΑΔύϑΥʔϚϯεԼ
ʮͲͪΒ͔ʁʯ Ͱͳ͘ ʮͲͬͪʯ
ΤσΟλͷΧελϚΠζΛͲͬͪͰΔ͔ʁ ΧελϜϒϩοΫ͕ڧ͍໘ • ೖྗิॿΨΠυͳͲɺಈతʹมԽ͍ͤͨ͞߹ • ϝλσʔλʹอଘ͢Δ·Ͱͳ͍ใͷ߹ • ReactJSΛ͏ํ͕ૣ࣮͘Ͱ͖ͦ͏ͳ߹ ΧελϜϑΟʔϧυ͕ڧ͍໘ •
Search EverythingͳͲͰݕࡧ͍ͤͨ͞σʔλͷ߹ • WPςʔϚPHP(WPؔ)Ͱॲཧ͍ͤͨ͞σʔλͷ߹ • GutenbergҠߦͰ͖ͳ͍αΠτͷ߹
ΤσΟλͷΧελϚΠζΛͲͬͪͰΔ͔ʁ ΧελϜϒϩοΫ͕ڧ͍໘ • ೖྗิॿΨΠυͳͲɺಈతʹมԽ͍ͤͨ͞߹ • ϝλσʔλʹอଘ͢Δ·Ͱͳ͍ใͷ߹ • ReactJSΛ͏ํ͕ૣ࣮͘Ͱ͖ͦ͏ͳ߹ ΧελϜϑΟʔϧυ͕ڧ͍໘ •
Search EverythingͳͲͰݕࡧ͍ͤͨ͞σʔλͷ߹ • WPςʔϚPHP(WPؔ)Ͱॲཧ͍ͤͨ͞σʔλͷ߹ • GutenbergҠߦͰ͖ͳ͍αΠτͷ߹
ΤσΟλͷΧελϚΠζΛͲͬͪͰΔ͔ʁ ΧελϜϒϩοΫ͕ڧ͍໘ • ೖྗิॿΨΠυͳͲɺಈతʹมԽ͍ͤͨ͞߹ • ϝλσʔλʹอଘ͢Δ·Ͱͳ͍ใͷ߹ • ReactJSΛ͏ํ͕ૣ࣮͘Ͱ͖ͦ͏ͳ߹ ΧελϜϑΟʔϧυ͕ڧ͍໘ •
Search EverythingͳͲͰݕࡧ͍ͤͨ͞σʔλͷ߹ • WPςʔϚPHP(WPؔ)Ͱॲཧ͍ͤͨ͞σʔλͷ߹ • GutenbergҠߦͰ͖ͳ͍αΠτͷ߹
More publishing !