jenkins-bot has submitted this change and it was merged.

Change subject: Fix broken ve.init.sa.Platform @example (ve.init.platform 
undefined)
......................................................................


Fix broken ve.init.sa.Platform @example (ve.init.platform undefined)

Follows-up 363c804, 12ef310.

To avoid having to mention ve.messagePaths in general example
code, ensure Platform is instantiated in eg-iframe.html.

However in the @example for ve.init.sa.Platform itself, still do
the instantiation explicitly there as example.

Move the main ve.init.sa.Target @example back to its own class.

Change-Id: I13efa6beeb3d2878b175f373f7cb4c665d42c4d8
---
M .jsduck/eg-iframe.html
M .jsduck/eg-iframe.html.template
M src/init/sa/ve.init.sa.Platform.js
M src/init/sa/ve.init.sa.Target.js
4 files changed, 42 insertions(+), 22 deletions(-)

Approvals:
  Esanders: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/.jsduck/eg-iframe.html b/.jsduck/eg-iframe.html
index 347b746..9b8a13a 100644
--- a/.jsduck/eg-iframe.html
+++ b/.jsduck/eg-iframe.html
@@ -60,14 +60,19 @@
 
                <!-- example scripts -->
                <script>
+                       // Ensure ve.init.platform exists for use in examples
+                       var platform = new ve.init.sa.Platform( ve.messagePaths 
).initialize();
+
                        function loadInlineExample( code, options, callback ) {
-                               try {
-                                       eval( code );
-                                       callback && callback( true );
-                               } catch (e) {
-                                       document.body.appendChild( 
document.createTextNode( e ) );
-                                       callback && callback( false, e );
-                               }
+                               platform.done( function () {
+                                       try {
+                                               eval( code );
+                                               callback && callback( true );
+                                       } catch (e) {
+                                               document.body.appendChild( 
document.createTextNode( e ) );
+                                               callback && callback( false, e 
);
+                                       }
+                               } );
                        }
                </script>
        </body>
diff --git a/.jsduck/eg-iframe.html.template b/.jsduck/eg-iframe.html.template
index 51c04b5..73d8928 100644
--- a/.jsduck/eg-iframe.html.template
+++ b/.jsduck/eg-iframe.html.template
@@ -22,14 +22,19 @@
 
                <!-- example scripts -->
                <script>
+                       // Ensure ve.init.platform exists for use in examples
+                       var platform = new ve.init.sa.Platform( ve.messagePaths 
).initialize();
+
                        function loadInlineExample( code, options, callback ) {
-                               try {
-                                       eval( code );
-                                       callback && callback( true );
-                               } catch (e) {
-                                       document.body.appendChild( 
document.createTextNode( e ) );
-                                       callback && callback( false, e );
-                               }
+                               platform.done( function () {
+                                       try {
+                                               eval( code );
+                                               callback && callback( true );
+                                       } catch (e) {
+                                               document.body.appendChild( 
document.createTextNode( e ) );
+                                               callback && callback( false, e 
);
+                                       }
+                               } );
                        }
                </script>
        </body>
diff --git a/src/init/sa/ve.init.sa.Platform.js 
b/src/init/sa/ve.init.sa.Platform.js
index f258688..db73038 100644
--- a/src/init/sa/ve.init.sa.Platform.js
+++ b/src/init/sa/ve.init.sa.Platform.js
@@ -8,14 +8,11 @@
  * Initialization Standalone platform.
  *
  *     @example
- *     ve.init.platform.initialize().done( function () {
- *         var target = new ve.init.sa.Target();
- *         target.addSurface(
- *             ve.dm.converter.getModelFromDom(
- *                 ve.createDocumentFromHtml( '<p>Hello, World!</p>' )
- *             )
- *         );
- *         $( 'body' ).append( target.$element );
+ *     var platform = new ve.init.sa.Platform( ve.messagePaths );
+ *     platform.initialize().done( function () {
+ *         $( 'body' ).append( $( '<p>' ).text(
+ *             platform.getMessage( 'visualeditor' )
+ *         ) );
  *     } );
  *
  * @class
diff --git a/src/init/sa/ve.init.sa.Target.js b/src/init/sa/ve.init.sa.Target.js
index dcdf0a2..50fafd7 100644
--- a/src/init/sa/ve.init.sa.Target.js
+++ b/src/init/sa/ve.init.sa.Target.js
@@ -7,6 +7,19 @@
 /**
  * Initialization Standalone target.
  *
+ * A platform must be constructed first. See ve.init.sa.Platform for an 
example.
+ *
+ *     @example
+ *     ve.init.platform.initialize().done( function () {
+ *         var target = new ve.init.sa.Target();
+ *         target.addSurface(
+ *             ve.dm.converter.getModelFromDom(
+ *                 ve.createDocumentFromHtml( '<p>Hello, World!</p>' )
+ *             )
+ *         );
+ *         $( 'body' ).append( target.$element );
+ *     } );
+ *
  * @class
  * @extends ve.init.Target
  *

-- 
To view, visit https://gerrit.wikimedia.org/r/204003
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I13efa6beeb3d2878b175f373f7cb4c665d42c4d8
Gerrit-PatchSet: 8
Gerrit-Project: VisualEditor/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Krinkle <[email protected]>
Gerrit-Reviewer: Catrope <[email protected]>
Gerrit-Reviewer: Esanders <[email protected]>
Gerrit-Reviewer: Krinkle <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to