fritx / vue-at

At.js for Vue.
https://fritx.github.io/vue-at/
MIT License
529 stars 114 forks source link

Froala integration #77

Open gabaum10 opened 5 years ago

gabaum10 commented 5 years ago

I'm in the process of porting an old jquery/backbonejs app over to vue. One of the components is a Froala editor. I've successfully got that all wired in, but can't seem to get the vue-at component wired in.

Is there an official way to integrate the at component into an external, non div.contenteditable container? I could manually set it up when the editor opens

fritx commented 5 years ago

@gabaum10 hi, worth a try! Is it https://github.com/froala/django-froala-editor ?

gabaum10 commented 5 years ago

@fritx so I was able to sort of hack it in there via the froala.initialized event like so:

      'froalaEditor.initialized': function (e, editor) {
            this.editor = editor
            if (this.options.disabled) {
              editor.edit.off()
            }

            if (this.enableMentions) {
              editor.$el.atwho(atjsConfig.call(this))
                .on('inserted.atwho', (e, $user) => {
                  editor.$el.find('.atwho-inserted[contenteditable=false]').removeAttr('contenteditable')
                  const user = $user.data().itemData

                  // not sure why this isn't triggering a change in the editor, so do it manually now
                  editor.$el.trigger('change')
                })
            }
          }.bind(this)
rcheung9 commented 4 years ago

@gabaum10 Is this the only way so far or have you found another way of doing this?