TYPO3 7.6 - I can't break long titles in two lines - typo3-7.6.x

I'm importing a TYPO3 6.2 site into 7.6.
To avoid <br/> being converted to <br/> for more than 15 years or so I have used:
lib.stdheader.10.setCurrent.htmlSpecialChars = 0
It worked very well, but now with TYPO3 7.6 it doesn't work, or I'm doing something wrong. I'm stuck.
I tried this old trick from Wiki.Resource (modification of Header.html in Fluid Styled Content):
<h1><f:link.typolink parameter="{link}"><f:format.raw>{header}</f:format.raw></f:link.typolink></h1>
and it works. However this is not a normal procedure.
Any suggestion?

Related

How to provide details/summary HTML element in TYPO3's CKEditor?

Unfortunately there's no details/summary element in the default CKEditor configuration of TYPO3 and I'm looking for a way to add it.
What I've been trying to do:
I searched and found a widget on https://ckeditor.com/cke4/addon/detail , but it's repository on GitHub has been archived and the widget does not work as expected. It requires 'api,widget' and this generates a JavaScript error:
[CKEDITOR.resourceManager.load] Resource name "api" was not found at "/typo3/sysext/rte_ckeditor/Resources/Public/JavaScript/Contrib/plugins/api/plugin.js?t=K24B-4e13cc129f".
When removing this requirement for "api", there's an error regarding line 72
CKEDITOR.api.parser.add(item, el);.
Then I found a similar widget at GitHub , which looks like an older version of the former without requirement for "api".
It already looks quite good, but is still a bit buggy: the HTML structure is changed when saving and the summary is duplicated. When switching to the source code, the HTML structure specified in the template ...
<details><summary>Summary</summary><div class="details-content"></div></details>
… get's partially lost.
I'm not sure if the widgets are buggy or if the editor is limited by the integration into TYPO3 and I was also not able to combine the two in a way that would lead to a working solution.
Update (Jul 22):
I successfully modified the Creating a Simple CKEditor Widget (Part 1) example to create
a widget with the following HTML structure:
<div class="expander">
<p class="expander-title">Title</p>
<div class="expander-content"><p>Content...</p></div>
</div>
With the help of a small JavaScript snippet and some CSS it now behaves almost like a details-summary element, but is not quite as good in terms of SEO and accessibility.
If I replace the elements <div class="expander"> and <p class="expander-title"> with <details> and <summary> in the widget, it unfortunately doesn't work properly anymore and changes the structure when saving. For some reason the RTE treats them differently.
I have already manually added the following to the RTE configuration:
processing:
allowTags:
- details
- summary
allowTagsOutside:
- details
- summary

Xpath, div with multiple classes

I feel really stupid: I just read this question How to get html elements with multiple css classes and the answer was very clear and straightforward but when I try to apply it on this HTML
<div class="header group">
I am completely unable to make it work.
Here are some of the variations I have tried
//*[contains (#class, ’header’) and contains (#class, ‘group’)]
//div[contains (#class, ’header’) and contains (#class, ‘group’)]
//div[contains (#class, ’header’)]
What am I missing here? Should be straightforward, shouldn't it?
Testing in Chrome Canary.
Updates
The invalid typographical apostrophes above happened when I copy-pasted into this form. I was using ' in the actual console.
I was playing around on an archived version of the page at the Wayback Machine (WM) and nothing worked. However, when trying on the live version, everything worked as expected (the problem with the live version was that the final element I was "aiming" at currently is missing but will return later on, therefore I used WM). Any ideas why // seems broken on WM? Even if WM adds a few levels of divs, // should be transparent about that, shouldn't it?
Just use this xpath.
//div[#class='header group']
you should use something like this
<xpath expr="//div[hasclass('header') and hasclass('group')]" position="replace">
<t>
xxxxxx
</t>
</xpath>

Ionic 2 + Angular 2: Images prepended with 'unsafe:' therefore not displaying even though they're fine

