如何使用 tailwind 设计博客页面的前端,它呈现包含图像、代码片段和文本的 ckeditor django 表单数据

how to design front-end of blog page with tailwind which renders data of a ckeditor django form which contains images, code snippets and text

{{blog_obj.content|safe}}

//这是博客的渲染部分,包含了博客的主要内容。但是图像有时宽度很大,会破坏整个页面。 有办法解决这个问题吗?

您可以设置 ckeditor 配置 allowedContentremoveFormatAttributes 这将允许您在 ckeditor

中添加自定义 css class
<script>
    CKEDITOR.replace('editor1');
    CKEDITOR.config.allowedContent = true;
    CKEDITOR.config.removeFormatAttributes = '';
</script>

如何添加 class 到图像这里是步骤

步骤 - 1

点击这个按钮

步骤 - 2

添加您想要添加的任何内容 class 以使图像具有响应性

并且当您提交 post 时,它会将特定顺风 css class 反映到您的 post
注意: 当你在 ckeditor 中添加 class 它不会影响 ckeditor 因为 ckeditor 不知道 tailwind css 但是当你保存它并在您的页面将按应有的方式显示。
如果 post 是你添加的,那么你可以使用这个方法,但如果它被用户使用,那么有一些 security best practices