Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CodeMirror with ACF Textarea #9768

Closed
riemerta6 opened this issue Sep 10, 2018 · 7 comments
Closed

CodeMirror with ACF Textarea #9768

riemerta6 opened this issue Sep 10, 2018 · 7 comments
Labels
[Type] Plugin Interoperability Incompatibilities between a specific plugin and the block editor. Close with workaround notes.

Comments

@riemerta6
Copy link

I have a Textarea field that I've created with Advanced Custom Fields. I have to so that the Textarea is replaced with a CodeMirror field (using plugin ACF Code Field). When I "Update" with the Gutenberg editor, it does not save the contents of the CodeMirror field. I have a feeling this is because the actual Textarea is not being saved. It does save when I'm not using Gutenberg. I submitted a note to the plugin creator about this, but I thought I would also post something here.

To Reproduce
Steps to reproduce the behavior:

  1. Create ACF Code Field

  2. Edit ACF Code Field on Page

  3. Update page with Gutenberg active
    / breaks here

  4. Create ACF Code Field

  5. Edit ACF Code Field on Page

  6. Update page without Gutenberg active

  7. Field is updated!

I've tried this in the latest versions of Firefox and Chrome

Gutenberg Version 3.7.0

@designsimply designsimply added the [Type] Plugin Interoperability Incompatibilities between a specific plugin and the block editor. Close with workaround notes. label Sep 11, 2018
@designsimply
Copy link
Member

Thank you for posting! Would you mind sharing the link where you reported the issue to the plugin creator so we can follow along or did you report that via email or through a private support system that you can't link to?

@riemerta6
Copy link
Author

riemerta6 commented Sep 11, 2018

https://wordpress.org/support/topic/not-saving-with-gutenberg/

@youknowriad
Copy link
Contributor

Is this still an issue? I know both ACF and Gutenberg have been updated to fix conflicts.

@youknowriad youknowriad added the [Status] Needs More Info Follow-up required in order to be actionable. label Dec 25, 2018
@riemerta6
Copy link
Author

riemerta6 commented Dec 27, 2018 via email

@youknowriad youknowriad removed the [Status] Needs More Info Follow-up required in order to be actionable. label Dec 27, 2018
@youknowriad
Copy link
Contributor

Thanks for the heads-up, make sure to follow up with in the ACF repo as well. More insights might help us see how we can provide compatibility for this if needed.

@riemerta6
Copy link
Author

I wanted to follow up on this issue. After digging deeper, I have realized it doesn't have anything to do with ACF or the plugin mentioned above. It has to do with how CodeMirror is initialized (by replacing textarea/metabox). Any ideas on how to save the edits to the metabox when CodeMirror is being used and Gutenberg is active on the page? What if everything typed in CodeMirror was copied to textarea using JavaScript?

mkevins added a commit that referenced this issue May 12, 2019
* Add safety check to image url before calling indexOf

* Set attributes.id to null when an image upload is cancelled

* Add console.warn and comments to help track WordPress-Android issue #9768

* Fix lint errors
mkevins added a commit that referenced this issue May 14, 2019
…5618)

* Add safety check to image url before calling indexOf

* Set attributes.id to null when an image upload is cancelled

* Add console.warn and comments to help track WordPress-Android issue #9768
@t-hamano
Copy link
Contributor

I have to so that the Textarea is replaced with a CodeMirror field (using plugin ACF Code Field).

If you mean this by a plugin called ACF Code Field, it looks like this plugin is already closed.

Instead I tried Advanced Custom Fields: Extended which allows us to add the code editor field. (This plugin requires ACF Pro version, but luckily I had a permanent license)

From what I've tried with this plugin, it appears to apply CodeMirror to the field and persist code changes even after I save the post and reload the browser.

code-editor

In any case, I think this issue is an implementation issue when applying Codemirror to Metabox, so I would like to close this issue.

@t-hamano t-hamano closed this as not planned Won't fix, can't repro, duplicate, stale Dec 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Type] Plugin Interoperability Incompatibilities between a specific plugin and the block editor. Close with workaround notes.
Projects
None yet
Development

No branches or pull requests

4 participants