Skip to content
This repository has been archived by the owner on May 15, 2019. It is now read-only.

Content not editable when using wp_editor() for comment textarea #74

Open
christianwach opened this issue Apr 19, 2014 · 14 comments
Open

Comments

@christianwach
Copy link
Contributor

My plugin/theme combination uses wp_editor() to enable TinyMCE on the comments textarea. This makes WordPress Front-end Editor fail to show any editing buttons, the content itself cannot be edited and the Update button does not save changes.

When I switch off wp_editor() for comments, the content becomes editable and things work as expected. The plugin/theme can be found at:

http://wordpress.org/plugins/commentpress-core/

It'd be great if you could look into this.

Many thanks,
Christian

@ellatrix
Copy link
Owner

Thanks for the report, I'll try the plugin. Though one of the things I'd like to do in the future is make comments editable as well.

On 19 Apr 2014, at 13:52, Christian Wach [email protected] wrote:

My plugin/theme combination uses wp_editor() to enable TinyMCE on the comments textarea. This makes WordPress Front-end Editor fail to show any editing buttons, the content itself cannot be edited and the Update button does not save changes.

When I switch off wp_editor() for comments, the content becomes editable and things work as expected. The plugin/theme can be found at:

http://wordpress.org/plugins/commentpress-core/

It'd be great if you could look into this.

Many thanks,
Christian


Reply to this email directly or view it on GitHub.

@christianwach
Copy link
Contributor Author

Thanks for looking into the issue!

@christianwach
Copy link
Contributor Author

I don't want to jump to conclusions, but presumably there's a conflict when there is already a TinyMCE instance present on the front end. I assume there ought to be a way to make sure that the instances don't conflict. Hope you can figure out how :-)

@ellatrix
Copy link
Owner

ellatrix commented May 2, 2014

I don't think this will work with different TinyMCE configs... I solved one problem, but created a few others... :/

@ellatrix ellatrix closed this as completed May 2, 2014
@christianwach
Copy link
Contributor Author

Thanks for responding. I'll take a look myself at some point and check if I can see any way forward.

@christianwach
Copy link
Contributor Author

@avryl I realise this issue is closed, but I'd like to reopen it as it would be great to have this plugin work when there are other instances of TinyMCE present on the front end.

A few months down the line, do you have any further thoughts on whether this is possible - or is it a pipe dream?

Cheers, Christian

@ellatrix ellatrix reopened this Oct 23, 2014
@ellatrix
Copy link
Owner

Actually this should be possible. Sorry that I closed this. :)
I'm thinking about rewriting the whole thing again, so not sure if I'll fix this problem before that.

@christianwach
Copy link
Contributor Author

Thanks for reopening and responding. It would be great to have multiple instances co-exist. Do you have any sort of roadmap/timescale?

@ellatrix
Copy link
Owner

Hm. It's difficult to make promises about that and keep it. :)

@ellatrix
Copy link
Owner

I'm figuring out the whole rewrite right now.

@christianwach
Copy link
Contributor Author

Understood 😄

@boonebgorges
Copy link

Hi @christianwach and @avryl - As promised, I've managed to look at this a little bit. I think there are a number of things happening here, but one of them is that when another plugin uses wp_editor() alongside FEE, window.tinyMCE.baseURL gets forced to 'example.com/wp-includes/js/'. See https://core.trac.wordpress.org/browser/tags/4.0/src/wp-includes/class-wp-editor.php#L299 and https://core.trac.wordpress.org/browser/tags/4.0/src/wp-includes/class-wp-editor.php#L1048. This, in turn, causes TinyMCE to look for FEE's plugins inside of baseURL.

Not sure if this is the "right" way around it, but I managed to get FEE to load properly in this kind of environment by using PluginsManager.load() and ThemesManager.load() instead of 'plugins' and 'themes' arguments in the initArray, which allowed me to pass explicit URLs for the plugins that should be loaded from the FEE directory. See boonebgorges@11c5b6a.

There are further issues on the page even with this fix, but I think they might be due to the other plugin (http://wordpress.org/plugins/commentpress-core/). I'll have to investigate that more.

@christianwach
Copy link
Contributor Author

@boonebgorges Thanks for this - your changes do seem to fix loading wp-fee's TinyMCE plugins.

It looks like wp-core may need a patch to fix the 404 I get for the AJAX spinner, which is defined with a relative path:
https://github.com/WordPress/WordPress/blob/master/wp-admin/includes/post.php#L1471

FYI, the way CommentPress works with TinyMCE is to load it once via a standard wp-editor() call, then disable it when it needs moving from one place in the DOM to another, reloading it once it's in place. Not sure how/if this impacts the situation, but thought it might be useful to know.

@christianwach
Copy link
Contributor Author

@avryl @boonebgorges Just a quick note to update you both on the issue of multisite loading...

Boone: your amends did indeed load wp-fee's TinyMCE plugins, but I cannot get any of the TinyMCE "toolbars" to appear when - for example - I highlight some text.

Janneke: it seems that the version of wp-fee in the WordPress plugin directory loads fine in WP multisite, but this repo on Github seems not to be updated with the code in 1.0.0-beta1.2. I'd like to ask that the plugin loads into a global variable, so that it's hooks can be addressed - it's really complex to address anonymous objects!

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

No branches or pull requests

3 participants