# CutBox.app

## Coverage Report

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

    .../Source/Components/LinkText.swift

    Line

    Count

    Source

    1

    //

    2

    //  LinkText.swift

    3

    //  CutBox

    4

    //

    5

    //  Created by jason on 8/9/23.

    6

    //  Copyright © 2023 ocodo. All rights reserved.

    7

    //

    8

    9

    import Cocoa

    10

    11

    class LinkText: CutBoxBaseTextField {

    12

        // Injectable NSWorkspace

    13

    29

        var workspace: NSWorkspace = NSWorkspace.shared

    14

    15

        @IBInspectable

    16

        var linkColor: NSColor!

    17

    18

    28

        override func awakeFromNib() {

    19

    28

            let attributes: [NSAttributedString.Key: Any] = [

    20

    28

                NSAttributedString.Key.foregroundColor: linkColor as Any,

    21

    28

                NSAttributedString.Key.underlineStyle: NSUnderlineStyle.single.rawValue,

    22

    28

                NSAttributedString.Key.underlineColor: linkColor as Any

    23

    28

            ]

    24

    28

            attributedStringValue = NSAttributedString(string: "about_cutbox_home_url".l7n, attributes: attributes)

    25

    28

        }

    26

    27

    1

        override func mouseDown(with event: NSEvent) {

    28

    1

            if let url = URL(string: "about_cutbox_home_url".l7n) {

    29

    1

                workspace.open(url)

    30

    1

            }

    31

    1

        }

    32

    }