Browse Source

Autosize the rich editor (for card description and comments)

Maxime Quandalle 10 years ago
parent
commit
a12f094710

+ 1 - 0
.jshintrc

@@ -43,6 +43,7 @@
     // Exported by packages we use
     "_": false,
     "$": false,
+    "autosize": false,
     "Router": false,
     "SimpleSchema": false,
     "getSlug": false,

+ 1 - 0
bower.json

@@ -1,6 +1,7 @@
 {
   "name": "LibreBoard",
   "dependencies": {
+    "autosize": "3.0.6",
     "perfect-scrollbar": "0.6.2"
   },
   "private": true

+ 7 - 0
client/components/main/editor.jade

@@ -0,0 +1,7 @@
+template(name="editor")
+  textarea.editor(
+    class="{{class}}"
+    id=id
+    autofocus=autofocus
+    placeholder="{{_ 'comment-placeholder'}}")
+    +Template.contentBlock

+ 2 - 0
client/components/main/editor.js

@@ -3,6 +3,8 @@ var dropdownMenuIsOpened = false;
 Template.editor.onRendered(function() {
   var $textarea = this.$('textarea');
 
+  autosize($textarea);
+
   $textarea.textcomplete([
     // Emojies
     {

+ 2 - 0
client/components/main/editor.styl

@@ -0,0 +1,2 @@
+textarea.editor
+  min-height: 100px

+ 2 - 3
client/components/main/templates.html

@@ -11,8 +11,7 @@
     </div>
 </template>
 
-<template name="editor">
-    <textarea class="{{class}}" placeholder="{{_ 'comment-placeholder'}}" id="{{id}}" autofocus="{{autofocus}}">{{> UI.contentBlock}}</textarea>
-</template>
+<!-- XXX This should be moved to editor.jade but there is an issue with jade
+     handling of the markdown component. -->
 
 <template name="viewer">{{#markdown}}{{#emoji}}{{#mentions}}{{> UI.contentBlock }}{{/mentions}}{{/emoji}}{{/markdown}}</template>