jenkins-bot has submitted this change and it was merged. (
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, 23 insertions(+), 2 deletions(-)
Approvals:
jenkins-bot: Verified
Jforrester: Looks good to me, approved
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..efd3239 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();
};
@@ -837,6 +842,9 @@
* @param {jQuery.Event} e Selection change event
*/
ve.ce.Surface.prototype.onDocumentSelectionChange = function () {
+ if ( this.disabled ) {
+ return;
+ }
this.fixupCursorPosition( 0, this.dragging );
this.updateActiveLink();
this.surfaceObserver.pollOnceSelection();
@@ -3504,6 +3512,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: merged
Gerrit-Change-Id: I2e9b53efd06a118117258a5f0552d42afa398552
Gerrit-PatchSet: 2
Gerrit-Project: VisualEditor/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Esanders <[email protected]>
Gerrit-Reviewer: Jforrester <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits