Anonymous avatar Anonymous committed 6d311bd

extract the arkdown stuff so we could use different converter.

Comments (0)

Files changed (4)

_attachments/css/screen.css

 a {
     color: #14456e;
 }
-h2, h3 {firehose...omark.org (line 14)
+h2, h3 {
 font-size:medium;
 }
 
     overflow: auto;    
 }
 
-form li {
+form ol {
+    list-style: none;
+}
+form ol li {
     padding: 2px 0;
     /*clear: both;*/
     margin: 0;
     margin: 0;
 }
 
-textarea {
+#fedit textarea {
     width: 99%;
+    height: 100%;
     border: 1px solid;
     height: 280px;
 }
Add a comment to this file

_attachments/js/.textarea.jquery.js.swp

Binary file modified.

_attachments/js/textarea.jquery.js

 
 (function($) {
 
-    $.fn.markdownEditor = function(options) {
+    $.fn.TextArea = function(options) {
         options = options || {};
 
         var defaults = {
             tab_spacing: true,
             tab_char: 4,
             lineHeight: 16,
-            preview: "#mdpreview"
+            change_callback: null        
         };
 
         var options = $.extend(defaults, options);
         return this.each(function() {
-            new MarkdownEditor(this, options);
+            new TextArea(this, options);
         });
     }
 
-    function MarkdownEditor(el, options) {
-        return this instanceof MarkdownEditor
+    function TextArea(el, options) {
+        return this instanceof TextArea
         ? this.init(el, options)
-        : MarkdownEditor(el, opttions);
+        : TextArea(el, opttions);
     }
 
-    $.extend(MarkdownEditor.prototype, {
+    $.extend(TextArea.prototype, {
 
         init: function(el, options) {
             this.el = $(el);
 
             this.element = this.el[0];
             this.options = options;
+            this._change_callback = options.change_callback;
+
             this.bindMethodsToObj("handleKey");
 
             // detection of browser for webkit
 
             this.el.keydown(this.handleKey);
 
-            if (typeof this.preview != "undefined") {
-                this.converter = new Showdown.converter;
-                var self = this;
-                this.converter_callback = function() {
-                    self.preview[0].innerHTML = self.converter.makeHtml(self.el.val());
+            var self = this;
+            this.change_callback = function() {
+                if (self._change_callback) {
+                    self._change_callback(self.element.value);
                 }
-                this.converter_callback();  
-                this.el.keydown(this.converter_callback).keyup(this.converter_callback);
+                return;
             }
-                
+            this.change_callback();  
+            this.el.keydown(this.change_callback).keyup(this.change_callback);
         },
 
         handleKey: function(e) {

lib/templates/edit.html

         </header>
         <div id="edit">
             <form id="fedit" name="fedit" action="new.html">
-                <ol>
-                    <li><label for="title">Titre<label><input type="text"
-                        name="title" id="title" value=""></li>
-            
-                    <li><textarea name="content" id="content" cols="80"
-                    rows="20"></textarea></li>
+                <p><label for="title">Titre<label><input type="text"
+                        name="title" id="title" value=""></p>
+                        
+                <textarea name="content" id="content" cols="80"
+                    rows="20"></textarea>
 
-                    <li><label for="labels">Libellés</label><input type="text"
-                name="labels" id="labels" value=""></li>
-                </ol>
+                <p><label for="labels">Libellés</label><input type="text"
+                name="labels" id="labels" value=""></p>
                 <p><input type="submit" name="save" id="save" value="Save">
             or <a href="cancel">Cancel</a></p>
             </form>
     <script src="<%= assets %>/js/showdown.js"></script>
 
     <script src="<%= assets %>/js/textarea.jquery.js"></script>
-
+    <script src="<%= assets %>/js/editor.js"></script>
     <script>
-        $("#content").markdownEditor();
+        new Editor() 
     </script>
 
 </html>
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.