Skip to content

:code prop reactive, package update #10

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .babelrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"presets": [
["es2015", { "modules": false }]
["env", { "modules": false }]
]
}
25 changes: 12 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "vue-monaco-editor",
"description": "Monaco Editor Component for Vue.js 2.x",
"version": "0.0.18",
"version": "0.0.20",
"author": "matt-oconnell <mattoconnell408@gmail.com>",
"main": "index.js",
"private": false,
Expand All @@ -26,19 +26,18 @@
},
"dependencies": {
"lodash.debounce": "^4.0.8",
"vue": "^2.1.0"
"vue": "^2.5.9"
},
"devDependencies": {
"babel-core": "^6.0.0",
"babel-loader": "^6.0.0",
"babel-preset-es2015": "^6.0.0",
"cross-env": "^3.0.0",
"css-loader": "^0.25.0",
"file-loader": "^0.9.0",
"vue-loader": "^10.0.0",
"vue-template-compiler": "^2.1.0",
"vueify": "^9.4.0",
"webpack": "^2.1.0-beta.25",
"webpack-dev-server": "^2.1.0-beta.9"
"babel-core": "^6.26.0",
"babel-loader": "^7.1.2",
"babel-preset-env": "^1.6.1",
"cross-env": "^5.1.1",
"css-loader": "^0.28.7",
"file-loader": "^1.1.5",
"vue-loader": "^13.5.0",
"vueify": "^9.4.1",
"webpack": "^3.10.0",
"webpack-dev-server": "^2.9.7"
}
}
4 changes: 2 additions & 2 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@
</template>

<script>
const Monaco = require('./Monaco.vue')
import Monaco from './Monaco.vue'

module.exports = {
export default {
components: {
Monaco
},
Expand Down
19 changes: 13 additions & 6 deletions src/Monaco.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
</template>

<script>
var debounce = require('lodash.debounce');
var monacoLoader = require('./MonacoLoader');
import debounce from 'lodash.debounce'
import monacoLoader from './MonacoLoader'

module.exports = {
export default {
props: {
width: { type: [String, Number], default: '100%' },
height: { type: [String, Number], default: '100%' },
Expand Down Expand Up @@ -64,8 +64,11 @@ module.exports = {
},
deep: true
},
language () {
window.monaco.editor.setModelLanguage(this.editor.getModel(), this.language)
code(value) {
if (this.editor && this.editor.getValue() !== value) {
this.codePropChange = true
this.editor.setValue(value)
}
}
},
methods: {
Expand Down Expand Up @@ -100,7 +103,11 @@ module.exports = {
);
this.$emit('mounted', editor);
},
codeChangeHandler: function(editor) {
codeChangeHandler(editor) {
if (this.codePropChange) {
this.codePropChange = false
return
}
if (this.codeChangeEmitter) {
this.codeChangeEmitter(editor);
} else {
Expand Down
6 changes: 3 additions & 3 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ module.exports = {
// the "scss" and "sass" values for the lang attribute to the right configs here.
// other preprocessors should work out of the box, no loader config like this nessessary.
'scss': 'vue-style-loader!css-loader!sass-loader',
'sass': 'vue-style-loader!css-loader!sass-loader?indentedSyntax'
'sass': 'vue-style-loader!css-loader!sass-loader?indentedSyntax'
}
// other vue-loader options go here
}
Expand Down Expand Up @@ -51,11 +51,11 @@ module.exports = {
performance: {
hints: false
},
devtool: '#eval-source-map'
devtool: 'eval-source-map'
}

if (process.env.NODE_ENV === 'production') {
module.exports.devtool = '#source-map'
module.exports.devtool = 'source-map'
// http://vue-loader.vuejs.org/en/workflow/production.html
module.exports.plugins = (module.exports.plugins || []).concat([
new CopyWebpackPlugin([
Expand Down