ellatrix / wp-front-end-editor

Front-end Editor for WordPress
https://wordpress.org/plugins/wp-front-end-editor/
340 stars 87 forks source link

Toolbar not showing #233

Closed andfinally closed 8 years ago

andfinally commented 9 years ago

Hi, I've tried out the plugin on my local installation with the Twenty Fifteen and Twenty Twelve themes. I activate the plugin and click on body text, headline and other parts of the single post page in my site, but nothing happens. I get the same thing on pages. There are no JS errors. Am I misunderstanding how the plugin's supposed to work?

Thanks!

ellatrix commented 8 years ago

You should click on "edit post" in the admin bar. This will change though, it's a bit too hidden.

andfinally commented 8 years ago

Thanks! I'll try that.

andfinally commented 8 years ago

Unfortunately it's still not working for me - I'm getting these JS errors when I activate the plugin. I see a new addition to the "Edit Post" link in the admin bar which says "Edit in admin". But clicking "Edit Post" does nothing.

tinymce.image.js?ver=1.1.0:3 Uncaught ReferenceError: tinymce is not defined(anonymous function) @ tinymce.image.js?ver=1.1.0:3 tinymce.insert.js?ver=1.1.0:3 Uncaught ReferenceError: tinymce is not defined(anonymous function) @ tinymce.insert.js?ver=1.1.0:3 tinymce.theme.js?ver=1.1.0:3 Uncaught ReferenceError: tinymce is not defined(anonymous function) @ tinymce.theme.js?ver=1.1.0:3 wp-auth-check.min.js?ver=4.6-alpha-37690:1 Uncaught TypeError: Cannot read property 'hasClass' of undefined(anonymous function) @ wp-auth-check.min.js?ver=4.6-alpha-37690:1dispatch @ jquery.js?ver=1.12.4:3r.handle @ jquery.js?ver=1.12.4:3trigger @ jquery.js?ver=1.12.4:3a.event.trigger @ jquery-migrate.min.js?ver=1.4.1:2(anonymous function) @ jquery.js?ver=1.12.4:3each @ jquery.js?ver=1.12.4:2each @ jquery.js?ver=1.12.4:2trigger @ jquery.js?ver=1.12.4:3(anonymous function) @ heartbeat.min.js?ver=4.6-alpha-37690:1i @ jquery.js?ver=1.12.4:2fireWith @ jquery.js?ver=1.12.4:2y @ jquery.js?ver=1.12.4:4c @ jquery.js?ver=1.12.4:4 mce-view-register.js?ver=1.1.0:187 Uncaught TypeError: Cannot read property 'views' of undefined

ellatrix commented 8 years ago

Thank for the feedback. I'm working on fixes and will release in a few days. May I ask what WP version you have?

andfinally commented 8 years ago

Thanks iseulde. I realised I didn't have the latest version of the plugin - installed plugin version 2.3.1 and switched to Twenty Fifteen theme. With that setup the JS errors I mentioned disappear, but the plugin doesn't seem to take over the Edit Post link - clicking it just takes me to the normal post edit form.

I am on WP 4.5.3.

ellatrix commented 8 years ago

This plugin version only goes to 1.1.0 :)

andfinally commented 8 years ago

Oh sorry, I didn't spot that! I will close this one. Thanks!

ellatrix commented 8 years ago

Was it another plugin then? Or does it work fine now?

andfinally commented 8 years ago

Oh sorry, I'm confused - I thought you meant the plugin supports only up to WP 1.1.0! Thought that was a bit old! This is the upgrade prompt I see in wp-admin/plugins when I go to activate the plugin:

front-end-editor

and here are the details, showing it goes up to 2.3.1:

front-end-editor-1

Thanks!

ellatrix commented 8 years ago

Hm that's weird. When you click edit, what's the first file you see under Plugin Files?

andfinally commented 8 years ago

It's wp-front-end-editor-master/plugin.php, contents look legit:

<?php

/*
 * Plugin Name: Front-end Editor
 * Plugin URI:  https://wordpress.org/plugins/wp-front-end-editor/
 * Description: Edit your posts on the front-end of your site.
 * Version:     1.1.0
 * Author:      Ella Iseulde Van Dorpe
 * Author URI:  https://iseulde.com
 * Text Domain: wp-front-end-editor
 * Domain Path: languages
 * Network:     false
 * License:     GPL-2.0+
 */

