I installed the latest dev version, but I cannot make the module to work.

I don't see the dropdown menu with the quick edit link in it. I suppose it's a javascript error, since I get in the console:

Uncaught SyntaxError: Unexpected token <
and
Uncaught ReferenceError: _ is not defined

I have installed underscore and backbone js's and they seem ok in the status report.

Any hints?

Issue fork edit_poc-2154891

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

jvdkolk’s picture

For me the same, also using the latest dev version.

Error I get:

TypeError: this.options is undefined
http://fch7.wmmrc.nl/sites/all/modules/edit/js/views/ContextualLinkView.js?v=7.22
Line 38

Screenshot of Firebug http://i.imgur.com/Dy2shOi.png

wrd’s picture

I've had the same problem as well. I do see an empty list item in the HTML where the Quick Edit link should be.

wim leers’s picture

Thanks for the useful feedback!

Can you please look at the status report page and check if any problems are being reported by Edit module?

wim leers’s picture

Status: Active » Postponed (maintainer needs more info)
yannisc’s picture

I get these errors, but I think it's only about CKEditor:

Edit: CKEditor library The CKEditor library is too old, please update to 4.2 or newer!
Edit: CKEditor's "Shared Space" plugin is included "Shared Space" CKEditor plugin missing
This plugin is essential for CKEditor to work with in-place editing.
Please create a custom build of CKEditor that includes this plugin.
Edit: CKEditor's "Source" button is used "Source Dialog" CKEditor plugin missing
This plugin is necessary to keep the "edit source" functionality while in-place editing.
Please create a custom build of CKEditor that includes this plugin.

underscore.js and backbone.js are detected and shown green.

Also, checked the permissions, admins are set to access in-place editing.

yannisc’s picture

Status: Postponed (maintainer needs more info) » Active
wim leers’s picture

#5: You should fix those CKEditor errors, but that indeed means something else is wrong. Can you give me access to this site, so I can see for myself what's happening? If it's not publicly accessible: use my d.o contact form. Thanks!

wim leers’s picture

Title: Quick Edit Menu not Shown » Quick Edit contextual link not shown
Assigned: Unassigned » wim leers
Issue tags: +Spark
Related issues: +#2149237: Upgrade from Backbone 0.9.2 to >=1.0.0 and from Underscore 1.4.0 to >=1.5.0

yannisc gave me access to his site, and that was very helpful, because now I know what's going on :)

There are two problems:

  1. For certain node types, e.g. the "business" node type (e.g. http://greekafm.com/afm/800395529), it seems a custom template is in place that prevents the essential data-edit-entity-id attribute that Edit sets from making it into the markup that gets sent to the user. I.e. this has no effect:
    function edit_preprocess_node(&$variables) {
      …
      $variables['attributes_array']['data-edit-entity-id'] = 'node/' . $node->nid;
      …
    }
    

    So, you'll need to make sure your template allows additional attributes to come through.

    It seems you're using Display Suite though, so maybe that's the culprit. Please let me know.

  2. For other node types, e.g. the "page" node type, this is not a problem: the data-edit-entity-id attribute gets set just fine. In this case, a JS error occurs.
    You're using Backbone.js 1.1.0 and Underscore.js 1.5.2. That's fine. But the current version of Edit module requires 0.9.2 and 1.4.0, respectively. I'm working right now on fixing that in #2149237: Upgrade from Backbone 0.9.2 to >=1.0.0 and from Underscore 1.4.0 to >=1.5.0.
    In other words: #2149237 should fix this for you :)
yannisc’s picture

Thanks Wim for testing that!

Yes, I use display suite for the business content type.

As for the error with the updated js versions, I updated them because there was an error with the previous versions as well. Since, you'll fix the updated versions, I'll wait for your patch on #2149237.

Thanks again!

wim leers’s picture

Thank *you*, for helping making this module stable!

wim leers’s picture

wrd’s picture

It's...it's beautiful...

yannisc’s picture

Still doesn't work properly for me. Now the link is shown and I can enable quick edit, but there's no save button and I get this javascript error:

Uncaught ReferenceError: CKEDITOR is not defined

Wim, I have activated your account again on my site, if you want to try it out.

yannisc’s picture

I also get at the status report:

Warning: file_get_contents(/ckeditor.js) [function.file-get-contents]: failed to open stream: No such file or directory in edit_requirements() (line 81 of /sites/all/modules/edit/edit.install).

Maybe I have installed a wrong version of CKEditor? Which one should I install?

wim leers’s picture

You've got your CKEditor in sites/all/modules/ckeditor/ckeditor/ckeditor.js, whereas it should be in sites/all/libraries/ckeditor/ckeditor.js. I've added a check for that now: #2160093: CKEditor module allows CKEditor library to be installed inside the module rather than in sites/all/libraries, check this in status report.

If you update before fixing the problem, you should see this:

Also, your status report indicates that your CKEditor build does not include the Shared Space plugin, which is essential. See the README for instructions.

wim leers’s picture

And thanks for the great feedback, keep it coming! :)

