Skip to content

ElementEditor Drafts & External Content #13795

Closed Answered by brandonkelly
markhuot asked this question in Q&A
Discussion options

You must be logged in to vote

It seems like ideally, your components should be created normally right away, and assigned to the (provisional) draft, and then reassigned to the canonical entry when the draft is applied. That way you don’t need to worry about serializing the component and storing it in a hidden input.

To do that, you would first need to ensure that the user is actually editing a (provisional) draft. You can do that by calling ElementEditor::ensureIsDraftOrRevision(). (So long as your JS code is only getting executed when $static is false from your field’s inputHtml() method, you don’t need to worry about it being a revision.)

async function createComponent() {
  const myField = document.getElementById('…

Replies: 2 comments 7 replies

Comment options

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

Comment options

You must be logged in to vote
6 replies
@markhuot
Comment options

@markhuot
Comment options

@brandonkelly
Comment options

@brandonkelly
Comment options

@markhuot
Comment options

Answer selected by brandonkelly
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