SlideShare a Scribd company logo
1 of 30
Download to read offline
Wysiwig on Rails
Roppongi.rb#1
@__timakin__ / timakin
Hello!
• timakin / @__timakin__
• Ruby / Node / Go
• https://medium.com/@timakin
• tech-savvy.hatenablog.com
Wysiwig
Wysiwig
•
•
•
•
Wysiwyg
•
•
•
• edit / view
Wysiwig on Rails
Wysiwyg Rails
• CKE Editor
• Squire
• Froala Editor
• Bootsy
• Redactor
• Medium-Editor
CKE Editor
CKE Editor
•
• WordPress
• Rails Carrierwave/PaperClip
• Plugin Rails config
•
Squire
Squire
•
•
•
textarea
iframe
Froala Editor
Froala Editor
•
•
• S3 ( or Froala
Storage )
• input
Bootsy
Bootsy
• Rails i18n
• Squire
• Carrierwave bootstrap-wysihtml5
Redactor
Redactor
•
• Video insert (Embed tag ) / Table
view / File upload
•
Medium-Editor
Medium-Editor
• Medium
•
• edit
Wysiwyg Rails
• CKE Editor
• Squire
• Froala Editor
• Bootsy
• Redactor
• Medium-Editor
Wysiwyg Rails
• CKE Editor
• Squire
• Froala Editor
• Bootsy
• Redactor
• Medium-Editor
Wysiwyg Rails
• CKE Editor
• Squire
• Froala Editor
• Bootsy
• Redactor
• Medium-Editor
Dante-Editor
Dante-Editor
• Medium-Editor Medium
• Image upload, video, social embed /
• iframe
url embedly
• S3 API js
• div value form hidden_field
• gem
image upload
class ApiController < ApplicationController
protect_from_forgery with: :null_session
def upload_image
s3 = Aws::S3::Resource.new(region: ENV['AWS_REGION'], access_key_id: ENV['AWS_ACCESS_KEY_ID'],
secret_access_key: ENV['AWS_SECRET_ACCESS_KEY'])
case Rails.env
when 'production'
obj = s3.bucket(ENV['SACKET_FOG_PRODUCTION_DIRECTORY']).object("images/embedded/
#{SecureRandom.hex(8)}")
when 'staging'
obj = s3.bucket(ENV['SACKET_FOG_STAGING_DIRECTORY']).object("images/embedded/#{SecureRandom.hex(8)}")
when 'development'
obj = s3.bucket(ENV['SACKET_FOG_STAGING_DIRECTORY']).object("images/embedded/#{SecureRandom.hex(8)}")
end
obj.upload_file(params[:file].tempfile, acl: 'public-read')
render json: { status: :ok, data: obj.public_url }
end
end
form
editor = new Dante.Editor(
{
el: "#editor",
disable_title: true,
upload_url: "/api/upload_image",
base_widgets: ["uploader", "embed"],
oembed_url: "http://api.embed.ly/1/oembed?key=hogehoge"
}
);
editor.start()
$(document).ready(function(){
$("#editor").bind("input properchange", function(){
$("#text_" + $(this).attr("data-field-id")).val($(this).html())
});
});
#
var embedTemplate = function() {
return "<figure contenteditable='false' class='graf--figure graf--iframe
graf--first' name='504e' tabindex='0'> <div class='iframeContainer'>
<iframe frameborder='0' width='700' height='393' data-media-id='' src=''
data-height='480' data-width='854'> </iframe> </div> <figcaption
contenteditable='true' data-default-value='Type caption for embed
(optional)' class='imageCaption'> <a rel='nofollow' class='markup--anchor
markup--figure-anchor' data-href='' href='' target='_blank'> </a> </
figcaption> </figure>";
};
var oembed_url = "http://api.embed.ly/1/oembed?
key=c6fc4f62de674f8a8ee60a7cbea1e13d&url=";
$(function(){
var node = $(".is-embedable");
var node_name = node.attr('name');
if (node.text())
{
console.log(node.text());
return $.getJSON("" + oembed_url + (node.text())).success((function(_this) {
return function(data) {
var iframe_src, replaced_node, tmpl, url;
var node = $("[name=" + node_name + "]");
node.hide();
iframe_src = $(data.html).prop("src");
tmpl = $(embedTemplate());
tmpl.attr("name", node.attr("name"));
$(node).replaceWith(tmpl);
replaced_node = $(".graf--iframe[name=" + (node.attr("name")) + "]");
replaced_node.find("iframe").attr("src", iframe_src);
url = data.url || data.author_url;
replaced_node.find(".markup--anchor").attr("href", url).text(url);
};
})(this)).error((function(_this) {
return function(res) {
console.log(res);
};
})(this));
}
});
•
Dante-Editor
• Rails gem
Carrierwave
js

More Related Content

What's hot

Making maven and grunt play nice
Making maven and grunt play niceMaking maven and grunt play nice
Making maven and grunt play niceZoran Nikolovski
 
eMusic: WordPress in the Enterprise
eMusic: WordPress in the EnterpriseeMusic: WordPress in the Enterprise
eMusic: WordPress in the EnterpriseScott Taylor
 
SPSNJ 2014: EmberJS & SharePoint
SPSNJ 2014: EmberJS & SharePointSPSNJ 2014: EmberJS & SharePoint
SPSNJ 2014: EmberJS & SharePointGreg Hurlman
 
2010.09.02 LT Doc fluxflex on JAWS-UG
2010.09.02 LT Doc fluxflex on JAWS-UG2010.09.02 LT Doc fluxflex on JAWS-UG
2010.09.02 LT Doc fluxflex on JAWS-UGHiro Fukami
 
Riding IronRuby on Rails
Riding IronRuby on RailsRiding IronRuby on Rails
Riding IronRuby on RailsShay Friedman
 
Ember and SharePoint
Ember and SharePointEmber and SharePoint
Ember and SharePointGreg Hurlman
 
In-house web automation?
In-house web automation?In-house web automation?
In-house web automation?Adam Christian
 
Better framework, better life
Better framework, better lifeBetter framework, better life
Better framework, better lifeDaniel Lv
 
Better Framework Better Life
Better Framework Better LifeBetter Framework Better Life
Better Framework Better Lifejeffz
 
WordPress Development Environments
WordPress Development EnvironmentsWordPress Development Environments
WordPress Development EnvironmentsJosh Cummings
 
DeveloperDeveloperDeveloper! Sydney 2012
DeveloperDeveloperDeveloper! Sydney 2012DeveloperDeveloperDeveloper! Sydney 2012
DeveloperDeveloperDeveloper! Sydney 2012kittenthecat
 
Building Elixir App Release with Distillery and Docker
Building Elixir App Release with Distillery and DockerBuilding Elixir App Release with Distillery and Docker
Building Elixir App Release with Distillery and DockerMickey Chen
 
2015 WordCamp Maine Keynote
2015 WordCamp Maine Keynote2015 WordCamp Maine Keynote
2015 WordCamp Maine KeynoteScott Taylor
 
Angular2 + AWS Lambdaでサーバサイドレンダリングしてみた
Angular2 + AWS LambdaでサーバサイドレンダリングしてみたAngular2 + AWS Lambdaでサーバサイドレンダリングしてみた
Angular2 + AWS Lambdaでサーバサイドレンダリングしてみた暁 三宅
 
Live Coverage at The New York Times
Live Coverage at The New York TimesLive Coverage at The New York Times
Live Coverage at The New York TimesScott Taylor
 
Deployment Nirvana
Deployment NirvanaDeployment Nirvana
Deployment NirvanaAdrian Pike
 

What's hot (20)

Making maven and grunt play nice
Making maven and grunt play niceMaking maven and grunt play nice
Making maven and grunt play nice
 
eMusic: WordPress in the Enterprise
eMusic: WordPress in the EnterpriseeMusic: WordPress in the Enterprise
eMusic: WordPress in the Enterprise
 
[Start] Playing
[Start] Playing[Start] Playing
[Start] Playing
 
SPSNJ 2014: EmberJS & SharePoint
SPSNJ 2014: EmberJS & SharePointSPSNJ 2014: EmberJS & SharePoint
SPSNJ 2014: EmberJS & SharePoint
 
2010.09.02 LT Doc fluxflex on JAWS-UG
2010.09.02 LT Doc fluxflex on JAWS-UG2010.09.02 LT Doc fluxflex on JAWS-UG
2010.09.02 LT Doc fluxflex on JAWS-UG
 
Riding IronRuby on Rails
Riding IronRuby on RailsRiding IronRuby on Rails
Riding IronRuby on Rails
 
Ember and SharePoint
Ember and SharePointEmber and SharePoint
Ember and SharePoint
 
ASP.NET MVC
ASP.NET MVCASP.NET MVC
ASP.NET MVC
 
Signature
SignatureSignature
Signature
 
Working with Git
Working with GitWorking with Git
Working with Git
 
In-house web automation?
In-house web automation?In-house web automation?
In-house web automation?
 
Better framework, better life
Better framework, better lifeBetter framework, better life
Better framework, better life
 
Better Framework Better Life
Better Framework Better LifeBetter Framework Better Life
Better Framework Better Life
 
WordPress Development Environments
WordPress Development EnvironmentsWordPress Development Environments
WordPress Development Environments
 
DeveloperDeveloperDeveloper! Sydney 2012
DeveloperDeveloperDeveloper! Sydney 2012DeveloperDeveloperDeveloper! Sydney 2012
DeveloperDeveloperDeveloper! Sydney 2012
 
Building Elixir App Release with Distillery and Docker
Building Elixir App Release with Distillery and DockerBuilding Elixir App Release with Distillery and Docker
Building Elixir App Release with Distillery and Docker
 
2015 WordCamp Maine Keynote
2015 WordCamp Maine Keynote2015 WordCamp Maine Keynote
2015 WordCamp Maine Keynote
 
Angular2 + AWS Lambdaでサーバサイドレンダリングしてみた
Angular2 + AWS LambdaでサーバサイドレンダリングしてみたAngular2 + AWS Lambdaでサーバサイドレンダリングしてみた
Angular2 + AWS Lambdaでサーバサイドレンダリングしてみた
 
Live Coverage at The New York Times
Live Coverage at The New York TimesLive Coverage at The New York Times
Live Coverage at The New York Times
 
Deployment Nirvana
Deployment NirvanaDeployment Nirvana
Deployment Nirvana
 

Viewers also liked

Concept of BlockChain & Decentralized Application
Concept of BlockChain & Decentralized ApplicationConcept of BlockChain & Decentralized Application
Concept of BlockChain & Decentralized ApplicationSeiji Takahashi
 
お前なんかハッカーじゃない╭( ・ㅂ・)و ̑̑
お前なんかハッカーじゃない╭( ・ㅂ・)و ̑̑お前なんかハッカーじゃない╭( ・ㅂ・)و ̑̑
お前なんかハッカーじゃない╭( ・ㅂ・)و ̑̑Seiji Takahashi
 
Blockchain: The Information Technology of the Future
Blockchain: The Information Technology of the FutureBlockchain: The Information Technology of the Future
Blockchain: The Information Technology of the FutureMelanie Swan
 
アクセシビリティはじめました
アクセシビリティはじめましたアクセシビリティはじめました
アクセシビリティはじめましたYuichi Sugiyama
 
BCU30 - Webでできるマルチメディア表現
BCU30 - Webでできるマルチメディア表現BCU30 - Webでできるマルチメディア表現
BCU30 - Webでできるマルチメディア表現Leonardo Ken Orihara
 
Serverside ES6@Livesense technight
Serverside ES6@Livesense technightServerside ES6@Livesense technight
Serverside ES6@Livesense technightSeiji Takahashi
 
機械学習で大事なことをミニGunosyをつくって学んだ╭( ・ㅂ・)و ̑̑ 
機械学習で大事なことをミニGunosyをつくって学んだ╭( ・ㅂ・)و ̑̑ 機械学習で大事なことをミニGunosyをつくって学んだ╭( ・ㅂ・)و ̑̑ 
機械学習で大事なことをミニGunosyをつくって学んだ╭( ・ㅂ・)و ̑̑ Seiji Takahashi
 
日本のIT市場のトピックス
日本のIT市場のトピックス日本のIT市場のトピックス
日本のIT市場のトピックスHiroyasu NOHATA
 
Etherem ~ agvm
Etherem ~ agvmEtherem ~ agvm
Etherem ~ agvmgha sshee
 
Dapps for Web Developers Aberdeen Techmeetup
Dapps for Web Developers Aberdeen TechmeetupDapps for Web Developers Aberdeen Techmeetup
Dapps for Web Developers Aberdeen TechmeetupJames Littlejohn
 
Etherisc Versicherung neu erfinden
Etherisc Versicherung neu erfindenEtherisc Versicherung neu erfinden
Etherisc Versicherung neu erfindenStephan Karpischek
 
Vision for a health blockchain
Vision for a health blockchainVision for a health blockchain
Vision for a health blockchainJames Littlejohn
 
"Performance Analysis of In-Network Caching in Content-Centric Advanced Meter...
"Performance Analysis of In-Network Caching in Content-Centric Advanced Meter..."Performance Analysis of In-Network Caching in Content-Centric Advanced Meter...
"Performance Analysis of In-Network Caching in Content-Centric Advanced Meter...Khaled Ben Driss
 
The Ethereum ÐApp IDE: Mix
The Ethereum ÐApp IDE: MixThe Ethereum ÐApp IDE: Mix
The Ethereum ÐApp IDE: Mixgavofyork
 
NodeJS Blockchain.info Wallet
NodeJS Blockchain.info WalletNodeJS Blockchain.info Wallet
NodeJS Blockchain.info WalletSjors Provoost
 
Everything dApp (Blockchain University Module II)
Everything dApp (Blockchain University Module II)Everything dApp (Blockchain University Module II)
Everything dApp (Blockchain University Module II)Tom Ding
 

Viewers also liked (20)

Concept of BlockChain & Decentralized Application
Concept of BlockChain & Decentralized ApplicationConcept of BlockChain & Decentralized Application
Concept of BlockChain & Decentralized Application
 
お前なんかハッカーじゃない╭( ・ㅂ・)و ̑̑
お前なんかハッカーじゃない╭( ・ㅂ・)و ̑̑お前なんかハッカーじゃない╭( ・ㅂ・)و ̑̑
お前なんかハッカーじゃない╭( ・ㅂ・)و ̑̑
 
Excelの話
Excelの話Excelの話
Excelの話
 
Blockchain: The Information Technology of the Future
Blockchain: The Information Technology of the FutureBlockchain: The Information Technology of the Future
Blockchain: The Information Technology of the Future
 
アクセシビリティはじめました
アクセシビリティはじめましたアクセシビリティはじめました
アクセシビリティはじめました
 
BCU30 - Webでできるマルチメディア表現
BCU30 - Webでできるマルチメディア表現BCU30 - Webでできるマルチメディア表現
BCU30 - Webでできるマルチメディア表現
 
Serverside ES6@Livesense technight
Serverside ES6@Livesense technightServerside ES6@Livesense technight
Serverside ES6@Livesense technight
 
機械学習で大事なことをミニGunosyをつくって学んだ╭( ・ㅂ・)و ̑̑ 
機械学習で大事なことをミニGunosyをつくって学んだ╭( ・ㅂ・)و ̑̑ 機械学習で大事なことをミニGunosyをつくって学んだ╭( ・ㅂ・)و ̑̑ 
機械学習で大事なことをミニGunosyをつくって学んだ╭( ・ㅂ・)و ̑̑ 
 
日本のIT市場のトピックス
日本のIT市場のトピックス日本のIT市場のトピックス
日本のIT市場のトピックス
 
Etherem ~ agvm
Etherem ~ agvmEtherem ~ agvm
Etherem ~ agvm
 
Ethereum @ descon 2016
Ethereum @ descon 2016Ethereum @ descon 2016
Ethereum @ descon 2016
 
Dapps for Web Developers Aberdeen Techmeetup
Dapps for Web Developers Aberdeen TechmeetupDapps for Web Developers Aberdeen Techmeetup
Dapps for Web Developers Aberdeen Techmeetup
 
Solidity intro
Solidity introSolidity intro
Solidity intro
 
Etherisc Versicherung neu erfinden
Etherisc Versicherung neu erfindenEtherisc Versicherung neu erfinden
Etherisc Versicherung neu erfinden
 
Vision for a health blockchain
Vision for a health blockchainVision for a health blockchain
Vision for a health blockchain
 
Introduction to Idea
Introduction to IdeaIntroduction to Idea
Introduction to Idea
 
"Performance Analysis of In-Network Caching in Content-Centric Advanced Meter...
"Performance Analysis of In-Network Caching in Content-Centric Advanced Meter..."Performance Analysis of In-Network Caching in Content-Centric Advanced Meter...
"Performance Analysis of In-Network Caching in Content-Centric Advanced Meter...
 
The Ethereum ÐApp IDE: Mix
The Ethereum ÐApp IDE: MixThe Ethereum ÐApp IDE: Mix
The Ethereum ÐApp IDE: Mix
 
NodeJS Blockchain.info Wallet
NodeJS Blockchain.info WalletNodeJS Blockchain.info Wallet
NodeJS Blockchain.info Wallet
 
Everything dApp (Blockchain University Module II)
Everything dApp (Blockchain University Module II)Everything dApp (Blockchain University Module II)
Everything dApp (Blockchain University Module II)
 

Similar to Wysiwig on Rails

Rapid development with Rails
Rapid development with RailsRapid development with Rails
Rapid development with RailsYi-Ting Cheng
 
Contributing to rails
Contributing to railsContributing to rails
Contributing to railsLukas Eppler
 
Plone for Education: Bibliographies
Plone for Education: BibliographiesPlone for Education: Bibliographies
Plone for Education: BibliographiesCristopher Ewing
 
OSDC 2013 | Introduction into Chef by Andy Hawkins
OSDC 2013 | Introduction into Chef by Andy HawkinsOSDC 2013 | Introduction into Chef by Andy Hawkins
OSDC 2013 | Introduction into Chef by Andy HawkinsNETWAYS
 
44 Slides About 22 Modules
44 Slides About 22 Modules44 Slides About 22 Modules
44 Slides About 22 Modulesheyrocker
 
WordPress Rest API
WordPress Rest APIWordPress Rest API
WordPress Rest APIBrian Layman
 
[.Net开发交流会][2010.06.19]better framework better life(吕国宁)
[.Net开发交流会][2010.06.19]better framework better life(吕国宁)[.Net开发交流会][2010.06.19]better framework better life(吕国宁)
[.Net开发交流会][2010.06.19]better framework better life(吕国宁)Shanda innovation institute
 
Scaling with swagger
Scaling with swaggerScaling with swagger
Scaling with swaggerTony Tam
 
Codestrong 2012 breakout session alloy (mvc) app framework overview
Codestrong 2012 breakout session   alloy (mvc) app framework overviewCodestrong 2012 breakout session   alloy (mvc) app framework overview
Codestrong 2012 breakout session alloy (mvc) app framework overviewAxway Appcelerator
 
Ship It ! with Ruby/ Rails Ecosystem
Ship It ! with Ruby/ Rails EcosystemShip It ! with Ruby/ Rails Ecosystem
Ship It ! with Ruby/ Rails EcosystemYi-Ting Cheng
 
Managing Multiple WordPress Websites in 2017
Managing Multiple WordPress Websites in 2017Managing Multiple WordPress Websites in 2017
Managing Multiple WordPress Websites in 2017South Florida Web Studio
 
Selenium WebDriverを利用したサンプルアプリケーションのテスト
Selenium WebDriverを利用したサンプルアプリケーションのテストSelenium WebDriverを利用したサンプルアプリケーションのテスト
Selenium WebDriverを利用したサンプルアプリケーションのテストAtsushi Matsuo
 
Azureサーバーレスで行う情報のスクリーニング
Azureサーバーレスで行う情報のスクリーニングAzureサーバーレスで行う情報のスクリーニング
Azureサーバーレスで行う情報のスクリーニングryosuke matsumura
 
Single Page Application Development with backbone.js and Simple.Web
Single Page Application Development with backbone.js and Simple.WebSingle Page Application Development with backbone.js and Simple.Web
Single Page Application Development with backbone.js and Simple.WebChris Canal
 
Project Tools in Web Development
Project Tools in Web DevelopmentProject Tools in Web Development
Project Tools in Web Developmentkmloomis
 
海纳百川,有容乃大
海纳百川,有容乃大海纳百川,有容乃大
海纳百川,有容乃大hujinpu
 

Similar to Wysiwig on Rails (20)

Rapid development with Rails
Rapid development with RailsRapid development with Rails
Rapid development with Rails
 
Contributing to rails
Contributing to railsContributing to rails
Contributing to rails
 
Impression of Rails 3
Impression of Rails 3Impression of Rails 3
Impression of Rails 3
 
Plone for Education: Bibliographies
Plone for Education: BibliographiesPlone for Education: Bibliographies
Plone for Education: Bibliographies
 
OSDC 2013 | Introduction into Chef by Andy Hawkins
OSDC 2013 | Introduction into Chef by Andy HawkinsOSDC 2013 | Introduction into Chef by Andy Hawkins
OSDC 2013 | Introduction into Chef by Andy Hawkins
 
44 Slides About 22 Modules
44 Slides About 22 Modules44 Slides About 22 Modules
44 Slides About 22 Modules
 
WordPress Rest API
WordPress Rest APIWordPress Rest API
WordPress Rest API
 
[.Net开发交流会][2010.06.19]better framework better life(吕国宁)
[.Net开发交流会][2010.06.19]better framework better life(吕国宁)[.Net开发交流会][2010.06.19]better framework better life(吕国宁)
[.Net开发交流会][2010.06.19]better framework better life(吕国宁)
 
Scaling with swagger
Scaling with swaggerScaling with swagger
Scaling with swagger
 
Alloy - Codestrong 2012
Alloy - Codestrong 2012Alloy - Codestrong 2012
Alloy - Codestrong 2012
 
Codestrong 2012 breakout session alloy (mvc) app framework overview
Codestrong 2012 breakout session   alloy (mvc) app framework overviewCodestrong 2012 breakout session   alloy (mvc) app framework overview
Codestrong 2012 breakout session alloy (mvc) app framework overview
 
Ship It ! with Ruby/ Rails Ecosystem
Ship It ! with Ruby/ Rails EcosystemShip It ! with Ruby/ Rails Ecosystem
Ship It ! with Ruby/ Rails Ecosystem
 
Managing Multiple WordPress Websites in 2017
Managing Multiple WordPress Websites in 2017Managing Multiple WordPress Websites in 2017
Managing Multiple WordPress Websites in 2017
 
Selenium WebDriverを利用したサンプルアプリケーションのテスト
Selenium WebDriverを利用したサンプルアプリケーションのテストSelenium WebDriverを利用したサンプルアプリケーションのテスト
Selenium WebDriverを利用したサンプルアプリケーションのテスト
 
Alloy Framework
Alloy FrameworkAlloy Framework
Alloy Framework
 
Azureサーバーレスで行う情報のスクリーニング
Azureサーバーレスで行う情報のスクリーニングAzureサーバーレスで行う情報のスクリーニング
Azureサーバーレスで行う情報のスクリーニング
 
Single Page Application Development with backbone.js and Simple.Web
Single Page Application Development with backbone.js and Simple.WebSingle Page Application Development with backbone.js and Simple.Web
Single Page Application Development with backbone.js and Simple.Web
 
Project Tools in Web Development
Project Tools in Web DevelopmentProject Tools in Web Development
Project Tools in Web Development
 
海纳百川,有容乃大
海纳百川,有容乃大海纳百川,有容乃大
海纳百川,有容乃大
 
Rack
RackRack
Rack
 

Recently uploaded

Electronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdfElectronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdfme23b1001
 
Arduino_CSE ece ppt for working and principal of arduino.ppt
Arduino_CSE ece ppt for working and principal of arduino.pptArduino_CSE ece ppt for working and principal of arduino.ppt
Arduino_CSE ece ppt for working and principal of arduino.pptSAURABHKUMAR892774
 
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxDecoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxJoão Esperancinha
 
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)Dr SOUNDIRARAJ N
 
Biology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxBiology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxDeepakSakkari2
 
main PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfidmain PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfidNikhilNagaraju
 
Call Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile serviceCall Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile servicerehmti665
 
DATA ANALYTICS PPT definition usage example
DATA ANALYTICS PPT definition usage exampleDATA ANALYTICS PPT definition usage example
DATA ANALYTICS PPT definition usage examplePragyanshuParadkar1
 
Internship report on mechanical engineering
Internship report on mechanical engineeringInternship report on mechanical engineering
Internship report on mechanical engineeringmalavadedarshan25
 
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdf
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdfCCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdf
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdfAsst.prof M.Gokilavani
 
Call Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call GirlsCall Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call Girlsssuser7cb4ff
 
Risk Assessment For Installation of Drainage Pipes.pdf
Risk Assessment For Installation of Drainage Pipes.pdfRisk Assessment For Installation of Drainage Pipes.pdf
Risk Assessment For Installation of Drainage Pipes.pdfROCENODodongVILLACER
 
complete construction, environmental and economics information of biomass com...
complete construction, environmental and economics information of biomass com...complete construction, environmental and economics information of biomass com...
complete construction, environmental and economics information of biomass com...asadnawaz62
 
GDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSCAESB
 
Application of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptxApplication of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptx959SahilShah
 

