<commit_before>protocol SectionEditorMenuItemsDataSource: class {
    var availableMenuActions: [Selector] { get }
}

protocol SectionEditorMenuItemsDelegate: class {
    func sectionEditorWebViewDidTapSelectAll(_ sectionEditorWebView: SectionEditorWebView)
    func sectionEditorWebViewDidTapBoldface(_ sectionEditorWebView: SectionEditorWebView)
    func sectionEditorWebViewDidTapItalics(_ sectionEditorWebView: SectionEditorWebView)
    func sectionEditorWebViewDidTapCitation(_ sectionEditorWebView: SectionEditorWebView)
    func sectionEditorWebViewDidTapLink(_ sectionEditorWebView: SectionEditorWebView)
    func sectionEditorWebViewDidTapTemplate(_ sectionEditorWebView: SectionEditorWebView)
}

protocol SectionEditorMenuItemsControllerDelegate: AnyObject {
    func sectionEditorMenuItemsControllerDidTapLink(_ sectionEditorMenuItemsController: SectionEditorMenuItemsController)
    func sectionEditorMenuItemsControllerShouldIncludeLinkItem(_ sectionEditorMenuItemsController: SectionEditorMenuItemsController) -> Bool
}

class SectionEditorMenuItemsController: NSObject, SectionEditorMenuItemsDataSource {
    let messagingController: SectionEditorWebViewMessagingController

    init(messagingController: SectionEditorWebViewMessagingController) {
        self.messagingController = messagingController
        super.init()
        setEditMenuItems()
    }

    weak var delegate: SectionEditorMenuItemsControllerDelegate?

    // Keep original menu items
    // so that we can bring them back
    // when web view disappears
    var originalMenuItems: [UIMenuItem]?

    private func setEditMenuItems() {
        originalMenuItems = UIMenuController.shared.menuItems<commit_msg>remove delegate method<commit_after>protocol SectionEditorMenuItemsDataSource: class {
    var availableMenuActions: [Selector] { get }
}

protocol SectionEditorMenuItemsDelegate: class {
    func sectionEditorWebViewDidTapSelectAll(_ sectionEditorWebView: SectionEditorWebView)
    func sectionEditorWebViewDidTapBoldface(_ sectionEditorWebView: SectionEditorWebView)
    func sectionEditorWebViewDidTapItalics(_ sectionEditorWebView: SectionEditorWebView)
    func sectionEditorWebViewDidTapCitation(_ sectionEditorWebView: SectionEditorWebView)
    func sectionEditorWebViewDidTapLink(_ sectionEditorWebView: SectionEditorWebView)
    func sectionEditorWebViewDidTapTemplate(_ sectionEditorWebView: SectionEditorWebView)
}

protocol SectionEditorMenuItemsControllerDelegate: AnyObject {
    func sectionEditorMenuItemsControllerDidTapLink(_ sectionEditorMenuItemsController: SectionEditorMenuItemsController)
}

class SectionEditorMenuItemsController: NSObject, SectionEditorMenuItemsDataSource {
    let messagingController: SectionEditorWebViewMessagingController

    init(messagingController: SectionEditorWebViewMessagingController) {
        self.messagingController = messagingController
        super.init()
        setEditMenuItems()
    }

    weak var delegate: SectionEditorMenuItemsControllerDelegate?

    // Keep original menu items
    // so that we can bring them back
    // when web view disappears
    var originalMenuItems: [UIMenuItem]?

    private func setEditMenuItems() {
        originalMenuItems = UIMenuController.shared.menuItems
{'fraction_non_alphanumeric': 0.04576167076167076, 'fraction_numerical': 0.0, 'mean_word_length': 6.368778280542986, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, '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': '4038719', 'n_tokens_mistral': 799, 'n_tokens_neox': 773, 'n_words': 168}