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

#2045 remove this check #1

Merged
merged 1 commit into from
Feb 25, 2016
Merged

#2045 remove this check #1

merged 1 commit into from
Feb 25, 2016

Conversation

devanecondition
Copy link

partially fixes ckeditor#2045

@@ -16,9 +16,6 @@ function dataIsEmpty( data )
if ( !data)
return true;

if ( data.length > 20 )
return false;

var value = data.replace( /[\n|\t]*/g, '' ).toLowerCase();
if ( !value || value == '<br>' || value == '<p>&nbsp;<br></p>' || value == '<p><br></p>' || value == '<p>&nbsp;</p>' || value == '&nbsp;' || value == ' ' || value == '&nbsp;<br>' || value == ' <br>' || value == '<p class="fs-14"><br></p>' || value == '<p class="fs-14">&nbsp;<br></p>')

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please can we refactor this?

var _ = require('lodash');
var matches = ['<br>', '<p>&nbsp;<br></p>', '<p><br></p>', '<p>&nbsp;</p>', '&nbsp;', ' ', '&nbsp;<br>', ' <br>', '<p class="fs-14"><br></p>', '<p class="fs-14">&nbsp;<br></p>'];
if(!value || _.includes(matches, value) {
   return true;
}

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nodesocket We’re trying to limit our changes. This is the ckeditor source, which, sadly, we’ve had to fork, but we still want to maintain the minimal surface area of local modifications.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure. Though their code makes me throw up a little in my mouth 😷 . Shouldn't it also be catching <br />?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's actually community driven code. This plugin isn't something they have written.

@dok
Copy link

dok commented Feb 25, 2016

LGTM

dok added a commit that referenced this pull request Feb 25, 2016
@dok dok merged commit edde3a9 into master Feb 25, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Reuse code in tools.throttle and tools.eventsBuffer
4 participants