I am trying to: Add and Remove Classes from Visual Editor cells contained in Layouts
I visited this URL: Any Layout containing a Visual Editor Cell
I expected to see: A visual editor cell with the class removed
Instead, I got: A visual editor cell with the class still present and the class duplicated to other cells
A major Layouts bug here!
Attempting to delete classes from Visual Editor cells will result in and error on select2.js?ver=4.0.3:5679 - The toolset_select2('destroy') method was called on an element that is not using Select2.
Repeated attempts to delete a class from the cell resulted in the all Visual Editor Cells in the layout that contained other classes switching to the class I'm attempting to remove. Attempts to delete the cell and replace it with a new one were also unsuccessful with the class now suddenly appearing in every cell on the layout. This Layout seemingly can now never be fixed again and will have to be started from scratch - There's no way I can do this for an entire site.
I have tested this on a fresh version of Toolset plugins using the Starter layout (with child) and confirm this error still exists. I can also confirm this is not related to any other plugins.
This has been an ongoing issue since the select2 changes to the toolset plugins, I really need a solution to this issue ASAP. After waiting over a week previously to resolve an identical issue with Grid Cells, I had expected this to be resolved with the last thread I was a part of which has now gone unanswered for quite some time.
I absolutely love the Layouts plugin but as of late have been really really hating it since the Select2 changes, TBH. The ongoing issues in Layouts with classes on cells has now ruined multiple versions of my toolset layouts on a site that was to launch at the end of last week.
Please get back to me as this is a very pressing issue with what should be basic functionality and is now costing us time and resources to correct.
Thank you in advance and my apologies for my frustration here.
Further testing shows that the classes automatically appearing when editing a NEW Visual Editor cell occurs only after viewing or saving a Visual Editor cell before saving the new one. Reloading the entire page, creating a new row and new visual editor cell adds the cell without the class. However once you save or close a visual editor cell with a class, you must reload the Layout editor otherwise any cell edited after this will contain that class.
Replicate issue:
1. Add a visual editor cell, Save and Close the cell editor.
2. Edit the cell and add a class. Save and Close.
3. Reload that Visual Editor Cell and try to remove the class. Save and Close.
4. Attempt to edit that Visual Editor Cell again. Notice that the class you just removed is now present again. (Bug #1)
5. Delete the Visual editor cell and replace it with a new Visual Editor cell, using the same row and don't add a class. Save and Close.
6. Edit that Visual Editor cell and a the class that was in the previously deleted cell will suddenly be present in the new one. (Bug #2)
I'm really sorry about this, your frustration is entirely understandable.
As you know updating the latest select2 library has sent us down a rabbit hole of issues which have sometimes difficult to reproduce, or which appear fixed and then re-appear.
I recently re-opened the internal ticket for this based on another thread reporting the same issues having reproduced it myself in testing, only for the developers to not be able to reproduce it, and then for me to have problems reproducing it in subsequent testing.
I have just re-tested the problem based on the steps you outline. Initially I couldn't reproduce it following your steps. I was able to add and delete classes to a visual editor cell without problem.
But I persisted, adding another row with another cell and then I began to see problems, though the behaviour didn't appear consistent. I did see the second bug you described.
So, we have inconsistent problems where adding classes to a visual editor cell may not be saved, where deleted classes may persist, and where classes added/removed from one visual editor cell may interfere with another visual editor cell—including cells which are added later.
I am escalating this thread and asking for more people to get involved with the testing to see if we can identify and fix the problem once and for all.
Thank you so much for pushing forward trying to replicate the issue, I'm relieved that you were able to see what I've been struggling with.
As you said, my steps don't work, however do seem to if you have another cell in another row on the layout, indeed.
It seems that once that select2 destroy error is thrown (usually upon closing a cell's editor), that the issue will progress from there when attempting to edit future cells. This seems to occur mostly with Grid cells for me. The solution for that particular type of cell was to add a class, save it, then reload the entire layout editor page before attempting to add another class to a different cell regardless of its type. I attempted to test this with Visual Editor cells before suddenly receiving save errors regarding json format.
But as you've previously mentioned, once it "breaks", it becomes very inconsistent so I can't be sure this is even related to the main issue we're experiencing. Sometime reloading the entire Layout editor page will resolve the issues and other times it doesn't.
You may have noticed we pushed out hotfix releases overnight in preparation for WordPress 4.7 next week but I just tested the issue against the updates myself to confirm that it is still a problem.
The fix for this issue is in the development branch mean it will be included in the next full release.
With the hotfixes out of the way the testing cycle for that has now begun and all being well it should be out in a couple of weeks.