From 35b165ca8d263d5e17a4a192996ef22ce8c73fe4 Mon Sep 17 00:00:00 2001
From: Friederike Schwager <friederike.schwager@rwth-aachen.de>
Date: Wed, 29 Nov 2023 14:43:43 +0100
Subject: [PATCH] fix plaintext editor

---
 locallib.php    | 2 +-
 shared/index.js | 2 +-
 version.php     | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/locallib.php b/locallib.php
index 8eb0d84..aba372e 100644
--- a/locallib.php
+++ b/locallib.php
@@ -90,7 +90,7 @@ function pdfannotator_display_embed($pdfannotator, $cm, $course, $file, $page =
     $capabilities->useprintcomments = has_capability('mod/pdfannotator:printcomments', $context);
     // 3. Comment editor setting.
     $editorsettings = new stdClass();
-    $editorsettings->active_editor = explode(',', get_config('core', 'texteditors'))[0];
+    $editorsettings->active_editor = get_class(editors_get_preferred_editor(FORMAT_HTML));
 
     $params = [$cm, $documentobject, $context->id, $USER->id, $capabilities, $toolbarsettings, $page, $annoid, $commid, $editorsettings];
     $PAGE->requires->js_init_call('adjustPdfannotatorNavbar', null, true);
diff --git a/shared/index.js b/shared/index.js
index a7848bf..6ea604c 100644
--- a/shared/index.js
+++ b/shared/index.js
@@ -6928,7 +6928,7 @@ function startIndex(Y,_cm,_documentObject,_contextId, _userid,_capabilities, _to
                     .then(function(html, js) {
                         let commentListForm = document.getElementById('comment-list-form');
                         templates.prependNodeContents(commentListForm, html, js);
-                        if (_editorSettings.active_editor === 'textarea') {
+                        if (_editorSettings.active_editor === 'textarea_texteditor') {
                             document.getElementById('id_pdfannotator_content').setAttribute('style', 'display:unset !important');
                         }
                     })
diff --git a/version.php b/version.php
index 0e0985c..10c067d 100644
--- a/version.php
+++ b/version.php
@@ -25,7 +25,7 @@
 defined('MOODLE_INTERNAL') || die();
 
 $plugin->component = 'mod_pdfannotator';
-$plugin->version   = 2023052300;
+$plugin->version   = 2023112900;
 $plugin->release  = 'PDF Annotator v1.5 release 5';
 $plugin->requires  = 2021051700;
 $plugin->maturity  = MATURITY_STABLE;
-- 
GitLab