Hi,
I want the FCKeditor on my page to be disabled until a specific condition is met.
The user should only be allowed to use an editorinstance when an element is selected. If not, an alert appears as soon as the editor instance is clicked and, after clicking OK in the alertbox, the editor should lose focus again.
What happens now is
1) user clicks editor instance
2) condition is not met so an alert pops up
3) user clicks OK in alert box
4) caret appears in FCKeditor instance so user can type.
Step 4 should not happen - instead the editor should lose focus. oEditor.blur does not work but that's what I'm looking for. I have this code:
function FCKeditor_OnComplete(editorInstance){
editorInstance.Events.AttachEvent( 'OnFocus',checkLanguageSelected) ;
}
// ALERT IF USER STARTS TYPING IN FCKEDITOR WITHOUT SELECTING A LANGUAGE FIRST
function checkLanguageSelected(editorInstance){
if($(".languageLabelSelected").length==0 && editorInstance.Name!="textEditor"){
alert("#inputFieldTip#"+editorInstance)
editorInstance.EditorDocument.body.disabled=true
}
else{
editorInstance.EditorDocument.body.disabled=false
}
}
I tried with this line
editorInstance.EditorDocument.body.disabled=true
to disable editing in the editorinstance but it has no effect.
Does anyone know how to do this?
I want the FCKeditor on my page to be disabled until a specific condition is met.
The user should only be allowed to use an editorinstance when an element is selected. If not, an alert appears as soon as the editor instance is clicked and, after clicking OK in the alertbox, the editor should lose focus again.
What happens now is
1) user clicks editor instance
2) condition is not met so an alert pops up
3) user clicks OK in alert box
4) caret appears in FCKeditor instance so user can type.
Step 4 should not happen - instead the editor should lose focus. oEditor.blur does not work but that's what I'm looking for. I have this code:
function FCKeditor_OnComplete(editorInstance){
editorInstance.Events.AttachEvent( 'OnFocus',checkLanguageSelected) ;
}
// ALERT IF USER STARTS TYPING IN FCKEDITOR WITHOUT SELECTING A LANGUAGE FIRST
function checkLanguageSelected(editorInstance){
if($(".languageLabelSelected").length==0 && editorInstance.Name!="textEditor"){
alert("#inputFieldTip#"+editorInstance)
editorInstance.EditorDocument.body.disabled=true
}
else{
editorInstance.EditorDocument.body.disabled=false
}
}
I tried with this line
editorInstance.EditorDocument.body.disabled=true
to disable editing in the editorinstance but it has no effect.
Does anyone know how to do this?
Re: how to disable editor?
You can have a look at this topic:
http://cksource.com/forums/viewtopic.php?f=11&t=15659&p=41309#p41309
Re: how to disable editor?
see http://www.saulmade.nl/FCKeditor/FCKSnippets.php