I am adding a new Content Layout accordion to replace the native LW accordions. While they will look and behave just like the native ones, they will have the added benefit of having the +, -, up, and down buttons.
We will use the new ones going forward, but there will be no need to change all the old ones immediately. We’ll just work through updating them slowly as time permits or as we edit existing pages.
I would like to make it easy for admins to convert them, though. I was thinking about creating a browser bookmarklet that runs some JS to replace existing accordions with new ones. I have that working if the user inserts a new accordion first. The script can copy content from the old to the new and delete the old.
I tried having the script just insert the content layout markup automatically, but I ran into an issue. The content layout doesn’t get “registered” or something, so the controls do not get added.
Is there a way to have the editor recognize that a new content layout has been added via JS, or should I stick with the working method of manually inserting a CL before running the script?
Or is there a better way I have not thought of? With ~700 pages with accordions on the site, the last thing I want to do is copy/paste everything manually.