Updates to correct a11y issues with CodeMirror

TNL-5281
This commit is contained in:
Albert St. Aubin
2016-11-03 08:25:13 -04:00
parent 5afab424a6
commit be0e0b8eec
4 changed files with 11 additions and 13 deletions

View File

@@ -337,7 +337,7 @@ define(['js/views/validation', 'codemirror', 'underscore', 'jquery', 'jquery.ui'
},
codeMirrors: {},
codeMirrorize: function(e, forcedTarget) {
var thisTarget;
var thisTarget, cachethis, field, cmTextArea;
if (forcedTarget) {
thisTarget = forcedTarget;
thisTarget.id = $(thisTarget).attr('id');
@@ -354,8 +354,8 @@ define(['js/views/validation', 'codemirror', 'underscore', 'jquery', 'jquery.ui'
}
if (!this.codeMirrors[thisTarget.id]) {
var cachethis = this;
var field = this.selectorToField[thisTarget.id];
cachethis = this;
field = this.selectorToField[thisTarget.id];
this.codeMirrors[thisTarget.id] = CodeMirror.fromTextArea(thisTarget, {
mode: 'text/html', lineNumbers: true, lineWrapping: true});
this.codeMirrors[thisTarget.id].on('change', function(mirror) {
@@ -366,6 +366,8 @@ define(['js/views/validation', 'codemirror', 'underscore', 'jquery', 'jquery.ui'
cachethis.setAndValidate(field, newVal);
}
});
cmTextArea = this.codeMirrors[thisTarget.id].getInputField();
cmTextArea.setAttribute('id', 'course-overview-cm-textarea');
}
},

View File

@@ -333,6 +333,9 @@ CMS.URL.UPLOAD_ASSET = '${upload_asset_url | n, js_escaped_string}'
<li class="field text" id="field-course-overview">
<label for="course-overview">${_("Course Overview")}</label>
<textarea class="tinymce text-editor" id="course-overview"></textarea>
<label class="sr" for="course-overview-cm-textarea">
${_('HTML Code Editor')}
</label>
<span class="tip tip-stacked">${
Text(_("Introductions, prerequisites, FAQs that are used on {a_link_start}your course summary page{a_link_end} (formatted in HTML)")).format(
a_link_start=HTML("<a class='link-courseURL' rel='external' href='{lms_link_for_about_page}'>").format(lms_link_for_about_page=lms_link_for_about_page),