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
React + contenteditable で作る魔のフォーム Gotanda.js #9
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Masataka Sato
October 06, 2017
Technology
1.4k
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
React + contenteditable で作る魔のフォーム Gotanda.js #9
Masataka Sato
October 06, 2017
More Decks by Masataka Sato
See All by Masataka Sato
開発2日間!MCPを導入した 新サービスの裏側 2025/06/04 - Behind the Scenes of Our New Service with MCP Implementation - 2 Days of Development! June 4, 2025
ma3tk
1
1.1k
ファインディの4年にわたる技術的負債の返済 / Repaying 4 Years of Technical Debt at Findy
ma3tk
8
5.2k
2024/7/11発刊!開発生産性の教科書がざっとわかるスライド 2024/06/20 / A Brief Overview of the Textbook on Development Productivity
ma3tk
0
350
開発生産性向上サービスを作るFindyが自分たちで開発生産性を爆上げした組織づくりの歩み / Findy's path to boosting its own development productivity 2024-04-17
ma3tk
3
8.3k
エンジニア向けにブログを書く上での考え方や信念 / engineer-blog-stance
ma3tk
2
3.8k
悩むのは当たり前!エンジニアが転職を考えた時の「悩み」を解決するには / jobchanger-lt-engineer-nayami-solve-findy-muscle
ma3tk
1
3.6k
Refinement を使ってクラスを拡張してサービスに導入してみた話 / Extended Class with Refinement in Findy
ma3tk
2
190
Findyと筋肉とOSS
ma3tk
0
430
Other Decks in Technology
See All in Technology
「重なり」は迎える側がつくる ― 人もAIエージェントも歓迎するプロダクトエンジニアリング ―
go0517go
PRO
0
280
多層防御と最⼩権限で実現する、安全なAIエージェント設計パターン
lycorptech_jp
PRO
1
270
Multica × 長期記憶:40個のミニプロジェクト管理
eiei114
1
250
OpenTelemetryのメトリクスをCloudWatchに送ってPromQLで見てみた
ota1022
0
120
幾何アルゴリズムで なめらかなピン操作を / iOSDC Japan 2026 / smoothpin
kazumanagano
0
270
AI時代、データエンジニアが一番おもろい
genshun9
0
130
2026-09-10 【Snowflake World Tour Tokyo 2026】dbt Core と Snowflake で実現する多層的なデータガバナンス / Multi-Layered Data Governance Powered by dbt Core and Snowflake
civitaspo
0
340
From Vanilla Kubernetes to a Batteries-Included Platform: Developer Experience at 1,300+ Clusters
yosshi_
0
690
Claude in Chrome 入門 / Introduction to Claude in Chrome
cielo1985
0
450
AIとペアプロを始める。人とのペアプロをやめる。ペアプロの良さを改めて知る。もっと好きになった。 / Rediscovering Pair Programming
honyanya
1
350
NW運用でNWトポロジ可視化ツールに期待すること/shumoku-meetup1
corestate55
2
120
AI時代に顧客へ最速で価値を 届けるための試行錯誤 〜「AI × マネジメント」領域におけるmentoのケース〜
posterkeisuke
0
110
Featured
See All Featured
Why Mistakes Are the Best Teachers: Turning Failure into a Pathway for Growth
auna
0
270
Digital Ethics as a Driver of Design Innovation
axbom
PRO
1
420
AI Search: Where Are We & What Can We Do About It?
aleyda
0
7.9k
Paper Plane
katiecoart
PRO
3
53k
The innovator’s Mindset - Leading Through an Era of Exponential Change - McGill University 2025
jdejongh
PRO
1
330
Site-Speed That Sticks
csswizardry
13
1.5k
16th Malabo Montpellier Forum Presentation
akademiya2063
PRO
0
370
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
25
2.1k
Large-scale JavaScript Application Architecture
addyosmani
515
110k
Stewardship and Sustainability of Urban and Community Forests
pwiseman
0
520
Efficient Content Optimization with Google Search Console & Apps Script
katarinadahlin
PRO
1
850
Statistics for Hackers
jakevdp
799
230k
Transcript
Copyright(C) 2017 Findy Inc. All rights reserved. React + Contenteditable
Ͱ࡞Δ ຐͷϑΥʔϜ CTO ࠤ౻ কߴ (@ma3tk) 2017/10/06(ۚ) Gotanda.js
Copyright(C) 2017 Findy Inc. All rights reserved. 2 ࠓͷൃදʹ͍ͭͯ •
ޒాͷάϧϝใʹ͍͓ͭͯ͠·ͤΜ(?) • ଜ্य़थ͕͍ͭϊʔϕϧจֶ͕औΕΔ͔ʹ͍ͭͯ ͠·ͤΜ • React Ͱ WYSIWYG ͳΤσΟλ(ϑΥʔϜ)Λ࡞ͬͯ ਏ͔ͬͨ(ݱࡏਐߦܥ)ͱ͍͏͓Λ͠·͢
Copyright(C) 2017 Findy Inc. All rights reserved. Զ is ୭
3 ϑΝΠϯσΟגࣜձࣾ औకCTOɿࠤ౻ কߴ ɹ·ͨ͞Μ (@ma3tk) ޒా.js ͡Ίͯ ౦ژେֶใཧֶܥݚڀՊใֶઐ߈ଔۀޙɺάϦʔΛܦͯ FindyͷۀʹࢀըɻେֶӃͰɺҴ༿ਅཧݚڀࣨʹॴଐɻաڈ10 ͷจʹର͠จؒͷྨࣅΛɺࣗવݴޠॲཧσʔλϚΠχϯάʹ ΑΓ༰ͷղੳΛఆྔతɾఆੑతʹߦ͏͜ͱͰࢉग़͢ΔจΛࣥචɻ άϦʔͰήʔϜϓϥοτϑΥʔϜͷ։ൃɺNativeήʔϜͷ։ൃɺQA ΤϯδχΞΛܦݧ͠ɺϑϩϯτΤϯυ͔ΒόοΫΤϯυ·Ͱ։ൃʹਫ਼ ௨͍ͯ͠ΔɻےτϨ͕͖ɻ࠷ۙݞτϨʹϋϚ͍ͬͯΔɻB:100 D: 130 S:130
Copyright(C) 2017 Findy Inc. All rights reserved. ͓Ͷ͕͍ 4 ͓खॊΒ͔ʹ
͓ئ͍͠·͢
Copyright(C) 2017 Findy Inc. All rights reserved. 5 Findy Score
ग़ͨ͠ • اۀͷਓࣄ͚ϓϩμΫτ • ืूཁ߲ͷςΩετΛೖΕΔͱɺ ʮ100ຬதԿͷग़དྷ͔ʯ͕Θ͔ΔϑΥʔϜ • 20169݄ϦϦʔε
Copyright(C) 2017 Findy Inc. All rights reserved. ߏ ׂΓͱϞμϯ 6
ϑϩϯτΤϯυ • ES2015 • React • Redux • Webpack όοΫΤϯυ • Ruby on Rails (API௨৴) • Heroku • AWS
Copyright(C) 2017 Findy Inc. All rights reserved. ͜ͷαʔϏεͷʹͱͬͯͷٕज़తͳπϥϛ 7 • Contenteditable
• ॳReactαʔϏε
Copyright(C) 2017 Findy Inc. All rights reserved. ͜ͷαʔϏεͷʹͱͬͯͷٕज़తͳπϥϛ 8 Ͳ͕͜ਏ͍ʁ
Copyright(C) 2017 Findy Inc. All rights reserved. 9 ਏ͍ͱ͜Ζ
Copyright(C) 2017 Findy Inc. All rights reserved. 10 ਏ͍ͱ͜Ζ ⊗͜͜
Copyright(C) 2017 Findy Inc. All rights reserved. ⛈ Contenteditable 11
Έͳ͞Μ Contenteditable ͬͯͬͯ·͔͢ʁ
Copyright(C) 2017 Findy Inc. All rights reserved. ⛈ Contenteditable ྫ1
12
Copyright(C) 2017 Findy Inc. All rights reserved. ⛈ Contenteditable ྫ2
13
Copyright(C) 2017 Findy Inc. All rights reserved. ⛈ Contenteditable ྫ3
14
Copyright(C) 2017 Findy Inc. All rights reserved. Contenteditable ਖ਼ମ 15
Copyright(C) 2017 Findy Inc. All rights reserved. Contenteditable ͷਖ਼ମ ଐੑ
16
Copyright(C) 2017 Findy Inc. All rights reserved. Contenteditable ͷ༷ 17
ࢀߟ: https://developer.mozilla.org/ja/docs/Web/HTML/Global_attributes/contenteditable
Copyright(C) 2017 Findy Inc. All rights reserved. ཁ݅ 18 কདྷతʹ
• ςΩετϋΠϥΠτ • ғ͍ • Օॻ͖ • ݟग़͠ ͳͲʹରԠͨ͠αʔϏεʹ͍ͨ͠ ※తʹஅ೦ͨ͠··Ͱ͢ɻ ୭͔ʙʙ
Copyright(C) 2017 Findy Inc. All rights reserved. ཁ݅ 19 ʹWYSIWYG
ΤσΟλΛ࡞Δඞཁ͕͋Δ
Copyright(C) 2017 Findy Inc. All rights reserved. / Ϣʔβ 20
Ϣʔβతʹ • IEରԠඞਢ(ਏ͍) • ςΩετͷίϐϖ͕͋ΔͷͰσʔ λΛਖ਼͘͠insertͰ͖ΔΑ͏ʹ • UIʹ͢ΔͨΊʹϚεΦʔ όʔରԠ
Copyright(C) 2017 Findy Inc. All rights reserved. Contenteditable + IE
21
Copyright(C) 2017 Findy Inc. All rights reserved. ⛄ IE ͷಠ༷ࣗʹΑΓ
Clipboard API ͡Όͳ͍͠ίϚϯυ͕ҧ͏ 22 https://qiita.com/saitoxu/items/b317ccde7e2af9797288
Copyright(C) 2017 Findy Inc. All rights reserved. IE Ͱվߦ͢Δͱ <br>
Ͱͳ͘ <p></p> Ͱғ·ΕΔ 23 https://stackoverflow.com/questions/2057881/avoid-ie-contenteditable-element-to-create-paragraphs-on-enter-key
Copyright(C) 2017 Findy Inc. All rights reserved. Contenteditable + IE
24 IEਏ͍ ※ͷ࣮ྗෆ
Copyright(C) 2017 Findy Inc. All rights reserved. Contenteditable ͚ͩͰͳ͔ͳ͔ਏ͍ 25
• ΧʔιϧΛҠಈͨ࣌͠ͷѻ͍ ◦ https://engineering.linecorp.com/ja/blog/detail/145 • HTML Λอଘͨ͠ࡍʹܗ͞Εͯ ͍ͳ͍ͱ͍͚ͳ͍ ◦ ݺͼग़͢ͱXSSʹͳͬͯ͠·͏ ◦ http://www.bokukoko.info/entry/2017/10/02/191614 • ϚεΦʔόʔɺΩʔϘʔυ γϣʔτΧοτ……
Copyright(C) 2017 Findy Inc. All rights reserved. Contenteditable Tsurai 26
Contenteditable ਏ͍ ※ͷ࣮ྗෆ
Copyright(C) 2017 Findy Inc. All rights reserved. 2. React 27
React
Copyright(C) 2017 Findy Inc. All rights reserved. Reactྺ 28 •
ॳReactαʔϏε • ʮReact͔͚ͬʔ͆͆͆ʯ • npmɺjQueryɺES6ɺ TypeScript͋ͨΓࣄͰ৮ͬ ͯͨ • JSྺʮࠓ19:40Ͱ͢ʂʯͱ ͍ͬͨจݴΛग़͋ͨ͢Γ͔Β ͑Ε20ۙ͘৮ͬͯΔݴޠ
Copyright(C) 2017 Findy Inc. All rights reserved. React ͱϑΥʔϜ 29
• React ͰϑΥʔϜૢ࡞͢Δͷਏ͘ͳ͍Ͱ ͔͢ʁ • ϑΥʔϜܥͷେม͞ ॳظ ೖྗorอଘϘλϯʹΑΔσʔλߋ৽ … ⇛保持用のhiddenςΩετΤϦΞor ॳظϨ ϯμϦϯάޙʹॳظऔ͖ͬͯͯ div ʹຒ ΊࠐΉ ͲͪΒ͔ͷղܾࡦ
Copyright(C) 2017 Findy Inc. All rights reserved. React ͱϑΥʔϜͱContenteditable 30
• React + Contenteditableͳ͔ ͳ͔େม • Virtual DOM ͳͷͰɺϖʔετ ͢ΔࡍʹHTMLೖΕΒΕͳ͍ React.createElement dangerouslySetInnerHTML={{__ html: text}}
Copyright(C) 2017 Findy Inc. All rights reserved. ϥΠϒϥϦͳ͍ͷʁ 31 •
https://github.com/lovasoa/react- contenteditable • IE11ʂʁ ࠷ۙ͋ΔΈ͍ͨ ࠓίϛοτ͠ΐ…
Copyright(C) 2017 Findy Inc. All rights reserved. ҰݴͰݴ͏ͱ 32 React
ͰϑΥʔϜपΓͷ੍ޚ͠ͳ ͕ΒɺContenteditable Λͬͯ WYSIWYG ΤσΟλͱͯ͠ײత ʹ͑ΔΑ͏ʹ࣮ͯ͠ͳ͓͔ͭ IEରԠ͠ͳ͕Βɺαʔόʹอଘ ͢Δࡍʹ XSS ͕ൃੜ͠ͳ͍Α͏ ʹؾΛ͚ͭΔҊ݅ͱԽͨ͠
Copyright(C) 2017 Findy Inc. All rights reserved. ⭕ ·ͱΊ 33
·ͱΊ
Copyright(C) 2017 Findy Inc. All rights reserved. ⭕ ·ͱΊ 34
• ͦͦ React ͰϑΥʔϜૢ࡞͢Δͷ͕ େม • ͦͷ্ʹ Contenteditable ͱ͍͏ةͳ͍ ڮΛΔ͜ͱେม →ͬͱ͍͍Έ߹Θͤ͋ͬͨؾ͕͢Δ →ྲྀߦΓͩ͠ʙͬͯReactબΜ͡Όବ →͍͍Έ߹ΘͤҰॹʹߟ͑·͠ΐ͏ʂ͆