简体   繁体   English

如何在ckeditor 4中显示具有不同列表样式类型的嵌套有序列表?

[英]how to display nested ordered list with different list-style-type in ckeditor 4?

I maintain a legacy application that has CKEDITOR 4 integrated.我维护了一个集成了 CKEDITOR 4 的遗留应用程序。 I am facing an issue with the display of the nested ordered list.我正面临嵌套有序列表的显示问题。 A user added an ordered list in this way using the bullet list plugin.用户使用项目符号列表插件以这种方式添加了一个有序列表。

Please refer to the screenshot.请参考截图。

在此处输入图片说明

The source of this HTML code can be viewed using the source button.可以使用源按钮查看此 HTML 代码的源代码。 Here is how the source looks like:这是源的样子: 在此处输入图片说明

But when the user is viewing the ordered list in the view mode, then it is not showing as expected.但是当用户在查看模式下查看有序列表时,它没有按预期显示。 Please refer to the screenshot here:请参考这里的截图:

在此处输入图片说明

In the view page, there are many other css file which are used across my application which is affecting the output.在视图页面中,我的应用程序中使用了许多其他 css 文件,这些文件影响了输出。

div.docSection ol li {
  /* list-style-type: decimal;  Commenting this line is solving the problem */ 
  margin: auto;
  margin-left: 2.0em;
  padding: 0em;
}
.sectionDiv li {
  padding: 0;
  padding-left: 2em;
  margin: 0;
  margin-bottom: 0.2em;
  margin-right: 1em;
  /* list-style: none; Commenting this line is solving the problem */
  line-height: 1.6em;
}

How can I make sure that the ordered list display is not affected in view mode.如何确保有序列表显示在查看模式下不受影响。 Is there a setting in CKEDITOR 4 for this? CKEDITOR 4 中是否有设置? Can we solve this in css rules?我们可以在 css 规则中解决这个问题吗?

Finally Found a solution to this issue.终于找到了解决这个问题的办法。 I had to use JQUERY to solve this.我不得不使用 JQUERY 来解决这个问题。 Basically I am over-riding the css rules which were getting applied from Header Css files by Local css rules.基本上,我覆盖了通过本地 css 规则从 Header Css 文件中应用的 css 规则。 The following is working for nested ordered list and nested un-ordered list but not mixed nested lists.以下适用于嵌套有序列表和嵌套无序列表,但不适用于混合嵌套列表。

 <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> jQuery(document).ready(function() { jQuery('div.docSection').find('ol').each( function() { var list_style_type = jQuery( this ).css("list-style-type"); jQuery( this ).find('li').each( function () { jQuery( this ).css("list-style-type", list_style_type); }); }); });

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM