MCPcopy Create free account
hub / github.com/codecombat/codecombat / afterRender

Method afterRender

app/views/i18n/I18NEditModelView.js:87–128  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

85 }
86
87 afterRender () {
88 super.afterRender()
89
90 this.ignoreLanguageSelectChanges = true
91 const $select = this.$el.find('#language-select').empty()
92 this.addLanguagesToSelect($select, this.selectedLanguage)
93 this.$el.find('option[value="en-US"]').remove()
94 this.ignoreLanguageSelectChanges = false
95 const editors = []
96
97 this.$el.find('tr[data-format="markdown"]').each((index, el) => {
98 let enEl, toEl
99 const foundEnEl = (enEl = $(el).find('.english-value-row div')[0])
100 if (foundEnEl != null) {
101 const englishEditor = ace.edit(foundEnEl)
102 englishEditor.el = enEl
103 englishEditor.setReadOnly(true)
104 editors.push(englishEditor)
105 }
106 const foundToEl = (toEl = $(el).find('.to-value-row div')[0])
107 if (foundToEl != null) {
108 const toEditor = ace.edit(foundToEl)
109 toEditor.el = toEl
110 toEditor.on('change', this.onEditorChange)
111 return editors.push(toEditor)
112 }
113 })
114
115 return (() => {
116 const result = []
117 for (const editor of Array.from(editors)) {
118 const session = editor.getSession()
119 session.setTabSize(2)
120 session.setMode('ace/mode/markdown')
121 session.setNewLineMode = 'unix'
122 session.setUseSoftTabs(true)
123 session.setUseWrapMode(true)
124 result.push(editor.setOptions({ maxLines: Infinity }))
125 }
126 return result
127 })()
128 }
129
130 onEditorChange (event, editor) {
131 if (this.destroyed) { return }

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected