简体   繁体   English

Tinymce 允许制表符空间缩进

[英]Tinymce allow tab space indent

I want to add constant tab space indent when user press TAB.我想在用户按下 TAB 时添加恒定的制表符空间缩进。

tinyMCE.init({
    selector: 'textarea',
    indentation : '60pt',
    plugins: 'textcolor print preview importcss searchreplace autolink autosave save directionality visualblocks visualchars fullscreen image link media template codesample table charmap hr pagebreak nonbreaking anchor toc insertdatetime advlist lists wordcount imagetools textpattern noneditable',
    paste_as_text:true,
    //menubar: false,
    toolbar: 'bold italic underline strikethrough superscript subscript | fontselect fontsizeselect | alignleft aligncenter alignright alignjustify | outdent indent |  numlist bullist checklist | forecolor backcolor',
    //nonbreaking_force_tab: true,
    setup : function(ed) {
        ed.on('keydown', function(e) {


            //

            //


          });
    },

});

TinyMCE has a plugin named Nonbreaking Space that will (when configured appropriately) inserted 3 spaces when you press the TAB key: TinyMCE 有一个名为Nonbreaking Space的插件,当你按下TAB键时,它会(在适当配置时)插入 3 个空格:

https://www.tiny.cloud/docs/plugins/nonbreaking/#nonbreaking_force_tab https://www.tiny.cloud/docs/plugins/nonbreaking/#nonbreaking_force_tab

The documentation covers the complexities of making this change as they relate to other plugins like table and lists so I would urge you to read the documentation in its entirety.该文档涵盖了进行此更改的复杂性,因为它们与其他插件(如tablelists因此我建议您完整阅读文档。

One word of WARNING about doing this ...关于这样做的一个警告词......

Changing the TAB key in this fashion will make it very difficult for people who rely on the keyboard to exit the editor and move to another form field as the TAB key is how you would typically do so.以这种方式更改TAB键将使依赖键盘的人很难退出编辑器并移动到另一个表单字段,因为TAB键是您通常会这样做的方式。 If you want your form to be accessible this change will make that very difficult to accomplish.如果您希望您的表单可访问,则此更改将使实现变得非常困难。

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

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