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
HTML5 Editor - LightningTalk at Paris JS
Search
sgruhier
January 25, 2012
Programming
110
3
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
HTML5 Editor - LightningTalk at Paris JS
How to make a simple HTML editor without TinyMCE
sgruhier
January 25, 2012
More Decks by sgruhier
See All by sgruhier
Maptimize - ElasticSearch
sgruhier
2
200
coffeescript.pdf
sgruhier
2
460
Other Decks in Programming
See All in Programming
Contextとはなにか
chiroruxx
1
380
Spring Security 実践 ─ GraphQL APIで実務に役立つ 認証・認可 を学ぶ
wagyu
0
260
Make SRE Operations Easier with Azure SRE Agent
kkamegawa
0
8.3k
LLM本来の能力を解き放つサンドボックス技術とAI民主化への適用
yukukotani
3
4.6k
Agentic UI
manfredsteyer
PRO
0
200
The ROI of Quarkus for Spring Boot Applications
hollycummins
0
140
The NotImplementedError Problem in Ruby
koic
1
950
Datadog LLM Observabilityで実現する 安全なLLM Usage 管理
3150
0
120
Even G2とAWSで推しのエージェントを召喚しよう!
har1101
1
130
その問い、本当に正しいですか?AI時代のエンジニアに必要な哲学と認知科学 / ai-philosophy-cognitive-science
minodriven
14
6.3k
コンテキストの使い捨てをやめる — ビジネスルール駆動開発と miko —
ioki
0
240
Vite+ Unified Toolchain for the Web
naokihaba
0
360
Featured
See All Featured
Mozcon NYC 2025: Stop Losing SEO Traffic
samtorres
1
260
The SEO identity crisis: Don't let AI make you average
varn
0
500
Game over? The fight for quality and originality in the time of robots
wayneb77
1
210
Optimising Largest Contentful Paint
csswizardry
37
3.7k
How Fast Is Fast Enough? [PerfNow 2025]
tammyeverts
3
620
The Illustrated Children's Guide to Kubernetes
chrisshort
51
52k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
34
2.8k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
32
2.9k
Optimizing for Happiness
mojombo
378
71k
Reality Check: Gamification 10 Years Later
codingconduct
0
2.2k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
12
1.7k
HTML-Aware ERB: The Path to Reactive Rendering @ RubyCon 2026, Rimini, Italy
marcoroth
2
250
Transcript
Editeur HTML(5) Sébastien Gruhier - xilinus.com 25/01/2012 Wednesday, January 25,
12
Solutions existantes Wednesday, January 25, 12
TinyMCE • 15000 lignes de code (sans les plugins) •
500 KO (200 KO minifié) Wednesday, January 25, 12
TinyMCE Wednesday, January 25, 12
TinyMCE $().ready(function() { $('textarea.tinymce').tinymce({ // Location of TinyMCE script script_url
: '../jscripts/tiny_mce/tiny_mce.js', // General options theme : "advanced", plugins : "", // Theme options theme_advanced_buttons1 : "bold,italic,underline", theme_advanced_buttons2 : "", theme_advanced_buttons3 : "", theme_advanced_buttons4 : "", theme_advanced_toolbar_location : "top", theme_advanced_toolbar_align : "left", theme_advanced_statusbar_location : "", theme_advanced_resizing : false, content_css : "css/content.css" }); }); Wednesday, January 25, 12
HTML(5) • contenteditable • Ajouté par microsoft en 2000 dans
IE 5.5 !! • Firefox 3, Safari 3, Opera 9, Google Chrome • execCommand • http://www.quirksmode.org/dom/execCommand.html • http://www.quirksmode.org/dom/execCommand/ Wednesday, January 25, 12
contentEditable Wednesday, January 25, 12
contenteditable <!doctype html> <html> <head> " <title>Demo contenteditable</title>" <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<style> #edit { width: 500px; height: 300px; border: 1px solid #DDD; outline:none; padding: 5px; } </style> </head> <body> <div id="edit" contenteditable></div> <div id="controls"> <input type="button" value="B" id="b"/> <input type="button" value="U" id="u"/> <input type="button" value="I" id="i"/> </div> <script> $('#b').click(function(event) { document.execCommand('bold', false, ''); return false; }); $('#i').click(function(event) { document.execCommand('italic', false, ''); return false; }); $('#u').click(function(event) { document.execCommand('underline', false, ''); return false; }); </script> </body> </html> http://xilinus.com//demos/contenteditable.html Wednesday, January 25, 12
BackboneJS/BrunchWithCoffee • Utilisation du localStorage • Utilisation de keymaster.js pour
⌘+b, ⌘+i, ⌘+u Wednesday, January 25, 12
http://xilinus.com/demos/contenteditable_bwc/ editorTemplate = require('templates/editor') class exports.EditorView extends Backbone.View tagName: "div"
className: "editor" events: 'click .control_B': 'bold' 'click .control_I': 'italic' 'click .control_U': 'underline' 'click .save' : 'save' initialize: ()-> key('⌘+b, ctrl+b', @bold) key('⌘+i, ctrl+i', @italic) key('⌘+u, ctrl+u', @underline) $(@el).delegate('.message', 'keyup', @save) bold: () -> document.execCommand('bold', false, '') false italic: () -> document.execCommand('italic', false, '') false underline: () -> document.execCommand('underline', false, '') false save: (event) => @model.set(text: @$(".message").html()).save() render: () -> $(@el).html editorTemplate() @$(".message").html(@model.get('text')) @$(".message").attr('contenteditable', true) @ Wednesday, January 25, 12