WBCE CMS Forum

WBCE CMS – Way Better Content Editing.

Du bist nicht angemeldet.

#1 31.08.2015 16:56:19

florian
Administrator

code2 2.2.5 verträgt sich nicht mit CKEditor

Wenn auf derselben Seite ein oder mehrere WYSIWYG-Abschnitte sowie ein oder mehrere Code2-Abschnitte sind, funktioniert in der "Sourcecode"-Ansicht des CKEditors das Syntaxhighlighting nicht mehr und es ist dann auch kein Wechsel mehr zurück in die WYSIWYG-Ansicht möglich (erst durch Neuladen der Seite).
Die Fehlerkonsole zeigt:

Fehler: TypeError: CodeMirror.newFoldFunction is not a function
Quelldatei: http://.../modules/ckeditor/ckeditor/plugins/codemirror/plugin.js?t=F61A
Zeile: 563


Code allein macht nicht glücklich. Jetzt spenden!

Offline

#2 31.08.2015 22:14:53

marmot
Mitglied

Re: code2 2.2.5 verträgt sich nicht mit CKEditor

Tried to fix this with an update of cke codemirror plugin. This works for me.

Offline

#3 01.09.2015 07:55:55

mrbaseman
Developer

Re: code2 2.2.5 verträgt sich nicht mit CKEditor

The changes look like a quite complicated fix - however, if I understand it correctly, you just updated the codemirror plugin inside ckeditor to the latest version (which might be a good idea anyway to pick up other fixes form the ckeditor developers).

I have tried the enhanced fix from here  https://github.com/w8tcha/CKEditor-Code … /issues/63 and applied it to modules/ckeditor/ckeditor/plugins/codemirror/plugin.js for ckeditor 4.4.3 in wb-classic 2.8.3 sp4 together with code2 2.2.5.
It also works once but you can't switch back and forth multiple times between source and wysiwyg mode - so the fix which I have found is still incomplete. Can you switch multiple times with marmots fix? If not, the above link could be a pointer but probably some more work is needed. (I just saw marmots fix and didn't have the time yet to test it on my own).

Offline

#4 01.09.2015 09:01:15

norhei
Developer

Re: code2 2.2.5 verträgt sich nicht mit CKEditor

Ähhhm bevor wir das jetzt komplett verhuddeln ... solten wir für die Experimente mit dem CKE nicht mal ein wenig mit den Branches schauen .

Also der CKE an sich funktioniert ? Der edit area funzt auch . Sprich die Beta 4 sollten wir an der Stelle abzweigen und auch nur noch Fixes einbauen.
Und dann sollten wir mal schauen das die beta langsam Stable wird.

Den CKE als Code Editor ist schon ein ganzes Stück über das Ziel des ersten Release hinaus. Erstmal wollten Wir ein funktionierendes WB.

Offline

#5 01.09.2015 09:37:20

mrbaseman
Developer

Re: code2 2.2.5 verträgt sich nicht mit CKEditor

So wie ich das Problem verstehe: Ja, ckeditor an sich funktioniert (zumindest im Hinblick auf das hier beschriebene Problem). Code2 an sich funktioniert auch. Mehrere Sections auf einer Seite ENTWEDER mit ckeditor ODER mit code2 funktionieren auch.

Nur nutzen beide Module codemirror fürs Syntax-Highlighting und beide bringen unterschiedliche Mechanismen mit, codemirror zu laden. Wenn von beiden Modulen eine Instanz auf einer Seite verwendet wird, kommen sich diese beiden Mechanismen in die Quere. Ich habe es in code2 einfach so implementiert, wie es auf allen codemirror-Beispielseiten gemacht wird. Ckeditor prüft zunächst, ob eine codeMirror-Klasse bereits existiert und versucht nur dann das Plugin nachzuladen, wenn es nicht bereits geladen ist.

Da jedes Modul, das codemirror verwendet, potentiell auch eine andere Version oder eine andere Zusammenstellung von Plugins verwendet, führt das immer dann zu Problemen, wenn mehrere unterschiedliche Module, die codemirror verwenden, auf der gleichen Seite verwendet werden.

Wenn jemand eine schlaue Idee hat, wie man den Konflikt beheben kann, bau ich das gern in Code2 mit ein. Der Mechanismus von ckeditor jedenfalls versucht schlau zu sein, verlässt sich jedoch auch auf globale Klassennamen.

Sowas wie Namespaces wäre hier angebracht. Eine naive aber auf Dauer nicht so elegante Methode wäre in Code2 mit search and replace durch alle Files durchgehen und alle Vorkommen von CodeMirror durch Code2.CodeMirror oder so ähnlich zu ersetzen. Aber vielleicht hat jemand eine bessere Idee?

Beitrag geändert von mrbaseman (01.09.2015 10:18:16)

Offline

#6 01.09.2015 09:42:44

norhei
Developer

Re: code2 2.2.5 verträgt sich nicht mit CKEditor

Wie wärs einfach erst mal die Edit Area Version zu nehmen ??
Oder lief die nicht stabil ?

Offline

#7 01.09.2015 10:12:12

kant
Mitglied

Re: code2 2.2.5 verträgt sich nicht mit CKEditor

Just a "quick" test:
- WBCE actual working-copy within the ck-editor "patch" from Marmot
- code2 2.2.5 from wbce aor
- Multiple sections within WYSIWYG/Code2 sections on one page
- Multiple times open and edit "source" in CK-Editor

no errors( php/js ) are thrown ;-)

MAMP 3.4 | PHP 5.6.10 | WBCE : er_level: -1 (within changes inside the "initialize.php")

As for me code2 doesn't seem to be touch within the codechanges from Marmot for the ck-editor plugin.

@marmot: +1 (WOW!)

Kind regards
Kant


