@appricot/strapi-plugin-tinymce
Version:
Replaces the default Strapi WYSIWYG editor with a customized build of TinyMCE editor.
37 lines (34 loc) • 1.01 kB
JavaScript
;
function getPluginStore() {
return strapi.store({
environment: "",
type: "plugin",
name: "tinymce",
});
}
async function createDefaultConfig() {
const pluginStore = getPluginStore();
const value = {
apiKey: "",
};
await pluginStore.set({ key: "settings", value });
return pluginStore.get({ key: "settings" });
}
module.exports = () => {
return {
async getSettings() {
const pluginStore = getPluginStore();
let config = await pluginStore.get({ key: "settings" });
if (!config) {
config = await createDefaultConfig();
}
return config;
},
async setSettings(settings) {
const value = settings;
const pluginStore = getPluginStore();
await pluginStore.set({ key: "settings", value });
return pluginStore.get({ key: "settings" });
},
};
};