import { addLinkMetadata } from './addLinkMetadata';
/**
 * Adds metadata to the transaction created from a command
 * The metadata describes the user intent and input method
 * for executing the command
 */
export const commandWithMetadata = (command, metadata) => {
  return (state, dispatch, view) => {
    if (!dispatch) {
      return command(state, dispatch, view);
    }
    return command(state, tr => {
      addLinkMetadata(state.selection, tr, metadata);
      dispatch(tr);
    }, view);
  };
};
// eslint-disable-next-line @atlaskit/editor/no-re-export
export { addLinkMetadata } from './addLinkMetadata';
// eslint-disable-next-line @atlaskit/editor/no-re-export
export { getLinkMetadataFromTransaction } from './getLinkMetadataFromTransaction';