MDL-34674 use browser built-in spell checking in all browsers except < IE10
This commit is contained in:
+1
-1
@@ -60,7 +60,7 @@
|
||||
?>
|
||||
<p><?php echo get_string('pleasereport', 'error'); ?>
|
||||
<p><form action="<?php echo $CFG->wwwroot ?>/error/index.php" method="post">
|
||||
<textarea rows="3" cols="50" name="text" id="text"></textarea><br />
|
||||
<textarea rows="3" cols="50" name="text" id="text" spellcheck="true"></textarea><br />
|
||||
<input type="hidden" name="referer" value="<?php p($httpreferer) ?>">
|
||||
<input type="hidden" name="requested" value="<?php p($requesturi) ?>">
|
||||
<input type="submit" value="<?php echo get_string('sendmessage', 'error'); ?>">
|
||||
|
||||
+2
-2
@@ -1920,7 +1920,7 @@ class admin_setting_configtextarea extends admin_setting_configtext {
|
||||
}
|
||||
|
||||
return format_admin_setting($this, $this->visiblename,
|
||||
'<div class="form-textarea" ><textarea rows="'. $this->rows .'" cols="'. $this->cols .'" id="'. $this->get_id() .'" name="'. $this->get_full_name() .'">'. s($data) .'</textarea></div>',
|
||||
'<div class="form-textarea" ><textarea rows="'. $this->rows .'" cols="'. $this->cols .'" id="'. $this->get_id() .'" name="'. $this->get_full_name() .'" spellcheck="true">'. s($data) .'</textarea></div>',
|
||||
$this->description, true, '', $defaultinfo, $query);
|
||||
}
|
||||
}
|
||||
@@ -1966,7 +1966,7 @@ class admin_setting_confightmleditor extends admin_setting_configtext {
|
||||
$editor->use_editor($this->get_id(), array('noclean'=>true));
|
||||
|
||||
return format_admin_setting($this, $this->visiblename,
|
||||
'<div class="form-textarea"><textarea rows="'. $this->rows .'" cols="'. $this->cols .'" id="'. $this->get_id() .'" name="'. $this->get_full_name() .'">'. s($data) .'</textarea></div>',
|
||||
'<div class="form-textarea"><textarea rows="'. $this->rows .'" cols="'. $this->cols .'" id="'. $this->get_id() .'" name="'. $this->get_full_name() .'" spellcheck="true">'. s($data) .'</textarea></div>',
|
||||
$this->description, true, '', $defaultinfo, $query);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1909,7 +1909,7 @@ function print_textarea($usehtmleditor, $rows, $cols, $width, $height, $name, $v
|
||||
$editorclass = '';
|
||||
}
|
||||
|
||||
$str .= "\n".'<textarea class="form-textarea" id="'. $id .'" name="'. $name .'" rows="'. $rows .'" cols="'. $cols .'">'."\n";
|
||||
$str .= "\n".'<textarea class="form-textarea" id="'. $id .'" name="'. $name .'" rows="'. $rows .'" cols="'. $cols .'" spellcheck="true">'."\n";
|
||||
if ($usehtmleditor) {
|
||||
$str .= htmlspecialchars($value); // needed for editing of cleaned text!
|
||||
} else {
|
||||
|
||||
@@ -22,6 +22,6 @@
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
$string['pluginname'] = 'Check spelling';
|
||||
$string['pluginname'] = 'Legacy spell checker';
|
||||
|
||||
/* This plugin abuses strings from the standard TinyMCE spellchecker plugin, there is no need to duplicate them here. */
|
||||
|
||||
@@ -32,6 +32,10 @@ class tinymce_spellchecker extends editor_tinymce_plugin {
|
||||
array $options = null) {
|
||||
global $CFG;
|
||||
|
||||
if (!$this->is_legacy_browser()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Check at least one language is supported.
|
||||
$spelllanguagelist = $this->get_config('spelllanguagelist', '');
|
||||
if ($spelllanguagelist !== '') {
|
||||
@@ -48,4 +52,13 @@ class tinymce_spellchecker extends editor_tinymce_plugin {
|
||||
$params['spellchecker_languages'] = $spelllanguagelist;
|
||||
}
|
||||
}
|
||||
|
||||
protected function is_legacy_browser() {
|
||||
// IE8 and IE9 are the only supported browsers that do not have spellchecker.
|
||||
if (check_browser_version('MSIE', 5) and !check_browser_version('MSIE', 10)) {
|
||||
return true;
|
||||
}
|
||||
// The rest of browsers supports spellchecking or is horribly outdated and we do not care...
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -383,7 +383,7 @@ class MoodleQuickForm_editor extends HTML_QuickForm_element {
|
||||
if (!is_null($this->getAttribute('onblur')) && !is_null($this->getAttribute('onchange'))) {
|
||||
$editorrules = ' onblur="'.htmlspecialchars($this->getAttribute('onblur')).'" onchange="'.htmlspecialchars($this->getAttribute('onchange')).'"';
|
||||
}
|
||||
$str .= '<div><textarea id="'.$id.'" name="'.$elname.'[text]" rows="'.$rows.'" cols="'.$cols.'"';
|
||||
$str .= '<div><textarea id="'.$id.'" name="'.$elname.'[text]" rows="'.$rows.'" cols="'.$cols.'" spellcheck="true"';
|
||||
$classes = array();
|
||||
if (isset($this->_options['collapsed']) && $this->_options['collapsed']) {
|
||||
$this->_options['collapsible'] = 1;
|
||||
|
||||
@@ -1521,7 +1521,7 @@ class assignment_base {
|
||||
} else if ($quickgrade) {
|
||||
$comment = '<div id="com'.$auser->id.'">'
|
||||
. '<textarea tabindex="'.$tabindex++.'" name="submissioncomment['.$auser->id.']" id="submissioncomment'
|
||||
. $auser->id.'" rows="2" cols="20">'.($auser->submissioncomment).'</textarea></div>';
|
||||
. $auser->id.'" rows="2" cols="20" spellcheck="true">'.($auser->submissioncomment).'</textarea></div>';
|
||||
} else {
|
||||
$comment = '<div id="com'.$auser->id.'">'.shorten_text(strip_tags($auser->submissioncomment),15).'</div>';
|
||||
}
|
||||
@@ -1549,7 +1549,7 @@ class assignment_base {
|
||||
} else if ($quickgrade) {
|
||||
$comment = '<div id="com'.$auser->id.'">'
|
||||
. '<textarea tabindex="'.$tabindex++.'" name="submissioncomment['.$auser->id.']" id="submissioncomment'
|
||||
. $auser->id.'" rows="2" cols="20">'.($auser->submissioncomment).'</textarea></div>';
|
||||
. $auser->id.'" rows="2" cols="20" spellcheck="true">'.($auser->submissioncomment).'</textarea></div>';
|
||||
} else {
|
||||
$comment = '<div id="com'.$auser->id.'"> </div>';
|
||||
}
|
||||
|
||||
@@ -125,7 +125,7 @@ class data_field_textarea extends data_field_base {
|
||||
}
|
||||
$editor->use_editor($field, $options, $fpoptions);
|
||||
$str .= '<input type="hidden" name="'.$field.'_itemid" value="'.$draftitemid.'" />';
|
||||
$str .= '<div><textarea id="'.$field.'" name="'.$field.'" rows="'.$this->field->param3.'" cols="'.$this->field->param2.'">'.s($text).'</textarea></div>';
|
||||
$str .= '<div><textarea id="'.$field.'" name="'.$field.'" rows="'.$this->field->param3.'" cols="'.$this->field->param2.'" spellcheck="true">'.s($text).'</textarea></div>';
|
||||
$str .= '<div><label class="accesshide" for="' . $field . '_content1">' . get_string('format') . '</label>';
|
||||
$str .= '<select id="' . $field . '_content1" name="'.$field.'_content1">';
|
||||
foreach ($formats as $key=>$desc) {
|
||||
|
||||
+1
-1
@@ -109,7 +109,7 @@ foreach ($users as $k => $v) {
|
||||
$checkbox .= html_writer::select($state_names, 'states[' . $k . ']', empty($states[$k]) ? NOTES_STATE_PUBLIC : $states[$k], false, array('id' => 'menustates'));
|
||||
$table->data[] = array(
|
||||
'<input type="hidden" name="userid['.$k.']" value="'.$v.'" />'. fullname($user, true),
|
||||
'<textarea name="contents['. $k . ']" rows="2" cols="40">' . strip_tags(@$contents[$k]) . '</textarea>',
|
||||
'<textarea name="contents['. $k . ']" rows="2" cols="40" spellcheck="true">' . strip_tags(@$contents[$k]) . '</textarea>',
|
||||
$checkbox
|
||||
);
|
||||
}
|
||||
|
||||
@@ -112,7 +112,7 @@ echo get_string('users'). ': ' . implode(', ', $userlist) . '.';
|
||||
echo '</p>';
|
||||
|
||||
echo '<p>' . get_string('content', 'notes');
|
||||
echo '<br /><textarea name="content" rows="5" cols="50">' . strip_tags(@$content) . '</textarea></p>';
|
||||
echo '<br /><textarea name="content" rows="5" cols="50" spellcheck="true">' . strip_tags(@$content) . '</textarea></p>';
|
||||
|
||||
echo '<p>';
|
||||
echo html_writer::label(get_string('publishstate', 'notes'), 'menustate');
|
||||
|
||||
Reference in New Issue
Block a user