Hi All!
Have you ever tried to connect the editor component with its components?
We have the following code:
import {Editor, EditorContext} from '@atlaskit/editor-core';
import {EmojiResource} from '@atlaskit/emoji/resource';
this.emojiProvider = new EmojiResource({
providers: [
{
url: '/emoji/standard',
securityProvider: () => ({headers: {Authorization: 'JWT ' + meta.get('token')}}),
}
],
});
<EditorContext>
<Editor appearance="full-width"
emojiProvider={this.emojiProvider}
contentTransformerProvider={schema => new JIRATransformer(schema)}
/>
</EditorContext>
But all the time we are receiving the following errors:
ascii-input-rules.js?58b7:22 Uncaught TypeError: provider.then is not a function
at handleProvider (ascii-input-rules.js?58b7:22)
at eval (provider-factory.js?d294:82)
at Array.forEach (<anonymous>)
at ProviderFactory.notifyUpdated (provider-factory.js?d294:81)
at ProviderFactory.setProvider (provider-factory.js?d294:35)
at Editor.handleProviders (editor.js?938a:181)
at Editor.componentDidMount (editor.js?938a:100)
at commitLifeCycles (react-dom.development.js?61bb:19814)
at commitLayoutEffects (react-dom.development.js?61bb:22803)
at HTMLUnknownElement.callCallback (react-dom.development.js?61bb:188)
at Object.invokeGuardedCallbackDev (react-dom.development.js?61bb:237)
at invokeGuardedCallback (react-dom.development.js?61bb:292)
at commitRootImpl (react-dom.development.js?61bb:22541)
at unstable_runWithPriority (scheduler.development.js?3069:653)
at runWithPriority$1 (react-dom.development.js?61bb:11039)
at commitRoot (react-dom.development.js?61bb:22381)
at finishSyncRender (react-dom.development.js?61bb:21807)
at performSyncWorkOnRoot (react-dom.development.js?61bb:21793)
at eval (react-dom.development.js?61bb:11089)
at unstable_runWithPriority (scheduler.development.js?3069:653)
at runWithPriority$1 (react-dom.development.js?61bb:11039)
at flushSyncCallbackQueueImpl (react-dom.development.js?61bb:11084)
at flushSyncCallbackQueue (react-dom.development.js?61bb:11072)
at discreteUpdates$1 (react-dom.development.js?61bb:21893)
at discreteUpdates (react-dom.development.js?61bb:806)
at dispatchDiscreteEvent (react-dom.development.js?61bb:4168)
LoadingEmojiComponent.js?fbd2:38 Uncaught TypeError: futureEmojiProvider.then is not a function
at ResourcedEmoji.LoadingEmojiComponent.loadEmojiProvider (LoadingEmojiComponent.js?fbd2:38)
at ResourcedEmoji.LoadingEmojiComponent [as constructor] (LoadingEmojiComponent.js?fbd2:18)
at new ResourcedEmoji (ResourcedEmoji.js?21e0:14)
at constructClassInstance (react-dom.development.js?61bb:12880)
at updateClassComponent (react-dom.development.js?61bb:17100)
at beginWork (react-dom.development.js?61bb:18620)
at HTMLUnknownElement.callCallback (react-dom.development.js?61bb:188)
at Object.invokeGuardedCallbackDev (react-dom.development.js?61bb:237)
at invokeGuardedCallback (react-dom.development.js?61bb:292)
at beginWork$1 (react-dom.development.js?61bb:23203)
at performUnitOfWork (react-dom.development.js?61bb:22157)
at workLoopSync (react-dom.development.js?61bb:22130)
at performSyncWorkOnRoot (react-dom.development.js?61bb:21756)
at eval (react-dom.development.js?61bb:11089)
at unstable_runWithPriority (scheduler.development.js?3069:653)
at runWithPriority$1 (react-dom.development.js?61bb:11039)
at flushSyncCallbackQueueImpl (react-dom.development.js?61bb:11084)
at flushSyncCallbackQueue (react-dom.development.js?61bb:11072)
at discreteUpdates$1 (react-dom.development.js?61bb:21893)
at discreteUpdates (react-dom.development.js?61bb:806)
at dispatchDiscreteEvent (react-dom.development.js?61bb:4168)
Any ideas how overpass this will be greatly appreciated.
The editor component without modules is initialized, but this is not enough.
Thanks.
Try to use import { EmojiResource } from "@atlaskit/emoji"; not from @atlaskit/emoji/resource.
this.emojiProvider is a promise with resolving an instance of EmojiResource. Currently, you are using this.emojiProvider as an instance of EmojiResource. Basically, the code will look like this
Thanks a lot for your help.
I was able to implement emojiProvider and it works.
Unfortunately, I came across another issue with metionProvider. I couldn’t find REST API response format. I’ve tried the same as Jira Cloud uses (/rest/internal/2/userteam/mention/search)
Hi @tthanhdang,
Could you please advise on the user mentions module. Is it possible to get the source code or some guide how you initialize modules in Jira Cloud?
Thanks.
Since I am not working in Jira Cloud team. I used to work with Editor 2 years ago so my knowledge about the Editor is out of update now and Editor is very big and complex component. I am not sure whether there is a public source of @atlaskit/editor-core or not.
About your question about mentionProvider, I tried to search about it in Confluence Frontend (it’s Atlassian internal repository), here is what I understand:
Actual source code to initialise the mentionProvider in Confluence is quite long and spread in some files. The above example is a short version which I can understand and transfer it in this comment.
Hi! @vrutkevich !
I work from the Editor Team, I am trying to understand the user case.
Do you want to setup the Editor using Atlassian Services?, or are you implementing your own backend services?
To give you more insigth, the Editor itself does not implement any comunication with backend services, it uses providers to do this job (Provider has to be provided by the consumer of the editor). In theory, you can create your own provider, the only requirement is that they have to follow the correct type that you can find in @atlaskit/editor-common/provider-factory (Providers).
As you mention, each team offers his own provider configuration to be used with the respective related service, if you want to use this with your own backend service, you might need to implement a similar response, and in theory it should work (not my area of expertise).
You can find mention response type in @atlaskit/mention/types under the name MentionResult.
Hi @JesusQuintana ,
Thanks for taking a look at this issue. The developer will send a direct message to you shortly.
We want to provide a capability to edit the Summary / Environment field with all its capabilities within our app. As of now, we have issue with the media editor module, without it, all the content of the field is reset.
The developer will provide all the details regarding the use case.
Thanks.