if ( ! class_exists( 'FEE' ) ) {
    require_once 'class-fee.php';
    $GLOBALS['wp_front_end_editor'] = new FEE;
}
ellatrix commented 8 years ago

Hm, why is it wp-front-end-editor-master? That's likely the confusing bit for the upgrader. If it can't match the folder it will try to match the name.

christianwach commented 8 years ago

why is it wp-front-end-editor-master

FWIW, that's what happens when there's been a download of the ZIP file for the master branch from this GitHub repo. The enclosing folder should be renamed by the downloader before adding the plugin to WordPress, but this appears to have been overlooked.

ellatrix commented 8 years ago

This is a problem in core/.org really, they shouldn't try to match plugin titles. I think it makes sense to adjust the title and/or the folder when a 2.x version is published, just so it's less confusing.

andfinally commented 8 years ago

Ah well spotted! Yes, I copied the expanded zip straight into wp-content/plugins.

OK, so now I've renamed the folder, reactivated the plugin and switched to Twenty Fifteen. Unfortunately I'm now getting similar JS errors as before, and although I see the addition of the "Edit in admin" link to the Edit Post link, clicking Edit Post doesn't do anything - the FE edit feature isn't active.

tinymce.image.js?ver=1.1.0:3 Uncaught ReferenceError: tinymce is not defined(anonymous function) @ tinymce.image.js?ver=1.1.0:3 tinymce.insert.js?ver=1.1.0:3 Uncaught ReferenceError: tinymce is not defined(anonymous function) @ tinymce.insert.js?ver=1.1.0:3 tinymce.theme.js?ver=1.1.0:3 Uncaught ReferenceError: tinymce is not defined(anonymous function) @ tinymce.theme.js?ver=1.1.0:3 wp-auth-check.min.js?ver=4.6-alpha-37690:1 Uncaught TypeError: Cannot read property 'hasClass' of undefined(anonymous function) @ wp-auth-check.min.js?ver=4.6-alpha-37690:1dispatch @ jquery.js?ver=1.12.4:3r.handle @ jquery.js?ver=1.12.4:3trigger @ jquery.js?ver=1.12.4:3a.event.trigger @ jquery-migrate.min.js?ver=1.4.1:2(anonymous function) @ jquery.js?ver=1.12.4:3each @ jquery.js?ver=1.12.4:2each @ jquery.js?ver=1.12.4:2trigger @ jquery.js?ver=1.12.4:3(anonymous function) @ heartbeat.min.js?ver=4.6-alpha-37690:1i @ jquery.js?ver=1.12.4:2fireWith @ jquery.js?ver=1.12.4:2y @ jquery.js?ver=1.12.4:4c @ jquery.js?ver=1.12.4:4 mce-view-register.js?ver=1.1.0:187 Uncaught TypeError: Cannot read property 'views' of undefined(anonymous function) @ mce-view-register.js?ver=1.1.0:187 fee.js?ver=1.1.0:6 Uncaught TypeError: Cannot read property 'util' of undefined

ellatrix commented 8 years ago

Okay. As you've already downloaded it from GitHub before, maybe it's worth downloading the master, renaming it, and uploading it to your site? The issues are likely to be resolved by now, and it's easier for me to fix any remaining issues rather than fixing the old version and trying to do a minor release for that. I'm happy to fix any issues you have with that one with priority.

Alternatively you could wait until I update the plugin and then update the plugin on your site. Not sure when it will be, but soon.

andfinally commented 8 years ago

Thanks iseulde - master is the version I'm working with. No worries, I'm happy to wait for whenever the next version comes out - if you don't mind I'll leave this open as a reminder to myself to try the next version. Good luck!

ellatrix commented 8 years ago

Ah, okay. Sorry I thought you were updating to the wp.org version. I just tried what you did and I know the problem now. GitHub does not clone the submodules and they are empty. I'll see what I can do right now.

andfinally commented 8 years ago

Great, thank you!

ellatrix commented 8 years ago

@andfinally Should work now after 8dd4ff04e163d6801ac5edcd494307f4ceefecac.

andfinally commented 8 years ago

Thanks iseulde - I'm getting closer - I see the Update and Cancel links - but when I click on Edit Post I get this alert, and I'm unable to do anything else.

front-end-edit

ellatrix commented 8 years ago

What happens if you click cancel? Sorry will fix asap.

