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

Fix extending existent Vue components #4884

Merged
merged 1 commit into from
Dec 5, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions panel/src/components/Forms/Blocks/index.js
Expand Up @@ -23,7 +23,7 @@ export default {
// block types
const components = import.meta.glob("./Types/*.vue", { eager: true });

Object.keys(components).map((key) => {
for (const key in components) {
// get name and type by filename
const name = key.match(/\/([a-zA-Z]*)\.vue/)[1];
const type = name.toLowerCase();
Expand All @@ -36,6 +36,6 @@ export default {

// globally define the block type component
app.component("k-block-type-" + type, component);
});
}
}
};
9 changes: 6 additions & 3 deletions panel/src/config/plugins.js
Expand Up @@ -37,6 +37,9 @@ export default {
});
} else {
// if component doesn't exist, don't extend
window.console.warn(
`Problem with plugin trying to register component "${name}": cannot extend non-existent component "${options.extends}"`
);
options.extends = null;
}
}
Expand All @@ -46,9 +49,9 @@ export default {
}

if (options.mixins) {
options.mixins = options.mixins.map((mixin) => {
return typeof mixin === "string" ? mixins[mixin] : mixin;
});
options.mixins = options.mixins.map((mixin) =>
typeof mixin === "string" ? mixins[mixin] : mixin
);
}

if (components[name]) {
Expand Down
2 changes: 1 addition & 1 deletion panel/src/index.js
Expand Up @@ -35,12 +35,12 @@ import "./styles/animations.css";
Vue.use(Errors);
Vue.use(Helpers);
Vue.use(Libraries);
Vue.use(Components);
Vue.use(Api, store);
Vue.use(Events);
Vue.use(I18n);
Vue.use(Fiber);
Vue.use(Vuelidate);
Vue.use(Components);
Vue.use(Plugins);

// Load CSS utilities after components
Expand Down