Skip to content
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

Workaround for new Boostrap-vue when editor became zombie #131

Open
hgc2002 opened this issue Mar 18, 2020 · 9 comments
Open

Workaround for new Boostrap-vue when editor became zombie #131

hgc2002 opened this issue Mar 18, 2020 · 9 comments

Comments

@hgc2002
Copy link

hgc2002 commented Mar 18, 2020

The current behavior is described in detail in #106 and #113: Editor get loaded correctly on first time it is shown, then second and later on it became blank / disabled / zombie / frozzen / etc.

The description of the real internal problem is also in those tickets. I want to show you my workaround, ugly but functional: reloading the component with v-if. Yes, it's not the best, but it works.

Here is it the component used:

<b-modal ref="modal_editor">
    <vue-mce v-if="show_editor" :config="config_mce" v-model="content"/>
</b-modal>

The magic code:

forceRerender () {
   this.show_editor = false;                
   this.$nextTick(() => { this.show_editor = true })
},

How to use it:

this.forceRerender()
this.$refs.modal_editor.show()

The rerender function (and other options that didn't work this time) comes from the following reference: https://michaelnthiessen.com/force-re-render/

My environment:
"bootstrap": "^4.4.1",
"bootstrap-vue": "^2.5.0",
"tinymce": "^5.1.1",
"vue": "^2.6.11",
"vue-mce": "^1.5.3",

Regards.

@jscasca
Copy link
Contributor

jscasca commented Mar 31, 2020

Hi @hgc2002

I'm a bit late in chiming in with workaround but if I may suggest key changing as part of the modal showing to ensure that the component is re-rendered whenever you open the modal.
E.G.

<div>
  <b-button v-b-modal.modal-1>Launch tinymce-vue modal</b-button>

  <b-modal @shown="render" no-fade id="modal-1" title="tinymce-vue modal">
    <editor :key="tinyId" api-key="your-api-key"></editor>
  </b-modal>
</div>

When the modal opens it will trigger the @shown behaviour calling the render function:

  components: {
    'editor': Editor
  },
  data: function () {
    return {tinyId: 0};
  },
  methods: {
    render () {
      this.tinyId += 1;
    }
  }

By having a new key Vue will force the re-rendering of the component.

Let me know if this works for your use case.

@baldeepsinghkwatra
Copy link

@jscasca I tried with the key as well. But still, it's not clickable. On inspecting the editor I have found that the iframe's body is blank and the content editable prop is not set.

@hgc2002 Did you find any solution?

@jscasca
Copy link
Contributor

jscasca commented Apr 15, 2020

The initial post is already a workaround.

Without context I am not sure what you, @baldeepsinghkwatra , are trying to achieve and what is working or not working for you. Are you trying to re-render the editor every time it appears in a modal?

@jbaum012
Copy link

jbaum012 commented May 13, 2020

working (and easy) solution from the bootstrap-vue github: bootstrap-vue/bootstrap-vue#4537 (comment)

Setting the no-enforce-focus option works:
https://codesandbox.io/s/bootstrapvue-tinymce-vue-modal-focusin-kxhvm

@christian-kolb
Copy link

The same issue is there when using a Dialog with Vuetify. The :key method didn't work for me. Only the initial workaround from @hgc2002, thanks for that!

@kpomeru
Copy link

kpomeru commented Oct 16, 2020

@hgc2002

Worked like a charm, i had a couple of thoughts regarding this. But my fingers couldn't help me.

@mansarip
Copy link

mansarip commented Dec 9, 2020

working (and easy) solution from the bootstrap-vue github: bootstrap-vue/bootstrap-vue#4537 (comment)

Setting the no-enforce-focus option works:
https://codesandbox.io/s/bootstrapvue-tinymce-vue-modal-focusin-kxhvm

This works for me, thanks!

@tiny-stale-bot
Copy link

This issue is stale because it has been open 30 days with no activity. Please comment if you wish to keep this issue open or it will be closed in 7 days.

@tiny-stale-bot tiny-stale-bot added the status:stale An issue that has been left with no response for an extended period of time. label Jul 9, 2024
@christian-kolb
Copy link

Answering the bot: Yes, this issue is very much still relevant 🙂

@danoaky-tiny danoaky-tiny added status: escalated and removed status:stale An issue that has been left with no response for an extended period of time. labels Jul 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

9 participants