andfinally commented 8 years ago

I'm not able to click on Edit Post > Cancel - the confirm pops up as soon as I click on Edit Post, and when I click OK or Cancel on that, the Update and Cancel links disappear from Edit Post.

No rush, I'm happy to hang on till whenever you have a chance to look at it, thanks!

ellatrix commented 8 years ago

Should be gone after 03cf6cc04c85fffc5f49557557d01ead06d775f7. Please note that this repository is a work in progress until there's a new release. I'd love people trying and testing it though!

andfinally commented 8 years ago

Joy! Thanks a lot, it's working fine in Twenty Fifteen!

My next challenge is to get it to work with my own theme - with that active I'm getting the occasional error

Uncaught TypeError: wp.api.models[(intermediate value)(intermediate value)(intermediate value)] is not a constructor fee.js?ver=2.0.0-alpha:51

And I'm unable to make changes. When I get a plain text post that does seem to accept it, I click the Edit Post button - I don't see the extra options but the link text goes blue suggesting it's active. When I make changes to the post content they appear in the page. But when I click the Edit Post button again or try to navigate back to the standard view of the post I get the alert "The changes you made will be lost if you navigate away from this page.", and the change isn't saved.

But that's a story for a different time - thanks for fixing this one - it's a great plugin!

ellatrix commented 8 years ago

Let's keep this open then, your theme should work too. :)

What theme do you have? Is there a link to it, or did you make it?

Not sure why you're getting the error. If you have the rest API installed (as the plugin will prompt you to do), then that constructor should be available.

The alert if only temporary, this will go away in the next commit which will be today. Then the saving will work a bit differently. For now you have to click save, then 'no' when it asks to publish, and then 'yes' if you navigate away (no changes will be lost if you just saved). After the next commit saving will happen automatically, you only have to use it for publishing. I'll also add some extra sanity checking to make sure everything actually saves.

andfinally commented 8 years ago

It's a custom theme used on a fairly big media site, so not public, unfortunately. Our site is hosted on Wordpress.com VIP, so although we have the WP Rest API plugin locally (where I am testing), on production the API is handled by WP.com at public-api.wordpress.com/rest/v1.1/sites.

Thanks for all your work on this!

ellatrix commented 8 years ago

Okay. If you can install this plugin, you can also install .org's REST API though? Having both should be fine, and eventually they will be merged. But if .com's API needs to be used this should not be that difficult soon. And I'll add some docs.

But back to the local install. If wp.api.models.Post or wp.api.models.Page is not available it means the wp-api script is missing? If it works for a different theme on the same install though, it should error there too, because you have the same REST API plugin installed when testing either theme?

FYI the script wp-api.js needs to be available and registered. https://github.com/WP-API/WP-API

ellatrix commented 8 years ago

I think your problem might be solved after 17dd3c2.

andfinally commented 8 years ago

This is great, we're getting closer and closer! I'd just be delighted if we could get it to work on my local. With this version, when I click the Edit Post link it goes blue, the elements of my post content that are rendered from shortcodes (like video embeds) change back into shortcodes, and I'm able to modify the post content by clicking and typing. But I'm not sure how to save my changes. When I click Edit Post again it goes back to white, and the previous version of the content appears.

ellatrix commented 8 years ago

Sorry about all the issues! But I'm glad someone is testing changes as I go. :)

So changes will be saved automatically in the future, at the moment it will only save changes for drafts every minute. Do you not see a permanent toolbar just under the admin bar when you're in edit mode?

ellatrix commented 8 years ago
screen shot 2016-07-08 at 19 14 06

You should see this.

andfinally commented 8 years ago

No worries, I appreciate all the work you're putting into this! I'm not seeing the toolbar, no. I did see it at one point when I was trying one of the earlier versions today, but not with this one. I do see the text formatting tooltip when I select text. I'm not seeing any JS errors. I also left it more than a minute, but the changes weren't saved.

ellatrix commented 8 years ago

Weird. We'll see once I'm done and start testing other themes. Haven't been able to reproduce so far.

ellatrix commented 8 years ago

Is this still an issue with the latest master? Needs to be resolved before releasing.

ellatrix commented 8 years ago

It seems to work fine here. Tested several themes. Could you open a new ticket if this happens again? Thanks!

andfinally commented 8 years ago

Hi iseulde, I've just tested on local with my previously problematic theme and it's working well now, thank you!