Ferdbold has uploaded a new change for review.
https://gerrit.wikimedia.org/r/253655
Change subject: Only load Vega with VE on pages containing graphs
......................................................................
Only load Vega with VE on pages containing graphs
Bug: T118813
Change-Id: Ic8af447eb297e34cbf75a14298132702d6b70639
---
M .jshintrc
M Graph.hooks.php
M modules/ve-graph/ve.ce.MWGraphNode.js
3 files changed, 16 insertions(+), 14 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Graph
refs/changes/55/253655/1
diff --git a/.jshintrc b/.jshintrc
index d11f205..d7f1c60 100644
--- a/.jshintrc
+++ b/.jshintrc
@@ -19,6 +19,7 @@
"globals": {
"mediaWiki": false,
+ "mw": false,
"OO": false,
"ve": false,
"vg": false,
diff --git a/Graph.hooks.php b/Graph.hooks.php
index 9145ea1..3addfb2 100644
--- a/Graph.hooks.php
+++ b/Graph.hooks.php
@@ -39,8 +39,7 @@
'modules/ve-graph/widgets/ve.ui.TableWidget.css'
),
'dependencies' => array(
- 'ext.visualEditor.mwcore',
- 'ext.graph'
+ 'ext.visualEditor.mwcore'
),
'messages' => array(
'graph-ve-dialog-edit-field-graph-type',
diff --git a/modules/ve-graph/ve.ce.MWGraphNode.js
b/modules/ve-graph/ve.ce.MWGraphNode.js
index f30f1e9..b9b019a 100644
--- a/modules/ve-graph/ve.ce.MWGraphNode.js
+++ b/modules/ve-graph/ve.ce.MWGraphNode.js
@@ -106,18 +106,20 @@
this.emit( 'teardown' );
}
- this.constructor.static.vegaParseSpec( this.getModel().getSpec(),
this.$element[ 0 ] ).then(
- function () {
- node.$focusable = node.$element.find( 'canvas' );
- },
- function ( failMessageKey ) {
- node.$element.text( ve.msg( failMessageKey ) );
- node.$focusable = node.$element;
- }
- ).always( function () {
- if ( node.live ) {
- node.emit( 'setup' );
- }
+ mw.loader.using( 'ext.graph' ).done( function () {
+ node.constructor.static.vegaParseSpec(
node.getModel().getSpec(), node.$element[ 0 ] ).then(
+ function () {
+ node.$focusable = node.$element.find( 'canvas'
);
+ },
+ function ( failMessageKey ) {
+ node.$element.text( ve.msg( failMessageKey ) );
+ node.$focusable = node.$element;
+ }
+ ).always( function () {
+ if ( node.live ) {
+ node.emit( 'setup' );
+ }
+ } );
} );
};
--
To view, visit https://gerrit.wikimedia.org/r/253655
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic8af447eb297e34cbf75a14298132702d6b70639
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Graph
Gerrit-Branch: master
Gerrit-Owner: Ferdbold <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits