Codemirror keeps inserting <p></p>

Questions about how to use the online - editors and suggestions how to improve them
Post Reply
Tata
Posts: 3586
Joined: Tue May 20, 2008 5:34 am
Location: Slovakia
Contact:

Codemirror keeps inserting <p></p>

Post by Tata » Fri Sep 24, 2021 7:15 pm

I see that the codemirror inserts

Code: Select all

<span class="CmCaReT" style="display: none;"></span>
It does not disturb as the span is hidden and obviously required by the plugin's function.
What makes problem is inserting

Code: Select all

<p> </p>
This is mostly inserted as the first line (moving the content on line down), but sometime it is inserted on the end of the page. How to avoid this insertion?
CMSimple.sk
It's no shame to ask for an answer if all efforts failed.
But it's awful to ask without any effort to find the answer yourself.

lck
Posts: 2963
Joined: Wed Mar 23, 2011 11:43 am
Contact:

Re: Codemirror keeps inserting <p></p>

Post by lck » Fri Sep 24, 2021 7:24 pm

„Bevor du den Pfeil der Wahrheit abschießt, tauche die Spitze in Honig!“   👉 Ludwig's XH-Templates for MultiPage & OnePage

Tata
Posts: 3586
Joined: Tue May 20, 2008 5:34 am
Location: Slovakia
Contact:

Re: Codemirror keeps inserting <p></p>

Post by Tata » Fri Sep 24, 2021 7:50 pm

Super, danke sehr!
CMSimple.sk
It's no shame to ask for an answer if all efforts failed.
But it's awful to ask without any effort to find the answer yourself.

Tata
Posts: 3586
Joined: Tue May 20, 2008 5:34 am
Location: Slovakia
Contact:

Re: Codemirror keeps inserting <p></p>

Post by Tata » Sun Sep 26, 2021 10:18 am

Der code auftaucht immer, wenn das Codemirrorfenster und die Seite im TinyMCE4 gespeichert ist und auftaucht auf der Stelle, wo der Cursor stand im Codemirrorfenster. Das einyige, dass hilft, ist den Cursor hinter der letzte Zeile verschieben.
Vor dem Speichern:

Code: Select all

<div class="blank-page">
	<img src="./userfiles/images/slideshow/1.jpg" alt="" width="2144" height="1214"></div>
<div>
Dann:

Code: Select all

<div class="blank-page">
	<span class="CmCaReT" style="display: none;"></span>
	<img src="./userfiles/images/slideshow/1.jpg" alt="" width="2144" height="1214">
</div>
Dann:

Code: Select all

<div class="blank-page">
	<span class="CmCaReT" style="display: none;">
		<span class="CmCaReT" style="display: none;"></span>
	</span> 
	<img src="./userfiles/images/slideshow/1.jpg" alt="" width="2144" height="1214"></div>
<div>
Dann:

Code: Select all

<div class="blank-page">
	<span class="CmCaReT" style="display: none;">
		<span class="CmCaReT" style="display: none;"></span> 
		<span class="CmCaReT" style="display: none;"></span> 
	</span> <img src="./userfiles/images/slideshow/1.jpg" alt="" width="2144" height="1214"></div>
<div>
Dann:

Code: Select all

<div class="blank-page">
	<span class="CmCaReT" style="display: none;">
		<span class="CmCaReT" style="display: none;"></span> 
		<span class="CmCaReT" style="display: none;"></span> 
		<span class="CmCaReT" style="display: none;"></span> 
	</span> <img src="./userfiles/images/slideshow/1.jpg" alt="" width="2144" height="1214">
