Workaround for the legacy inheritance support
authorAlexander Ebert <ebert@woltlab.com>
Fri, 27 Nov 2020 16:59:51 +0000 (17:59 +0100)
committerAlexander Ebert <ebert@woltlab.com>
Fri, 27 Nov 2020 16:59:51 +0000 (17:59 +0100)
wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Message/InlineEditor.js
wcfsetup/install/files/ts/WoltLabSuite/Core/Ui/Message/InlineEditor.ts

index 4617cf60edde92dc1c44e992152d39fd0ea41bea..feae49bcec09a9d17da319819d512170a058569a 100644 (file)
@@ -23,6 +23,14 @@ define(["require", "exports", "tslib", "../../Ajax", "../../Core", "../../Dom/Ch
          * Initializes the message inline editor.
          */
         constructor(opts) {
+            this.init(opts);
+        }
+        /**
+         * Helper initialization method for legacy inheritance support.
+         */
+        init(opts) {
+            // Define the properties again, the constructor might not be
+            // called in legacy implementations.
             this._activeDropdownElement = null;
             this._activeElement = null;
             this._dropdownMenu = null;
index af75d13a821ae4a8d552cc543a9789b2c16d1117..0dd0e8ee22d657ec0185d49ae265cbd3f683cb89 100644 (file)
@@ -75,16 +75,30 @@ interface AjaxResponseMessage extends ResponseData {
 }
 
 class UiMessageInlineEditor implements AjaxCallbackObject {
-  protected _activeDropdownElement: HTMLElement | null = null;
-  protected _activeElement: HTMLElement | null = null;
-  protected _dropdownMenu: HTMLUListElement | null = null;
-  protected readonly _elements = new WeakMap<HTMLElement, ElementData>();
-  protected readonly _options: MessageInlineEditorOptions;
+  protected _activeDropdownElement: HTMLElement | null;
+  protected _activeElement: HTMLElement | null;
+  protected _dropdownMenu: HTMLUListElement | null;
+  protected _elements: WeakMap<HTMLElement, ElementData>;
+  protected _options: MessageInlineEditorOptions;
 
   /**
    * Initializes the message inline editor.
    */
   constructor(opts: Partial<MessageInlineEditorOptions>) {
+    this.init(opts);
+  }
+
+  /**
+   * Helper initialization method for legacy inheritance support.
+   */
+  protected init(opts: Partial<MessageInlineEditorOptions>): void {
+    // Define the properties again, the constructor might not be
+    // called in legacy implementations.
+    this._activeDropdownElement = null;
+    this._activeElement = null;
+    this._dropdownMenu = null;
+    this._elements = new WeakMap<HTMLElement, ElementData>();
+
     this._options = Core.extend(
       {
         canEditInline: false,