tinymce autoresize with chrome when readonly

2019-02-27 17:56发布

Hi guys i tried the full day, but i did not get it.

I use the tinymce editor and in all browsers it works fine, except in ** chrome. I use the autoresize in readonly mode and i always have the problem that in chrome the editor iframe is ~20px to small, so that often text is missing.

I am not the jquery or javascript crack and did not find a solution for it. There is a row where it is setting the style h.setStyle(h.get(a.id + "_ifr"), "height", k + "px"); but when i would add +20 i have the problem that in editor mode it always adds 20 px when keydown. So not a solution.

Add some pixeld by css? But how do i access the iframe element? Maybe someone of you have an idea what i can do here to add there extra pixels.

EDIT

Ok seems no one has interest to help so i do it with a workaround. In the plugin file i do the following, maybe it helps people, having the same problem:

if (tinymce.isWebKit && tinymce.activeEditor.settings.readonly == true) {

Then you can add some extra pixels, in my case 20px. Maybe there are much better solutions, but it works.

1条回答
疯言疯语
2楼-- · 2019-02-27 18:12

I had a similiar problem with Chrome, tinyMCE 3.5.6 and the autoresize plugin. What helped was manually calling the resize plugin in the init_instance_callback. I'm calling tinyMCE (jQuery version) like this now when the window is loaded:

$('.tinymce').tinymce({
  theme : 'advanced',
  plugins : 'autoresize',
  width: '100%',
  height: 400,
  autoresize_min_height: 400,
  autoresize_max_height: 800,
  init_instance_callback: function (inst) { inst.execCommand('mceAutoResize'); }
});
查看更多
登录 后发表回答