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
Gitは怖い?共有ワークスペースから始めるSnowflakeチーム開発
coco_se
0
200
おい、エージェントを使って終わらせろ
nwiizo
0
180
フルカイテン株式会社 エンジニア向け採用資料
fullkaiten
0
12k
GoにおけるFFIのこれまでとこれから
goccy
5
2.7k
日経電子版を支えていく Kasane Design System/fec_fukuoka
nikkei_engineer_recruiting
0
1.4k
Claude in Chrome 入門 / Introduction to Claude in Chrome
cielo1985
0
710
AIを活用するために決めた "やらないこと" - 価値に注目する / Not betting on AI
soudai
PRO
1
490
コスト最適化の「めんどくさい」を AWS FinOps Agent でチョット楽にする
classmethod_kaz
0
340
Deployment の 先にある AI Agent 基盤 - kagent vNext、Agent Substrate、Hermes から読み解く Agent Runtime の現在地 / k8s-matsuri-2-ai-agent-platform-amsy810
masayaaoyama
3
470
DEFCON_CHV_CTF_Write-up.pdf
bata_24
0
150
株式会社シーエーシー エンジニア向け会社紹介資料
cac
0
57k
AIオーケストレーションを活用した 開発ワークフローの設計と実践
bqnq
0
180
Featured
See All Featured
Fashionably flexible responsive web design (full day workshop)
malarkey
408
67k
The SEO identity crisis: Don't let AI make you average
varn
0
560
How STYLIGHT went responsive
nonsquared
100
6.3k
Embracing the Ebb and Flow
colly
88
5.2k
sira's awesome portfolio website redesign presentation
elsirapls
0
410
Learning to Love Humans: Emotional Interface Design
aarron
275
41k
Sam Torres - BigQuery for SEOs
techseoconnect
PRO
0
540
The innovator’s Mindset - Leading Through an Era of Exponential Change - McGill University 2025
jdejongh
PRO
1
330
How Fast Is Fast Enough? [PerfNow 2025]
tammyeverts
3
880
Beyond borders and beyond the search box: How to win the global "messy middle" with AI-driven SEO
davidcarrasco
3
240
How to Talk to Developers About Accessibility
jct
2
540
The MySQL Ecosystem @ GitHub 2015
samlambert
251
13k
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બΜ͡Όବ →͍͍Έ߹ΘͤҰॹʹߟ͑·͠ΐ͏ʂ͆