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

Allow local registration of plugin to avoid bloating main.js file #226

Open
olemarius opened this issue Aug 7, 2023 · 1 comment
Open

Comments

@olemarius
Copy link

It should be possible to import Froala in a component instead of installing it globally.

import VueFroala from 'vue-froala-wysiwyg'; only provide the install method. This means that the only way to dynamically load a component locally is by dynamically installing the plugin globally like this:

<script lang="ts" setup>
import { getCurrentInstance } from 'vue';
const vueInstance = getCurrentInstance();
vueInstance?.appContext.app.use(VueFroala);
</script>
<template>
   <froala ... /> 
</template>
@ItMaga
Copy link

ItMaga commented Feb 25, 2024

One more workaround for the case

let Froala;
let FroalaView;

const fakeApp = {
  component(name, component) {
    if (name === 'Froala') {
      Froala = component;
    }
    if (name === 'FroalaView') {
      FroalaView = component;
    }
  }
}
VueFroala.install(fakeApp);

export { Froala, FroalaView };

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants