[QUESTION] How can i save a selected component in editor to database and use it for the next time? #4390
Answered
by
artf
trandoancuong195
asked this question in
Q&A
-
Beta Was this translation helpful? Give feedback.
Answered by
artf
Jun 22, 2022
Replies: 1 comment 1 reply
-
Probably the best approach would be to store the component as JSON const cmpJson = JSON.parse(JSON.stringify(editor.getSelected()));
// ...save the component and reuse it later in a block // ...load the saved component
editor.Blocks.add('saved-component-ID', {
label: 'Saved component',
content: cmpJson,
}); |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
trandoancuong195
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Probably the best approach would be to store the component as JSON
and reuse it later in a block