1
- import { RubricsElement } from "./rubrics-element.js" ;
2
- import { html } from "/webcomponents/assets/lit-element/lit-element.js" ;
3
- import { tr } from "./sakai-rubrics-language.js" ;
1
+ import { RubricsElement } from "./rubrics-element.js" ;
2
+ import { html } from "/webcomponents/assets/lit-element/lit-element.js" ;
3
+ import { tr } from "./sakai-rubrics-language.js" ;
4
4
5
5
export class SakaiRubricGradingComment extends RubricsElement {
6
6
@@ -16,25 +16,27 @@ export class SakaiRubricGradingComment extends RubricsElement {
16
16
return {
17
17
criterion : { type : Object } ,
18
18
entityId : { attribute : "entity-id" , type : String } ,
19
- evaluatedItemId : { attribute : "evaluated-item-id" , type : String } ,
19
+ evaluatedItemId : { attribute : "evaluated-item-id" , type : String }
20
20
} ;
21
21
}
22
22
23
23
set criterion ( newValue ) {
24
24
25
25
var oldValue = this . _criterion ;
26
26
this . _criterion = newValue ;
27
- this . _criterion . comments = ( newValue . comments && newValue . comments . indexOf ( "null" ) === 0 ) ? "" : newValue . comments ;
27
+ this . _criterion . comments = newValue . comments && newValue . comments . indexOf ( "null" ) === 0 ? "" : newValue . comments ;
28
28
this . requestUpdate ( "criterion" , oldValue ) ;
29
29
}
30
30
31
- get criterion ( ) { return this . _criterion ; }
31
+ get criterion ( ) {
32
+ return this . _criterion ;
33
+ }
32
34
33
35
render ( ) {
34
36
35
37
return html `
36
38
<!-- edit icon -->
37
- < div style ="cursor: pointer; " class ="comment-icon fa fa-2x fa-comments ${ this . criterion . comments ? "active" : "" } " @click =" ${ this . toggleEditor } " title ="${ tr ( "criterion_comment" ) } "> </ div >
39
+ < div tabindex =" 0 " style ="cursor: pointer; " class ="comment-icon fa fa-2x fa-comments ${ this . criterion . comments ? "active" : "" } " @click =${ this . toggleEditor } @keypress = ${ this . toggleEditor } title="${ tr ( "criterion_comment" ) } "> </ div >
38
40
39
41
<!-- popover -->
40
42
< div id ="criterion-editor-${ this . criterion . id } - ${ this . randombit } " class ="popover criterion-edit-popover left ">
@@ -76,7 +78,7 @@ export class SakaiRubricGradingComment extends RubricsElement {
76
78
var popover = $ ( `#criterion-editor-${ this . criterion . id } -${ this . randombit } ` ) ;
77
79
78
80
popover [ 0 ] . style . left = e . target . offsetLeft - 270 + "px" ;
79
- popover [ 0 ] . style . top = ( ( e . target . offsetTop + e . target . offsetHeight / 2 + 20 ) - popover . height ( ) / 2 ) + "px" ;
81
+ popover [ 0 ] . style . top = e . target . offsetTop + e . target . offsetHeight / 2 + 20 - popover . height ( ) / 2 + "px" ;
80
82
81
83
this . setupEditor ( ) ;
82
84
@@ -99,23 +101,19 @@ export class SakaiRubricGradingComment extends RubricsElement {
99
101
if ( ! this . criterion . comments ) {
100
102
this . criterion . comments = "" ;
101
103
}
102
- this . dispatchEvent ( new CustomEvent ( 'update-comment' , { detail : { evaluatedItemId : this . evaluatedItemId , entityId : this . entityId , criterionId : this . criterion . id , value : this . criterion . comments } , bubbles : true , composed : true } ) ) ;
104
+ this . dispatchEvent ( new CustomEvent ( 'update-comment' , { detail : { evaluatedItemId : this . evaluatedItemId , entityId : this . entityId , criterionId : this . criterion . id , value : this . criterion . comments } , bubbles : true , composed : true } ) ) ;
103
105
this . requestUpdate ( ) ;
104
106
}
105
107
106
108
setupEditor ( ) {
107
109
108
110
try {
109
111
var commentEditor = CKEDITOR . replace ( 'criterion_' + this . evaluatedItemId + '_' + this . entityId + '_comment_' + this . criterion . id + '|' + this . randombit + '|' , {
110
- toolbar : [
111
- // ['Bold', 'Italic', 'Underline', '-', 'Link', 'Unlink'],
112
- [ 'Bold' , 'Italic' , 'Underline' ] ,
113
- [ 'NumberedList' , 'BulletedList' , 'Blockquote' ]
114
- ] ,
115
- height : 40 ,
112
+ toolbar : [ [ 'Bold' , 'Italic' , 'Underline' ] , [ 'NumberedList' , 'BulletedList' , 'Blockquote' ] ] ,
113
+ height : 40
116
114
} ) ;
117
115
118
- commentEditor . on ( 'change' , ( e ) => this . criterion . comments = commentEditor . getData ( ) ) ;
116
+ commentEditor . on ( 'change' , e => this . criterion . comments = commentEditor . getData ( ) ) ;
119
117
} catch ( error ) {
120
118
console . log ( error ) ;
121
119
}
0 commit comments