yannisc’s picture

I updated the module. I got the status report message about having CKEditor on the wrong folder. I moved ckeditor to libraries. Everything works now!!!

Nice job Wim!

I think someone should update the documentation here: http://docs.cksource.com/CKEditor_for_Drupal/Open_Source/Drupal_7/Instal...

It recommends to install CKEditor in the ckeditor module, not in the libraries folder.

Also, I need (and suppose many more people) instructions on how to include the missing plugins in CKEditor. Which version should I download?

yannisc’s picture

ok, I found out how to compile CKEditor with these 2 plugins, I did it and the errors are gone.

Again, I think documentation should be updated here: https://drupal.org/project/ckeditor and not direct people to download the full version.

yannisc’s picture

While quick edit works, CCK is not activating.

I get in full edit mode:

Notice: Undefined offset: 1 in location_cck_tokens() (line 622 of sites/all/modules/location/contrib/location_cck/location_cck.module).
Notice: Undefined index: in location_cck_tokens() (line 628 of sites/all/modules/location/contrib/location_cck/location_cck.module).

yannisc’s picture

The above notices are not related to CKeditor, but to CCK Location. After I disabled CCK Location, the notices are gone.

CKEditor still is not working. I get this javascript error at ckeditor.js:

Uncaught TypeError: Cannot read property 'toolbar' of undefined

wim leers’s picture

#17:

I think someone should update the documentation here: http://docs.cksource.com/CKEditor_for_Drupal/Open_Source/Drupal_7/Instal...

It recommends to install CKEditor in the ckeditor module, not in the libraries folder.

We can't do that: people may want to use CKEditor without using Edit, and hence also without the Libraries API module. Then the sites/all/libraries directory wouldn't exist and installing it in the module directory would be fine. So it's an additional requirement, that's why we now have it in the Status Report :)

Also, I need (and suppose many more people) instructions on how to include the missing plugins in CKEditor. Which version should I download?

The detailed instructions are in the README, and the high-level ones are in the Status Report. What more do you want? :)

#18:

Again, I think documentation should be updated here: https://drupal.org/project/ckeditor and not direct people to download the full version.

We can't do that: people may want to use CKEditor without using Edit, in which case Edit's additional requirements don't apply.

#19: that's entirely unrelated. I see that happen all across your website.

#20: please clear your browser cache, close the tab you're testing in and then try again. It works fine for me on the test page you sent me! :)

wim leers’s picture

FYI, I just tagged beta 1: https://drupal.org/node/2160191 :)

huma2000’s picture

I'm getting also the same problem, no contextual link on my developing machine, there is no errors on the status page and all the js libraries and the ckaeditor are the last verions available.
My site is based on the spark profile, any ideas?

yannisc’s picture

Yes, it worked after I cleared my browser's cache!

Congratulations, Wim for the beta1!!!

