我正在使用 CKEditor,我无法弄清楚的一件事是如何更改保存从工具栏插入的元素的父级的背景颜色。
需要明确的是,我不想更改 CKEditor 本身的颜色(例如将其更改为深色模式等)
我指的是当我单击“标题 1”等工具栏项目时。h1 元素被添加到 CKEditor 的画布中,我可以按照自己喜欢的方式设置 h1 的样式。我想要设计的是画布本身。在这种情况下,请更改背景颜色。
我正在使用 Vue,我有这个:
<script setup>
import { ref } from "vue";
import ClassicEditor from "@ckeditor/ckeditor5-build-classic";
const editor = ref(ClassicEditor);
const editorData = ref(
"<div style='background-color:red;width:300px;height:300px;'><p>I want the entire background of the contents inside of the editor to be red (or any other color)</p></div>"
);
const editorConfig = ref({});
</script>
然后在我的模板中,我有这个:
<template>
<img alt="Vue logo" src="./assets/logo.png" />
<ckeditor
:editor="editor"
v-model="editorData"
:config="editorConfig"
></ckeditor>
</template>
这不是在做我想做的事。这是一个实现代码的codesandbox:https://codesandbox.io/p/sandbox/vue-3-gyhpz4
我想这样做是因为我最终会保存内容并稍后检索它们。
如何更改(样式)CKEditor 上的画布元素?
谢谢