monaco-editor icon indicating copy to clipboard operation
monaco-editor copied to clipboard

Editor stops printing/typing

Open hugsyy opened this issue 8 years ago • 4 comments

monaco-editor version: 0.14.2 Browser: Firefox OS: Windows Steps or JS usage snippet reproducing the issue: Sometimes editor stops typing. As you can see in the image below it listens to key down event but doesn't type.

issue

hugsyy avatar Aug 15 '18 09:08 hugsyy

@hugsyy Do you have a minimal reproducible case?

alexdima avatar Aug 15 '18 10:08 alexdima

Unfortunately it's not easy to reproduce this issue. Maybe code will help :


Ext.ns("Ext.ux.form");

Ext.ux.form.Monaco = Ext.extend(Ext.BoxComponent, {
  value: null,
  language: "javascript",

  initComponent: function() {
    Ext.ux.form.Monaco.superclass.initComponent.apply(this, arguments);

    this.on(
      {
        afterrender: function() {
          var self = this;
          require.config({ paths: { vs: "/monaco/min/vs" } });
          require(["vs/editor/editor.main"], function() {
            self.editor = monaco.editor.create(self.el.dom, {
              value: self.value,
              language: self.language
            });
            monaco.editor.setTheme("vs-dark");

            var containerHeight = self.ownerCt.container.dom.clientHeight;

            if (containerHeight < 500) {
              containerHeight = 500;
              self.ownerCt.setHeight(500);
              self.ownerCt.container.setHeight(500);
            }
            self.setHeight(containerHeight);
            self.editor.layout();

            var itemLength = self.ownerCt.items.items.length;
            var totalChildHeight = 0;
            if (itemLength > 1) {
              for (var i = 0; i < itemLength; i++) {
                if (
                  self.ownerCt.items.items[i].editor == null &&
                  self.ownerCt.items.items[i].el
                ) {
                  totalChildHeight +=
                    self.ownerCt.items.items[i].el.dom.clientHeight;
                }
              }
              var editorHeight = containerHeight - totalChildHeight - 70;
              self.setHeight(editorHeight);
              self.editor.layout();
            }

            window.onresize = function() {
              self.editor.layout();
              containerHeight = self.ownerCt.container.dom.clientHeight;
              self.setHeight(containerHeight);
              self.editor.layout();
            };
          });
        },
        show: function() {
          var self = this;
          var containerHeight = self.ownerCt.container.dom.clientHeight;
          if (containerHeight < 500) {
            containerHeight = 500;
          }
          self.setHeight(containerHeight);
          self.editor.layout();
        }
      },
      this
    );
  },

  getValue: function() {
    return this.editor.getValue();
  }
});

Ext.reg("monacoeditor", Ext.ux.form.Monaco);



hugsyy avatar Aug 27 '18 07:08 hugsyy

Not sure if it is related but I am facing a problem similar to this one on I.E 11, focusing outside of the editor and clicking again on the same cursor position will lock the editor and I am not able to type anything until I move the cursor again.

acautin avatar Sep 02 '18 19:09 acautin

I cannot reproduce. Please reopen with steps that help us reproduce.

alexdima avatar Dec 12 '19 14:12 alexdima