Skip to content

How to execute Javascript in admin preview after element change #2281

Answered by tvdeyen
dssjoblom asked this question in Q&A
Discussion options

You must be logged in to vote

It seems like adding a slide will directly modify the DOM in the preview instead of reloading it.

We are not modifying the DOM in the preview frame. We reload it.

$errors.hide();
$el.trigger('SaveElement.Alchemy', {previewText: '<%= j sanitize(@element.preview_text) %>'});
Alchemy.growl('<%= Alchemy.t(:element_saved) %>');
Alchemy.PreviewWindow.refresh(function() {
Alchemy.ElementEditors.focusElementPreview(<%= @element.id %>);
});

Not sure where your impression we modify the DOM comes from.

Is there some other event we could listen to, e.g. "alchemy-element-ch…

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Answer selected by dssjoblom
Comment options

You must be logged in to vote
1 reply
@tvdeyen
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #2279 on April 05, 2022 07:54.