Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,466,881
Community Members
 
Community Events
176
Community Groups

How to specify a custom Media Client in Atlaskit especially @atlaskit/editor-core

I'm trying to use @atlaskit/editor-core in a project and want to specify my own Fileserver/MediaClient. But apparently this is very hard to accomplish since I can only set the Auth Provider and not the Media Provider in the Editor.

 

Atlasskit does provide a function, where I could mock the client and instead of really mocking I could inject my own client this way... but is this really the best option?

Since the documentation on @atlaskit/editor-core is fairly basic, I do not know where else to look...

Findings so far: with the following line the mocking can be enabled.

import { mediaMock } from '@atlaskit/media-test-helpers'
mediaMock.enable()

Minimal Example:

import React from 'react';
import { MediaProvider } from '@atlaskit/editor-common';
import { Editor } from '@atlaskit/editor-core';
import { MediaClientConfig } from '@atlaskit/media-core';
import { mediaMock, mediaPickerAuthProvider } from '@atlaskit/media-test-helpers';

mediaMock.enable();


// Crreating basic MediaProvider
const collection = 'sample-collection';
const mediaClientConfig: MediaClientConfig = {
  authProvider: mediaPickerAuthProvider(),
};

const mediaProvider = Promise.resolve<MediaProvider>({
  uploadParams: { collection },
  viewMediaClientConfig: mediaClientConfig,
  uploadMediaClientConfig: mediaClientConfig,
});

export const EditorMinimal = () => {
  return (
    <Editor
      appearance="full-page"
      media={{
        provider: mediaProvider,
        allowResizing: true,
        allowMediaSingle: true,
        useMediaPickerPopup: false,
        allowDropzoneDropLine: true,
        isCopyPasteEnabled: true,
      }}
    />
  );
};


Any link, direction, advise or starting point will be appreciated!!

3 answers

1 accepted

0 votes
Answer accepted

Got it working by rewriting parts of the media client

Hii, @Fabio Moretti  have you find any solution which works with legacyUploadImage?

Thanks

Let us know if you find the solution with the legacyUploadImage, thanks you.

Suggest an answer

Log in or Sign up to answer
TAGS

Atlassian Community Events