MDL-76367 core: Apply RTL transformations to editors too

This commit is contained in:
Andrew Nicols
2022-11-18 15:13:12 +08:00
parent 899397c0af
commit 44d6b24d28
2 changed files with 18 additions and 7 deletions
+15 -4
View File
@@ -925,6 +925,11 @@ class theme_config {
public function editor_css_url($encoded=true) {
global $CFG;
$rev = theme_get_revision();
$type = 'editor';
if (right_to_left()) {
$type .= '-rtl';
}
if ($rev > -1) {
$themesubrevision = theme_get_sub_revision_for_theme($this->name);
@@ -936,13 +941,19 @@ class theme_config {
$url = new moodle_url("/theme/styles.php");
if (!empty($CFG->slasharguments)) {
$url->set_slashargument('/'.$this->name.'/'.$rev.'/editor', 'noparam', true);
$url->set_slashargument("{$this->name}/{$rev}/{$type}", 'noparam', true);
} else {
$url->params(array('theme'=>$this->name,'rev'=>$rev, 'type'=>'editor'));
$url->params([
'theme' => $this->name,
'rev' => $rev,
'type' => $type,
]);
}
} else {
$params = array('theme'=>$this->name, 'type'=>'editor');
$url = new moodle_url('/theme/styles_debug.php', $params);
$url = new moodle_url('/theme/styles_debug.php', [
'theme' => $this->name,
'type' => $type,
]);
}
return $url;
}
+3 -3
View File
@@ -67,7 +67,7 @@ if (!is_null($themesubrev)) {
}
// Check that type fits into the expected values.
if (!in_array($type, ['all', 'all-rtl', 'editor'])) {
if (!in_array($type, ['all', 'all-rtl', 'editor', 'editor-rtl'])) {
css_send_css_not_found();
}
@@ -103,7 +103,7 @@ require("$CFG->dirroot/lib/setup.php");
$theme = theme_config::load($themename);
$theme->force_svg_use($usesvg);
$theme->set_rtl_mode($type === 'all-rtl' ? true : false);
$theme->set_rtl_mode(substr($type, -4) === '-rtl');
$themerev = theme_get_revision();
$currentthemesubrev = theme_get_sub_revision_for_theme($themename);
@@ -125,7 +125,7 @@ if ($themerev <= 0 or $themerev != $rev or $themesubrev != $currentthemesubrev)
make_localcache_directory('theme', false);
if ($type === 'editor') {
if ($type === 'editor' || $type === 'editor-rtl') {
$csscontent = $theme->get_css_content_editor();
if ($cache) {