Skip to content

On page load document disappears until i press CTRL+Z and then everything works as expected #8

@virtuman

Description

@virtuman

almost every time when i load a page the contents of the CM area disappears, but after i press CTRL+Z everything re-appears and works as expected.
any idea what i'm doing wrong here?

thank you.

window.Debugger = (function() {

  return {
    init: function() {
      //init resizer
      $(".debug-panel:not(:first)").splitter().data('splitter')
      .trigger('init')
      .on('resize-start', function() {
        $('#left-area .overlay').show();
      })
      .on('resize-end', function() {
        $('#left-area .overlay').hide();
      });

      //codemirror
      CodeMirror.keyMap.basic.Tab = 'indentMore';
      this.init_python_editor($("#python-editor"));
      ...
    },

    not_saved: false,
    init_python_editor: function($el) {
      var _this = this;
      var cm = this.python_editor = CodeMirror($el[0], {
        value: script_content,
        mode: "python",
        indentUnit: 4,
        lineWrapping: true,
        styleActiveLine: true,
        lineNumbers: true,
        autofocus: true
      });

      var s = new BCSocket("http://" + location.hostname + ":7007/channel", {origin: "http://" + location.hostname + ":7007/channel",
            crossdomainXhr: true,
            reconnect: true
      });
//
    var sjs = new window.sharejs.Connection(s);
    var doc = sjs.get('users', project_name);

      doc.subscribe();

      doc.whenReady(function () {
        if (!doc.type) doc.create('text');
        if (doc.type && doc.type.name === 'text') {
            doc.attachCodeMirror(cm);
        }
      });

.....

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions