From afed8681197b2611cd8605a985059ad8ac7461e1 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Fri, 27 Nov 2020 17:59:51 +0100 Subject: [PATCH] Workaround for the legacy inheritance support --- .../Core/Ui/Message/InlineEditor.js | 8 +++++++ .../Core/Ui/Message/InlineEditor.ts | 24 +++++++++++++++---- 2 files changed, 27 insertions(+), 5 deletions(-) diff --git a/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Message/InlineEditor.js b/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Message/InlineEditor.js index 4617cf60ed..feae49bcec 100644 --- a/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Message/InlineEditor.js +++ b/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Message/InlineEditor.js @@ -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; diff --git a/wcfsetup/install/files/ts/WoltLabSuite/Core/Ui/Message/InlineEditor.ts b/wcfsetup/install/files/ts/WoltLabSuite/Core/Ui/Message/InlineEditor.ts index af75d13a82..0dd0e8ee22 100644 --- a/wcfsetup/install/files/ts/WoltLabSuite/Core/Ui/Message/InlineEditor.ts +++ b/wcfsetup/install/files/ts/WoltLabSuite/Core/Ui/Message/InlineEditor.ts @@ -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(); - protected readonly _options: MessageInlineEditorOptions; + protected _activeDropdownElement: HTMLElement | null; + protected _activeElement: HTMLElement | null; + protected _dropdownMenu: HTMLUListElement | null; + protected _elements: WeakMap; + protected _options: MessageInlineEditorOptions; /** * Initializes the message inline editor. */ constructor(opts: Partial) { + this.init(opts); + } + + /** + * Helper initialization method for legacy inheritance support. + */ + protected init(opts: Partial): 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(); + this._options = Core.extend( { canEditInline: false, -- 2.20.1