Can't import mxgraph libs in my plugin panel


#1

Hi,

First, i apologize for my powerless english.
I’am a production engineer (not developper) and i’ll try to developp a plugin based on mxgraph :

But with angular, i cant use third libraries mxgraph :disappointed_relieved:
import libs works :
flowchartControl.js :
import * as mxClient from ‘./mxgraph/javascript/dist/build.js’;

When i call function in line 111, i have a message in console :
Plugin component error TypeError: mxClient.isBrowserSupported is not a function
at FlowchartCtrl.initializeMxgraph (flowchartControl.js:107)

How can i use libs without modify it ? i searched in internet, try examples without success since 2 days.

I need your help please

Best reguard
Arnaud


#2

Hi,
I replace mxgraph by mxgraph-js, it work bette but when i try with the same on index.html
i have error
Plugin component error TypeError: t.setAttribute is not a function
at Object.eval [as disableContextMenu] (mxgraph-js.js:2435)
at FlowchartCtrl.initializeMxgraph (flowchartControl.js:133)
at FlowchartCtrl.onRender (flowchartControl.js:184)
at FlowchartCtrl (flowchartControl.js:101)
at Object.invoke (angular.js:5040)
at M.instance (angular.js:11000)
at ie (angular.js:9852)
at angular.js:9174
at angular.js:9039
at dashboard_ctrl.ts:30
in html, its work, why ?


#3

I change again tu use webpack instead es6
A have another pb when i build with grunt
Module not found: Error: Can’t resolve ‘grafana/app/plugins/sdk’