Getting the Media plugin for Editor-core to work

Hello everyone,

I’m working on an app that uses UI Kit for a Jira issue activity module. In the module, I have a button that opens a modal, and in that modal I have a Frame where I render a Custom UI resource containing @atlaskit/editor-core.

I have been able to get all of that to work, but there is one last thing I’m struggling with: I want to be able to paste images inline and also insert them via the toolbar button. In either case, I want the images to get saved as attachments on the issue.

The editor seems to support this by using the @atlaskit/editor-plugin-media. However, when I include it, nothing seems to happen - the button doesn’t get added to the toolbar and pasting doesn’t seem to do anything either. Below is a minimal example of my code:

const App = () => {
  // Dummy provider, this should have been enough
  // to at least get the media plugins to init?
  const mediaProvider: Promise<MediaProvider> = Promise.resolve({
    viewMediaClientConfig: {
      authProvider: async () => ({
        clientId: "",
        token: "",
        baseUrl: "",
      }),
    },
    uploadMediaClientConfig: {
      authProvider: async () => ({
        clientId: "",
        token: "",
        baseUrl: "",
      }),
    },
  });

  const defaultPreset = () =>
    createDefaultPreset({ featureFlags: { undoRedoButtons: true }, paste: {} })
      // Some other plugins
      .add([
        mediaPlugin,
        {
          provider: mediaProvider,
          allowMediaSingle: true,
          allowMediaInlineImages: true,
          isCopyPasteEnabled: true,
          featureFlags: {
            mediaInline: true,
          },
        },
      ])
    // I have also tried adding @atlaskit/editor-plugin-media-insert
    // and @atlaskit/editor-plugin-image upload with no results

  const { preset } = usePreset(defaultPreset);

  return (
    <ComposableEditor appearance="max" preset={preset} />
  );
};

export default App;

Did anyone get the media plugin to work? Any help would be appreciated :slightly_smiling_face:

Anyone? :slight_smile: