From 93d86389948c4e86fec14de6a1be8ec4c5ffc824 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Sun, 8 Nov 2020 19:04:00 +0100 Subject: [PATCH] Convert `Language/Text` to TypeScript --- .../js/WoltLabSuite/Core/Language/Text.js | 76 ++++++++----------- .../ts/WoltLabSuite/Core/Language/Input.ts | 6 +- .../ts/WoltLabSuite/Core/Language/Text.js | 62 --------------- .../ts/WoltLabSuite/Core/Language/Text.ts | 49 ++++++++++++ 4 files changed, 83 insertions(+), 110 deletions(-) delete mode 100644 wcfsetup/install/files/ts/WoltLabSuite/Core/Language/Text.js create mode 100644 wcfsetup/install/files/ts/WoltLabSuite/Core/Language/Text.ts diff --git a/wcfsetup/install/files/js/WoltLabSuite/Core/Language/Text.js b/wcfsetup/install/files/js/WoltLabSuite/Core/Language/Text.js index b3388226cb..7672312e53 100644 --- a/wcfsetup/install/files/js/WoltLabSuite/Core/Language/Text.js +++ b/wcfsetup/install/files/js/WoltLabSuite/Core/Language/Text.js @@ -2,56 +2,42 @@ * I18n interface for wysiwyg input fields. * * @author Alexander Ebert - * @copyright 2001-2019 WoltLab GmbH + * @copyright 2001-2019 WoltLab GmbH * @license GNU Lesser General Public License * @module WoltLabSuite/Core/Language/Text */ -define(['Core', './Input'], function (Core, LanguageInput) { +define(["require", "exports", "tslib", "./Input"], function (require, exports, tslib_1, LanguageInput) { "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.init = void 0; + LanguageInput = tslib_1.__importStar(LanguageInput); /** - * @exports WoltLabSuite/Core/Language/Text + * Refreshes the editor content on language switch. */ - return { - /** - * Initializes an WYSIWYG input field. - * - * @param {string} elementId input element id - * @param {Object} values preset values per language id - * @param {Object} availableLanguages language names per language id - * @param {boolean} forceSelection require i18n input - */ - init: function (elementId, values, availableLanguages, forceSelection) { - var element = elById(elementId); - if (!element || element.nodeName !== 'TEXTAREA' || !element.classList.contains('wysiwygTextarea')) { - throw new Error("Expected