Coder Social home page Coder Social logo

Comments (18)

codebykyle avatar codebykyle commented on May 23, 2024 1

Yep, thanks I see that now. My mistake. I had .on('show.bs.modal') which fires before, not after the modal is shown. Sorry about that. For others experiencing this:

Make a markdown component with a ref attribute
<markdown-editor ref="markdown" :id="field" v-model="contentValue"></markdown-editor>

My Show Dialog function to show the Modal with a simplemde component

        showDialog() {
            this.resetForm();
            let modal = $('#' + this.getModalId);
            let self = this;
            modal.on('shown.bs.modal', function () {
                self.$refs.markdown.simplemde.codemirror.refresh();
            });
            modal.modal('show');
        },

whatever is in your ref attribute on your markdown component is swapped in self.$refs.

Thanks for the help and super quick reply, @F-loat. Appreciate it. :)

from vue-simplemde.

F-loat avatar F-loat commented on May 23, 2024

What version of vue and webpack are you using?

from vue-simplemde.

crabvn avatar crabvn commented on May 23, 2024

"vue": "^2.3.3" and "webpack": "2.2.1"

from vue-simplemde.

F-loat avatar F-loat commented on May 23, 2024

https://f-loat.github.io/vue-simplemde/
Does this demo have the same problem?

from vue-simplemde.

crabvn avatar crabvn commented on May 23, 2024

No it does not. The issue on mine happened on a modal.

from vue-simplemde.

F-loat avatar F-loat commented on May 23, 2024

Try to use this.$refs.markdownEditor.initialize() when the modal show.

from vue-simplemde.

crabvn avatar crabvn commented on May 23, 2024

Thank :) I will do it on Monday

from vue-simplemde.

crabvn avatar crabvn commented on May 23, 2024

It says initialize() is undefined.
and, the editor works fine on form without modals. Is this any help?

from vue-simplemde.

F-loat avatar F-loat commented on May 23, 2024

You should modify markdown-editor.vue like this:

mounted() {
  // this.initialize();
},

and after the model show do this:

this.$nextTick(() => {
  this.$refs.markdownEditor.initialize();
});

from vue-simplemde.

F-loat avatar F-loat commented on May 23, 2024

I will solve the problem in the next release.

from vue-simplemde.

crabvn avatar crabvn commented on May 23, 2024

Thank you. I actually have not resolved the issue yet.

from vue-simplemde.

F-loat avatar F-loat commented on May 23, 2024

I think the modal is hidden or not exist at mounted hook, so markdownEditor init fail.
And reinit it after the modal show, it should work.

Actually, it should init only when the first time show.

from vue-simplemde.

F-loat avatar F-loat commented on May 23, 2024

same issue, maybe help.
sparksuite/simplemde-markdown-editor#596
sparksuite/simplemde-markdown-editor#344

from vue-simplemde.

voicecode-bv avatar voicecode-bv commented on May 23, 2024

I'm having the same problem, any updates on this?

from vue-simplemde.

F-loat avatar F-loat commented on May 23, 2024

Try to refresh editor after the modal show.

this.simplemde.codemirror.refresh();

from vue-simplemde.

F-loat avatar F-loat commented on May 23, 2024

SimpleMDE's issue

from vue-simplemde.

codebykyle avatar codebykyle commented on May 23, 2024

Thanks for the help @F-loat. I still have this issue, and unable to remedy it using any of the information posted here, or via upgrading to the newest version. I've tried researching the link you've provided in the last post, but it doesn't seem to link to anything.

Is this issue resolved? How can I go about fixing it?

Thank you for the help.

from vue-simplemde.

F-loat avatar F-loat commented on May 23, 2024

The link is right now. Vue-simplemde is just a small wrapper of SimpleMDE and this issue should be SimpleMDE's.

@burhanmt provided a solution in the last post of SimpleMDE#596

$("#application-modal").focus(function () {
  simplemde.codemirror.refresh();
});

The snippet which is above is not working in Safari and Chrome.
But if I change the code like that:

$('#modal_editarticle').on('shown.bs.modal', function () {
  simplemde.codemirror.refresh();
});

it will work in all browsers.

from vue-simplemde.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.