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
340
開発生産性向上サービスを作る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
Retriever と Reranker、結局どうする?
kazuaki
2
610
13年運用タイトルのサーバーサイドが辿り着いた現在地 ― モンスターストライクにおける技術・組織・AI活用から得た知見
mixi_engineers
PRO
1
420
Data Hubグループ 紹介資料
sansan33
PRO
0
3.1k
最高のシステムプロンプトを作るためにフィードバック機能を導入した話
alchemy1115
1
290
20260801_スクフェス大阪
kgnkhkr
1
1k
SnowflakeCoCoでデータエンジニアリング!
foursue
0
130
歴史から理解するクラウドインフラのしくみ
kizawa2020
1
200
今こそ聞きたいソフトウェア設計 ドメイン駆動設計再入門
masuda220
PRO
5
540
もう一度考える SRE チームの作り方・育て方 / Rethinking SRE #1: Building and Growing SRE Teams
rrreeeyyy
5
910
ウォーターフォール開発案件のPMとしてAI活用を模索している話
hatahata021
3
270
DevOps Agentで運用判断をチーム資産にする~Agent InstructionsとAgent Skillを継続的に育てる~
fujioka6789
0
200
ガバメントクラウドでのランサムウェア対策
techniczna
1
640
Featured
See All Featured
What does AI have to do with Human Rights?
axbom
PRO
1
2.3k
A Guide to Academic Writing Using Generative AI - A Workshop
ks91
PRO
1
360
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
141
35k
Balancing Empowerment & Direction
lara
6
1.2k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
234
17k
The Curious Case for Waylosing
cassininazir
1
440
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
21
1.6k
Agile Actions for Facilitating Distributed Teams - ADO2019
mkilby
0
230
Darren the Foodie - Storyboard
khoart
PRO
3
3.5k
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
12
1.2k
Joys of Absence: A Defence of Solitary Play
codingconduct
1
420
How People are Using Generative and Agentic AI to Supercharge Their Products, Projects, Services and Value Streams Today
helenjbeal
1
260
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બΜ͡Όବ →͍͍Έ߹ΘͤҰॹʹߟ͑·͠ΐ͏ʂ͆