Skip to content

Commit

Permalink
#108 SCAYT 3 Plugin for CKEditor: SCAYT copies id of editor element t…
Browse files Browse the repository at this point in the history
…o the iframe / Removed id copying / Normalized container getter
  • Loading branch information
KremYura committed Oct 25, 2015
1 parent a71ef5a commit ac633a1
Showing 1 changed file with 13 additions and 19 deletions.
32 changes: 13 additions & 19 deletions plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -1104,10 +1104,9 @@ CKEDITOR.plugins.scayt = {
plugin = CKEDITOR.plugins.scayt;

this.loadScaytLibrary(editor, function(_editor) {
var container = _editor.editable().$.nodeName == 'BODY' ? _editor.document.getWindow().$.frameElement : _editor.editable().$,
scaytInstanceOptions = {
var scaytInstanceOptions = {
lang : _editor.config.scayt_sLang,
container : _editor.editable().$.nodeName == 'BODY' ? _editor.document.getWindow().$.frameElement : _editor.editable().$,
container : ( _editor.window.getFrame() || _editor.editable() ).$,
customDictionary : _editor.config.scayt_customDictionaryIds,
userDictionaryName : _editor.config.scayt_userDictionaryName,
localization : _editor.langCode,
Expand All @@ -1124,8 +1123,7 @@ CKEDITOR.plugins.scayt = {
multiLanguageMode : _editor.config.scayt_multiLanguageMode,
multiLanguageStyles : _editor.config.scayt_multiLanguageStyles,
graytAutoStartup : plugin.state.grayt[_editor.name]
},
contcontainerID;
};

if(_editor.config.scayt_serviceProtocol) {
scaytInstanceOptions['service_protocol'] = _editor.config.scayt_serviceProtocol;
Expand Down Expand Up @@ -1160,12 +1158,6 @@ CKEDITOR.plugins.scayt = {
scaytInstanceOptions['ignore-words-with-numbers'] = _editor.config.scayt_ignoreWordsWithNumbers;
}

// Fix bug with getting wrong uid after re-creating SCAYT instance.
// And as result - restoring options for wrong instance
if(!container.id && _editor.element.getAttribute('id')) {
container.id = _editor.element.getAttribute('id');
}

var scaytInstance = new SCAYT.CKSCAYT(scaytInstanceOptions, function() {
// success callback
}, function() {
Expand Down Expand Up @@ -1247,18 +1239,20 @@ CKEDITOR.plugins.scayt = {
CKEDITOR.scriptLoader.load(scaytUrl, function(success) {
var editorName;

CKEDITOR.fireOnce('scaytReady');
if ( success ) {
CKEDITOR.fireOnce('scaytReady');

for(var i = 0; i < self.loadingHelper.loadOrder.length; i++) {
editorName = self.loadingHelper.loadOrder[i];
for(var i = 0; i < self.loadingHelper.loadOrder.length; i++) {
editorName = self.loadingHelper.loadOrder[i];

if(typeof self.loadingHelper[editorName] === 'function') {
self.loadingHelper[editorName](CKEDITOR.instances[editorName]);
}
if(typeof self.loadingHelper[editorName] === 'function') {
self.loadingHelper[editorName](CKEDITOR.instances[editorName]);
}

delete self.loadingHelper[editorName];
delete self.loadingHelper[editorName];
}
self.loadingHelper.loadOrder = [];
}
self.loadingHelper.loadOrder = [];
});
this.loadingHelper.ckscaytLoading = true;
}
Expand Down

0 comments on commit ac633a1

Please sign in to comment.