From 287f84328311780c7ce9e41b5baa3385c1203c11 Mon Sep 17 00:00:00 2001 From: yggverse Date: Thu, 18 Jul 2024 15:32:23 +0300 Subject: [PATCH] fix return handler on activate-link event --- .../Entity/Browser/Container/Page/Content/Markup.php | 4 ++-- src/Entity/Browser/Container/Page/Content/Gemtext.php | 9 +++++---- src/Entity/Browser/Container/Page/Content/Plain.php | 5 ++++- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/Abstract/Entity/Browser/Container/Page/Content/Markup.php b/src/Abstract/Entity/Browser/Container/Page/Content/Markup.php index b174f98e..0be2e7f0 100644 --- a/src/Abstract/Entity/Browser/Container/Page/Content/Markup.php +++ b/src/Abstract/Entity/Browser/Container/Page/Content/Markup.php @@ -58,7 +58,7 @@ abstract class Markup \GtkLabel $label, string $href ) { - $this->_onActivateLink( + return $this->_onActivateLink( $label, $href ); @@ -69,7 +69,7 @@ abstract class Markup abstract protected function _onActivateLink( \GtkLabel $label, string $href - ); + ): bool; abstract public function set( string $value diff --git a/src/Entity/Browser/Container/Page/Content/Gemtext.php b/src/Entity/Browser/Container/Page/Content/Gemtext.php index 5d3f10ff..5da20f93 100644 --- a/src/Entity/Browser/Container/Page/Content/Gemtext.php +++ b/src/Entity/Browser/Container/Page/Content/Gemtext.php @@ -236,7 +236,8 @@ class Gemtext extends Markup protected function _onActivateLink( \GtkLabel $label, string $href - ) { + ): bool + { // Format URL $url = $this->_url( $href @@ -253,7 +254,7 @@ class Gemtext extends Markup $this->content->page->update(); // Prevent propagation for supported protocols - if (in_array( + return in_array( parse_url( $url, PHP_URL_SCHEME @@ -262,8 +263,8 @@ class Gemtext extends Markup 'nex', 'gemini', 'file' - ]) - ) return true; + ] + ); } private function _wrap( diff --git a/src/Entity/Browser/Container/Page/Content/Plain.php b/src/Entity/Browser/Container/Page/Content/Plain.php index 1f90057a..8e191701 100644 --- a/src/Entity/Browser/Container/Page/Content/Plain.php +++ b/src/Entity/Browser/Container/Page/Content/Plain.php @@ -25,5 +25,8 @@ class Plain extends Markup protected function _onActivateLink( \GtkLabel $label, string $href - ) {} + ): bool + { + return true; + } } \ No newline at end of file