How about adding in the documentation of CKEditor that IF you want use CKeditor with the edit module, you should put ckeditor in the libraries folder and compile it with the 2 additional plugins?

yannisc’s picture

There's also a usability problem on the same site I gave you access: The first time you use quickedit, the toolbar stays on top of the input box not letting you see what you type (screenshot here: http://d.pr/i/EHUX).

If you close the bar and you retry, it goes to the right position though.

huma2000’s picture

Solved!! Cleaned the internal cahes and the links appears, works great now!!
Thanks for this wonderful module!

wim leers’s picture

Status: Active » Fixed
Related issues: +#2090945: Polish entity toolbar's positioning

#23/#26: yay :)

#24: yay :) The README already covers all those things. And the Status Report now specifically checks that. Nothing more I can do.

#25: Indeed, the entity toolbar's positioning can be pretty annoying in certain cases. We need to fix that in D8 too. I've linked to your comment from the D8 issue: #2090945-2: Polish entity toolbar's positioning.
Also: you don't need to close anything, just wait a little bit and it'll fix itself. Which is of course not acceptable, but at least you don't have to close anything.

Everything reported here has been addressed, and for #8.1, you've opened a new issue (#2160321: Uncaught TypeError: Cannot call method 'getAttribute' of undefined):

  1. For certain node types, e.g. the "business" node type (e.g. http://greekafm.com/afm/800395529), it seems a custom template is in place that prevents the essential data-edit-entity-id attribute that Edit sets from making it into the markup that gets sent to the user. I.e. this has no effect:
    function edit_preprocess_node(&$variables) {
      …
      $variables['attributes_array']['data-edit-entity-id'] = 'node/' . $node->nid;
      …
    }
    

    So, you'll need to make sure your template allows additional attributes to come through.

    It seems you're using Display Suite though, so maybe that's the culprit. Please let me know.

So, closing this issue.

wim leers’s picture

#25: my explanation above was incorrect: this is not a bug in D8, so it's a D7-only problem. Opened an issue for that: #2160517: Entity toolbar when using the CKEditor in-place editor repositions way too slowly: very annoying.

huma2000’s picture

I'm still getting the error, no contextual link.
According to firebug:

TypeError: entityElement.get(...) is undefined
http://192.168.72.129/judo/profiles/spark/modules/contrib/edit/js/edit.j...
Line 212

Ideas?

I'm using the last dev version.

huma2000’s picture

If you need I can give you access to the website to debug.

socialnicheguru’s picture

With the new edit module beta 1, I get the same as in #29.

socialnicheguru’s picture

Status: Fixed » Needs work

I opened it up because of the "TypeError: entityElement.get(...) is undefined error mentioned." If it should be a new issue, please let us know and I will create a new one. The error hampers the contextual link being shown

tomtech’s picture

Status: Needs work » Needs review
StatusFileSize
new2.12 KB

The 'Quick Edit' contextual item would not show up for me either with the latest dev.

I encountered a few issues:

1) edit_page_load in edit.module presumes there are regions present when it attaches to $children[0[], which isn't the case.

I was able to get around this with a fallback to the mandatory 'content' region. (I guess one could also initialize the theme and grab the first region, similar to block.module's block_page_load, but that seems overkill.)

2) loadMissingEditors in js/edit.js returns an array of scripts, but the call to insert() eventually calls jquery's html() method, which strips out

elements. I was able to work through this by using jquery's parseHTML() method, then calling getScript for each document, though this has two issues. (a) parseHTML requires jquery 1.8.x and (b) I'm assuming the return is always going to be a set of scripts to load. This seems to be the case in the current implementation, but is an assumption nonetheless. This finally got the 'Quick Edit' link to load, but the CKEditor was not showing up. 3) If you have text transformations/filters, a callback is made to...transform the text. but the command on the js side is textLoaderAjax.commands.editorGetUntransformedText, while the ajax return object is invoking the command editCKEditorGetUntransformedText. setting the returned command to editorGetUntransformedText in includes/pages.inc resolves this. I finally have ckeditor loading again!
tomtech’s picture

