You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
Next: Root
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
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!!
Got it working by rewriting parts of the media client
Very hacky but it works
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Let us know if you find the solution with the legacyUploadImage, thanks you.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.