For some reason, some of my images are being prepended with 'unsafe:', which is causing them not to be rendered.
Q) Why is this happening and how can I fix it - Is this Angular 2 being odd with whitelisting or Ionic 2?
e.g.
<p><img src="unsafe:data:image/jpeg;base64,/9.....
<p><img src="data:image/jpeg;base64,/9.....
There is nothing wrong with the image (see here), see plunkr here
The second image is rendered from Ionic 2, the first I manually removed the prefix to show it's fine.
For anyone experiencing this issue, I have 'solved' it by using the following:
Class:
import {DomSanitizationService} from '#angular/platform-browser';
constructor(private _DomSanitizationService: DomSanitizationService) {}
Template:
<img [src]="_DomSanitizationService.bypassSecurityTrustUrl(imgSrcProperty)"/>
Where imgSrcProperty is the offending image base64 encoded.
I still think this is a bug!
in angular 5.2.6
class:
import { DomSanitizer } from '#angular/platform-browser';
constructor(public _DomSanitizationService: DomSanitizer ) {}
Template
<img [src]="_DomSanitizationService.bypassSecurityTrustUrl(imgSrcProperty)"/>
I would like to add an additional answer, so some of you will not have to debug for ages.
We also came across this problem together with Ionic+Angular on iOS (WKWebView) and found out, that Base64 data urls are also considered "unsafe" once the Base64 string contains line breaks. Either MS Windows style CRLF or LF.
We proceeded to remove those offending characters from base64 strings (an external interface was "pretty printing" them), which ultimately resolved the issue for us.
Before applying the bypass mentioned by #Dave, I would check the string.
In my case, I discovered, after have banged my head against the wall several times, that a litle and innocent whitespace in the end of the image url can make Ionic/Angular issue this error.
It worked for me, although in Angular 11 its slightly different.
The DomSanitationService is now The DomSanitizer:
import {DomSanitizer } from '#angular/platform-browser';
And if you want to use this in your component html, you need to set it public:
constructor(public domSrv: DomSanitizer)
Then its easy to use:
<img *ngIf="picture" [src]="domSrv.bypassSecurityTrustUrl(picture)" />
Alternative solution is to user ion-img:
<ion-img src="{{base64SVGString}}"></ion-img>

Producing a pdf with internal anchor links using dompdf

I am using dompdf to collate a load of existing HTML pages. A lot of these pages have anchor links in them that I would like to preserve. When I collate these articles the pdf collates very nicely but the anchors links don't work. The text is underlined like a link but on clicking it you don't go anywhere.
I have some test HTML that I am using to try out anchor links. Such as:
$content .= '<div style="page-break-after: always;">blah</div>
<div><a id="blah">link location</a></div>';
and also I have tried using name instead of id, based on this forum post - http://www.dashinteractive.net/dompdf/index.php?v=1530231. Such as:
$content .= '<div style="page-break-after: always;">blah</div>
<div><a name="blah">link location</a></div>';
Of course neither of these are working as I would expect.
I can't find much on the internet about how dompdf handles internal links. Apart from this page http://webresourcesdepot.com/html-to-pdf-rendering-engine-dompdf/ that says it can handle links and anchors. Not sure how reliable it is...
How do you put internal anchor links in pdfs using dompdf please? Can it do it?
dompdf up through 0.6.2 should work so long as you use the <a name="blah">...</a> format. The only problem in that release is that if the A tag is empty it will be removed before the link is rendered.
Your second sample should be fine, though maybe just as part of typing up the question the actual anchor reference is incorrect. The following should work:
<div style="page-break-after: always;">blah</div>
<div><a name="blah">link location</a></div>
The current beta for 0.7.0 has a bug that mangles the anchor resulting in a mis-interpreted link type. That issue should be addressed for the stable 0.7.0 release.
Note that no version up to and including v0.7.0 supports linking based on ID.

prestashop 1.6 addJsDef not working

i updated prestashop from 1.5 to 1.6, now the theme have some little issue, the most important is that the price of the combinations is 0 in the product page. I tried to update the theme but everything declared with {addJsDef} is absent from the source code. Do you have any suggestion please? Thanks.
I'm digging an old issue here, but maybe that could help someone in the future :
As said on this thread of the Prestashop forums : http://www.prestashop.com/forums/topic/357269-prestashop-16-addjsdef-not-working/ , try to force the add of the Prestashop JS Files in the footer of your page in the back office.
Back Office -> Advanced Params -> Performance -> Activate Javascript to end
You need to make sure your theme has layout.tpl file
Without this the following if statement fails in the classes/Controller/Controller.php
if (in_array($this->controller_type, array('front', 'modulefront')) && !empty($html) && $this->getLayout()) {
or your js won't be loaded into the defer variable.
Perhaps the reason that there is no definition in the pattern of these variables?
Try adding this code in header.tpl:
{if isset($js_defer) && !$js_defer && isset($js_files) && isset($js_def)}
{$js_def}
{foreach from=$js_files item=js_uri}
<script type="text/javascript" src="{$js_uri|escape:'html':'UTF-8'}"></script>
{/foreach}
{/if}

Resources