【问题标题】:monaco-editor - resize property causes editor popups to be hiddenmonaco-editor - resize 属性导致编辑器弹出窗口被隐藏
【发布时间】:2022-08-24 03:42:06
【问题描述】:

我正在使用deltaDecorations 在我的编辑器中显示错误。
这是我的代码:https://gist.github.com/dinager/41578bd658b60cc912a6023f80431810
结果如下:

我正在尝试通过添加到样式来将调整大小属性添加到编辑器

resize: both;overflow: auto;

但是随后悬停消息被编辑器的边缘部分隐藏
正如您在下面的附加图片中看到的 - 编辑器现在可以调整大小(右下角),但悬停消息部分隐藏

如何添加调整大小属性以不隐藏元素?
另一个问题:我可以让悬停消息在编辑器内浮动,这意味着如果它在顶行它应该浮动到底部,如果在编辑器的一侧浮动到中间,等等。

附加代码添加markerDecorations(也存在于顶部的要点链接中):

  this.markerDecorations = codeEditor.deltaDecorations(this.markerDecorations, [
    {
      range: new monaco.Range(pos.startLine, pos.startColumn, pos.endLine, pos.endColumn),
      options: {
        className: \'squiggly-error\',
        minimap: {
          color: { id: \'minimap.errorHighlight\' },
          position: monaco.editor.MinimapPosition.Gutter,
        },
        overviewRuler: {
          color: { id: \'editorOverviewRuler.errorForeground\' },
          position: monaco.editor.OverviewRulerLane.Full,
        },
        stickiness: monaco.editor.TrackedRangeStickiness.AlwaysGrowsWhenTypingAtEdges,
        zIndex: 1,
        hoverMessage: { value: parseResponse.error, isTrusted: false },
      },
    },
  ]);

    标签: html css monaco-editor


    【解决方案1】:

    通过在monaco.editor.create 选项上添加fixedOverflowWidgets: true 解决了这个问题。

    this.editor = monaco.editor.create(el, {
        // ...
        fixedOverflowWidgets: true
    
    });
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-01-05
      • 1970-01-01
      • 2013-05-01
      • 2020-05-14
      • 2018-07-21
      • 2022-12-31
      • 1970-01-01
      • 2018-12-19
      相关资源
      最近更新 更多