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

High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escortsranjana rawat
 
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)Suman Mia
 
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Serviceranjana rawat
 
chaitra-1.pptx fake news detection using machine learning
chaitra-1.pptx  fake news detection using machine learningchaitra-1.pptx  fake news detection using machine learning
chaitra-1.pptx fake news detection using machine learningmisbanausheenparvam
 
the ladakh protest in leh ladakh 2024 sonam wangchuk.pptx
the ladakh protest in leh ladakh 2024 sonam wangchuk.pptxthe ladakh protest in leh ladakh 2024 sonam wangchuk.pptx
the ladakh protest in leh ladakh 2024 sonam wangchuk.pptxhumanexperienceaaa
 
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 for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Christo Ananth
 
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝soniya singh
 
Microscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxMicroscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxpurnimasatapathy1234
 
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130Suhani Kapoor
 
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
 
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSHARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSRajkumarAkumalla
 
Introduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxIntroduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxupamatechverse
 
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
Extrusion Processes and Their Limitations
Extrusion Processes and Their LimitationsExtrusion Processes and Their Limitations
Extrusion Processes and Their Limitations120cr0395
 
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...srsj9000
 
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
 

Recently uploaded (20)

High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
 
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)
 
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
 
chaitra-1.pptx fake news detection using machine learning
chaitra-1.pptx  fake news detection using machine learningchaitra-1.pptx  fake news detection using machine learning
chaitra-1.pptx fake news detection using machine learning
 
the ladakh protest in leh ladakh 2024 sonam wangchuk.pptx
the ladakh protest in leh ladakh 2024 sonam wangchuk.pptxthe ladakh protest in leh ladakh 2024 sonam wangchuk.pptx
the ladakh protest in leh ladakh 2024 sonam wangchuk.pptx
 
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 for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
 
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
 
Microscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxMicroscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptx
 
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
 
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
 
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSHARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
 
Introduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxIntroduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptx
 
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINEDJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
 
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCRCall Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
 
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
Extrusion Processes and Their Limitations
Extrusion Processes and Their LimitationsExtrusion Processes and Their Limitations
Extrusion Processes and Their Limitations
 
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
 
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptxExploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
 
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
 

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)); } });