/**
* Converts `<woltlab-metacode>` into the bbcode representation.
*
- * @author Alexander Ebert
- * @copyright 2001-2019 WoltLab GmbH
- * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
- * @module WoltLabSuite/Core/Ui/Redactor/Page
+ * @author Alexander Ebert
+ * @copyright 2001-2019 WoltLab GmbH
+ * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @module WoltLabSuite/Core/Ui/Redactor/Page
*/
-define(['WoltLabSuite/Core/Ui/Page/Search'], function (UiPageSearch) {
+define(["require", "exports", "tslib", "../../Core", "../Page/Search"], function (require, exports, tslib_1, Core, UiPageSearch) {
"use strict";
- if (!COMPILER_TARGET_DEFAULT) {
- var Fake = function () { };
- Fake.prototype = {
- init: function () { },
- _click: function () { },
- _insert: function () { }
- };
- return Fake;
- }
- function UiRedactorPage(editor, button) { this.init(editor, button); }
- UiRedactorPage.prototype = {
- init: function (editor, button) {
+ Core = tslib_1.__importStar(Core);
+ UiPageSearch = tslib_1.__importStar(UiPageSearch);
+ class UiRedactorPage {
+ constructor(editor, button) {
this._editor = editor;
- button.addEventListener('click', this._click.bind(this));
- },
- _click: function (event) {
+ button.addEventListener("click", (ev) => this._click(ev));
+ }
+ _click(event) {
event.preventDefault();
- UiPageSearch.open(this._insert.bind(this));
- },
- _insert: function (pageID) {
+ UiPageSearch.open((pageId) => this._insert(pageId));
+ }
+ _insert(pageId) {
this._editor.buffer.set();
- this._editor.insert.text("[wsp='" + pageID + "'][/wsp]");
+ this._editor.insert.text(`[wsp='${pageId}'][/wsp]`);
}
- };
+ }
+ Core.enableLegacyInheritance(UiRedactorPage);
return UiRedactorPage;
});
+++ /dev/null
-/**
- * Converts `<woltlab-metacode>` into the bbcode representation.
- *
- * @author Alexander Ebert
- * @copyright 2001-2019 WoltLab GmbH
- * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
- * @module WoltLabSuite/Core/Ui/Redactor/Page
- */
-define(['WoltLabSuite/Core/Ui/Page/Search'], function(UiPageSearch) {
- "use strict";
-
- if (!COMPILER_TARGET_DEFAULT) {
- var Fake = function() {};
- Fake.prototype = {
- init: function() {},
- _click: function() {},
- _insert: function() {}
- };
- return Fake;
- }
-
- function UiRedactorPage(editor, button) { this.init(editor, button); }
- UiRedactorPage.prototype = {
- init: function (editor, button) {
- this._editor = editor;
-
- button.addEventListener('click', this._click.bind(this));
- },
-
- _click: function (event) {
- event.preventDefault();
-
- UiPageSearch.open(this._insert.bind(this));
- },
-
- _insert: function (pageID) {
- this._editor.buffer.set();
-
- this._editor.insert.text("[wsp='" + pageID + "'][/wsp]");
- }
- };
-
- return UiRedactorPage;
-});
--- /dev/null
+/**
+ * Converts `<woltlab-metacode>` into the bbcode representation.
+ *
+ * @author Alexander Ebert
+ * @copyright 2001-2019 WoltLab GmbH
+ * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @module WoltLabSuite/Core/Ui/Redactor/Page
+ */
+
+import * as Core from "../../Core";
+import * as UiPageSearch from "../Page/Search";
+import { RedactorEditor } from "./Editor";
+
+class UiRedactorPage {
+ protected _editor: RedactorEditor;
+
+ constructor(editor: RedactorEditor, button: HTMLAnchorElement) {
+ this._editor = editor;
+
+ button.addEventListener("click", (ev) => this._click(ev));
+ }
+
+ protected _click(event: MouseEvent): void {
+ event.preventDefault();
+
+ UiPageSearch.open((pageId) => this._insert(pageId));
+ }
+
+ protected _insert(pageId: string): void {
+ this._editor.buffer.set();
+
+ this._editor.insert.text(`[wsp='${pageId}'][/wsp]`);
+ }
+}
+
+Core.enableLegacyInheritance(UiRedactorPage);
+
+export = UiRedactorPage;