为了账号安全,请及时绑定邮箱和手机立即绑定

CKEditor 5改变高度事件

CKEditor 5改变高度事件

繁星淼淼 2023-09-25 17:06:02
只需明确定义时间的输入类型就可以了$('#Tools input[type=time]').timepicker({   timeFormat: 'HH:mm',   interval: 30,   use24hours: true,   scrollbar: true,});但这不起作用...您对如何修复它有什么想法吗?感谢您抽出宝贵的时间,祝您有美好的一天:)
查看完整描述

1 回答

?
偶然的你

TA贡献1841条经验 获得超3个赞

您可以检查事件内的编辑器高度change,看看高度是否发生变化。


请运行以下代码片段并检查控制台:


let editorWidth;

let editorHeight;


ClassicEditor

  .create(document.querySelector('#Comment'), {

    toolbar: [ 'heading', '|', 'bold', 'italic', 'blockQuote' ],

  })

  .then(editor => {


    editor.model.document.on('change', (eventInfo, name, value, oldValue) => {

        const newWidth = editor.ui.view.element.offsetWidth;

        const newHeight = editor.ui.view.element.offsetHeight;


        if(editorWidth !== newWidth || editorHeight !== newHeight) {

          console.log('Editor size changed. New size:', newWidth, newHeight);

          editorWidth = newWidth;

          editorHeight = newHeight;

        }

    });


  })

  .catch(error => {

      console.error(error);

  });

<script src="https://cdn.ckeditor.com/ckeditor5/17.0.0/classic/ckeditor.js"></script>


<div id="Comment"></div>


查看完整回答
反对 回复 2023-09-25
  • 1 回答
  • 0 关注
  • 46 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信