Skip to content

Commit 3037ffb

Browse files
Fixes #14 The readOnly option is not respected for non-input tags (contenteditable is always set to true)
Signed-off-by: Alexandre Bonneau <[email protected]>
1 parent fe4df9e commit 3037ffb

File tree

6 files changed

+49
-24
lines changed

6 files changed

+49
-24
lines changed

CHANGELOG.md

+3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
## Changelog for vue-autoNumeric
22

3+
### 1.2.5
4+
+ Fixes #14 The `readOnly` option is not respected for non-input tags (`contenteditable` is always set to `true`)
5+
36
### 1.2.4
47
+ Fixes #18 Require of AutoNumeric is ES6 module and not the distribution version
58
+ Fix how using vue-autonumeric with a CDN did not work since the external library it searched was in lowercase.

dist/vue-autonumeric.js

+14-11
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* vue-autonumeric v1.2.4 (https://github.com/autoNumeric/vue-autoNumeric)
2+
* vue-autonumeric v1.2.5 (https://github.com/autoNumeric/vue-autoNumeric)
33
* © 2018 Alexandre Bonneau <[email protected]>
44
* Released under the MIT License.
55
*/
@@ -328,7 +328,7 @@ exports.default = {
328328
};
329329
} else {
330330
attributes = {
331-
contenteditable: true
331+
contenteditable: this.hasContentEditable
332332
};
333333
}
334334

@@ -378,26 +378,29 @@ exports.default = {
378378

379379
data: function data() {
380380
return {
381-
anElement: null
382-
};
381+
anElement: null,
382+
initialOptions: null,
383+
hasContentEditable: true };
383384
},
384-
mounted: function mounted() {
385+
created: function created() {
385386
var _this = this;
386387

387-
var options = void 0;
388388
if (Array.isArray(this.options)) {
389389
var optionObjects = {};
390390
this.options.forEach(function (optionElement) {
391-
options = _this.manageOptionElement(optionElement);
392-
optionObjects = (0, _assign2.default)(optionObjects, options);
391+
_this.initialOptions = _this.manageOptionElement(optionElement);
392+
optionObjects = (0, _assign2.default)(optionObjects, _this.initialOptions);
393393
});
394394

395-
options = optionObjects;
395+
this.initialOptions = optionObjects;
396396
} else {
397-
options = this.manageOptionElement(this.options);
397+
this.initialOptions = this.manageOptionElement(this.options);
398398
}
399399

400-
this.anElement = new _autoNumeric2.default(this.$refs.autoNumericElement, options);
400+
this.hasContentEditable = !this.initialOptions.readOnly;
401+
},
402+
mounted: function mounted() {
403+
this.anElement = new _autoNumeric2.default(this.$refs.autoNumericElement, this.initialOptions);
401404
if (this.value !== null && this.value !== '') {
402405
this.anElement.set(this.value);
403406

0 commit comments

Comments
 (0)