Skip to content

Commit 6b39ec6

Browse files
committed
Update Ace-Editor Version src-min-noconflict v1.43.2
1 parent 25d2f89 commit 6b39ec6

File tree

5 files changed

+82
-23
lines changed

5 files changed

+82
-23
lines changed

CHANGELOG.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,24 @@
11
# Ace-Editor - Changelog
22

3+
## Version 1.4.0 - 19.07.2025
4+
5+
### Features
6+
7+
* Update Ace-Editor Version src-min-noconflict v1.43.2 @aeberhard
8+
* Code-Quality - AddOn-Code überarbeitet mit REDAXO-Coding Standards (2.15.0) + rexstan (2.0.18) + rexfactor (0.1.24) @aeberhard
9+
* Level 10, REDAXO SuperGlobals, Bleeding-Edge, Strict-Mode, Strict-Mode, PHPUnit, phpstan-dba, cognitive complexity, report mixed, dead code
10+
* PHP Maximalversion auf <9 gesetzt @aeberhard
11+
* Select-Felder für Theme-Auswahl nach LIGHT/DARK in optgroups aufgeteilt @aeberhard
12+
* Select-Felder für Theme-Auswahl in der Höhe beschränkt @aeberhard
13+
* Hinweismeldung angepasst wenn Codemirror noch aktiviert ist @aeberhard
14+
* Update LICENSE @aeberhard
15+
* Update README @aeberhard
16+
17+
### Bugfixes
18+
19+
* Ace-Editor nur auf der Einstellungen-Seite einbinden auch wenn der Codemirror aktiv ist
20+
* Vorschau bei Theme-Wechsel klappte nicht zuverlässig
21+
322
## Version 1.3.0 - 13.07.2023
423

524
### Features

assets/vendor/aceeditor.zip

48.9 KB
Binary file not shown.

boot.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,14 @@
88
use rex_addon;
99
use rex_plugin;
1010
use rex_view;
11+
use rex_be_controller;
1112

1213
$addon = rex_addon::get('aceeditor');
1314

1415
$config = $addon->getConfig();
1516

1617
if (true === rex::isBackend() && null !== rex::getUser() && '|1|' === $addon->getConfig('active')) {
17-
if (true === rex_plugin::get('be_style', 'customizer')->isInstalled() && 1 === rex_plugin::get('be_style', 'customizer')->getConfig('codemirror')) {
18+
if (true === rex_plugin::get('be_style', 'customizer')->isInstalled() && 1 === rex_plugin::get('be_style', 'customizer')->getConfig('codemirror') && rex_be_controller::getCurrentPagePart(2) !== 'aceeditor') {
1819
return;
1920
}
2021

lang/de_de.lang

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,6 @@ aceeditor_config_options_notice = <b>Achtung</b>: Die Optionen müssen im korrek
2020

2121
aceeditor_config_legend4 = Ace-Editor individuell verwenden
2222

23-
aceeditor_error_codemirror = Ace-Editor kann nicht aktiviert werden da das Plugin Codemirror aktiv ist. Codemirror muss deaktiviert werden! Siehe unter System->Customizer.
23+
aceeditor_error_codemirror = <b>ACHTUNG</b>: Ace-Editor kann nicht aktiviert werden da das Plugin <code>Codemirror</code> aktiv ist. Codemirror muss deaktiviert werden! Siehe unter <code>System->Customizer</code>.
2424
aceeditor_error_unzip = Beim entpacken der Assets aus dem Ace-Editor-Archiv ist ein Fehler aufgetreten!
2525
aceeditor_success_message = <br>Die Einstellungen können unter <b>System</b> auf der Seite {0} vorgenommen werden.

pages/system.aceeditor.php

Lines changed: 60 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
}
2323

2424
if (true === rex_plugin::get('be_style', 'customizer')->isInstalled() && 1 === rex_plugin::get('be_style', 'customizer')->getConfig('codemirror')) {
25-
echo rex_view::warning($addon->i18n('error_codemirror'));
25+
echo rex_view::error($addon->i18n('error_codemirror'));
2626
}
2727

2828
$form = rex_config_form::factory('aceeditor');
@@ -43,29 +43,67 @@
4343
$form->addFieldset($addon->i18n('config_legend2'));
4444

4545
$curDir = $addon->getAssetsUrl('vendor/aceeditor/');
46-
$themes = [];
46+
$themes_light = [];
47+
$themes_dark = [];
48+
$themes_misc = [];
49+
4750
$files = glob($curDir . 'theme-*.js');
4851
if (false !== $files) {
4952
foreach ($files as $filename) {
50-
$themes[] = str_replace('theme-', '', substr(rex_path::basename($filename), 0, -3));
53+
$file = rex_file::get($filename);
54+
if ($file === null) {
55+
$file = '';
56+
}
57+
58+
$theme_name = str_replace('theme-', '', substr(rex_path::basename($filename), 0, -3));
59+
if (str_contains($file, 't.isDark=!0')) {
60+
$themes_dark[] = $theme_name;
61+
} elseif (str_contains($file, 't.isDark=!1')) {
62+
$themes_light[] = $theme_name;
63+
} else {
64+
$themes_misc[] = $theme_name;
65+
}
5166
}
5267
}
5368

54-
$field = $form->addSelectField('theme', $value = null, ['class' => 'form-control selectpicker']);
69+
$field = $form->addSelectField('theme', $value = null, ['class' => 'form-control selectpicker', 'data-size' => '10']);
5570
$field->setLabel($addon->i18n('config_theme'));
5671
$select = $field->getSelect();
57-
foreach ($themes as $theme) {
72+
$select->addOptgroup('LIGHT');
73+
foreach ($themes_light as $theme) {
74+
$select->addOption($theme, $theme);
75+
}
76+
77+
$select->addOptgroup('DARK');
78+
foreach ($themes_dark as $theme) {
79+
$select->addOption($theme, $theme);
80+
}
81+
82+
$select->addOptgroup('MISC');
83+
foreach ($themes_misc as $theme) {
5884
$select->addOption($theme, $theme);
5985
}
6086

61-
$field = $form->addSelectField('darktheme', $value = null, ['class' => 'form-control selectpicker']);
87+
$field = $form->addSelectField('darktheme', $value = null, ['class' => 'form-control selectpicker', 'data-size' => '10']);
6288
$field->setLabel($addon->i18n('config_darktheme'));
6389
$select = $field->getSelect();
64-
foreach ($themes as $theme) {
90+
$select->addOptgroup('LIGHT');
91+
foreach ($themes_light as $theme) {
6592
$select->addOption($theme, $theme);
6693
}
6794

68-
$field = $form->addRawField('<dl class="rex-form-group form-group"><dt>' . $addon->i18n('config_theme_preview') . '</dt><dd><textarea class="form-control rex-js-code themepreview" readonly rows="15" data-theme="' . $addon->getConfig('theme') . '">
95+
$select->addOptgroup('DARK');
96+
foreach ($themes_dark as $theme) {
97+
$select->addOption($theme, $theme);
98+
}
99+
100+
$select->addOptgroup('MISC');
101+
foreach ($themes_misc as $theme) {
102+
$select->addOption($theme, $theme);
103+
}
104+
105+
// @phpstan-ignore-next-line
106+
$field = $form->addRawField('<dl class="rex-form-group form-group"><dt>' . $addon->i18n('config_theme_preview') . '</dt><dd><textarea class="form-control aceeditor themepreview" readonly rows="18" data-theme="' . $addon->getConfig('theme') . '">
69107
<?php
70108
function nfact($n) {
71109
if ($n == 0) {
@@ -87,7 +125,7 @@ function nfact($n) {
87125
// Ace-Editor Options
88126
$form->addFieldset($addon->i18n('config_legend3'));
89127

90-
$field = $form->addTextAreaField('options', null, ['class' => 'form-control rex-js-code', 'rows' => 15, 'aceeditor-theme' => 'github', 'aceeditor-themedark' => 'cobalt', 'aceeditor-mode' => 'json', 'aceeditor-options' => '{"showInvisibles": true}']);
128+
$field = $form->addTextAreaField('options', null, ['class' => 'form-control aceeditor', 'rows' => 18, 'aceeditor-theme' => 'eclipse', 'aceeditor-themedark' => 'dracula', 'aceeditor-mode' => 'json', 'aceeditor-options' => '{"showInvisibles": true}']);
91129
$field->setLabel($addon->i18n('config_options'));
92130
$field->setNotice($addon->i18n('config_options_notice'));
93131

@@ -128,7 +166,18 @@ function nfact($n) {
128166

129167
<script>
130168
$(document).on('rex:ready', function () {
131-
$('#aceeditor-themes-theme').on('change', function() {
169+
$('.dropdown-toggle').on('focus', function() {
170+
if ($(this).attr('title') != $('textarea.themepreview').data('theme')) {
171+
$('textarea.themepreview').prev().remove();
172+
$('textarea.themepreview')[0].style.display = 'block';
173+
$('textarea.themepreview')[0].setAttribute('data-aceactive', 'false');
174+
editor = textAreaToAceEditor($('textarea.themepreview')[0]);
175+
editor.setTheme('ace/theme/' + $(this).attr('title'));
176+
$('textarea.themepreview').data('theme', $(this).attr('title'));
177+
}
178+
});
179+
180+
$('#ace-editor-themes-theme').on('change', function() {
132181
$('textarea.themepreview').prev().remove();
133182
$('textarea.themepreview')[0].style.display = 'block';
134183
$('textarea.themepreview')[0].setAttribute('data-aceactive', 'false');
@@ -137,7 +186,7 @@ function nfact($n) {
137186
$('textarea.themepreview').data('theme', this.value);
138187
});
139188

140-
$('#aceeditor-themes-darktheme').on('change', function() {
189+
$('#ace-editor-themes-darktheme').on('change', function() {
141190
$('textarea.themepreview').prev().remove();
142191
$('textarea.themepreview')[0].style.display = 'block';
143192
$('textarea.themepreview')[0].setAttribute('data-aceactive', 'false');
@@ -146,15 +195,5 @@ function nfact($n) {
146195
$('textarea.themepreview').data('theme', this.value);
147196
});
148197

149-
$('.dropdown-toggle').on('focus', function() {
150-
if ($(this).attr('title') != $('textarea.themepreview').data('theme')) {
151-
$('textarea.themepreview').prev().remove();
152-
$('textarea.themepreview')[0].style.display = 'block';
153-
$('textarea.themepreview')[0].setAttribute('data-aceactive', 'false');
154-
editor = textAreaToAceEditor($('textarea.themepreview')[0]);
155-
editor.setTheme('ace/theme/' + $(this).attr('title'));
156-
$('textarea.themepreview').data('theme', $(this).attr('title'));
157-
}
158-
});
159198
});
160199
</script>

0 commit comments

Comments
 (0)