-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathboot.php
More file actions
60 lines (47 loc) · 2.14 KB
/
Copy pathboot.php
File metadata and controls
60 lines (47 loc) · 2.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
<?php
/** @var rex_addon $this */
// Basic assets laden
if (rex::isBackend() && is_object(rex::getUser())) {
// EditorJS Bundle (enthält Core + alle Tools)
rex_view::addJsFile($this->getAssetsUrl('js/editorjs.bundle.js'));
// Bundle-CSS (automatisch generiert im js-Ordner)
rex_view::addCssFile($this->getAssetsUrl('js/editorjs.bundle.css'));
// Auto-Initialisierung für Module
rex_view::addJsFile($this->getAssetsUrl('js/editorjs-auto-init.js'));
// Eigene Styles
rex_view::addCssFile($this->getAssetsUrl('css/editorjs-basic.css'));
// Medienpool-Integration (nach Redactor-Vorbild)
if (rex_addon::get('mediapool')->isAvailable()) {
rex_view::setJsProperty('editorjs_rex_media_getImageTypes', rex_media::getImageTypes());
}
// Bild-URL-Pfad konfigurieren
$imageUrlPath = rex_url::media();
if (rex_addon::get('media_manager')->isAvailable()) {
$imageUrlPath = 'index.php?rex_media_type=rex_mediapool_detail&rex_media_file=';
if (rex_addon::get('yrewrite')->isAvailable()) {
$imageUrlPath = '/media/rex_mediapool_detail/';
}
}
rex_view::setJsProperty('editorjs_imageUrlPath', $imageUrlPath);
}
// EditorJS Renderer-Klasse automatisch laden
spl_autoload_register(function ($class) {
if ($class === 'FriendsOfRedaxo\\EditorJs\\EditorJsRenderer') {
require_once __DIR__ . '/lib/EditorJSRenderer.php';
}
});
// Extension Point für automatisches CSS im Frontend
rex_extension::register('OUTPUT_FILTER', function (rex_extension_point $ep) {
$content = $ep->getSubject();
// Prüfen ob EditorJS Renderer verwendet wird
if (strpos($content, 'editorjs-') !== false) {
$addon = rex_addon::get('editorjs');
$cssUrl = $addon->getAssetsUrl('css/editorjs-frontend.css');
// CSS vor </head> einfügen falls noch nicht vorhanden
if (strpos($content, 'editorjs-frontend.css') === false) {
$cssLink = '<link rel="stylesheet" href="' . $cssUrl . '">';
$content = str_replace('</head>', $cssLink . "\n</head>", $content);
}
}
return $content;
});