# CutBox.app

## Coverage Report

#### Created: 2024-03-12 03:40

    .../Source/App/JSFuncSearchPreview/JSFuncSearchAndPreviewView.swift

    Line

    Count

    Source

    1

    //

    2

    //  JSFuncSearchAndPreviewView.swift

    3

    //  CutBox

    4

    //

    5

    //  Created by Jason Milkins on 16/5/18.

    6

    //  Copyright © 2018-2023 ocodo. All rights reserved.

    7

    //

    8

    9

    import Foundation

    10

    import Cocoa

    11

    import RxSwift

    12

    import RxCocoa

    13

    14

    class JSFuncSearchAndPreviewView: SearchAndPreviewViewBase {

    15

    16

    75

        var js = JSFuncService()

    17

    75

        var events = PublishSubject<SearchJSFuncViewEvents>()

    18

    19

    24

        override func awakeFromNib() {

    20

    24

            self.placeHolderTextString = "search_placeholder".l7n

    21

    24

            setupSearchText()

    22

    24

    23

    24

            super.awakeFromNib()

    24

    24

        }

    25

    26

    24

        private func setupSearchText() {

    27

    24

            self.searchText.isFieldEditor = true

    28

    24

            self.searchText.delegate = self

    29

    24

        }

    30

    31

    66

        func setupClipItemsContextMenu() {

    32

    66

            let reload = CutBoxBaseMenuItem(title: "preferences_javascript_transform_reload".l7n,

    33

    66

                                    action: #selector(reloadJS),

    34

    66

                                    keyEquivalent: "")

    35

    66

    36

    66

            let contextMenu = CutBoxBaseMenu()

    37

    66

            contextMenu.addItem(reload)

    38

    66

    39

    66

            self.itemsList?.menu = contextMenu

    40

    66

        }

    41

    42

    1

        override func applyTheme() {

    43

    1

            super.applyTheme()

    44

    1

        }

    45

    46

    1

        @objc func reloadJS(_ sender: CutBoxBaseMenuItem) {

    47

    1

            prefs.loadJavascript()

    48

    1

            self.itemsList.reloadData()

    49

    1

        }

    50

    }