Scroll to the editor after inserting the quote
authorAlexander Ebert <ebert@woltlab.com>
Thu, 28 Jul 2022 11:11:57 +0000 (13:11 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Thu, 28 Jul 2022 11:11:57 +0000 (13:11 +0200)
See https://www.woltlab.com/community/thread/296552-zitieren-von-kompletten-beitr%C3%A4gen-springt-nicht-in-den-editor/

ts/WoltLabSuite/Core/Ui/Redactor/Quote.ts
wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Redactor/Quote.js

index 9cfcd3dc488c5aab74a196bb679c350110b20bd3..4fd59f7f2cdd73d1b2c593a406233f847e9f5c55 100644 (file)
@@ -18,6 +18,7 @@ import { DialogCallbackSetup } from "../Dialog/Data";
 import { RedactorEditor } from "./Editor";
 import * as UiRedactorMetacode from "./Metacode";
 import * as UiRedactorPseudoHeader from "./PseudoHeader";
+import * as UiScroll from "../Scroll";
 
 interface QuoteData {
   author: string;
@@ -115,6 +116,10 @@ class UiRedactorQuote {
 
       this._editor.buffer.set();
     });
+
+    window.setTimeout(() => {
+      UiScroll.element(this._editor.core.box()[0]);
+    }, 0);
   }
 
   /**
index 560f93479cea99def2417da9792cb617c924b0f3..9622a7fb52b6ea2dd8a3ff986d51e294a211982a 100644 (file)
@@ -7,7 +7,7 @@
  * @module      WoltLabSuite/Core/Ui/Redactor/Quote
  * @woltlabExcludeBundle tiny
  */
-define(["require", "exports", "tslib", "../../Core", "../../Dom/Util", "../../Event/Handler", "../../Language", "../../StringUtil", "../Dialog", "./Metacode", "./PseudoHeader"], function (require, exports, tslib_1, Core, Util_1, EventHandler, Language, StringUtil, Dialog_1, UiRedactorMetacode, UiRedactorPseudoHeader) {
+define(["require", "exports", "tslib", "../../Core", "../../Dom/Util", "../../Event/Handler", "../../Language", "../../StringUtil", "../Dialog", "./Metacode", "./PseudoHeader", "../Scroll"], function (require, exports, tslib_1, Core, Util_1, EventHandler, Language, StringUtil, Dialog_1, UiRedactorMetacode, UiRedactorPseudoHeader, UiScroll) {
     "use strict";
     Core = tslib_1.__importStar(Core);
     Util_1 = tslib_1.__importDefault(Util_1);
@@ -17,6 +17,7 @@ define(["require", "exports", "tslib", "../../Core", "../../Dom/Util", "../../Ev
     Dialog_1 = tslib_1.__importDefault(Dialog_1);
     UiRedactorMetacode = tslib_1.__importStar(UiRedactorMetacode);
     UiRedactorPseudoHeader = tslib_1.__importStar(UiRedactorPseudoHeader);
+    UiScroll = tslib_1.__importStar(UiScroll);
     let _headerHeight = 0;
     class UiRedactorQuote {
         /**
@@ -85,6 +86,9 @@ define(["require", "exports", "tslib", "../../Core", "../../Dom/Util", "../../Ev
                 this._editor.WoltLabCaret.paragraphAfterBlock(quote);
                 this._editor.buffer.set();
             });
+            window.setTimeout(() => {
+                UiScroll.element(this._editor.core.box()[0]);
+            }, 0);
         }
         /**
          * Toggles the quote block on button click.