<commit_before>Ext.ns('Rwiki');

Rwiki.rootFolderName = '.';
Rwiki.nodeManager = new Rwiki.Node();

/**
 * Log the event names to the console of any observable object.
 */
Rwiki.captureEvents = function(observable) {
  Ext.util.Observable.capture(observable, function(eventName) {
    if (console === undefined) return;
    console.log(eventName);
  });
};

Rwiki.init = function() {
  var treePanel = new Rwiki.TreePanel();
  treePanel.relayEvents(Rwiki.nodeManager,
    ['folderCreated', 'pageCreated', 'nodeRenamed', 'nodeDeleted']);

  var tabPanel = new Rwiki.TabPanel();
  tabPanel.relayEvents(Rwiki.nodeManager,
    ['pageLoaded', 'folderCreated', 'pageCreated', 'pageSaved', 'nodeRenamed', 'nodeDeleted']);
  tabPanel.relayEvents(treePanel, ['pageSelected']);

  var editorPanel = new Rwiki.EditorPanel();
  editorPanel.relayEvents(Rwiki.nodeManager,
    ['pageLoaded', 'nodeRenamed', 'nodeDeleted']);

  // Create layout

  var sidePanel = new Rwiki.SidePanel({
    items: [treePanel]
  });

  var toggleTreePanelAction = new Ext.Action({
    text: 'Toggle tree',
    handler: function() {
      sidePanel.toggleCollapse();
    }
  });

  var toggleEditorAction = new Ext.Action({
    text: 'Toggle editor',
    handler: function() {
      editorPanel.toggleCollapse();
    }
  });

  var toolbar = new Rwiki.Toolbar({
    items: [toggleTreePanelAction, toggleEditorAction]
  });

  var pageAndEditorPanel = new Ext.Panel({
    layout: 'border',
    region: 'center',
    items: [tabPanel, editorPanel]
  });

  var mainPanel = new Ext.Panel({
    layout: 'border',
    region: 'center',
    tbar: toolbar,
    items: [sidePanel, pageAndEditorPanel]
  });

  var app = new Rwiki.Viewport({
    items: [mainPanel]
  });

  app.show();
};<commit_msg>Toggle buttons.<commit_after>Ext.ns('Rwiki');

Rwiki.rootFolderName = '.';
Rwiki.nodeManager = new Rwiki.Node();

/**
 * Log the event names to the console of any observable object.
 */
Rwiki.captureEvents = function(observable) {
  Ext.util.Observable.capture(observable, function(eventName) {
    if (console === undefined) return;
    console.log(eventName);
  });
};

Rwiki.init = function() {
  var treePanel = new Rwiki.TreePanel();
  treePanel.relayEvents(Rwiki.nodeManager,
    ['folderCreated', 'pageCreated', 'nodeRenamed', 'nodeDeleted']);

  var tabPanel = new Rwiki.TabPanel();
  tabPanel.relayEvents(Rwiki.nodeManager,
    ['pageLoaded', 'folderCreated', 'pageCreated', 'pageSaved', 'nodeRenamed', 'nodeDeleted']);
  tabPanel.relayEvents(treePanel, ['pageSelected']);

  var editorPanel = new Rwiki.EditorPanel();
  editorPanel.relayEvents(Rwiki.nodeManager,
    ['pageLoaded', 'nodeRenamed', 'nodeDeleted']);

  // Create layout

  var sidePanel = new Rwiki.SidePanel({
    items: [treePanel]
  });

  var toggleTreePanelAction = new Ext.Action({
    text: 'Toggle tree',
    enableToggle: true,
    pressed: true,
    handler: function() {
      sidePanel.toggleCollapse();
    }
  });

  var toggleEditorAction = new Ext.Action({
    text: 'Toggle editor',
    enableToggle: true,
    pressed: false,
    handler: function() {
      editorPanel.toggleCollapse();
    }
  });

  var toolbar = new Rwiki.Toolbar({
    items: [toggleTreePanelAction, toggleEditorAction]
  });

  var pageAndEditorPanel = new Ext.Panel({
    layout: 'border',
    region: 'center',
    items: [tabPanel, editorPanel]
  });

  var mainPanel = new Ext.Panel({
    layout: 'border',
    region: 'center',
    tbar: toolbar,
    items: [sidePanel, pageAndEditorPanel]
  });

  var app = new Rwiki.Viewport({
    items: [mainPanel]
  });

  app.show();
};
{'fraction_non_alphanumeric': 0.14904246461282264, 'fraction_numerical': 0.0, 'mean_word_length': 3.863697705802969, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4303733', 'n_tokens_mistral': 1160, 'n_tokens_neox': 1135, 'n_words': 255}