- Examples:
- Simple
- Custom buttons
- Buttons manipulation
- Custom settings
- Custom functions
mark_it_up
Buttons manipulation example
Code used
show layout code
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>mark_it_up</title>
<%= stylesheet_link_tag "examples" %>
<%= javascript_include_tag "jquery" %>
<%= yield :head %>
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-16452609-1']);
_gaq.push(['_setDomainName', '.cingel.hr']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
</head>
<body>
<%= examples_menu %>
<h1>mark_it_up</h1>
<h2><%= params[:action].to_s.humanize %> example</h2>
<%= yield %>
<h3>Code used</h3>
<%= render :partial => "layouts/code" %>
</body>
</html>
<%
MarkItUp.buttons = MarkItUp.default_buttons
MarkItUp.replace_button(14, { :name => 'Image', :icon => "image", :key => 'P', :replaceWith => '<img src="/path" alt="" />' })
MarkItUp.insert_button(16, { :name => 'Some button', :icon => 'picture', :key => 'X', :replaceWith => 'something' }) # insert new button at specific position
MarkItUp.insert_button(17, { :separator => '---------------' })
MarkItUp.insert_button({ :name => 'Some other button', :icon => 'code', :key => 'Y', :replaceWith => 'something else' }) # insert new button to the end
MarkItUp.delete_button(3)
MarkItUp.delete_button("Bold")
%>
<% content_for :head do %>
<%= mark_it_up "#miu_test" %>
<% end %>
<% form_tag do %>
<%= text_area_tag "miu_test" %>
<% end %>
For more info see http://github.com/cingel/mark_it_up