Recently uploaded (20)

Electronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdfElectronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdf
 
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Serviceyoung call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
 
young call girls in Green Park🔝 9953056974 🔝 escort Service
young call girls in Green Park🔝 9953056974 🔝 escort Serviceyoung call girls in Green Park🔝 9953056974 🔝 escort Service
young call girls in Green Park🔝 9953056974 🔝 escort Service
 
Arduino_CSE ece ppt for working and principal of arduino.ppt
Arduino_CSE ece ppt for working and principal of arduino.pptArduino_CSE ece ppt for working and principal of arduino.ppt
Arduino_CSE ece ppt for working and principal of arduino.ppt
 
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxDecoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
 
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
 
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)
 
Biology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxBiology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptx
 
POWER SYSTEMS-1 Complete notes examples
POWER SYSTEMS-1 Complete notes  examplesPOWER SYSTEMS-1 Complete notes  examples
POWER SYSTEMS-1 Complete notes examples
 
main PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfidmain PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfid
 
Call Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile serviceCall Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile service
 
DATA ANALYTICS PPT definition usage example
DATA ANALYTICS PPT definition usage exampleDATA ANALYTICS PPT definition usage example
DATA ANALYTICS PPT definition usage example
 
Internship report on mechanical engineering
Internship report on mechanical engineeringInternship report on mechanical engineering
Internship report on mechanical engineering
 
