Sha256: 569c62b153cb1241be99789ce7f2da051b248afd3ad05583c431e62800e328b6

Contents?: true

Size: 1.63 KB

Versions: 63

Compression:

Stored size: 1.63 KB

Contents

pageflow.EditorView = Backbone.View.extend({
  scrollNavigationKeys: _.values({
    pageUp: 33,
    pageDown: 34,
    end: 35,
    home: 36,
    left: 37,
    up: 38,
    right: 39,
    down: 40
  }),

  events: {
    'click a': function(event) {
      // prevent default for all links
      if (!$(event.currentTarget).attr('target') &&
          !$(event.currentTarget).attr('download') &&
          !$(event.currentTarget).attr('href')) {
        return false;
      }
    },

    'keydown sidebar': function(event) {
      this.preventScrollingPreviewWhileFocusInSidebar(event);
    }
  },

  initialize: function() {
    $(window).on('beforeunload', function(event) {
      if (pageflow.entry.get('uploading_files_count') > 0)  {
        return I18n.t('pageflow.editor.views.editor_views.files_pending_warning');
      }
    });
  },

  render: function() {
    this.$el.layout({
      minSize: 300,
      togglerTip_closed: I18n.t('pageflow.editor.views.editor_views.show_editor'),
      togglerTip_open: I18n.t('pageflow.editor.views.editor_views.hide_editor'),
      resizerTip: I18n.t('pageflow.editor.views.editor_views.resize_editor'),
      enableCursorHotkey: false,
      fxName: 'none',

      onresize: function() {
        pageflow.app.trigger('resize');
      }
    });

    new pageflow.UploaderView().render();

    this.$el.append(new pageflow.LockedView({
      model: pageflow.editLock
    }).render().el);

    this.$el.append(new pageflow.HelpView().render().el);
  },

  preventScrollingPreviewWhileFocusInSidebar: function(event) {
    if (this.scrollNavigationKeys.indexOf(event.which) >= 0) {
      event.stopPropagation();
    }
  }
});

Version data entries

63 entries across 63 versions & 1 rubygems

Version Path
pageflow-14.5.2 app/assets/javascripts/pageflow/editor/views/editor_view.js
pageflow-15.0.2 app/assets/javascripts/pageflow/editor/views/editor_view.js
pageflow-15.0.1 app/assets/javascripts/pageflow/editor/views/editor_view.js
pageflow-15.0.0 app/assets/javascripts/pageflow/editor/views/editor_view.js
pageflow-14.5.1 app/assets/javascripts/pageflow/editor/views/editor_view.js
pageflow-14.5.0 app/assets/javascripts/pageflow/editor/views/editor_view.js
pageflow-15.0.0.rc2 app/assets/javascripts/pageflow/editor/views/editor_view.js
pageflow-15.0.0.rc1 app/assets/javascripts/pageflow/editor/views/editor_view.js
pageflow-15.0.0.beta4 app/assets/javascripts/pageflow/editor/views/editor_view.js
pageflow-15.0.0.beta3 app/assets/javascripts/pageflow/editor/views/editor_view.js
pageflow-14.4.0 app/assets/javascripts/pageflow/editor/views/editor_view.js
pageflow-15.0.0.beta2 app/assets/javascripts/pageflow/editor/views/editor_view.js
pageflow-15.0.0.beta1 app/assets/javascripts/pageflow/editor/views/editor_view.js
pageflow-14.3.0 app/assets/javascripts/pageflow/editor/views/editor_view.js
pageflow-14.2.1 app/assets/javascripts/pageflow/editor/views/editor_view.js
pageflow-14.2.0 app/assets/javascripts/pageflow/editor/views/editor_view.js
pageflow-14.1.1 app/assets/javascripts/pageflow/editor/views/editor_view.js
pageflow-14.1.0 app/assets/javascripts/pageflow/editor/views/editor_view.js
pageflow-14.0.0 app/assets/javascripts/pageflow/editor/views/editor_view.js
pageflow-14.0.0.rc2 app/assets/javascripts/pageflow/editor/views/editor_view.js