codevise/pageflow

View on GitHub
entry_types/scrolled/package/src/frontend/inlineEditing/postMessage.js

Summary

Maintainability
C
7 hrs
Test Coverage
export function postInsertContentElementMessage({id, at, splitPoint}) {
  window.parent.postMessage(
    {
      type: 'INSERT_CONTENT_ELEMENT',
      payload: {id, at, splitPoint}
    },
    window.location.origin
  );
}

export function postMoveContentElementMessage({id, range, to}) {
  window.parent.postMessage(
    {
      type: 'MOVE_CONTENT_ELEMENT',
      payload: {id, range, to}
    },
    window.location.origin
  );
}

export function postUpdateContentElementMessage({id, configuration}) {
  window.parent.postMessage(
    {
      type: 'UPDATE_CONTENT_ELEMENT',
      payload: {
        id,
        configuration
      }
    },
    window.location.origin
  );
}

export function postUpdateTransientContentElementStateMessage({id, state}) {
  window.parent.postMessage(
    {
      type: 'UPDATE_TRANSIENT_CONTENT_ELEMENT_STATE',
      payload: {
        id,
        state
      }
    },
    window.location.origin
  );
}

export function postSelectLinkDestinationMessage() {
  window.parent.postMessage(
    {
      type: 'SELECT_LINK_DESTINATION'
    },
    window.location.origin
  );
}