<commit_before>/*
 * WKTextView.j
 * WyzihatKit
 *
 * Created by <NAME>, WireLoad LLC.
 *
 */

WKTextCursorHeightFactor = 0.2;
WKTextViewInnerPadding = 4;
WKTextViewDefaultFont = "Verdana";

_CancelEvent = function(ev) {
    if (!ev)
        ev = window.event;
    if (ev && ev.stopPropagation)
        ev.stopPropagation();
    else
        ev.cancelBubble = true;
}

_EditorEvents = [
    'onmousedown',
    'onmouseup',
    'onkeypress',
    'onkeydown',
    'onkeyup'
]

/*!
    A WYSIHAT based rich text editor widget.

    Beware of the load times. Wait for the load event.
*/
@implementation WKTextView : CPWebView
{
    id              delegate @accessors;
    CPTimer         loadTimer;
    Object          editor;
    Object          _scrollDiv;
    BOOL            shouldFocusAfterAction;
    BOOL            suppressAutoFocus;
    BOOL            editable;
    BOOL            enabled;
    CPString        lastFont;
    CPString        lastColorString;
    CPColor         lastColor;
    CPDictionary    eventHandlerSwizzler;

    CPScroller      _verticalScroller;
    float           _verticalLineScroll;
    float           _verticalPageScroll;

}

- (id)initWithFrame:(CGRect)aFrame
{
    if (self = [super initWithFrame:aFrame])
    {
        lastColor = [CPColor blackColor];

        _verticalPageScroll = 10;
        _verticalLineScroll = 10;

        eventHandlerSwizzler = [[CPDictionary alloc] init];
        shouldFocusAfterAction = YES;
        [self setEditable: YES];
        [self setEnabled: YES];
        [self setScrollMode:CPWebViewScrollNative];
        [self setMainFrameURL:[[CPBundle mainBundle] pathForResource:"WKTextView/editor.html"]];

        _verticalScroller = [[CPScroller alloc] initWithFrame:CGRectMake(0.0, 0.0, [CPScroller scrollerWidth], MAX(CGRectGetHeight([self bounds]), [CPScroller scrollerWidth]+1))];
        [_verticalScroller setAutoresizingMask:CPViewMinXMargin];
        [_verticalScroller setTarget:self];
        [_verticalScroller setAction:@selector(_verticalScrollerDidScroll:)];

        [self addSubview:_verticalScroller];<commit_msg>revises how the main frame is loaded so we no longer require the developer to move editor.html into the main resources directory and breaking isolation.<commit_after>/*
 * WKTextView.j
 * WyzihatKit
 *
 * Created by <NAME>, WireLoad LLC.
 *
 */

WKTextCursorHeightFactor = 0.2;
WKTextViewInnerPadding = 4;
WKTextViewDefaultFont = "Verdana";

_CancelEvent = function(ev) {
    if (!ev)
        ev = window.event;
    if (ev && ev.stopPropagation)
        ev.stopPropagation();
    else
        ev.cancelBubble = true;
}

_EditorEvents = [
    'onmousedown',
    'onmouseup',
    'onkeypress',
    'onkeydown',
    'onkeyup'
]

/*!
    A WYSIHAT based rich text editor widget.

    Beware of the load times. Wait for the load event.
*/
@implementation WKTextView : CPWebView
{
    id              delegate @accessors;
    CPTimer         loadTimer;
    Object          editor;
    Object          _scrollDiv;
    BOOL            shouldFocusAfterAction;
    BOOL            suppressAutoFocus;
    BOOL            editable;
    BOOL            enabled;
    CPString        lastFont;
    CPString        lastColorString;
    CPColor         lastColor;
    CPDictionary    eventHandlerSwizzler;

    CPScroller      _verticalScroller;
    float           _verticalLineScroll;
    float           _verticalPageScroll;

}

- (id)initWithFrame:(CGRect)aFrame
{
    if (self = [super initWithFrame:aFrame])
    {
        lastColor = [CPColor blackColor];

        _verticalPageScroll = 10;
        _verticalLineScroll = 10;

        eventHandlerSwizzler = [[CPDictionary alloc] init];
        shouldFocusAfterAction = YES;
        [self setEditable: YES];
        [self setEnabled: YES];
        [self setScrollMode:CPWebViewScrollNative];
        [self setMainFrameURL:[[CPBundle bundleForClass:[self class]] pathForResource:"WKTextView/editor.html"]];
	
        _verticalScroller = [[CPScroller alloc] initWithFrame:CGRectMake(0.0, 0.0, [CPScroller scrollerWidth], MAX(CGRectGetHeight([self bounds]), [CPScroller scrollerWidth]+1))];
        [_verticalScroller setAutoresizingMask:CPViewMinXMargin];
        [_verticalScroller setTarget:self];
        [_verticalScroller setAction:@selector(_verticalScrollerDidScroll:)];

        [self addSubview:_verticalScroller];
{'fraction_non_alphanumeric': 0.09057555606512267, 'fraction_numerical': 0.005503324925475808, 'mean_word_length': 2.674810446503791, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '1815724', 'n_tokens_mistral': 1333, 'n_tokens_neox': 1275, 'n_words': 290}