Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feature request] Add CodeMirror support #18

Open
PeterBurner opened this issue Jan 22, 2016 · 6 comments
Open

[feature request] Add CodeMirror support #18

PeterBurner opened this issue Jan 22, 2016 · 6 comments

Comments

@PeterBurner
Copy link

the CodeMirror Plugin isn't loaded on inline edit

@chchch
Copy link

chchch commented Aug 31, 2016

Hi,

I've managed to make them work, but it seems to require also modifying the CodeMirror plugin. The CodeMirror plugin wraps everything in an anonymous function that loads on document.ready; I've instead gave that function a name, i.e. dokuwiki_codemirror_init, and then in the fastwiki plugin, in the _initEdit function, I simply add a line to run dokuwiki_codemirror_init().

Hope that helps.

@PeterBurner
Copy link
Author

PeterBurner commented Aug 31, 2016

cool workaround
thanks
am I getting this right, I have to replace function(a) by function dokuwiki_codemirror_init(a) in the scripts.min.js of codemirror?
unfortunately I can't test it right now

@chchch
Copy link

chchch commented Aug 31, 2016

Search for jQuery(function(){"use strict";.... and replace that with function dw_cm_init(){"use strict";...

then at the bottom of the script, you need to run the function, so add jQuery(document).ready(dw_cm_init());

Then in the fastwiki plugin, in the _initEdit() function, add dw_cm_init(); ... I put it after if($editform.length == 0) return;

Let me know if it works!

@PeterBurner
Copy link
Author

great
thanks
i'll try that

@chchch
Copy link

chchch commented Aug 31, 2016

Oh wait, also at the end of the script you need to remove the
);
that corresponds to the
jQuery(
that we replaced.

@zioth
Copy link
Owner

zioth commented Sep 2, 2016

This patch might cause problems if you go in and out of edit mode more than once. Since codemirror is distributed compressed, I can't easily make and test a pull request, but I've submitted an issue with what I think is the right fix. albertgasset/dokuwiki-plugin-codemirror#59

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants