- Posts: 6
COMMUNITY FORUM
Codemirror does not work
- Saen
- Topic Author
- Offline
- New Member
Less
More
15 years 2 months ago #72831
by Saen
Codemirror does not work was created by Saen
Hi All
I use Codemirror as my default editor. When it is used in K2 - the item contents won't save.
Is this a K2 problem or a Codemirror problem?
Saen
I use Codemirror as my default editor. When it is used in K2 - the item contents won't save.
Is this a K2 problem or a Codemirror problem?
Saen
Please Log in or Create an account to join the conversation.
- Ben Sims
- Offline
- New Member
Less
More
- Posts: 4
15 years 1 month ago #72832
by Ben Sims
Replied by Ben Sims on topic Codemirror does not work
Hi,
Had the same issue; wasn't saving any text.
Modified the function submitbutton() in: /includes/js/joomla.javascript.js around line 321 so it now looks like:
/**
* Submit the admin form
*/
function submitform(pressbutton){
/**
* @ADDITION - get the CodeMirror index and update the actual element with the same id.
*/
if( typeof(CodeMirror) == 'function' && ){
for (x in CodeMirror.instances){
document.getElementById(x).value = CodeMirror.instances[x].getCode();
}
}
if (pressbutton) {
document.adminForm.task.value=pressbutton;
}
if (typeof document.adminForm.onsubmit == "function") {
document.adminForm.onsubmit();
}
document.adminForm.submit();
}
Had the same issue; wasn't saving any text.
Modified the function submitbutton() in: /includes/js/joomla.javascript.js around line 321 so it now looks like:
/**
* Submit the admin form
*/
function submitform(pressbutton){
/**
* @ADDITION - get the CodeMirror index and update the actual element with the same id.
*/
if( typeof(CodeMirror) == 'function' && ){
for (x in CodeMirror.instances){
document.getElementById(x).value = CodeMirror.instances[x].getCode();
}
}
if (pressbutton) {
document.adminForm.task.value=pressbutton;
}
if (typeof document.adminForm.onsubmit == "function") {
document.adminForm.onsubmit();
}
document.adminForm.submit();
}
Please Log in or Create an account to join the conversation.
- Saen
- Topic Author
- Offline
- New Member
Less
More
- Posts: 6
15 years 1 month ago #72833
by Saen
Replied by Saen on topic Codemirror does not work
Excellent thanks Ben
I think I will submit this to the Codemirror people as well as it seems to be a problem with quite a few components. Although interestingly enough it works fine in articles and modules.
Many thanks for that - was quite a headache that one.
Saen
I think I will submit this to the Codemirror people as well as it seems to be a problem with quite a few components. Although interestingly enough it works fine in articles and modules.
Many thanks for that - was quite a headache that one.
Saen
Please Log in or Create an account to join the conversation.
- Saen
- Topic Author
- Offline
- New Member
Less
More
- Posts: 6
15 years 1 month ago #72834
by Saen
Replied by Saen on topic Codemirror does not work
ah ben...i see you already sent the fix through to Ercan...nice one.
Any ideas how this edit will affect upgrades?
I suppose one can just take a note of it and apply again if need be.
Saen
Any ideas how this edit will affect upgrades?
I suppose one can just take a note of it and apply again if need be.
Saen
Please Log in or Create an account to join the conversation.
- Daniel Bogatev
- Offline
- New Member
Less
More
- Posts: 1
15 years 3 weeks ago #72835
by Daniel Bogatev
Replied by Daniel Bogatev on topic Codemirror does not work
Hi,
10x for the sugeestion it helped me a lot.
Just a quick note - there is an error in the code which is causing K2 buttons to stop work.
The problem is in:
"if( typeof(CodeMirror) == 'function' && ){"
which should in fact be:
"if( typeof(CodeMirror) == 'function' ){"
10x for the sugeestion it helped me a lot.
Just a quick note - there is an error in the code which is causing K2 buttons to stop work.
The problem is in:
"if( typeof(CodeMirror) == 'function' && ){"
which should in fact be:
"if( typeof(CodeMirror) == 'function' ){"
Please Log in or Create an account to join the conversation.