To participate you must create an account on apostrophenow.org. If you have already done so, click Login.

Ticket #494 (closed defect: fixed)

Opened 19 months ago

Last modified 14 months ago

FCK Editor - <br/> is output as <br>

Reported by: johnnyoffline Owned by: tboutell
Priority: major Milestone: 1.5
Component: apostrophePlugin Version: trunk
Keywords: aRichText, FCK, 1.5rc2 Cc: geoffd, agilbert, rickybanister, jake, johnnyoffline, dordille, boutell, thingygeoff,
Symfony version: 1.4

Description

I can't find anything in fckconfig.js that says to output bad break tags.

When you view source -within- FCK, the break tag looks good, w/ the closing slash.

But after you save and run the validator, it fails showing a bad BR tag.

Is this FCK Bug? aHtml bug? DB Bug?

Apostorphe pages cannot validate until this is fixed.


Attachments

br-tag-fails.PNG Download (83.2 KB) - added by anonymous 19 months ago.
aHtml.class.php Download (21.6 KB) - added by thingygeoff 14 months ago.
Modified aHtml.class.php allowing for app.yml control of br tags

Change History

Changed 19 months ago by anonymous

Changed 16 months ago by geoffd

  • keywords FCK, 1.5b added; FCK removed
  • milestone changed from 1.4.2 to 1.5

Changed 15 months ago by geoffd

  • keywords 1.5rc2 added; 1.5b removed

Changed 14 months ago by tboutell

This relates to ticket #500

Changed 14 months ago by geoffd

  • cc thingygeoff, added

From Geoff Hammond:

I have narrowed down the issue, and it's not (in my case) to do with
the FCKeditor. It's actually to do with the DOMDocument that the
simplify function processes the HTML through.

I've spent a LONG time trying to change the DOMDocument to an xHTML
strict DocType? but it appears that it can only parse the loadHTML
function as HTML Transitional:

$imp = new DOMImplementation();
$dtd = $imp->createDocumentType('html', '-//W3C//DTD XHTML 1.0

Strict//EN', ' http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd');

$doc = $imp->createDocument(null, 'html', $dtd);
$doc->encoding = 'UTF-8';
//$doc = new DOMDocument('1.0', 'UTF-8');

The above should work, but as soon as you call ->loadHTML it changes
the DocType?, it doesn't look like it's got the capacity to format the
br's in any other way.

So having wasted a stupid amount of time trying to do it properly, the
issue can be simply fixed by adding a:

$result = str_replace('<br>', '<br />', $result);

Anywhere after the $result has been taken out of the DOMDocument
object.

Or to potentially make it toggleable by:

---
Line 123: static public function simplify($value, $allowedTags =
false, $complete = false, $allowedAttributes = false, $allowedStyles =
false, $strictBr = true;)

Starting Line 210:

if ($strictBr)
{

$result = str_replace('<br>', '<br />', $result);

}

---

Hopefully this will help any stuck with this issue...

Changed 14 months ago by thingygeoff

Modified aHtml.class.php allowing for app.yml control of br tags

Changed 14 months ago by thingygeoff

Attached aHtml.class.php file that works with the following entry in app.yml:

...
aToolkit:

html_strict_br: true
...

Best regards

Geoff Hammond

Changed 14 months ago by tboutell

  • status changed from new to closed
  • resolution set to fixed

Fix applied in [2742]. I made html_strict_br the default behavior but otherwise used your patch unchanged. Thanks Geoff.

Note: See TracTickets for help on using tickets.