Skip to content
This repository has been archived by the owner on Apr 12, 2018. It is now read-only.

Commit

Permalink
Adding tinymce
Browse files Browse the repository at this point in the history
Signed-off-by: kosmas58 <kosmas.schuetz@gmx.com>
  • Loading branch information
kosmas58 committed Mar 11, 2011
1 parent 8418ffd commit ed56b3c
Show file tree
Hide file tree
Showing 68 changed files with 436 additions and 15,971 deletions.
17 changes: 16 additions & 1 deletion README.md
Expand Up @@ -18,7 +18,7 @@ A Sass-based Meta-Framework for Compass that allows you to mix and match any of
* jquery.dynatree.js V1.0.2
* jquery.ribbon.js
* jquery.jqGrid.js V3.8.2 (with minor changes to make it RESTful)

* jquery.tinymce.js V3.4
and for mobile devices <i>(using pure haml/sass without compass)</i>:

* jquery.mobile.js 1.0a3
Expand Down Expand Up @@ -168,6 +168,19 @@ To use the stylesheets and javacripts include:
= stylesheet_link_tag :ical, :media => 'screen, projection'
= javascript_include_tag :ical</pre>


jQuery TinyMCE Plugin
--------------------

Use compass to install the jQuery TinyMCE Editor Javascript WYSIWYG Editor into your project.

<pre>compass install [-r jquery] jquery/tiny_mce <project name></pre>

To use the javascripts include:

<pre>
= javascript_include_tag :tiny_mce</pre>

Graphics
--------

Expand Down Expand Up @@ -280,6 +293,7 @@ jQuery Plugins included:
* Andrew M Andrews III for [Any+Time][29]
* Steven Wittens for [Farbtastic Colorpicker plugin][30]
* Adam Shaw for [FullCalendar][31]
* Moxiecode Systems AB for [TinyMCE][40]

Other stuff included:
---------------------
Expand Down Expand Up @@ -343,3 +357,4 @@ Copyright &copy; 2009-2011 Kosmas Schuetz. See LICENSE for details.
[37]: http://github.com/cowboy/jquery-dotimeout
[38]: http://github.com/gamache/DSt
[39]: http://github.com/thegrubbsian/jquery.ganttView
[40]: http://tinymce.moxiecode.com/
4 changes: 4 additions & 0 deletions app/controllers/widgets/tiny_mce_controller.rb
Expand Up @@ -2,4 +2,8 @@ class Widgets::TinyMceController < ApplicationController
layout 'tiny_mce'

protect_from_forgery

def dump
puts "wiili"
end
end
8 changes: 6 additions & 2 deletions app/views/layouts/ribbon.html.haml
Expand Up @@ -30,5 +30,9 @@
= yield :content_head

%body{body_attributes}
= yield
= render :partial => "widgets/ribbon/license"
#content
#flash_messages
%span
= raw flash_messages
= yield
= render :partial => "widgets/ribbon/license"
8 changes: 6 additions & 2 deletions app/views/layouts/tiny_mce.html.haml
Expand Up @@ -34,5 +34,9 @@
= yield :content_head

%body{body_attributes}
= yield
= render :partial => "widgets/tiny_mce/license"
#content
#flash_messages
%span
= raw flash_messages
= yield
= render :partial => "widgets/tiny_mce/license"
4 changes: 4 additions & 0 deletions app/views/welcome/hello.html.haml
Expand Up @@ -55,6 +55,10 @@
%li
= link_to raw("<b>FullCalendar</b>"), "http://arshaw.com/fullcalendar/", :class=> :greybox
%br
%li
%p
TinyMCE Javascript WYSIWYG Editor plugin
= link_to raw("<b>jquery.tinymce.js</b>"), "http://tinymce.moxiecode.com/index.php", :class=> :greybox
%li
%p
%b
Expand Down
23 changes: 8 additions & 15 deletions app/views/widgets/tiny_mce/_default.js.haml
@@ -1,18 +1,4 @@
:css
.tinymce {
background-color: #FFFFFF;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 10px;
scrollbar-3dlight-color: #F0F0EE;
scrollbar-arrow-color: #676662;
scrollbar-base-color: #F0F0EE;
scrollbar-darkshadow-color: #DDDDDD;
scrollbar-face-color: #E0E0DD;
scrollbar-highlight-color: #F0F0EE;
scrollbar-shadow-color: #F0F0EE;
scrollbar-track-color: #F5F5F5;
}

