@@ -59,7 +59,7 @@ export class SakaiRubricGradingComment extends RubricsElement {
59
59
aria-label ="${ this . _i18n . criterion_comment } "
60
60
class ="form-control "
61
61
name ="rbcs-${ this . evaluatedItemId } -${ this . entityId } -criterion-comment- ${ this . criterion . id } "
62
- .value =${ this . criterion . comments }
62
+ .value =${ this . criterion . comments === undefined ? null : this . criterion . comments }
63
63
id ="criterion-${ this . criterion . id } -${ this . evaluatedItemId } -comment-${ this . randombit } ">
64
64
</ textarea >
65
65
</ div >
@@ -79,13 +79,6 @@ export class SakaiRubricGradingComment extends RubricsElement {
79
79
const editorKey = `criterion-${ this . criterion . id } -${ this . evaluatedItemId } -comment-${ this . randombit } ` ;
80
80
81
81
try {
82
- /*
83
- const commentEditor = CKEDITOR.replace(editorKey, {
84
- startupFocus: true,
85
- toolbar: [ [ "Bold", "Italic", "Underline" ], [ "NumberedList", "BulletedList", "Blockquote" ] ],
86
- height: 40
87
- });
88
- */
89
82
const commentEditor = sakai . editor . launch ( editorKey , {
90
83
startupFocus : true ,
91
84
versionCheck : false ,
@@ -100,8 +93,8 @@ export class SakaiRubricGradingComment extends RubricsElement {
100
93
101
94
// When we click away from the comment editor we need to save the comment, but only if the comment has been updated
102
95
const updatedComments = commentEditor . getData ( ) ;
103
-
104
- if ( this . criterion . comments !== updatedComments ) {
96
+ const nonEmptyComment = this . criterion . comments !== undefined || updatedComments . trim ( ) . length > 0 ;
97
+ if ( this . criterion . comments !== updatedComments && nonEmptyComment ) {
105
98
this . criterion . comments = updatedComments ;
106
99
const updateEvent = new CustomEvent ( "update-comment" , {
107
100
detail : {
@@ -112,6 +105,7 @@ export class SakaiRubricGradingComment extends RubricsElement {
112
105
} ,
113
106
bubbles : true , composed : true } ) ;
114
107
this . dispatchEvent ( updateEvent ) ;
108
+ this . requestUpdate ( ) ;
115
109
}
116
110
117
111
this . hideTooltip ( ) ;
0 commit comments