Skip to content

Commit

Permalink
Merge branch 'MDL-76367-master' of https://github.com/andrewnicols/mo…
Browse files Browse the repository at this point in the history
  • Loading branch information
junpataleta committed Nov 22, 2022
2 parents 18dda19 + 44d6b24 commit 60e2751
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 7 deletions.
5 changes: 5 additions & 0 deletions lib/editor/tiny/lang.php
Expand Up @@ -185,6 +185,11 @@ function(string $value, string $key): bool {
}
}

// TinyMCE uses a secret string only present in some languages to set a language direction.
// Rather than applying to only some languages, we just apply to all from our own langconfig.
// Note: Do not rely on right_to_left() as the current language is unset.
$strings['_dir'] = $stringmanager->get_string('thisdirection', 'langconfig', null, $this->lang);

return $strings;
}

Expand Down
19 changes: 15 additions & 4 deletions lib/outputlib.php
Expand Up @@ -925,6 +925,11 @@ public function renderer_prefixes() {
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);

Expand All @@ -936,13 +941,19 @@ public function editor_css_url($encoded=true) {

$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;
}
Expand Down
6 changes: 3 additions & 3 deletions theme/styles.php
Expand Up @@ -67,7 +67,7 @@
}

// 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();
}

Expand Down Expand Up @@ -103,7 +103,7 @@

$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);
Expand All @@ -125,7 +125,7 @@

make_localcache_directory('theme', false);

if ($type === 'editor') {
if ($type === 'editor' || $type === 'editor-rtl') {
$csscontent = $theme->get_css_content_editor();

if ($cache) {
Expand Down

0 comments on commit 60e2751

Please sign in to comment.