Skip to content

Commit 3f17d1f

Browse files
author
SergKovalenko
committed
Fixed issue with pasting SCAYT markup in CKEditor
1 parent a5519f5 commit 3f17d1f

1 file changed

Lines changed: 9 additions & 22 deletions

File tree

plugin.js

Lines changed: 9 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -680,22 +680,12 @@ CKEDITOR.plugins.add('scayt', {
680680
var dataFilterRules = {
681681
elements: {
682682
span: function(element) {
683-
var scaytState = plugin.state.scayt[editor.name],
684-
graytState = plugin.state.grayt[editor.name];
685-
686-
if( plugin && element.classes && (
687-
(scaytState && CKEDITOR.tools.search(element.classes, plugin.options.misspelled_word_class)) ||
688-
(graytState && CKEDITOR.tools.search(element.classes, plugin.options.problem_grammar_class))
689-
) ) {
690-
691-
if (element.classes && element.parent.type === CKEDITOR.NODE_DOCUMENT_FRAGMENT) {
692-
delete element.attributes['style'];
693-
delete element.name;
694-
} else {
695-
delete element.classes[CKEDITOR.tools.indexOf(element.classes, plugin.options.misspelled_word_class)];
696-
delete element.classes[CKEDITOR.tools.indexOf(element.classes, plugin.options.problem_grammar_class)];
697-
}
698683

684+
var scaytState = element.hasClass(plugin.options.misspelled_word_class) && element.attributes[plugin.options.data_attribute_name],
685+
graytState = element.hasClass(plugin.options.problem_grammar_class) && element.attributes[plugin.options.problem_grammar_data_attribute];
686+
687+
if(plugin && (scaytState || graytState)) {
688+
delete element.name;
699689
}
700690

701691
return element;
@@ -710,15 +700,11 @@ CKEDITOR.plugins.add('scayt', {
710700
var htmlFilterRules = {
711701
elements: {
712702
span: function(element) {
713-
var scaytState = plugin.state.scayt[editor.name] && element.hasClass(plugin.options.misspelled_word_class) && element.attributes[plugin.options.data_attribute_name],
714-
graytState = plugin.state.grayt[editor.name] && element.hasClass(plugin.options.problem_grammar_class) && element.attributes[plugin.options.problem_grammar_data_attribute];
715703

716-
if(plugin && (scaytState || graytState)) {
704+
var scaytState = element.hasClass(plugin.options.misspelled_word_class) && element.attributes[plugin.options.data_attribute_name],
705+
graytState = element.hasClass(plugin.options.problem_grammar_class) && element.attributes[plugin.options.problem_grammar_data_attribute];
717706

718-
element.removeClass(plugin.options.misspelled_word_class);
719-
element.removeClass(plugin.options.problem_grammar_class);
720-
delete element.attributes[plugin.options.data_attribute_name];
721-
delete element.attributes[plugin.options.problem_grammar_data_attribute];
707+
if(plugin && (scaytState || graytState)) {
722708
delete element.name;
723709
}
724710

@@ -1379,6 +1365,7 @@ CKEDITOR.on('scaytReady', function() {
13791365
* @member CKEDITOR.config
13801366
*/
13811367

1368+
13821369
/**
13831370
* The parameter defines the number of SCAYT suggestions to show in the main context menu.
13841371
* Possible values are:

0 commit comments

Comments
 (0)