gpt4 book ai didi

javascript - Tinymce 如何 float 图像?

转载 作者:数据小太阳 更新时间:2023-10-29 04:33:37 25 4
gpt4 key购买 nike

在tinymce中默认没有图像 float ,只有图像,文本对齐我应该手动做还是已经有一些插件?找不到任何...或者如何获取当前选定的元素并将它们 float ?

最佳答案

您可以使用 style_formats 选项。
文件在这里:https://www.tiny.cloud/docs/configure/content-formatting/#style_formats

This option enables you to add more advanced style formats for text and other elements to the editor. The value of this option will be rendered as styles in the Formats dropdown.

初始化tinymce时可以这样走。

tinymce.init({
...
style_formats: [
{
title: 'Image Left',
selector: 'img',
styles: {
'float': 'left',
'margin': '0 10px 0 10px'
}
},
{
title: 'Image Right',
selector: 'img',
styles: {
'float': 'right',
'margin': '0 0 10px 10px'
}
}
]
});

希望这对您有所帮助。

关于javascript - Tinymce 如何 float 图像?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23729411/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com