Further details to #33...

1) Seems to be theme related. Some themes do not have the regions created when edit_page_load is called. In my case, it is adaptive themes panels everywhere.

2) Seems to be related to jquery_update. The jquery shipped with Drupal7 doesn't seem to have the strip script code. (Running jquery 1.8.x also introduces layout issues that do not exist with jquery 1.7.x.)

3) This issue is related to whether you have any filters enabled. If you do, I don't think ckeditor would ever load since the callback is made to a non-existent method.

tomtech’s picture

I've confirmed that issue #2 in comment #33 is related to jquery_update. It does not happen with the Drupal 7 included jquery.

I've rolled another patch that just addresses issues #1 and #3.

I still think that working with more recent query versions needs to be addressed, but not sure at the moment the best way to handle that.

wim leers’s picture

Status: Needs review » Fixed

#32: Please open a new issue!

#33/#34/#35: Thanks for all your efforts in tracking down why things are breaking :)

  1. Regarding the missing regions: that's indeed theme-dependent. Please see #2160321-4: Uncaught TypeError: Cannot call method 'getAttribute' of undefined, plus comments 5 and 6. I also just committed #2167981: Do a best-effort theme compatibility check in the status report, which should help significantly with this, even though it appears to be a slightly different problem — but it's definitely related.
    If #2167981 doesn't help with this, then please create a new issue for it. It's not good to repurpose this issue for other things.
  2. Wow. I vaguely remember a similar (maybe the same) problem about a year ago in Drupal 8 development. CKEditor failed to figure out where its plugins lived on the server (i.e. what the base URL was) because CKEditor was being loaded dynamically by inserting a <script> tag and for some reason jQuery totally fucked that up: it was somehow hiding the <script> tag, which is why CKEditor couldn't find it, and hence couldn't figure out its location on the server. That was a major WTF!

    After having written the above, I did a git grep CKEDITOR_BASEPATH, and it turns out I still have the work-around in the Drupal 7 code! (It was removed from Drupal 8 after we upgraded to jQuery 2, which fixed it.) It's in formattedText:

    // This value needs to be set before ckeditor.js is loaded (when ckeditor.js
    // is loaded dynamically and when using jQuery <1.9).
    // @see http://bugs.jquery.com/ticket/11795#comment:20
    window.CKEDITOR_BASEPATH = Drupal.settings.edit.ckeditor.basePath;
    

    So I suspect that the problem here must be at least slightly different. It almost sounds like it's a bug you should also encounter with other modules, but then again very few modules dynamically load more JS. Still, it sounds more like a deficiency on jquery_update.module's side than on Edit's: Edit is merely using the "insert" AJAX command, and it is that which is broken.

    Hence my best suggestion for now is to open a new issue in the jQuery Update issue queue. If it turns out to be an Edit issue after all, please open a new issue in the Edit issue queue.

  3. HAH! Great catch :) The server-side part was correctly named though, it was the client-side part that needed to be updated. I've spun off a separate issue for that: #2167997: formattedTextEditor.js implements D8's editorGetUntransformedText instead of D7's editCKEditorGetUntransformedText AJAX command, fixed it on the client side and have credited it to you :)

Thanks, all, for the great feedback! But please open new issues, otherwise it becomes impossible to track things. Thanks!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

milos.kroulik’s picture

If you come here because contextual link doesn't display on nodes, while it does on other places, make sure, that it isn't result of Overlay Paths module incompatibility. I posted the issue at https://drupal.org/node/2185965.

vpiplani’s picture

#27: So, you'll need to make sure your template allows additional attributes to come through.

For above issues, in node.tpl.php, following div should be added on top and closing div at the end of the file.

print $node->nid; " class=" print $classes; clearfix" print $attributes; >

It's missing in several contributed themes, and causing quick edit to not load and give error in following element:
entityElement.getAttribute('data-quickedit-entity-id')

vipul tulse made their first commit to this issue’s fork.