News for hackers. Stuff that matters.
Re:X-editable: In-place editing with Twitter Bootstrap, jQue... by masklinn on Sunday November 25, 2012 @08:34AM (#4828100)
I find it sad (to annoying) that these projects still use actual form elements instead of `contenteditable`, even though they're quite obviously full-JS (and probably not going to be submitted through HTML forms), given the difficulty of correctly styling, integrating and interacting with form elements.

The web is in dire need of a library correctly reimplementing "form behaviors" (events, mostly) on top of contenteditable, and allowing those behaviors to be applied to arbitrary (to the extent that browser implementations allow) elements on the fly.

edit: just in case, don't take me wrong, HTML forms should stay and I'm an advocate of less javascript everywhere as it tends to be mandated in places where it has no reason to be (and to ultimately decrease usability rather than enhance it), but if you're going to do "edit in place" and rich web applications which require javascript to run — and using the library linked above would probably qualify as you can't do anything without JS enabled and a fairly recent browser running it. And in those cases, HTML form elements tend to be a hindrance more than a help.

Re:X-editable: In-place editing with Twitter Bootstrap, jQue... by ot on Sunday November 25, 2012 @01:16PM (#4828765)
I don't see why contenteditable should be better than form elements. contenteditable is meant for formatted text, not plain text entry.

For example, if you cut&paste formatted text into a contenteditable, it will keep the formatting [1]. Then you have to intercept the paste event and sanitize the text. Also, the selection model is a mess and slightly incompatible among browsers (although this might be fixed in modern browsers, I haven't looked into it for a while).

What are the benefits of contenteditable that justify to go into all this trouble?

[1] http://stackoverflow.com/questions/3306205/how-to-avoid-webk...

Re:X-editable: In-place editing with Twitter Bootstrap, jQue... by masklinn on Sunday November 25, 2012 @03:29PM (#4829178)
> contenteditable is meant for formatted text, not plain text entry.

contenteditable is meant for editing content, what kind of content you edit with it is up to you.

> What are the benefits of contenteditable that justify to go into all this trouble?

Coherent and simple styling and integration, avoidance of reflow (especially when toggling between editable and non-editable)

Re:X-editable: In-place editing with Twitter Bootstrap, jQue... by jazzduck on Wednesday November 28, 2012 @10:56AM (#4843126)
As a developer, why the hell do I need stylized text when I'm having a user fill out, say, a shipping form? Why should I have to worry about whether someone applied italics to their zip code? Should I really have to try to make the thermal label printer print out Zapf Dingbats if someone pastes that in there?

Also, forms go far beyond text input. Are you seriously suggesting that dropdown menus, multi-select boxes, sliders, radio buttons, datepickers, etc. should all be reimplemented on top of a rich text element?

Re:X-editable: In-place editing with Twitter Bootstrap, jQue... by waskosky on Sunday November 25, 2012 @04:27PM (#4829354)
Perhaps the main issue lies with the relative inability to detect the presence of support: https://github.com/Modernizr/Modernizr/wiki/Undetectables

Android Gingerbread devices do not support it, and they are still the largest percentage of Android devices accessing Google Play: http://developer.android.com/about/dashboards/index.html

So it seems that a user agent detection and fallback for Android < 3.0 devices is still a great necessity, and it is difficult to say just how many other devices fall into this category.

This next link is the most comprehensive list of support I could find, and although the support does seem widespread at this point, there are probably still too many user agent unknowns for someone wanting to make a mobile friendly library around the feature: http://caniuse.com/#feat=contenteditable

Re:X-editable: In-place editing with Twitter Bootstrap, jQue... by csulok on Sunday November 25, 2012 @03:00PM (#4829085)
>> I find it sad (to annoying) that these projects still use actual form elements instead of `contenteditable`, even though they're quite obviously full-JS (and probably not going to be submitted through HTML forms), given the difficulty of correctly styling, integrating and interacting with form elements.

I think this is because of performance. form elements are rendered differently and actions mostly result in a limited repaint and a couple events fired. contenteditable DOM elements are a lot more work to update.

Re:X-editable: In-place editing with Twitter Bootstrap, jQue... by masklinn on Sunday November 25, 2012 @03:30PM (#4829187)
I'm not sure about this hypothesis, when making a field editable requires inserting a bunch of dom nodes and trying to position your brand new input at the right place, it should be way more repaint that the NOOP of adding an attribute to the element.
Re:X-editable: In-place editing with Twitter Bootstrap, jQue... by laktek on Sunday November 25, 2012 @09:38AM (#4828232)
Have you seen Aloha Editor(http://aloha-editor.org)? Its behavior is built on `contenteditable`.
Re:X-editable: In-place editing with Twitter Bootstrap, jQue... by gidan on Sunday November 25, 2012 @09:54AM (#4828254)
Aloha editor is 1MB in size..
Re:X-editable: In-place editing with Twitter Bootstrap, jQue... by fox91 on Monday November 26, 2012 @05:25AM (#4831403)
I really love Hallo.js http://hallojs.org/ It's based on contenteditable and it's very lightweight
Re:X-editable: In-place editing with Twitter Bootstrap, jQue... by masklinn on Sunday November 25, 2012 @10:07AM (#4828275)
Aloha is an RTE, I'm not talking about RTEs in my comment I'm talking about bare, basic fields. Such as the one I'm typing/editing this comment in.
Re:X-editable: In-place editing with Twitter Bootstrap, jQue... by laktek on Sunday November 25, 2012 @11:03AM (#4828394)
Aloha is not a traditional WYISWYG editor contained in a textarea. You can apply it to any HTML element in a page, which would turn them in to editables (check this example of math editing - http://wysiwhat.github.com/Aloha-Editor/cnx.html)
Re:X-editable: In-place editing with Twitter Bootstrap, jQue... by scribu on Sunday November 25, 2012 @11:59AM (#4828540)
Doesn't work in Firefox.

OT: Am I the only one annoyed by this "viewed best in Chrome" trend? Reminds me of those old "Best in IE" badges.

Re:X-editable: In-place editing with Twitter Bootstrap, jQue... by Surio on Sunday November 25, 2012 @12:27PM (#4828620)
No, you are not alone. And I am sad to miffed at lack of support for Opera too.

There was a jquery fundamentals website that had the same problem. To compound matters, Chrome font rendering is godawfully bad on my machine.

Re:X-editable: In-place editing with Twitter Bootstrap, jQue... by fredsted on Sunday November 25, 2012 @01:45PM (#4828840)
Works fine in Firefox 17, try updating your browser.
Re:X-editable: In-place editing with Twitter Bootstrap, jQue... by scribu on Sunday November 25, 2012 @03:12PM (#4829122)
I was running Firefox 16.0.2. I updated to Firefox 17 and it still doesn't work; I can't edit or change anything.
Re:X-editable: In-place editing with Twitter Bootstrap, jQue... by Surio on Sunday November 25, 2012 @09:16PM (#4830081)
I am also beginning to find this browser update treadmill very tedious.
Re:X-editable: In-place editing with Twitter Bootstrap, jQue... by masklinn on Sunday November 25, 2012 @12:01PM (#4828548)
> Aloha is not a traditional WYISWYG editor contained in a textarea.

Did you miss the part where I said I wasn't talking about RTE?

I don't care that it's implemented using something which was introduced to build RTEs in the first place and has been used for exactly that for the past 12 years or so (which does happen to make contenteditable-based RTEs traditional, as are designMode-based ones, despite your apparent assertion to the contrary), my original comment is not about rich text edition.