User tests: Successful: Unsuccessful:
Pull Request for Issue #32997 redo of #16357 .
Use abetter script for marking HTML: https://markjs.io https://bundlephobia.com/result?p=mark.js@8.11.1
After pulling this PR and running npm ci:
Create an article with the word "create" and the word "admin" in the body text.
Ensure the System - Highlight plugin is enabled
View the article on the frontend
Then append the url you are on with ?highlight=WyJjcmVhdGUiLCJhZG1pbiJd
WyJjcmVhdGUiLCJhZG1pbiJd = base64encode of the array ["create","admin"]
No highlight
This should be 100% B/C but the idea is to deprecate as many HTMLHelpers as possible as they are really unfriendly for front end devs (nobody will ever create a Plugin just to adjust some HTML/JS/CSS and then have to maintain it)
@PhilETaylor can you give this a test?
| Status | New | ⇒ | Pending |
| Category | ⇒ | JavaScript Repository NPM Change Layout Libraries |
| Labels |
Added:
NPM Resource Changed
?
|
||
| Category | JavaScript Repository NPM Change Layout Libraries | ⇒ | JavaScript Repository NPM Change Layout Libraries Front End Plugins |
| Category | JavaScript Repository NPM Change Layout Libraries Front End Plugins | ⇒ | JavaScript Repository NPM Change Front End com_finder Layout Libraries Plugins |
It looks good,
but I have a couple notes :)
Now something more complicated
1) We do not need layout joomla.highlight.highlight.
You should not define ALL possible options in the layout.
The JS script should have a default options, and merge with User options, in this way it will be more efficient.
So, example, if your code have 'iframesTimeout'=> 5000, 'class' => 'js-highlight' then this should be in JS default, not PHP.
Then in PHP set only modified options:
$doc->addScriptOptions('highlight', [
'highLight' => $terms,
])Developer should set them only if he want diferent class, timeout:
$doc->addScriptOptions('highlight', [
'highLight' => $terms,
'class' => 'foo-bar',
])In this way we save a loot of KB, and we do not need joomla.highlight.highlight.
2) For this script it better to allow to have a couple highlight on the page.
In addScriptOptions set array of options, instead of just options,
in this way we can have a couple highlight, for different terms:
$doc->addScriptOptions('highlight', [[ 'highLight' => $terms]], false);
$doc->addScriptOptions('highlight', [[ 'highLight' => $terms2]], false);The JS could do some caching/checking to avoid the terms duplication, so we safe if someone have multiple call of same terms.
| Category | JavaScript Repository NPM Change Layout Libraries Front End Plugins com_finder | ⇒ | JavaScript Repository NPM Change Front End com_finder Libraries Plugins |
Now something more complicated
Should be ok now, fwiw I was copying fixing the old PR here without paying too much attention on my previous assumptions
@infograf768 as this PR is just replacing the highlighting script can you make a PR with the colour change once this is merged?
Edit: nevermind I added it here
| Category | JavaScript Repository NPM Change Libraries Front End Plugins com_finder | ⇒ | JavaScript Repository NPM Change Front End com_finder Libraries Plugins Templates (site) |
I still would drop from php 'accuracy' => 'partially', 'diacritics' => true,
But it already better than before
Later I will try to test
okay, I have tested, and it does not work
well, it partly work, only for ?highlight=WyJjcmVhdGUiLCJhZG1pbiJd
but not work for search result view
I have tested this item
I have tested this item
Created a highlight string to match content I had on my J4 installation and highlighting appeared as per expected result.
| Status | Pending | ⇒ | Ready to Commit |
RTC
| Status | Ready to Commit | ⇒ | Fixed in Code Base |
| Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2021-04-19 06:30:09 |
| Closed_By | ⇒ | rdeutz | |
| Labels |
Added:
?
|
||
Works OK but imho the default bootstrap
$mark-bg: #fcf8e3 !default;is too weak.we have
gives

I suggest overriding it with a stronger hue in
.../templates/cassiopeia/scss/tools/variables/_variables.scssfor example:
#fbeea8which would give