Esanders has uploaded a new change for review.
https://gerrit.wikimedia.org/r/227434
Change subject: Update documentation and code to show that model is optional in
ContextItem
......................................................................
Update documentation and code to show that model is optional in ContextItem
Bug: T107102
Change-Id: I7352065cec33a5f9a9927ca2e25334d0b8d2925d
---
M src/ui/ve.ui.ContextItem.js
1 file changed, 3 insertions(+), 3 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/VisualEditor/VisualEditor
refs/changes/34/227434/1
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: newchange
Gerrit-Change-Id: I7352065cec33a5f9a9927ca2e25334d0b8d2925d
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