question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Compatibility with Vue.js 2.0

See original GitHub issue

Is vue-html-editor compatible with Vue.js 2.0? I’m using Vue.js 2.0 and I’m getting the following error:

[Vue warn]: Failed to mount component: template or render function not defined. (found in component <vue-html-editor>)

Issue Analytics

  • State:open
  • Created 7 years ago
  • Reactions:7
  • Comments:20

github_iconTop GitHub Comments

14reactions
ninmesaracommented, Nov 1, 2016

I ended up forking it and making a private version with more customization options. My version uses single file components (in order to be compatible with the new version of vuejs’s default runtime) and uses the v-model directive, which is the standard way of handling input in vuejs 2.0. I’ll submit a pull request when I have the time.

4reactions
renatonericommented, Mar 15, 2017

If someone wants, works in v2:

<script>
export default {
    data() {
        return {
            isChanging: false,
            control: null,
            text: ''
        }
    },
    replace: true,
    inherit: false,
    template: '<textarea v-model="text" class="form-control" :name="name"></textarea>',
    props: {
        value: {
            required: false
        },
        language: {
            type: String,
            required: false,
            default: 'en-US'
        },
        height: {
            type: Number,
            required: false,
            default: 160
        },
        minHeight: {
            type: Number,
            required: false,
            default: 160
        },
        maxHeight: {
            type: Number,
            required: false,
            default: 800
        },
        name: {
            type: String,
            required: false,
            default: ''
        },
        toolbar: {
            type: Array,
            required: false,
            default() {
                return [
                    ['font', ['bold', 'italic', 'underline', 'clear']],
                    ['fontsize', ['fontsize']],
                    ['para', ['ul', 'ol', 'paragraph']],
                    ['color', ['color']],
                    ['insert', ['link', 'picture', 'hr']]
                ];
            }
        }
    },
    watch: {
        text(val) {
            this.$emit('input', val)
        },
        value(newVal) {
            this.text = newVal;
            if (this.minHeight > this.height) {
                this.minHeight = this.height;
            }
            if (this.maxHeight < this.height) {
                this.maxHeight = this.height;
            }

            var that = this;

            this.control =  $(this.$el);
            this.control.summernote({
                lang: this.language,
                height: this.height,
                minHeight: this.minHeight,
                maxHeight: this.maxHeight,
                toolbar: this.toolbar,
                callbacks: {
                    onInit: function() {
                        that.control.summernote('code', that.text);
                    }
                }
            }).on('summernote.change', function() {
                if (!that.isChanging) {
                    that.isChanging = true;
                    var code = that.control.summernote('code');
                    that.text = (code === null || code.length === 0 ? null : code);
                    that.$nextTick(function() {
                        that.isChanging = false;
                    });
                }
            });
        }
    }
};
</script>

Html:

<summernote v-model="form.texto"></summernote>
Read more comments on GitHub >

github_iconTop Results From Across the Web

Frequently Asked Questions - Vue.js
Despite the differences, the majority of Vue APIs are shared between the two major versions, so most of your Vue 2 knowledge will...
Read more >
Vue.js - The Progressive JavaScript Framework | Vue.js
Builds on top of standard HTML, CSS and JavaScript with intuitive API and world-class documentation. Performant. Truly reactive, compiler-optimized rendering ...
Read more >
Installation - Vue.js
NPM is the recommended installation method when building large scale applications with Vue. It pairs nicely with module bundlers such as Webpack or...
Read more >
Browser Compatibility | Vue CLI
Browser Compatibility | Vue CLI. ⚠️ Vue CLI is in Maintenance Mode! For new projects, it is now recommended to use create-vue to...
Read more >
Introduction - Vue.js
Vue (pronounced /vjuː/, like view) is a progressive framework for building user interfaces. Unlike other monolithic frameworks, Vue is designed from the ground ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found