Replies: 1 comment 1 reply
-
Try with something likes this: // Get wrapper component of the selected page
const wrapper = editor.Pages.getSelected().getMainComponent();
// Add new page with a clone of the wrapper
editor.Pages.add({
id: 'page-2',
component: wrapper.clone(),
}, { select: true }); // select the new created page Styles are stored in a shared instance so, for example, component-related styles are copied automatically and you can still use the same classes across all your pages. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi experts,
I'm trying to duplicate the current visible page to a new page using PageManager's api. I'm passing the components and the style while creating the new page from the current editor using
getComponents
andgetStyle
. But this doesn't seem to work.I tried passing components using
getHtml
andgetCss
but the css gets weird (appends, and generates duplicate css) and this doesn't generate new element ids.I tried to use
editor.getComponents().models
with copy-paste hack, but that seems to be copying it on the older page. It doesn't copy it to the new page.What's the right way to duplicate a page? Please let me know any demo link is required.
Beta Was this translation helpful? Give feedback.
All reactions