</div>
usw.
EDIT:
Gefunden in tinymce4/tinymce/plugins/codemirror/source.html (#121...)

Code: Select all

...	
	// Set CodeMirror cursor to same position as cursor was in TinyMCE:
	var html = editor.getContent({source_view: true});
	html = html.replace(/<span\s+class="CmCaReT"([^>]*)>([^<]*)<\/span>/gm, String.fromCharCode(chr));
	editor.dom.remove(editor.dom.select('.CmCaReT'));
...
(#195)

Code: Select all

...
	// Submit HTML to TinyMCE:
	editor.setContent(codemirror.getValue().replace(cc, '<span id="CmCaReT"></span>'));
	editor.isNotDirty = !isDirty;
	if (isDirty) {
		editor.nodeChanged();
	}

	// Set cursor:
	var el = editor.dom.select('span#CmCaReT')[0];
	if (el) {
		editor.selection.scrollIntoView(el);
		editor.selection.setCursorLocation(el,0);
		editor.dom.remove(el);
	}
Ich bin nicht sicher wie weit ist es wichtig, weil wenn man im CODE arbeitet, die wachsende Inserts stören schon.
CMSimple.sk
It's no shame to ask for an answer if all efforts failed.
But it's awful to ask without any effort to find the answer yourself.

lck
Posts: 2963
Joined: Wed Mar 23, 2011 11:43 am
Contact:

Re: Codemirror keeps inserting <p></p>

Post by lck » Sun Sep 26, 2021 12:17 pm

Hast du deine init_fontawesome-codemirror.js Datei dementsprechend gefixt und aktiviert?
viewtopic.php?p=81378#p81376
„Bevor du den Pfeil der Wahrheit abschießt, tauche die Spitze in Honig!“   👉 Ludwig's XH-Templates for MultiPage & OnePage

Tata
Posts: 3586
Joined: Tue May 20, 2008 5:34 am
Location: Slovakia
Contact:

Re: Codemirror keeps inserting <p></p>

Post by Tata » Sun Sep 26, 2021 1:07 pm

Ja, der leere <p> </p> is definitiv weg.
CMSimple.sk
It's no shame to ask for an answer if all efforts failed.
But it's awful to ask without any effort to find the answer yourself.

lck
Posts: 2963
Joined: Wed Mar 23, 2011 11:43 am
Contact:

Re: Codemirror keeps inserting <p></p>

Post by lck » Mon Sep 27, 2021 11:01 am

Ich kann das Problem nicht nachvollziehen. Eventuell hast du schon zu viel geändert. Ich würde es mal mit einer sauberen Installation und aktuellem Plugin prüfen.
„Bevor du den Pfeil der Wahrheit abschießt, tauche die Spitze in Honig!“   👉 Ludwig's XH-Templates for MultiPage & OnePage

manu
Posts: 1086
Joined: Wed Jun 04, 2008 12:05 pm
Location: St. Gallen - Schweiz
Contact:

Re: Codemirror keeps inserting <p></p>

Post by manu » Thu Dec 21, 2023 2:38 pm

Ich habe eine Installation mit Codemirror als Quelltext Ansicht. Da funktioniert alles. Das span#CmCaReT element wird gesetzt, um beim Verlassen des Codemirrors ("ok") den Cursor an die richtige Stelle im Text zu setzen. Das span#CmCaReT wird aber wieder entfernt. Ich würde es auch mal mit einer aktuellen Installation 1.7.6 versuchen. Da funktioniert es bei mir mit Tiny4 und Tiny5.

Tata
Posts: 3586
Joined: Tue May 20, 2008 5:34 am
Location: Slovakia
Contact:

Re: Codemirror keeps inserting <p></p>

Post by Tata » Thu Dec 21, 2023 3:37 pm

Ich weiss nicht wieso, aber bei mir ist die aktuellste Version installiert. Codeemirror nutze ich sehr offt, weill ich für jede Seite, die ich nicht selbst verewalte, einen "Sninppets" Ordner ertelle, wo ich die "Bausteine" sammle, die dann der Webmaster eifach auf der Seite nutzen kann. Und die dürfen NUR im Quelcode rein.
Dafür habe ich auch init_fontawesome-codemirror.js und init_fontawesome-XH-plugincall.js kombiniert. Für den Fall, dass es auf der Seite auch Holger's hi-fancybox eingesetzt wird, habe ich noch die nötige Liste integriert (auch die Liste der Classen für verlinkte Bilder).

Code: Select all

link_class_list: [
    {title: "---", value: ""},
    {title: "zoom", value: "zoom"},
    {title: "zoom_g", value: "zoom_g"},
    {title: "zoom_i", value: "zoom_i"}
  ],
    image_class_list: [
    {title: "---", value: ""},
    {title: "zoom", value: "zoom"},
    {title: "zoom_g", value: "zoom_g"}
  ]
Der Bug mit der <p> </p> ist aber weiter da, solange ich nicht beachte, dass der Cursor am Ende stehen muss. Dann erscheint diese "Teufelzeile" nur am Ende. Das stört auch, aber nicht so sehr.
CMSimple.sk
It's no shame to ask for an answer if all efforts failed.
But it's awful to ask without any effort to find the answer yourself.

Post Reply