Sapere aude!

Offline

#8 01.09.2015 10:31:31

mrbaseman
Developer

Re: code2 2.2.5 verträgt sich nicht mit CKEditor

thanks for this test. I still didn't have the time to test marmots fix. The discussion went more in a general direction. There is this general problem that a real concept of namespaces is missing in javascript (but there are workarounds http://stackoverflow.com/questions/8815 … javascript) - and we had such a conflict and it was solved by marmots fix which kant has successfully tested.

My previous post was rather aiming at a solution in Code2 which avoids such collisions in the future. I'm thinking of implementing one of the solutions of the above link but I'm still unsure how this works with including multiple files from codemirror which I would like to leave untouched. Maybe one has to combine it with a loader mechanism like the one used by ckeditor. But since it's working fine for the moment, we have some time to think about this more general task and postpone it for a later release.

Offline

#9 02.09.2015 07:01:44

mrbaseman
Developer

Re: code2 2.2.5 verträgt sich nicht mit CKEditor

I just wanted to let you know: I have upgraded my ckeditor to 4.4.7 in wb-classic 2.8.3 sp4 and copied in the latest codemirror plugin (1.13) and syntax highlighting works out of the box, without any further patches. I can switch multiple times between code and wysiwyg, too. So, the ckeditor developers have already solved the problem and we don't have to apply our own patches for the WB module.

However, I still have the intention to improve code2 - maybe I should have a closer look how codemirror is loaded in the latest module for ckeditor.

Offline

#10 02.09.2015 18:37:27

marmot
Mitglied

Re: code2 2.2.5 verträgt sich nicht mit CKEditor

It would be a great honor for me, if someone would read my posts (and follow the link, and read my comment).

Offline

#11 03.09.2015 10:25:05

mrbaseman
Developer

Re: code2 2.2.5 verträgt sich nicht mit CKEditor

Sorry Marmot,

I'm really confused by your latest post:

marmot schrieb:

It would be a great honor for me, if someone would read my posts (and follow the link, and read my comment).

sure, I did. I was investigating the same problem in parallel and saw on github that someone had a similar problem and he requested further fixes from the ckeditor developers. Therefore, I thought it would be still helpful, to provide that link and report from my tests. At least you wrote that you tried to fix this issue - so at that point I was not sure if this try was successful - and for which environment it works (maybe you weren't sure either, otherwise you would probably have written that you fixed it, not that you tried to fix it).

Then, kant took your fix and verified that your fix indeed works and that he does not see the problem which was reported by the user who requested further fixes on github.

Then, I replied to kants comment that your fix doesn't touch code2 at all and clarified that there is a problem not inside code2, but on a more general level, how modules interact, if they both use codemirror. I also stated that I didn't find the time to verify your fix at that time, again referring to your post.

The next day, I did the same thing as you did (for a different environment though, namely WB classic), and I have also reported that your fix (i.e. the update of the codemirror plugin in the ckeditor module) indeed fixes the problem discussed in the current thread. However, it is solved for the special case of using code2 together with ckeditor, but if another module comes along and uses codemirror, too, it might conflict with code2 again. Therefore, I wrote that I want to have a look at the codemirror plugin and see if I can learn how the developers of the plugin have solved it and see if I can implement the same thing in code2 in order to avoid such collisions in the future.

The only thing which I could not do yet, is checking out your commit in a WBCE installation, for the simple reason that I don't have a WBCE, yet and my time is also limited (currently, I'm working a lot on several modules). But I have read your post and your comment. Actually, most posts here refer to yours, directly or indirectly by stating something that is related to your commit. I really ask myself why you write "It would be a great honor for me, if someone would read my posts (and follow the link, and read my comment)." now. What was your intention of this post?

best regards,
Martin

Offline

#12 03.09.2015 17:46:43

marmot
Mitglied

Re: code2 2.2.5 verträgt sich nicht mit CKEditor

mrbaseman schrieb:

What was your intention of this post?

Hmm, I should have known that this would happen. Obviosly you feel offended. Sorry for that.
The intention was to tell the people here that I'm wondering if I did the fix in vaine. The post was in relation to the whole thread. You can recognize as I didn't quote anything. But surely some posts came from you.
That's what happend, just how it looks for me (subjective):
- we had a rather specific problem description, as this is the wbce forum and nothing else was mentioned it's a wbce problem
- I tested, took some time, tried to fix
- I commited and answered the post with the problem description
- As the fix was just an update and no specific solution after problem analysis I wrote "tried to fix" becuse I could not be sure if this only works for me
- FOR ME a normal reaction would be to test and report
- INSTEAD you tell you don't have the time to test and did anything else what works not good with wb classic (so what? can you say something to my try - no, do you have another solution - no)
- someone wanted to create a branch (for that update?)
- we have a disussion about namespaces
- wow, really one took the time to test and repot thats great
- you present the solution I already gave in post 2 again

Sorry, but that gives me the clear impression that my post was not noted. We have a problem, we have a solution, why do we have to save the whole world? Maybe we the solution is not good enough? Maybe we think our stuff ist better then anything else?

Once again, this is MY impresson. People are free to write what they want (under some rules) but so did I.
It's rather likely that many people see things different and we are miles off topic now.

Once again, sorry if you or anyone else feels offended. I really like the stuff you did for code 2 module.
For me this is the end of this discussion as this will lead to nothing and I like to work determined.

I learn my lesson and hopefully shut up next time and leave this discussions for other forums.

Offline

#13 03.09.2015 17:57:27

florian
Administrator

Re: code2 2.2.5 verträgt sich nicht mit CKEditor

tested marmot's solution successfully - a big Thank you again. Now closing this thread to avoid further irritations.


Code allein macht nicht glücklich. Jetzt spenden!

Offline

Fußzeile des Forums

up