Design and analysis of solar grass cutter.pdf
Design and analysis of solar grass cutter.pdfDesign and analysis of solar grass cutter.pdf
Design and analysis of solar grass cutter.pdf
 
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdf
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdfCCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdf
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdf
 
Call Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call GirlsCall Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call Girls
 
Risk Assessment For Installation of Drainage Pipes.pdf
Risk Assessment For Installation of Drainage Pipes.pdfRisk Assessment For Installation of Drainage Pipes.pdf
Risk Assessment For Installation of Drainage Pipes.pdf
 
complete construction, environmental and economics information of biomass com...
complete construction, environmental and economics information of biomass com...complete construction, environmental and economics information of biomass com...
complete construction, environmental and economics information of biomass com...
 
GDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentation
 
Application of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptxApplication of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptx
 

Wysiwig on Rails

  • 2. Hello! • timakin / @__timakin__ • Ruby / Node / Go • https://medium.com/@timakin • tech-savvy.hatenablog.com
  • 4.
  • 8. Wysiwyg Rails • CKE Editor • Squire • Froala Editor • Bootsy • Redactor • Medium-Editor
  • 10. CKE Editor • • WordPress • Rails Carrierwave/PaperClip • Plugin Rails config •
  • 14. Froala Editor • • • S3 ( or Froala Storage ) • input
  • 16. Bootsy • Rails i18n • Squire • Carrierwave bootstrap-wysihtml5
  • 18. Redactor • • Video insert (Embed tag ) / Table view / File upload •
  • 21. Wysiwyg Rails • CKE Editor • Squire • Froala Editor • Bootsy • Redactor • Medium-Editor
  • 22. Wysiwyg Rails • CKE Editor • Squire • Froala Editor • Bootsy • Redactor • Medium-Editor
  • 23. Wysiwyg Rails • CKE Editor • Squire • Froala Editor • Bootsy • Redactor • Medium-Editor
  • 25. Dante-Editor • Medium-Editor Medium • Image upload, video, social embed / • iframe url embedly • S3 API js • div value form hidden_field • gem
  • 26. image upload class ApiController < ApplicationController protect_from_forgery with: :null_session def upload_image s3 = Aws::S3::Resource.new(region: ENV['AWS_REGION'], access_key_id: ENV['AWS_ACCESS_KEY_ID'], secret_access_key: ENV['AWS_SECRET_ACCESS_KEY']) case Rails.env when 'production' obj = s3.bucket(ENV['SACKET_FOG_PRODUCTION_DIRECTORY']).object("images/embedded/ #{SecureRandom.hex(8)}") when 'staging' obj = s3.bucket(ENV['SACKET_FOG_STAGING_DIRECTORY']).object("images/embedded/#{SecureRandom.hex(8)}") when 'development' obj = s3.bucket(ENV['SACKET_FOG_STAGING_DIRECTORY']).object("images/embedded/#{SecureRandom.hex(8)}") end obj.upload_file(params[:file].tempfile, acl: 'public-read') render json: { status: :ok, data: obj.public_url } end end
  • 27. form editor = new Dante.Editor( { el: "#editor", disable_title: true, upload_url: "/api/upload_image", base_widgets: ["uploader", "embed"], oembed_url: "http://api.embed.ly/1/oembed?key=hogehoge" } ); editor.start() $(document).ready(function(){ $("#editor").bind("input properchange", function(){ $("#text_" + $(this).attr("data-field-id")).val($(this).html()) }); });
  • 28. # var embedTemplate = function() { return "<figure contenteditable='false' class='graf--figure graf--iframe graf--first' name='504e' tabindex='0'> <div class='iframeContainer'> <iframe frameborder='0' width='700' height='393' data-media-id='' src='' data-height='480' data-width='854'> </iframe> </div> <figcaption contenteditable='true' data-default-value='Type caption for embed (optional)' class='imageCaption'> <a rel='nofollow' class='markup--anchor markup--figure-anchor' data-href='' href='' target='_blank'> </a> </ figcaption> </figure>"; }; var oembed_url = "http://api.embed.ly/1/oembed? key=c6fc4f62de674f8a8ee60a7cbea1e13d&url=";
  • 29. $(function(){ var node = $(".is-embedable"); var node_name = node.attr('name'); if (node.text()) { console.log(node.text()); return $.getJSON("" + oembed_url + (node.text())).success((function(_this) { return function(data) { var iframe_src, replaced_node, tmpl, url; var node = $("[name=" + node_name + "]"); node.hide(); iframe_src = $(data.html).prop("src"); tmpl = $(embedTemplate()); tmpl.attr("name", node.attr("name")); $(node).replaceWith(tmpl); replaced_node = $(".graf--iframe[name=" + (node.attr("name")) + "]"); replaced_node.find("iframe").attr("src", iframe_src); url = data.url || data.author_url; replaced_node.find(".markup--anchor").attr("href", url).text(url); }; })(this)).error((function(_this) { return function(res) { console.log(res); }; })(this)); } });