apostrophecms-legacy / apostrophe-schemas

DEPRECATED - FOR APOSTROPHE 0.5 SITES ONLY - BUILT IN TO APOSTROPHE 2.X. Allows any object to have a schema of properties that can be edited in the browser, sanitized on the server and easily saved in Mongo. Schema types include text, select, tags, Apostrophe areas and singletons, and joins (one-to-one and many-to-many relationships), among others.
MIT License
3 stars 3 forks source link

Bug: Autocomplete implementation inconsistent #23

Open jonashaefele opened 8 years ago

jonashaefele commented 8 years ago

Problem

Blog Post Editor fails to load due to autocomplete error.

Cannot set property '_renderItem' of undefined

That's this line: https://github.com/punkave/apostrophe-schemas/blob/master/public/js/editor.js#L847

Fix

On line https://github.com/punkave/apostrophe-schemas/blob/master/public/js/editor.js#L846 a DOM element is selected with the jQuery UI in v1.9 syntax:

<div data-autocomplete="..."></div>

Then on line https://github.com/punkave/apostrophe-schemas/blob/master/public/js/editor.js#L847 the same autocomplete instance is accessed with the jQuery UI in v1.10 syntax:

<div data-ui-autocomplete="..."></div>

See: http://stackoverflow.com/questions/9513251/cannot-set-property-renderitem-of-undefined-jquery-ui-autocomplete-with-html

For me it was fixed changing https://github.com/punkave/apostrophe-schemas/blob/master/public/js/editor.js#L847 to:

    $autocomplete.data( "autocomplete" )._renderItem = function(ul, item) {

Happy to make a PR if it's only this one line, but I'm not sure if this fix might break something else.... would appreciate feedback from someone who's worked with apostrophe for more than a couple days.

jonashaefele commented 8 years ago

Steps to reproduce locally: Create blog as a subpage, then add blogpost

Using a stripped down version of the sandbox. (same modules, minus the styles and demo markup) Can't reproduce the bug on the http://demo.apostrophenow.com/

My dependency versions:

"apostrophe-blog-2": "0.5.x",
    "apostrophe-browserify": "0.5.x",
    "apostrophe-editor-2": "0.5.x",
    "apostrophe-events": "^0.5.18",
    "apostrophe-groups": "0.5.x",
    "apostrophe-people": "0.5.x",
    "apostrophe-redirects": "0.5.x",
    "apostrophe-search": "0.5.x",
    "apostrophe-site": "0.5.x",
    "apostrophe-snippets": "^0.5.79",
    "apostrophe-ui-2": "0.5.x"
boutell commented 8 years ago

I haven't seen this problem so far, but I'm open to a PR that resolves it in a backwards compatible way.

On Fri, Jun 10, 2016 at 12:46 PM, Jonas notifications@github.com wrote:

Using a stripped down version of the sandbox. (same modules, minus the styles and demo markup) Can't reproduce the bug on the http://demo.apostrophenow.com/

My dependency versions:

"apostrophe-blog-2": "0.5.x", "apostrophe-browserify": "0.5.x", "apostrophe-editor-2": "0.5.x", "apostrophe-events": "^0.5.18", "apostrophe-groups": "0.5.x", "apostrophe-people": "0.5.x", "apostrophe-redirects": "0.5.x", "apostrophe-search": "0.5.x", "apostrophe-site": "0.5.x", "apostrophe-snippets": "^0.5.79", "apostrophe-ui-2": "0.5.x"

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/punkave/apostrophe-schemas/issues/23#issuecomment-225234713, or mute the thread https://github.com/notifications/unsubscribe/AAB9fRsGyhErvL18PcOcxr-p3Taix3C_ks5qKZTSgaJpZM4IzHnz .

THOMAS BOUTELL, SUPPORT LEAD P'UNK AVENUE | (215) 755-1330 | punkave.com