@@ -98,18 +98,15 @@ Vue.directive('click-outside', {
9898 // TODO::LATER completed: too soon / on time / too late --> auto priority adjustment
9999 // TODO::LATER suggested priority
100100
101- // TODO:: #0 change <textarea> to <div contenteditable="true">
102- // TODO:: #1 parse URL
103-
104- // https://stackoverflow.com/questions/37684/how-to-replace-plain-urls-with-links
105-
106101 // https://stackoverflow.com/questions/19214453/rich-text-editor-replacement-for-html-textarea
107102 // https://stackoverflow.com/questions/17785845/convert-html-tag-in-textarea-to-rich-text
108103 // https://stackoverflow.com/questions/2580247/can-i-embed-html-formatting-inside-of-a-textarea-tag
109104 // https://stackoverflow.com/questions/10404312/html5-rich-text-inside-textarea
110-
111105 // https://github.com/guardian/scribe
112106
107+ // TODO:: #1 parse URL
108+ // https://stackoverflow.com/questions/37684/how-to-replace-plain-urls-with-links
109+
113110 // https://github.com/SoapBox/linkifyjs
114111 // https://github.com/nfrasser/linkify-shim/blob/master/linkify.min.js
115112 // https://github.com/phanan/vue-linkify
@@ -134,24 +131,14 @@ Vue.component('compact-task-item', {
134131
135132 template : `
136133 <div class="task-compact" v-bind:style="{ 'background-color': color }">
137- <textarea ref="message" v-on:input="textAreaAdjust()" :value="text" @input="$emit('update:text', $event.target.value)" aria-label="Task text" class="task-compact-textarea" v-bind:style="{ 'background-color': color }"></textarea >
134+ <div aria-label="Task text" class="task-compact-textarea" v-bind:style="{ 'background-color': color }">{{ text }}</div >
138135 <button v-on:click="$emit('activity')">
139136 <img src="icons/count.png" alt="Number of times task was completed" title="Number of times task was completed" height="20" width="20">{{ activityCounter }}x
140137 </button>
141138 </div>
142139 ` ,
143140
144- props : [ 'text' , 'activityCounter' , 'color' ] ,
145- methods : {
146- textAreaAdjust ( ) {
147- var o = this . $refs . message ;
148- o . style . height = "1px" ;
149- o . style . height = ( o . scrollHeight ) + "px" ;
150- }
151- } ,
152- mounted ( ) {
153- this . textAreaAdjust ( ) ;
154- }
141+ props : [ 'text' , 'activityCounter' , 'color' ]
155142} )
156143
157144//-------------------------------------------------------------------------
@@ -211,7 +198,8 @@ Vue.component('task-item', {
211198 <img src="icons/delete.png" alt="Delete task" title="Delete task" height="20" width="20">
212199 </button>
213200 </div>
214- <textarea ref="message" v-on:input="textAreaAdjust()" :value="text" @input="$emit('update:text', $event.target.value)" aria-label="Task text" class="task-textarea" v-bind:style="{ 'background-color': color }"></textarea>
201+ <textarea v-if="expanded" ref="message" v-on:input="textAreaAdjust()" :value="text" @input="$emit('update:text', $event.target.value)" aria-label="Task text" class="task-textarea" v-bind:style="{ 'background-color': color }"></textarea>
202+ <div v-else aria-label="Task text" class="task-formatted-textarea" v-bind:style="{ 'background-color': color }">{{ text }}</div>
215203 </div>
216204 ` ,
217205
@@ -257,6 +245,7 @@ Vue.component('task-item', {
257245
258246 this . $nextTick ( ( ) => {
259247 this . inputAdjust ( ) ;
248+ this . textAreaAdjust ( ) ;
260249 } )
261250 } ,
262251 onClickOutside ( ) {
@@ -269,6 +258,7 @@ Vue.component('task-item', {
269258 var o = this . $refs . message ;
270259 o . style . height = "1px" ;
271260 o . style . height = ( o . scrollHeight ) + "px" ;
261+ o . focus ( ) ; // TODO:: only on div click
272262 } ,
273263 inputAdjust ( ) {
274264 var o = this . $refs . factor ;
@@ -280,7 +270,7 @@ Vue.component('task-item', {
280270 }
281271 } ,
282272 mounted ( ) {
283- this . textAreaAdjust ( ) ;
273+ // this.textAreaAdjust();
284274 }
285275} )
286276
0 commit comments