简体   繁体   English

使用ExecCommand插入多级无序列表

[英]Inserting Multi-Level Unordered List with ExecCommand

I have a javascript WYSIWYG editor I'm creating using "execCommand" and I'm wondering how to go about creating a multi-leveled bullet list using this command. 我有一个使用“ execCommand”创建的javascript WYSIWYG编辑器,我想知道如何使用此命令创建多级项目符号列表。

Currently I have a button which executes this code on the editor to create an unordered list: 目前,我有一个按钮,可在编辑器上执行此代码以创建无序列表:

WYSIWYG.document.execCommand('InsertUnorderedList',false,'NewUL');

My problem is that if I want to create a sub level of bullets by pressing the button the javascript obviously just closes the UL. 我的问题是,如果我想通过按按钮创建子弹级别,则JavaScript显然会关闭UL。

Any ideas as to how I could create a sub-unordered list? 关于如何创建一个无序列表的任何想法?

一种简单的方法是在选择要更改的项目时使用indentoutdent命令:

WYSIWYG.document.execCommand('indent', false, null);

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

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