.tinymce td {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 10px;
Expand Down Expand Up @@ -105,7 +91,14 @@
text-align: inherit;
}

.toolbar { padding: 0.3em; }
.toolbar .ui-button{ font-size: 0.8em; }

:javascript
$(function() {
$("a, input", ".toolbar").button();
});

$().ready(function() {
$('textarea.tinymce').tinymce({
// Location of TinyMCE script
Expand All @@ -126,7 +119,7 @@
theme_advanced_resizing : true,

// Example content CSS (should be your site CSS)
content_css : "css/content.css",
//content_css : "css/content.css",

// Drop lists for link/image/media/template dialogs
template_external_list_url : "lists/template_list.js",
Expand Down
2 changes: 1 addition & 1 deletion app/views/widgets/tiny_mce/_license.html.haml
@@ -1,6 +1,6 @@
%br
%p
The TinyMCE is released under the
%a{ :href => "http://tinymce.moxiecode.com/js/tinymce/jscripts/tiny_mce/license.txt", :class => :greybox }
%a{ :href => "http://tinymce.moxiecode.com/js/tinymce/jscripts/tiny_mce/license.txt"}
GNU LGPL Version 2.1

52 changes: 25 additions & 27 deletions app/views/widgets/tiny_mce/default.html.haml
Expand Up @@ -5,36 +5,34 @@

.demo
%h3
=image_tag("icons/22x22/alarmclock.png", :border => 0)
=image_tag("icons/22x22/editor.png", :border => 0)
=raw @title

%p
This example shows how TinyMCE can be lazy loaded using jQuery. The jQuery plugin will also attach it's self to various jQuery methods to make it more easy to get/set editor contents etc.
.toolbar.ui-widget-header.ui-corner-all
%a{:href => "javascript:;", :onmousedown => "$('#elm1').tinymce().show();"} Show
%a{:href => "javascript:;", :onmousedown => "$('#elm1').tinymce().hide();"} Hide
%a{:href => "javascript:;", :onmousedown => "$('#elm1').tinymce().execCommand('Bold');"} Bold
%a{:href => "javascript:;", :onmousedown => "alert($('#elm1').html());"} Get contents
%a{:href => "javascript:;", :onmousedown => "alert($('#elm1').tinymce().selection.getContent());"} Get selected HTML
%a{:href => "javascript:;", :onmousedown => "alert($('#elm1').tinymce().selection.getContent({format : 'text'}));"} Get selected text
%a{:href => "javascript:;", :onmousedown => "alert($('#elm1').tinymce().selection.getNode().nodeName);"} Get selected element
%a{:href => "javascript:;", :onmousedown => "$('#elm1').tinymce().execCommand('mceInsertContent',false,'<b>Hello world!!</b>');"} Insert HTML
%a{:href => "javascript:;", :onmousedown => "$('#elm1').tinymce().execCommand('mceReplaceContent',false,'<b>{$selection}</b>');"} Replace selection
.tinymce
%form{:action => "http://tinymce.moxiecode.com/dump.php?example=true", :method => "post"}
%form{:action => "/widgets/tiny_mce/dump?example=true", :method => "post"}
%div
%h3 Full featured example using jQuery plugin
%p
This example shows how TinyMCE can be lazy loaded using jQuery. The jQuery plugin will also attach it's self to various jQuery methods to make it more easy to get/set editor contents etc.
/ Gets replaced with TinyMCE, remember HTML in a textarea should be encoded
%div
%textarea#elm1.tinymce{:cols => "80", :name => "elm1", :rows => "15", :style => "width: 80%"}
%textarea#elm1.tinymce{:cols => "80", :name => "elm1", :rows => "15", :style => "width: 100%"}
:preserve

&lt;p&gt;
This is some example text that you can edit inside the &lt;strong&gt;TinyMCE editor&lt;/strong&gt;.
&lt;/p&gt;
&lt;p&gt;
Nam nisi elit, cursus in rhoncus sit amet, pulvinar laoreet leo. Nam sed lectus quam, ut sagittis tellus. Quisque dignissim mauris a augue rutrum tempor. Donec vitae purus nec massa vestibulum ornare sit amet id tellus. Nunc quam mauris, fermentum nec lacinia eget, sollicitudin nec ante. Aliquam molestie volutpat dapibus. Nunc interdum viverra sodales. Morbi laoreet pulvinar gravida. Quisque ut turpis sagittis nunc accumsan vehicula. Duis elementum congue ultrices. Cras faucibus feugiat arcu quis lacinia. In hac habitasse platea dictumst. Pellentesque fermentum magna sit amet tellus varius ullamcorper. Vestibulum at urna augue, eget varius neque. Fusce facilisis venenatis dapibus. Integer non sem at arcu euismod tempor nec sed nisl. Morbi ultricies, mauris ut ultricies adipiscing, felis odio condimentum massa, et luctus est nunc nec eros.
&lt;/p&gt;
/ Some integration calls
%a{:href => "javascript:;", :onmousedown => "$('#elm1').tinymce().show();"} [Show]
%a{:href => "javascript:;", :onmousedown => "$('#elm1').tinymce().hide();"} [Hide]
%a{:href => "javascript:;", :onmousedown => "$('#elm1').tinymce().execCommand('Bold');"} [Bold]
%a{:href => "javascript:;", :onmousedown => "alert($('#elm1').html());"} [Get contents]
%a{:href => "javascript:;", :onmousedown => "alert($('#elm1').tinymce().selection.getContent());"} [Get selected HTML]
%a{:href => "javascript:;", :onmousedown => "alert($('#elm1').tinymce().selection.getContent({format : 'text'}));"} [Get selected text]
%a{:href => "javascript:;", :onmousedown => "alert($('#elm1').tinymce().selection.getNode().nodeName);"} [Get selected element]
%a{:href => "javascript:;", :onmousedown => "$('#elm1').tinymce().execCommand('mceInsertContent',false,'<b>Hello world!!</b>');"} [Insert HTML]
%a{:href => "javascript:;", :onmousedown => "$('#elm1').tinymce().execCommand('mceReplaceContent',false,'<b>{$selection}</b>');"} [Replace selection]
%br/
%input{:name => "save", :type => "submit", :value => "Submit"}/
%input{:name => "reset", :type => "reset", :value => "Reset"}/
&lt;p&gt;
This is some example text that you can edit inside the &lt;strong&gt;TinyMCE editor&lt;/strong&gt;.
&lt;/p&gt;
&lt;p&gt;
Nam nisi elit, cursus in rhoncus sit amet, pulvinar laoreet leo. Nam sed lectus quam, ut sagittis tellus. Quisque dignissim mauris a augue rutrum tempor. Donec vitae purus nec massa vestibulum ornare sit amet id tellus. Nunc quam mauris, fermentum nec lacinia eget, sollicitudin nec ante. Aliquam molestie volutpat dapibus. Nunc interdum viverra sodales. Morbi laoreet pulvinar gravida. Quisque ut turpis sagittis nunc accumsan vehicula. Duis elementum congue ultrices. Cras faucibus feugiat arcu quis lacinia. In hac habitasse platea dictumst. Pellentesque fermentum magna sit amet tellus varius ullamcorper. Vestibulum at urna augue, eget varius neque. Fusce facilisis venenatis dapibus. Integer non sem at arcu euismod tempor nec sed nisl. Morbi ultricies, mauris ut ultricies adipiscing, felis odio condimentum massa, et luctus est nunc nec eros.
&lt;/p&gt;
/ Some integration calls
.toolbar.ui-widget-header.ui-corner-all
%input{:name => "save", :type => "submit", :value => "Submit"}
%input{:name => "reset", :type => "reset", :value => "Reset"}
1 change: 0 additions & 1 deletion config/initializers/tiny_mce.rb
@@ -1,4 +1,3 @@
require 'jquery/tiny_mce'
require 'tiny_mce_gzip_routes'

ActionView::Helpers::AssetTagHelper.register_javascript_expansion :tiny_mce => ['tiny_mce/jquery.tinymce']

0 comments on commit ed56b3c

Please sign in to comment.