更改默认的所见即所得编辑器
¥Change the default WYSIWYG editor
要更改 Strapi 管理面板提供的默认所见即所得编辑器,你可以使用多种选项:
¥To change the default WYSIWYG editor provided with Strapi's admin panel, several options are at your disposal:
你可以通过访问 Strapi 的市场 安装第三方插件,例如 CKEditor 插件。
¥You can install a third-party plugin, such as one for CKEditor, by visiting Strapi's Marketplace.
你可以创建自己的插件来创建和注册完全自定义的所见即所得字段(参见 自定义字段文档)。
¥You can create your own plugin to create and register a fully custom WYSIWYG field (see custom fields documentation).
你可以利用 Strapi 的管理面板 extensions 系统并利用管理面板的 引导生命周期函数。
¥You can take advantage of Strapi's admin panel extensions system and leverage the bootstrap lifecycle function of the admin panel.
如果你选择使用扩展系统,请在 /src/admin/extensions
文件夹中创建你的 WYSIWYG 组件并将其导入管理面板的 /src/admin/app.[tsx|js]
入口点文件,然后使用 app.addFields()
函数声明新字段,如下所示:
¥If you choose to use the extensions system, create your WYSIWYG component in the /src/admin/extensions
folder and import it in the admin panel's /src/admin/app.[tsx|js]
entry point file, then declare the new field with the app.addFields()
function as follows:
- JavaScript
- TypeScript
// The following file contains the logic for your new WYSIWYG editor👇
import MyNewWYSIGWYG from "./extensions/components/MyNewWYSIGWYG";
export default {
bootstrap(app) {
app.addFields({ type: "wysiwyg", Component: MyNewWYSIGWYG });
},
};
// The following file contains the logic for your new WYSIWYG editor👇
import MyNewWYSIGWYG from "./extensions/components/MyNewWYSIGWYG";
export default {
bootstrap(app) {
app.addFields({ type: "wysiwyg", Component: MyNewWYSIGWYG });
},
};