Ckeditor 使用单位调整大小

Ckeditor resize using unit

我希望通过使用带有 jquery 的按钮 onclick 事件将我的 ckeditor 设置为 A4 大小和 A5 大小。 这是我的活动代码。

var editor = CKEDITOR.instances['documentformat-header'];
editor.resize(793, 1122, true);

这段代码工作正常。但是,我希望使用单位(厘米、毫米、英寸)而不是像素来设置尺寸。 所以我把我的代码改成了这个。

var editor = CKEDITOR.instances['documentformat-header'];
editor.resize('21cm', '29cm', true);

调整大小停止工作。它不会改变大小,也不会发生错误。根据 ckeditor 4 doc,它确实接受 CSS 单位的大小值。我的问题是你是怎么做到的?

Here是我看的文档网站

你是对的。根据docs you should be able to pass an argument as a CSS size value with unit. I've tested various CSS units 'em', 'rem', 'vw', 'cm'. It seems none of them is working. I just reported this as a bug on CKEDITOR Github page. You can follow this issue知道什么时候修好了。