Skip to content

Commit 0c0f2e1

Browse files
committed
fix(codemirror): if disable richtext at the document edit page, then injected codemirror
1 parent 017ab3a commit 0c0f2e1

2 files changed

Lines changed: 7 additions & 5 deletions

File tree

assets/plugins/codemirror/codemirror.plugin.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@
1515
*
1616
* @see https://github.com/Mihanik71/CodeMirror-MODx
1717
*/
18-
global $content, $which_editor;
18+
global $content;
19+
20+
$which_editor = $modx->getConfig('which_editor');
1921
$textarea_name = 'post';
2022
$mode = 'htmlmixed';
2123
$lang = 'htmlmixed';
@@ -56,7 +58,7 @@
5658
/*
5759
* Switch event
5860
*/
59-
switch($modx->Event->name) {
61+
switch($modx->event->name) {
6062
case 'OnTempFormRender' :
6163
$object_name = $content['templatename'];
6264
$rte = ($prte ? $prte : 'none');
@@ -150,6 +152,7 @@
150152
$this->logEvent(1, 2, 'Undefined event : <b>' . $modx->Event->name . '</b> in <b>' . $this->Event->activePlugin . '</b> Plugin', 'CodeMirror Plugin : ' . $modx->Event->name);
151153
}
152154
$output = '';
155+
153156
if(('none' == $rte) && $mode && !defined('INIT_CODEMIRROR')) {
154157
define('INIT_CODEMIRROR', 1);
155158
$output = <<< HEREDOC
@@ -405,5 +408,4 @@ function onComplete() {
405408
</script>\n";
406409
};
407410
};
408-
409-
$modx->Event->output($output);
411+
$modx->event->addOutput($output);

manager/actions/mutate_content.dynamic.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
$pg = isset($_REQUEST['page']) ? '&page=' . (int) $_REQUEST['page'] : '';
66
$add_path = $sd . $sb . $pg;
77
/*******************/
8-
8+
global $content;
99
$richtexteditorIds = array();
1010
$defaultContentType = 'document';
1111
// check permissions

0 commit comments

Comments
 (0)