diff --git a/changelog/62_UNRELEASED_xxxx-xx-xx.md b/changelog/62_UNRELEASED_xxxx-xx-xx.md index c57598bc..b7cc2a60 100644 --- a/changelog/62_UNRELEASED_xxxx-xx-xx.md +++ b/changelog/62_UNRELEASED_xxxx-xx-xx.md @@ -58,6 +58,7 @@ - Some night mode style improvements (thanks @BlizzWave and @KTibow) - Help tooltips are now additionally also triggered by clicking on them (instead of only hovering them, which doesn't work on mobile / touch devices) - Fixed that the number picker up/down buttons did not work when the input field was empty or contained an invalid number +- Fixed that links and embeds (e.g. YouTube videos) did not work in the text editor ### API fixes - Fixed that due soon products with `due_type` = "Expiration date" were missing in `due_products` of the `/stock/volatile` endpoint diff --git a/controllers/BaseController.php b/controllers/BaseController.php index 0a773501..81442d4b 100644 --- a/controllers/BaseController.php +++ b/controllers/BaseController.php @@ -99,7 +99,6 @@ class BaseController return PrintService::getInstance(); } - protected function getTasksService() { return TasksService::getInstance(); @@ -211,9 +210,11 @@ class BaseController { $htmlPurifierConfig = \HTMLPurifier_Config::createDefault(); $htmlPurifierConfig->set('Cache.SerializerPath', GROCY_DATAPATH . '/viewcache'); - $htmlPurifierConfig->set('HTML.Allowed', 'div,b,strong,i,em,u,a[href|title],ul,ol,li,p[style],br,span[style],img[width|height|alt|src],table[border|width|style],tbody,tr,td,th,blockquote'); + $htmlPurifierConfig->set('HTML.Allowed', 'div,b,strong,i,em,u,a[href|title|target],iframe[src|width|height|frameborder],ul,ol,li,p[style],br,span[style],img[width|height|alt|src],table[border|width|style],tbody,tr,td,th,blockquote'); + $htmlPurifierConfig->set('HTML.SafeIframe', true); $htmlPurifierConfig->set('CSS.AllowedProperties', 'font,font-size,font-weight,font-style,font-family,text-decoration,padding-left,color,background-color,text-align'); - $htmlPurifierConfig->set('URI.AllowedSchemes', ['data' => true]); + $htmlPurifierConfig->set('URI.AllowedSchemes', ['data' => true, 'http' => true, 'https' => true]); + $htmlPurifierConfig->set('URI.SafeIframeRegexp', '%^.*%'); //allow YouTube and Vimeo self::$htmlPurifierInstance = new \HTMLPurifier($htmlPurifierConfig); }