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

Enable / disable editors individually #1073

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open

Conversation

houd1ni
Copy link

@houd1ni houd1ni commented Apr 27, 2016

Original issue: #180

I failed to write the test: only created an appropriate shell for it.

I'm quite new in this kind of testing, so I just describe my approach.

The test has failed, though I'd added a child element with .className='disableClass' right options {disable: '.disableClass'} and actually in manual testing with debug tools, in at least chrome, events haven't been fired: the selectiveListener shell returns before an original Event.

Michael added 2 commits April 27, 2016 20:18
@houd1ni houd1ni changed the title Master Enable / disable editors individually Apr 27, 2016
changed to .call due to perfomance.
--characters of code
@nmielnik
Copy link
Member

@houd1ni sorry for taking so long to look at this. My first question is, is there any reason you wouldn't just set contenteditable="false" on the elements you don't want to be editable?

@houd1ni
Copy link
Author

houd1ni commented May 14, 2016

@nmielnik we discussed it in gitter a month ago. You'd suggested this approach, then I've tried and faild at least in cases like <span contenteditable="true"> <img or a or something for context menu> </span> for instance, over an image, it shows ugly #. And without crutches it cannot be avoided.
Then you pointed me on #180.

},

toArr: function (arraylike) {
return [].slice.call(arraylike);
Copy link
Member

Choose a reason for hiding this comment

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

Is there a benefit to calling [].slice() as opposed to Array.prototype.slice?

Copy link
Author

Choose a reason for hiding this comment

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

Sorry for megaslow response. Yes: it's just a bit smaller :)

Copy link
Author

Choose a reason for hiding this comment

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

But now I'm not sure that is's not slower. Gonna test it.

@nmielnik
Copy link
Member

Ah yes, thanks for reminding me!

So looks like I created a merge conflict for you with some of the changes that I merged in, apologies for that but we'll want to get that fixed first.

I can try to help out with writing tests and what-not if that's what you were looking for, or were you looking for additional feedback on the change and pointers on how to add some tests?

@@ -231,6 +231,21 @@
}, this);
}

function offDisabledElements(elements) {
// Should be checked that it exists outside the func.
elements.forEach(function (element) {
Copy link
Member

Choose a reason for hiding this comment

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

Once you merge the latest master into your branch, you'll likely want to move this logic into initElement. It's a function that will be called for every editor element during initialization and when elements are added dynamically.

@houd1ni
Copy link
Author

houd1ni commented Aug 16, 2016

Im alive, will take a look on this soon :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants