Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
React + contenteditable で作る魔のフォーム Gotanda.js #9
Search
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.1k
2024/7/11発刊!開発生産性の教科書がざっとわかるスライド 2024/06/20 / A Brief Overview of the Textbook on Development Productivity
ma3tk
0
330
開発生産性向上サービスを作るFindyが自分たちで開発生産性を爆上げした組織づくりの歩み / Findy's path to boosting its own development productivity 2024-04-17
ma3tk
3
8.2k
エンジニア向けにブログを書く上での考え方や信念 / engineer-blog-stance
ma3tk
2
3.7k
悩むのは当たり前!エンジニアが転職を考えた時の「悩み」を解決するには / 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
420
Other Decks in Technology
See All in Technology
2026TECHFRESH畢業分享會 - 葬送的通靈師:化系統與用戶雜訊成行動訊號
line_developers_tw
PRO
0
1.1k
AI駆動開発を通して感じた、 AI時代のデザイナーの役割変化
whisaiyo
3
2.2k
GitHub Copilot 最新アップデート – 「一歩先」の実践活用術
moulongzhang
4
1.2k
エラーバジェットのアラートのタイミングを考える.pdf
kairim0
0
150
攻撃者視点で考えるDetection Engineering
cryptopeg
3
1.9k
【NRUG vol.18】KubernetesにおけるNew Relicデータ取得量削減の考え方
nrug_member
0
150
手塩にかけりゃいいってもんじゃない
ming_ayami
0
590
FinOps × AIエージェントで実現する コストインシデントの自動調査
oasis1994liveforever
0
150
気軽に使える"情報のハブ"としてのNotion活用 〜フロー情報の集積点 と、 Claude Code × Notion AI〜
syucream
1
140
非エンジニアがClaudeと挑んだ「1ヶ月間プロダクト30本ノック」
askokc
0
600
AWS Security Agent といっしょに脅威モデリングをやってみよう
amarelo_n24
0
110
【NRUG vol.18】なぜ多くのオブザーバビリティ導入は失敗するのか
nrug_member
0
170
Featured
See All Featured
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
123
22k
Prompt Engineering for Job Search
mfonobong
0
350
Jess Joyce - The Pitfalls of Following Frameworks
techseoconnect
PRO
1
170
Product Roadmaps are Hard
iamctodd
PRO
55
12k
From Legacy to Launchpad: Building Startup-Ready Communities
dugsong
0
230
Designing for Timeless Needs
cassininazir
1
260
Keith and Marios Guide to Fast Websites
keithpitt
413
23k
世界の人気アプリ100個を分析して見えたペイウォール設計の心得
akihiro_kokubo
PRO
71
40k
Scaling GitHub
holman
464
140k
Building AI with AI
inesmontani
PRO
1
1.1k
jQuery: Nuts, Bolts and Bling
dougneiner
66
8.5k
Efficient Content Optimization with Google Search Console & Apps Script
katarinadahlin
PRO
1
620
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બΜ͡Όବ →͍͍Έ߹ΘͤҰॹʹߟ͑·͠ΐ͏ʂ͆