Convert `Form/Builder/Field/Wysiwyg/Poll` to TypeScript
authorMatthias Schmidt <gravatronics@live.com>
Sat, 12 Dec 2020 14:36:46 +0000 (15:36 +0100)
committerMatthias Schmidt <gravatronics@live.com>
Tue, 15 Dec 2020 17:23:05 +0000 (18:23 +0100)
wcfsetup/install/files/js/WoltLabSuite/Core/Form/Builder/Field/Wysiwyg/Poll.js
wcfsetup/install/files/ts/WoltLabSuite/Core/Form/Builder/Field/Wysiwyg/Poll.ts [new file with mode: 0644]

index ac9ebb0f5e5298b37d6b245d3de9bd01d02af381..4cb0e1836bba52f5692bcf326df855b5708be9bd 100644 (file)
@@ -1,44 +1,27 @@
 /**
  * Data handler for the poll options.
  *
- * @author      Matthias Schmidt
- * @copyright   2001-2020 WoltLab GmbH
- * @license     GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
- * @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 <http://opensource.org/licenses/lgpl-license.php>
+ * @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 (file)
index 0000000..a7541cd
--- /dev/null
@@ -0,0 +1,34 @@
+/**
+ * Data handler for the poll options.
+ *
+ * @author  Matthias Schmidt
+ * @copyright 2001-2020 WoltLab GmbH
+ * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @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;