Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
virtuman opened this issue Apr 21, 2015 · 0 comments

Comments

@virtuman
Copy link

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);
        }
      });

.....
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant