Esanders has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/345388 )

Change subject: Fix disabling of surface
......................................................................

Fix disabling of surface

Ensure we don't throw exceptions when the surface is disabled.

Also fix the styling of a few things:
* Use cusor:default.
* Hide block slugs (using visibility:hidden so the page
  doesn't reflow).

Change-Id: I2e9b53efd06a118117258a5f0552d42afa398552
---
M src/ce/styles/nodes/ve.ce.BranchNode.css
M src/ce/styles/nodes/ve.ce.DocumentNode.css
M src/ce/ve.ce.Surface.js
3 files changed, 20 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/VisualEditor/VisualEditor 
refs/changes/88/345388/1

diff --git a/src/ce/styles/nodes/ve.ce.BranchNode.css 
b/src/ce/styles/nodes/ve.ce.BranchNode.css
index 967e61e..bc22d1d 100644
--- a/src/ce/styles/nodes/ve.ce.BranchNode.css
+++ b/src/ce/styles/nodes/ve.ce.BranchNode.css
@@ -10,8 +10,9 @@
 }
 
 .ve-ce-branchNode-blockSlug {
-       cursor: pointer;
+       visibility: hidden;
        opacity: 0;
+       cursor: pointer;
        /* stylelint-disable no-unsupported-browser-features */
        -webkit-transition: opacity 200ms ease-out;
        -moz-transition: opacity 200ms ease-out;
@@ -27,6 +28,10 @@
        background-color: rgba( 241, 247, 251, 0.75 );
 }
 
+.ve-ce-surface-enabled .ve-ce-branchNode-blockSlug {
+       visibility: visible;
+}
+
 .ve-ce-branchNode-blockSlug:hover,
 .ve-ce-branchNode-blockSlug.ve-ce-branchNode-blockSlug-focused {
        opacity: 1;
diff --git a/src/ce/styles/nodes/ve.ce.DocumentNode.css 
b/src/ce/styles/nodes/ve.ce.DocumentNode.css
index ecaff78..3d927aa 100644
--- a/src/ce/styles/nodes/ve.ce.DocumentNode.css
+++ b/src/ce/styles/nodes/ve.ce.DocumentNode.css
@@ -5,9 +5,13 @@
  */
 
 .ve-ce-documentNode {
-       cursor: text;
        /* 0.75/0.8, 1.5/0.8 */
        padding: 0.9375em 1.875em;
+       cursor: default;
+}
+
+.ve-ce-surface-enabled .ve-ce-documentNode {
+       cursor: text;
 }
 
 /*
diff --git a/src/ce/ve.ce.Surface.js b/src/ce/ve.ce.Surface.js
index e3fabf0..7ef17e9 100644
--- a/src/ce/ve.ce.Surface.js
+++ b/src/ce/ve.ce.Surface.js
@@ -209,6 +209,7 @@
        this.$element.append( this.$documentNode, this.$pasteTarget );
        this.surface.$blockers.append( this.$highlights );
        this.surface.$selections.append( this.$deactivatedSelection );
+       this.enable();
 };
 
 /* Inheritance */
@@ -457,6 +458,8 @@
  * @method
  */
 ve.ce.Surface.prototype.enable = function () {
+       this.disabled = false;
+       this.$element.addClass( 've-ce-surface-enabled' );
        this.documentView.getDocumentNode().enable();
 };
 
@@ -466,6 +469,8 @@
  * @method
  */
 ve.ce.Surface.prototype.disable = function () {
+       this.disabled = true;
+       this.$element.removeClass( 've-ce-surface-enabled' );
        this.documentView.getDocumentNode().disable();
 };
 
@@ -3504,6 +3509,10 @@
                sel = this.nativeSelection,
                newSel = selection;
 
+       if ( this.disabled ) {
+               return false;
+       }
+
        if ( newSel.equalsSelection( sel ) ) {
                this.updateActiveLink();
                return false;

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I2e9b53efd06a118117258a5f0552d42afa398552
Gerrit-PatchSet: 1
Gerrit-Project: VisualEditor/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Esanders <[email protected]>

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

Reply via email to