- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
在TinyMCE 4.7.3中,有没有办法设置水平线的样式(不使用源代码)?使用Horizontal Rule plugin ,看来我只能插入一条水平线(即 <hr />
)而不能插入其他任何东西。
如果没有,是否有其他方法可以创建具有某种样式(对齐、颜色、粗细等)的水平线(不使用源代码)?
$(function() {
tinymce.init({
selector: 'textarea',
branding: false,
menubar: false,
toolbar_items_size: 'small',
theme: 'modern',
fontsize_formats: "8pt 9pt 10pt 12pt 14pt 18pt 24pt 36pt 48pt 72pt",
// use absolute URLs
relative_urls: false,
remove_script_host: false,
width: 580,
height: 400,
plugins: 'print preview searchreplace autolink directionality visualblocks visualchars fullscreen image link media template codesample table charmap hr pagebreak nonbreaking anchor toc insertdatetime advlist lists textcolor imagetools code contextmenu colorpicker textpattern help',
toolbar1: 'formatselect | fontselect fontsizeselect | bold italic strikethrough superscript subscript forecolor backcolor | alignleft aligncenter alignright alignjustify | numlist bullist outdent indent | hr link image table code | removeformat',
});
});
最佳答案
我最终创建了一个非常简单的插件来满足我的需求。
plugin.min.js
tinymce.PluginManager.add('hrcustom', function (editor, url) {
// create button
editor.addButton('hrcustom', {
icon: 'hr',
tooltip: 'Insert horizontal rule',
onclick: function() {
// open window
editor.windowManager.open({
title: 'Insert horizontal rule',
body: [
{
type: 'listbox',
name: 'align',
label: 'Alignment',
values: [
{ value: 'left', text: 'Left' },
{ value: 'center', text: 'Center' },
{ value: 'right', text: 'Right' }
]
},
{
type: 'colorbox',
name: 'color',
label: 'Color',
onaction: createColorPickerAction(),
value: '#000000'
},
{
type: 'textbox',
name: 'width',
label: 'Width',
maxLength: 5,
value: '100%'
},
{
type: 'textbox',
name: 'height',
label: 'Thickness',
maxLength: 5,
value: '2px'
}
],
// generate and insert HTML upon submitting dialog
onsubmit: function (e) {
var hr = document.createElement('hr');
// set alignment
switch (e.data.align) {
case 'center':
hr.style.marginLeft = 'auto';
hr.style.marginRight = 'auto';
break;
case 'right':
hr.style.textAlign = 'right';
hr.style.marginRight = 0;
break;
default:
hr.style.textAlign = 'left';
hr.style.marginLeft = 0;
break;
}
// set color
hr.style.backgroundColor = e.data.color || '#000000';
var unitRegex = /^\d+(px|%)?$/;
// set width
hr.style.width = unitRegex.test(e.data.width) ? e.data.width : '100%';
// set height (thickness)
hr.style.height = unitRegex.test(e.data.height) ? e.data.height : '1px';
// set other styles
hr.style.border = 0;
hr.style.marginTop = '5px';
hr.style.marginBottom = '5px';
hr.style.overflow = 'hidden';
// insert content when the window form is submitted
editor.insertContent(hr.outerHTML);
}
});
}
});
// note: colorpicker plugin MUST be included for this to work
// taken from core plugins
function createColorPickerAction() {
var callback = tinymce.activeEditor.settings.color_picker_callback;
if (callback) {
return function () {
var self = this;
callback.call(
editor,
function (value) {
self.value(value).fire('change');
},
self.value()
);
}
}
}
});
它将打开一个对话框并生成一个样式 <hr />
根据提供的数据:
有用的链接
关于javascript - TinyMCE 中的水平线样式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49237170/
在我的站点中,我添加了 google friend connect。现在在侧边栏的右边,有一条小线。我不想在那里删除该行。 最佳答案 你能把第二个隐藏起来吗它看起来不需要可见,因此隐藏该元素将隐藏内部
我需要在我的多个箱线图中添加晶须(或水平线)。 你可以在这里找到我的数据集:link to data is broken... 换句话说,我正在绘制除以性别(F 和 M)的三个变量(Mat、Ita 和
我目前正在使用 PHPWord 生成我的文档,但我想在文档中添加一条水平线。就像在 HMTL 中一样。在 Word 中,您可以通过在 Enter 中键入三个下划线来完成此操作,但我想在生成的文档中使用
这个问题在这里已经有了答案: CSS technique for a horizontal line with words in the middle (34 个答案) 关闭 3 年前。
我正在尝试在 SWT 的文本字段中显示历史记录。 历史会生成一个新的 shell,它有两个 Composites。第一个显示标题部分,其中包含标签“历史”和下方的水平线。第二个是显示实际数据的页 fo
我想把我的文字放在水平线上。我想如果文本长度增加,应该根据文本长度调整行。在 IE7,8,Mozilla 上运行良好。我想让它适用于 Google Chrome。 除了 Google Chrome 浏
访问此链接进行演示:http://codepen.io/anon/pen/Bvkjx 我想实现以下目标: content:'hellooo'; 让它适合圆圈内而不会剪裁/溢出,基本上重新调整大小以自动
在 Android 中,我有一个 TextView,它的内容是动态的。我想在每行文本后显示一条水平线。我搜索了很多并找到了 EditText( How to use ruled/horizontal
我想在文本左侧创建水平线。我有这样的想法,但它在两侧都形成了线条,但我只想在一侧 - 左侧或右侧。我该怎么做? h2 { width: 100%; text-align: center;
如果我的 y 变量有一个因子,并尝试在 facet_grid 中使用 geom_hline,我会得到一个错误: p p + geom_hline(aes(yintercept = z), hline
创建一个相对简单的数据输入表单,只想用一条水平线(与 HTML 中的 HR 标签不同)分隔某些部分,该水平线延伸整个表单的长度。 我已经尝试过这个: 由于父控件不是固定宽度,因此该行会导致窗口拉伸(
所以我有这个应用程序,它使用视觉效果 View 来制作应用程序的容器,在这个应用程序中,我有一个使用 NSBox 的行分隔符,当我运行它时,它会出现这个 你可以看到它出现了,但是它周围有一个 1 或
我有一个来自数据库的元素列表: Jon Skeet Darin Dimitrov Marc Gravell BalusC Hans Passant S
我有非常简单的 html,如下所列。在 Firefox 和 Chrome 中运行良好。在 IE8 中也运行良好。但是当我升级到 IE9 时,它在灰色边框内显示一条白线。我们需要做什么才能让它像 Chr
我想连续放置 3 条水平线。有谁知道如何在 IE7 的 inline-block 中显示一条水平线? 这是我的 CSS: hr.small { width: 28.9%; margin
我使用的是响应式表格,其中缺少 1 像素的垂直线和水平线。 这是我的 CSS 和 HTML: .table-responsive { overflow-x: auto; min-hei
我的屏幕上有 8 个表格,我想将它们分成四个 Pane 。 请问如何在我的 fluidrow() + column() 网格中添加垂直线和水平线? 目标设计: 当前设计: 可重现代码: DTWrapp
我已经为 .它按预期呈现,除了 svg 元素底部边缘的水平线。 svg来源是 你可以在这里看到错误的水平线 Codepen (它在底部,蓝色...)。 我希望线路消失
关闭。这个问题是opinion-based .它目前不接受答案。 想要改进这个问题? 更新问题,以便 editing this post 可以用事实和引用来回答它. 关闭 3 年前。 Improve
我的计划是使用 4 个 GridSpec(4,1) 网格规范来创建 4x4 子图网格。我想在每行 4 个子图的 x 轴上添加一条水平线。我查看了 matplotlib.lines.Line2D 但无法
我是一名优秀的程序员,十分优秀!