<commit_before>import { withPluginApi } from "discourse/lib/plugin-api";
import showModal from "discourse/lib/show-modal";

function initializeScheduleUIBuilder(api) {
  const siteSettings = api.container.lookup("site-settings:main");

  if (!siteSettings.calendar_enabled) return;

  const ComposerController = api.container.lookupFactory("controller:composer");
  ComposerController.reopen({
    actions: {
      showScheduleBuilder() {
        showModal("schedule-ui-builder").set("toolbarEvent", this.get("toolbarEvent"));
      }
    }
  });

  api.addToolbarPopupMenuOptionsCallback(function() {
    return {
      action: "showScheduleBuilder",
      icon: "calendar",
      label: "calendar.schedule.ui_builder.title"
    };
  });
}

export default {
  name: "add-schedule-ui-builder",

  initialize() {
    withPluginApi("0.5", initializeScheduleUIBuilder);
  }
};<commit_msg>Fixes the modal show up<commit_after>import { withPluginApi } from "discourse/lib/plugin-api";
import showModal from "discourse/lib/show-modal";

function initializeScheduleUIBuilder(api) {
  const siteSettings = api.container.lookup("site-settings:main");

  if (!siteSettings.calendar_enabled) return;

  api.modifyClass('controller:composer', {
    actions: {
      showScheduleBuilder() {
        showModal("schedule-ui-builder").set("toolbarEvent", this.get("toolbarEvent"));
      }
    }
  });

  api.addToolbarPopupMenuOptionsCallback(function() {
    return {
      action: "showScheduleBuilder",
      icon: "calendar",
      label: "calendar.schedule.ui_builder.title"
    };
  });
}

export default {
  name: "add-schedule-ui-builder",

  initialize() {
    withPluginApi("0.8.7", initializeScheduleUIBuilder);
  }
};
{'fraction_non_alphanumeric': 0.14002333722287047, 'fraction_numerical': 0.0029171528588098016, 'mean_word_length': 4.181268882175226, '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': '3229828', 'n_tokens_mistral': 510, 'n_tokens_neox': 513, 'n_words': 79}