app/src/components/CommentList.js
// Add comment by clicking on the 'comment' button
Add comment by clicking on the 'comment' button
Add comment by clicking on the ' comment ' button
addComment(event) {
        if (this.state.inProgCom !== null) {
            window.alert("Submit or cancel current comment before creating new one");
        } else {
            let ace = document.getElementById("ace-editor");
            let start = ace.env.editor.selection.anchor.row + 1;
            let end = ace.env.editor.selection.cursor.row + 1;
            if (start > end) {
                let temp = start;
                start = end;
                end = temp;
            }
            this.setState({
                inProgCom: {
                    text: "",
                    regionStart: start,
                    regionEnd: end,
                }
            });
        }
    }
addComment ( event ) { if ( this . state . inProgCom !== null ) { window . alert ( "Submit or cancel current comment before creating new one" ) ; } else { let ace = document . getElementById ( "ace-editor" ) ; let start = ace . env . editor . selection . anchor . row + 1 ; let end = ace . env . editor . selection . cursor . row + 1 ; if ( start > end ) { let temp = start ; start = end ; end = temp ; } this . setState ( { inProgCom : { text : "" , regionStart : start , regionEnd : end , } } ) ; } }
Add comment by clicking on the 'comment' button
Add comment by clicking on the ' comment ' button