Skip to content

Commit

Permalink
fix object assign
Browse files Browse the repository at this point in the history
  • Loading branch information
surmon committed Dec 2, 2017
1 parent edc269b commit e64731b
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -742,7 +742,7 @@ module.exports = {
"prefer-reflect": 0,

// 在ES2015(ES6)中推荐使用剩余参数(...rest)代替arguments变量
"prefer-rest-params": 2,
"prefer-rest-params": 0,

// 在ES2015(ES6)中推荐使用扩展符替代apply()方法
"prefer-spread": 2,
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@

### V3.0.3

1. fix object assign in spa

### V3.0.3

1. fix import es module bug
2. add test script

Expand Down
2 changes: 1 addition & 1 deletion dist/vue-quill-editor.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "vue-quill-editor",
"description": "Quill editor component for Vue",
"version": "3.0.3",
"version": "3.0.4",
"license": "MIT",
"private": false,
"author": {
Expand Down
31 changes: 29 additions & 2 deletions src/editor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,37 @@
</template>

<script>
// require sources
import _Quill from 'quill'
import objectAssign from 'object-assign'
import defaultOptions from './options'
const Quill = window.Quill || _Quill
// pollfill
if (typeof Object.assign != 'function') {
Object.defineProperty(Object, 'assign', {
value(target, varArgs) {
if (target == null) {
throw new TypeError('Cannot convert undefined or null to object')
}
const to = Object(target)
for (let index = 1; index < arguments.length; index++) {
const nextSource = arguments[index]
if (nextSource != null) {
for (const nextKey in nextSource) {
if (Object.prototype.hasOwnProperty.call(nextSource, nextKey)) {
to[nextKey] = nextSource[nextKey]
}
}
}
}
return to
},
writable: true,
configurable: true
})
}
// export
export default {
name: 'quill-editor',
data() {
Expand Down Expand Up @@ -47,7 +74,7 @@
if (this.$el) {
// Options
this._options = objectAssign({}, this.defaultOptions, this.globalOptions, this.options)
this._options = Object.assign({}, this.defaultOptions, this.globalOptions, this.options)
// Instance
this.quill = new Quill(this.$refs.editor, this._options)
Expand Down
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import _Quill from 'quill'
import quillEditor from './editor.vue'

const Quill = window.Quill || _Quill
const install = function (Vue, globalOptions) {
const install = (Vue, globalOptions) => {
if (globalOptions) {
quillEditor.props.globalOptions.default = () => globalOptions
}
Expand Down

0 comments on commit e64731b

Please sign in to comment.