ckeditor dialog positioning

前端 未结 5 1494
臣服心动
臣服心动 2021-01-17 16:40

Dialog windows for CKEditor by default appear in the middle of the page but if the page is an iframe with a big height the dialogs appear way down the page.

Is it po

5条回答
  •  -上瘾入骨i
    2021-01-17 17:04

    The solution by zaf works in that it helps to position the dialog, but I've found it to produce a bunch of side effects as to how the dialog functions (failing to display the URL of the image in the image dialog is one example).

    It turned out that the original onShow() method that is being overridden returns a meaningful value that we should keep. This could be due to a plugin or something, but here's the code that ultimately worked for me:

    CKEDITOR.on('dialogDefinition', function(e) {
      var dialogName = e.data.name;
      var dialogDefinition = e.data.definition;
      var onShow = dialogDefinition.onShow;
      dialogDefinition.onShow = function() {
        var result = onShow.call(this);
        this.move(this.getPosition().x, $(e.editor.container.$).position().top);
        return result;
      }
    });
    

提交回复
热议问题