private createDiffEditor()

in src/app/files/code-editor.component.ts [222:268]


    private createDiffEditor(content: string) {
        let mode: CompareMode = this.calcCompareMode();

        let options: any = {
            automaticLayout: true,
            language: this._lang,
            renderSideBySide: (mode == CompareMode.Split)
        }

        if (!this._editor || mode != this._diff) {
            this.dispose();
            this._editor = this._monaco.editor.createDiffEditor(this._editorElement.nativeElement, options);
        }

        let setModel: boolean;
        let model = this._editor.getModel() || {};

        //
        // Original
        if (!model.original) {
            model.original = this._monaco.editor.createModel(this._originalText, this._lang);
            setModel = true;
        }

        if (model.original.getValue() != this._originalText) {
            model.original.setValue(this._originalText);
        }

        //
        // Modified
        if (!model.modified) {
            model.modified = this._monaco.editor.createModel(content, this._lang);
            setModel = true;
        }

        if (model.modified.getValue() != content) {
            model.modified.setValue(content);
        }

        // Set Model
        if (setModel) {
            this._editor.setModel(model);
            this._editor.onDidChangeModelContent(c => this.change.emit(c));
        }

        this._diff = mode;
    }