File tree Expand file tree Collapse file tree 2 files changed +6
-6
lines changed
ts/WoltLabSuite/Core/Component/Quote
wcfsetup/install/files/js/WoltLabSuite/Core/Component/Quote Expand file tree Collapse file tree 2 files changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -500,7 +500,7 @@ function removeSelection(): void {
500500}
501501
502502function alignQuoteButtons ( content : HTMLElement ) : void {
503- const coordinates = getElementBoundaries ( window . getSelection ( ) ) ! ;
503+ const coordinates = getElementBoundaries ( window . getSelection ( ) ) ;
504504 const dimensions = { height : copyQuote . offsetHeight , width : copyQuote . offsetWidth } ;
505505 let left = ( coordinates . right - coordinates . left ) / 2 - dimensions . width / 2 + coordinates . left ;
506506
@@ -516,13 +516,13 @@ function alignQuoteButtons(content: HTMLElement): void {
516516 copyQuote . style . setProperty ( "left" , `${ left } px` ) ;
517517}
518518
519- function getElementBoundaries ( selection : Selection | null ) : ElementBoundaries | null {
519+ function getElementBoundaries ( selection : Selection | null ) : ElementBoundaries {
520520 if ( ! selection ) {
521- return null ;
521+ throw new Error ( "Nothing is selected" ) ;
522522 }
523523
524524 if ( selection . rangeCount <= 0 ) {
525- return null ;
525+ throw new Error ( "Selection has no range" ) ;
526526 }
527527
528528 // The coordinates returned by getBoundingClientRect() are relative to the
You can’t perform that action at this time.
0 commit comments