jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/332875 )

Change subject: Fix minimal demo
......................................................................


Fix minimal demo

* Append before setting up surface to fix toolbar measurement
* Use 0.8em globally
* Use OOUI widgets for HTML output

Bug: T152781
Change-Id: Icb4dd0293874eb26d694593b63d477238612786a
---
M demos/ve/demo.minimal.css
M demos/ve/demo.minimal.js
M demos/ve/minimal-rtl.html
M demos/ve/minimal.html
M demos/ve/minimal.html.template
5 files changed, 22 insertions(+), 21 deletions(-)

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



diff --git a/demos/ve/demo.minimal.css b/demos/ve/demo.minimal.css
index 770e36d..e233882 100644
--- a/demos/ve/demo.minimal.css
+++ b/demos/ve/demo.minimal.css
@@ -6,6 +6,7 @@
 
 body {
        font-family: sans-serif;
+       font-size: 0.8em;
 }
 
 .ve-instance {
@@ -24,6 +25,6 @@
 
 .ve-demo-html {
        margin-top: 1em;
-       width: 100%;
-       height: 10em;
+       max-width: none;
+       font-family: monospace, 'Courier';
 }
diff --git a/demos/ve/demo.minimal.js b/demos/ve/demo.minimal.js
index 493c600..ddad9eb 100644
--- a/demos/ve/demo.minimal.js
+++ b/demos/ve/demo.minimal.js
@@ -10,8 +10,12 @@
                $( '.ve-instance' ).text( 'Sorry, this browser is not 
supported.' );
        } )
        .done( function () {
-               // Create the target
-               var target = new ve.init.sa.Target();
+               var convertButton, convertText,
+                       // Create the target
+                       target = new ve.init.sa.Target();
+
+               // Append the target to the document
+               $( '.ve-instance' ).append( target.$element );
 
                // Create a document model for a new surface
                target.addSurface(
@@ -22,11 +26,16 @@
                        )
                );
 
-               // Append the target to the document
-               $( '.ve-instance' ).append( target.$element );
-
-               $( '.ve-demo-convert' ).on( 'click', function () {
+               // Button and textarea for showing HTML output
+               convertButton = new OO.ui.ButtonWidget( { label: 'Convert to 
HTML', icon: 'expand' } ).on( 'click', function () {
                        // Get the current HTML from the surface and display
-                       $( '.ve-demo-html' ).val( target.getSurface().getHtml() 
);
+                       convertText.setValue( target.getSurface().getHtml() );
                } );
+
+               convertText = new OO.ui.TextInputWidget( { multiline: true, 
autosize: true, classes: [ 've-demo-html' ] } );
+
+               $( '.ve-demo-output' ).append(
+                       convertButton.$element,
+                       convertText.$element
+               );
        } );
diff --git a/demos/ve/minimal-rtl.html b/demos/ve/minimal-rtl.html
index 60387ec..2bc64ce 100644
--- a/demos/ve/minimal-rtl.html
+++ b/demos/ve/minimal-rtl.html
@@ -31,10 +31,7 @@
        </head>
        <body dir="rtl">
                <div class="ve-instance"></div>
-               <div class="ve-demo-output">
-                       <input type="button" class="ve-demo-convert" 
value="&darr; Convert to HTML">
-                       <textarea class="ve-demo-html"></textarea>
-               </div>
+               <div class="ve-demo-output"></div>
 
                <!-- jquery -->
                <script src="../../lib/jquery/jquery.js"></script>
diff --git a/demos/ve/minimal.html b/demos/ve/minimal.html
index 277e4e5..b195623 100644
--- a/demos/ve/minimal.html
+++ b/demos/ve/minimal.html
@@ -31,10 +31,7 @@
        </head>
        <body dir="ltr">
                <div class="ve-instance"></div>
-               <div class="ve-demo-output">
-                       <input type="button" class="ve-demo-convert" 
value="&darr; Convert to HTML">
-                       <textarea class="ve-demo-html"></textarea>
-               </div>
+               <div class="ve-demo-output"></div>
 
                <!-- jquery -->
                <script src="../../lib/jquery/jquery.js"></script>
diff --git a/demos/ve/minimal.html.template b/demos/ve/minimal.html.template
index d8ad050..b4dd589 100644
--- a/demos/ve/minimal.html.template
+++ b/demos/ve/minimal.html.template
@@ -17,10 +17,7 @@
        </head>
        <body dir="<!-- DIR -->">
                <div class="ve-instance"></div>
-               <div class="ve-demo-output">
-                       <input type="button" class="ve-demo-convert" 
value="&darr; Convert to HTML">
-                       <textarea class="ve-demo-html"></textarea>
-               </div>
+               <div class="ve-demo-output"></div>
 
 <!-- SCRIPTS -->
 

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Icb4dd0293874eb26d694593b63d477238612786a
Gerrit-PatchSet: 1
Gerrit-Project: VisualEditor/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Esanders <esand...@wikimedia.org>
Gerrit-Reviewer: Jforrester <jforres...@wikimedia.org>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to