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.2k
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
フィジカルAIの知識ゼロの僕でも AIを使えばここまでできた
tatsuya1970
0
200
形式手法特論:Hyperproperty とモデル検査 #kernelvm / Kernel VM Study Tokyo 19th
ytaka23
1
880
When Token Pruning is Worse than Random: Understanding Visual Token Information in VLLMs
sansantech
PRO
0
130
RapidCopy2 Matrix I/Oエンジンによるファイルコピーソフトウェアの設計と実装
kengosawa2
1
480
指示待ちから変化に応じるClaude Codeへ!~環境からAgentへの帰り道を作る~
gotalab555
7
1.5k
Introduction to Sansan Meishi Maker Development Engineer
sansan33
PRO
0
460
Cloudflare製品を活用した AIガバナンス実践入門 / AI governance with Cloudflare Service
delta_tech
1
120
atproto spaces概要
yamarten
0
110
Introduction to Sansan, inc / Sansan Global Development Center, Inc.
sansan33
PRO
0
3.2k
APIセキュリティを組織で実現するには~注力する点と設計・実装に入れたい対策~
riiimparm
2
700
EMの役割で 変わったこと・変わらなかったこと
sansantech
PRO
0
190
500名弱規模の組織のPythonプロジェクト(dbt) をどう管理するか?
hiracky16
0
360
Featured
See All Featured
Measuring & Analyzing Core Web Vitals
bluesmoon
9
970
Ethics towards AI in product and experience design
skipperchong
2
350
Fantastic passwords and where to find them - at NoRuKo
philnash
52
3.8k
Leo the Paperboy
mayatellez
8
2.2k
AI: The stuff that nobody shows you
jnunemaker
PRO
9
950
Joys of Absence: A Defence of Solitary Play
codingconduct
1
450
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
128
56k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
35
2.6k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
25
2k
Scaling GitHub
holman
464
140k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
28
3.6k
Collaborative Software Design: How to facilitate domain modelling decisions
baasie
1
290
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બΜ͡Όବ →͍͍Έ߹ΘͤҰॹʹߟ͑·͠ΐ͏ʂ͆