Docstrings: Fix popup "autoClose" and "closeOnClick" options, fixes #5040 (#5304)

* Fix popup "autoClose" and "closeOnClick" options documentation, fixes #5040

* Docstring for Popup `closeOnClick` option

* Backticks on docstrings
This commit is contained in:
Madis Allikmaa 2017-02-07 17:24:36 +02:00 committed by Iván Sánchez Ortega
parent fa458e7511
commit 59298a72d0
4 changed files with 30 additions and 9 deletions

View File

@ -2916,13 +2916,19 @@ off of the screen while it is open.</td>
<td><code>true</code></td> <td><code>true</code></td>
<td>Controls the presence of a close button in the popup.</td> <td>Controls the presence of a close button in the popup.</td>
</tr> </tr>
<tr id='popup-closeonclick'>
<td><code><b>closeOnClick</b></code></td>
<td><code>Boolean</code>
<td><code>*</code></td>
<td>Set it if you want to override the default behavior of the popup closing when user clicks
on the map. Defaults to the Map&#39;s <a href="#map-closepopuponclick">closePopupOnClick</a> option.</td>
</tr>
<tr id='popup-autoclose'> <tr id='popup-autoclose'>
<td><code><b>autoClose</b></code></td> <td><code><b>autoClose</b></code></td>
<td><code>Boolean</code> <td><code>Boolean</code>
<td><code>true</code></td> <td><code>true</code></td>
<td>Set it to <code>false</code> if you want to override the default behavior of <td>Set it to <code>false</code> if you want to override the default behavior of
the popup closing when user clicks the map (set globally by the popup closing when another popup is opened.</td>
the Map&#39;s <a href="#map-closepopuponclick">closePopupOnClick</a> option).</td>
</tr> </tr>
<tr id='popup-classname'> <tr id='popup-classname'>
<td><code><b>className</b></code></td> <td><code><b>className</b></code></td>

View File

@ -2958,13 +2958,19 @@ off of the screen while it is open.</td>
<td><code>true</code></td> <td><code>true</code></td>
<td>Controls the presence of a close button in the popup.</td> <td>Controls the presence of a close button in the popup.</td>
</tr> </tr>
<tr id='popup-closeonclick'>
<td><code><b>closeOnClick</b></code></td>
<td><code>Boolean</code>
<td><code>*</code></td>
<td>Set it if you want to override the default behavior of the popup closing when user clicks
on the map. Defaults to the Map&#39;s <a href="#map-closepopuponclick">closePopupOnClick</a> option.</td>
</tr>
<tr id='popup-autoclose'> <tr id='popup-autoclose'>
<td><code><b>autoClose</b></code></td> <td><code><b>autoClose</b></code></td>
<td><code>Boolean</code> <td><code>Boolean</code>
<td><code>true</code></td> <td><code>true</code></td>
<td>Set it to <code>false</code> if you want to override the default behavior of <td>Set it to <code>false</code> if you want to override the default behavior of
the popup closing when user clicks the map (set globally by the popup closing when another popup is opened.</td>
the Map&#39;s <a href="#map-closepopuponclick">closePopupOnClick</a> option).</td>
</tr> </tr>
<tr id='popup-classname'> <tr id='popup-classname'>
<td><code><b>className</b></code></td> <td><code><b>className</b></code></td>

View File

@ -2967,13 +2967,19 @@ off of the screen while it is open.</td>
<td><code>true</code></td> <td><code>true</code></td>
<td>Controls the presence of a close button in the popup.</td> <td>Controls the presence of a close button in the popup.</td>
</tr> </tr>
<tr id='popup-closeonclick'>
<td><code><b>closeOnClick</b></code></td>
<td><code>Boolean</code>
<td><code>*</code></td>
<td>Set it if you want to override the default behavior of the popup closing when user clicks
on the map. Defaults to the Map&#39;s <a href="#map-closepopuponclick">closePopupOnClick</a> option.</td>
</tr>
<tr id='popup-autoclose'> <tr id='popup-autoclose'>
<td><code><b>autoClose</b></code></td> <td><code><b>autoClose</b></code></td>
<td><code>Boolean</code> <td><code>Boolean</code>
<td><code>true</code></td> <td><code>true</code></td>
<td>Set it to <code>false</code> if you want to override the default behavior of <td>Set it to <code>false</code> if you want to override the default behavior of
the popup closing when user clicks the map (set globally by the popup closing when another popup is opened.</td>
the Map&#39;s <a href="#map-closepopuponclick">closePopupOnClick</a> option).</td>
</tr> </tr>
<tr id='popup-classname'> <tr id='popup-classname'>
<td><code><b>className</b></code></td> <td><code><b>className</b></code></td>

View File

@ -84,10 +84,13 @@ export var Popup = DivOverlay.extend({
// @option autoClose: Boolean = true // @option autoClose: Boolean = true
// Set it to `false` if you want to override the default behavior of // Set it to `false` if you want to override the default behavior of
// the popup closing when user clicks the map (set globally by // the popup closing when another popup is opened.
// the Map's [closePopupOnClick](#map-closepopuponclick) option).
autoClose: true, autoClose: true,
// @option closeOnClick: Boolean = *
// Set it if you want to override the default behavior of the popup closing when user clicks
// on the map. Defaults to the map's [`closePopupOnClick`](#map-closepopuponclick) option.
// @option className: String = '' // @option className: String = ''
// A custom CSS class name to assign to the popup. // A custom CSS class name to assign to the popup.
className: '' className: ''
@ -148,7 +151,7 @@ export var Popup = DivOverlay.extend({
getEvents: function () { getEvents: function () {
var events = DivOverlay.prototype.getEvents.call(this); var events = DivOverlay.prototype.getEvents.call(this);
if ('closeOnClick' in this.options ? this.options.closeOnClick : this._map.options.closePopupOnClick) { if (this.options.closeOnClick !== undefined ? this.options.closeOnClick : this._map.options.closePopupOnClick) {
events.preclick = this._close; events.preclick = this._close;
} }