Fórumok

Web-Content-Editor verändert HTML

Jan Florkowski, módosítva 13 év-val korábban

Web-Content-Editor verändert HTML

New Member Bejegyzések: 5 Csatlakozás dátuma: 2010.12.08. Legújabb bejegyzések
Hallo Zusammen,

wir setzen Liferay 6.0.5 ein und haben ein Problem mit dem Web-Content-Editor in der HTML/Quellcode-Ansicht.

Wechselt man in die Quellcode ansicht und gibt z.B. folgendes ein:
<a href="/path/to/destination"><div id="headline-logo"></div></a>

wird der Code nach dem Verlassen und Freigeben automatisch verändert. Es reicht, wenn man nach der Quellcode-Ansicht in die WYSIWYG-Ansicht wechselt und danach wieder zurück auf Quellcode wechselt. Das Ergebnis sieht dann so aus:
<p>
</p>
<div id="headline-logo">
	 </div>


Wo ist mein HTML hin?

Mit folgendem Workaround schaffe ich es, dass der Quellcode vom Prinzip enthalten bleibt, allerdings verfälscht Liferay ihn wieder:
Eingabe:
<a href="/path/to/destination"><div id="headline-logo">test</div></a>

Ergebnis:
<p>
</p>
<div id="headline-logo">
	<a href="/path/to/destination">test</a></div>


Das Ergebnis passiert sowohl im IE8 als auch FF3.6 und FF4.

Wie lässt sich diese Quellcode-Manipulation im Web-Content-Editor verhindern?
Alberto Delgado, módosítva 10 év-val korábban

RE: Web-Content-Editor verändert HTML

New Member Bejegyzés: 1 Csatlakozás dátuma: 2013.04.16. Legújabb bejegyzések
Hello Jan,

I am using LR GA 6.1 and it has same issue. We are using CKEditor.
It seems that the version of CKEditor included in LR by default requires html code to be html4.01 strict and it will remove "unneeded" tags, etc to make it compliant. There are many users with similar issue. Some people out there have been trying to work-around the problem to bypass somehow the parsing of the html code when entered in directly in the editor but this could have an impact on how that code will be displayed on the wysiwyg editor.

I would say that the root cause is that CKEditor version included in LR does not support html5.

It seems that CKEditor 4.2 (released on July 2013) has better support of html5 but still does not solve this problem (see bug report https://dev.ckeditor.com/ticket/9457).

In our case, we are working on using a different html editor.

Best regards, Alberto
Oliver Bayer, módosítva 10 év-val korábban

RE: Web-Content-Editor verändert HTML

Liferay Master Bejegyzések: 894 Csatlakozás dátuma: 2009.02.18. Legújabb bejegyzések
Hi Alberto,

I don't think it has sth to do with html5 support. You should modify the "fckconfig.js" (at least in 5.2.3):
FCKConfig.EnterMode = 'br' ;			// p | div | br

The default is "p" so if someone enters the editor an empty <p> element will be added. Setting it to "br" you don't have that problem. Your users will remove the blank line or set the cursor to the first line so override the "<br />".

Greets Oli