From 6b3a57b64baa090ee149807062d4b57b221ec704 Mon Sep 17 00:00:00 2001 From: Matthias Schmidt Date: Sat, 12 Dec 2020 15:36:46 +0100 Subject: [PATCH] Convert `Form/Builder/Field/Wysiwyg/Poll` to TypeScript --- .../Core/Form/Builder/Field/Wysiwyg/Poll.js | 61 +++++++------------ .../Core/Form/Builder/Field/Wysiwyg/Poll.ts | 34 +++++++++++ 2 files changed, 56 insertions(+), 39 deletions(-) create mode 100644 wcfsetup/install/files/ts/WoltLabSuite/Core/Form/Builder/Field/Wysiwyg/Poll.ts diff --git a/wcfsetup/install/files/js/WoltLabSuite/Core/Form/Builder/Field/Wysiwyg/Poll.js b/wcfsetup/install/files/js/WoltLabSuite/Core/Form/Builder/Field/Wysiwyg/Poll.js index ac9ebb0f5e..4cb0e1836b 100644 --- a/wcfsetup/install/files/js/WoltLabSuite/Core/Form/Builder/Field/Wysiwyg/Poll.js +++ b/wcfsetup/install/files/js/WoltLabSuite/Core/Form/Builder/Field/Wysiwyg/Poll.js @@ -1,44 +1,27 @@ /** * Data handler for the poll options. * - * @author Matthias Schmidt - * @copyright 2001-2020 WoltLab GmbH - * @license GNU Lesser General Public License - * @module WoltLabSuite/Core/Form/Builder/Field/Wysiwyg/Poll - * @since 5.2 + * @author Matthias Schmidt + * @copyright 2001-2020 WoltLab GmbH + * @license GNU Lesser General Public License + * @module WoltLabSuite/Core/Form/Builder/Field/Wysiwyg/Poll + * @since 5.2 */ -define(['Core', '../Field'], function(Core, FormBuilderField) { - "use strict"; - - /** - * @constructor - */ - function FormBuilderFieldPoll(fieldId) { - this.init(fieldId); - }; - Core.inherit(FormBuilderFieldPoll, FormBuilderField, { - /** - * @see WoltLabSuite/Core/Form/Builder/Field/Field#_getData - */ - _getData: function() { - return this._pollEditor.getData(); - }, - - /** - * @see WoltLabSuite/Core/Form/Builder/Field/Field#_readField - */ - _readField: function() { - // does nothing - }, - - /** - * - * @param {WoltLabSuite/Core/Ui/Poll/Editor} pollEditor - */ - setPollEditor: function(pollEditor) { - this._pollEditor = pollEditor; - } - }); - - return FormBuilderFieldPoll; +define(["require", "exports", "tslib", "../Field", "../../../../Core"], function (require, exports, tslib_1, Field_1, Core) { + "use strict"; + Field_1 = tslib_1.__importDefault(Field_1); + Core = tslib_1.__importStar(Core); + class Poll extends Field_1.default { + _getData() { + return this._pollEditor.getData(); + } + _readField() { + // does nothing + } + setPollEditor(pollEditor) { + this._pollEditor = pollEditor; + } + } + Core.enableLegacyInheritance(Poll); + return Poll; }); diff --git a/wcfsetup/install/files/ts/WoltLabSuite/Core/Form/Builder/Field/Wysiwyg/Poll.ts b/wcfsetup/install/files/ts/WoltLabSuite/Core/Form/Builder/Field/Wysiwyg/Poll.ts new file mode 100644 index 0000000000..a7541cdef5 --- /dev/null +++ b/wcfsetup/install/files/ts/WoltLabSuite/Core/Form/Builder/Field/Wysiwyg/Poll.ts @@ -0,0 +1,34 @@ +/** + * Data handler for the poll options. + * + * @author Matthias Schmidt + * @copyright 2001-2020 WoltLab GmbH + * @license GNU Lesser General Public License + * @module WoltLabSuite/Core/Form/Builder/Field/Wysiwyg/Poll + * @since 5.2 + */ + +import Field from "../Field"; +import * as Core from "../../../../Core"; +import { FormBuilderData } from "../../Data"; +import UiPollEditor from "../../../../Ui/Poll/Editor"; + +class Poll extends Field { + protected _pollEditor: UiPollEditor; + + protected _getData(): FormBuilderData { + return this._pollEditor.getData(); + } + + protected _readField(): void { + // does nothing + } + + public setPollEditor(pollEditor: UiPollEditor): void { + this._pollEditor = pollEditor; + } +} + +Core.enableLegacyInheritance(Poll); + +export = Poll; -- 2.20.1