<commit_before>define [
  'backbone'
  'cs!models/content/inherits/saveable'
  'cs!mixins/tree'
  'cs!models/content/book'
  'cs!models/content/module'
  'cs!models/content/folder'
  'cs!collections/content'
  'filtered-collection'
], (Backbone, Saveable, treeMixin, Book, Module, Folder, allContent) ->

  return new class WorkspaceRoot extends Saveable.extend(treeMixin)
    accept: [Book::mediaType, Module::mediaType, Folder::mediaType]
    initialize: (options) ->
      super(options)

      content = new Backbone.FilteredCollection(null, {collection:allContent})
      # Filter the Workspace sidebar to only contain Book and Folder
      content.setFilter (model) => return model.mediaType in [Book::mediaType, Folder::mediaType]

      @_initializeTreeHandlers {root:@, children:content}
<commit_msg>add fix so new Modules are added properly to the Workspace<commit_after>define [
  'backbone'
  'cs!models/content/inherits/saveable'
  'cs!mixins/tree'
  'cs!models/content/book'
  'cs!models/content/module'
  'cs!models/content/folder'
  'cs!collections/content'
  'filtered-collection'
], (Backbone, Saveable, treeMixin, Book, Module, Folder, allContent) ->

  return new class WorkspaceRoot extends Saveable.extend(treeMixin)
    accept: [Book::mediaType, Module::mediaType, Folder::mediaType]
    initialize: (options) ->
      super(options)

      content = new Backbone.FilteredCollection(null, {collection:allContent})
      # Filter the Workspace sidebar to only contain Book and Folder
      content.setFilter (model) => return model.mediaType in [Book::mediaType, Folder::mediaType]

      @_initializeTreeHandlers {root:@, children:content}

    # Just return the node; for a Book this would return options.model wrapped in a TocPointerNode
    newNode: (options) ->
      return options.model

{'fraction_non_alphanumeric': 0.11508810572687225, 'fraction_numerical': 0.0, 'mean_word_length': 4.6080246913580245, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 10, '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': '2960477', 'n_tokens_mistral': 561, 'n_tokens_neox': 549, 'n_words': 135}