jenkins-bot has submitted this change and it was merged.
Change subject: ContextItem: Update documentation, code to show that model is
optional
......................................................................
ContextItem: Update documentation, code to show that model is optional
Bug: T107102
Change-Id: I7352065cec33a5f9a9927ca2e25334d0b8d2925d
---
M src/ui/ve.ui.ContextItem.js
1 file changed, 3 insertions(+), 3 deletions(-)
Approvals:
Jforrester: Looks good to me, approved
jenkins-bot: Verified
diff --git a/src/ui/ve.ui.ContextItem.js b/src/ui/ve.ui.ContextItem.js
index 56ce159..e24c5af 100644
--- a/src/ui/ve.ui.ContextItem.js
+++ b/src/ui/ve.ui.ContextItem.js
@@ -15,7 +15,7 @@
*
* @constructor
* @param {ve.ui.Context} context Context item is in
- * @param {ve.dm.Model} model Model item is related to
+ * @param {ve.dm.Model} [model] Model item is related to
* @param {Object} [config] Configuration options
* @cfg {boolean} [basic] Render only basic information
*/
@@ -156,7 +156,7 @@
* @return {boolean} Item is editable
*/
ve.ui.ContextItem.prototype.isEditable = function () {
- return this.constructor.static.editable && this.model.isEditable();
+ return this.constructor.static.editable && ( !this.model ||
this.model.isEditable() );
};
/**
@@ -176,7 +176,7 @@
ve.ui.ContextItem.prototype.getFragment = function () {
if ( !this.fragment ) {
var surfaceModel = this.context.getSurface().getModel();
- this.fragment = this.model instanceof ve.dm.Node ?
+ this.fragment = this.model && this.model instanceof ve.dm.Node ?
surfaceModel.getLinearFragment(
this.model.getOuterRange() ) :
surfaceModel.getFragment();
}
--
To view, visit https://gerrit.wikimedia.org/r/227434
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I7352065cec33a5f9a9927ca2e25334d0b8d2925d
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