<commit_before>(function ($) {

/*
# mode:          textonly/richtext / disable b/i/u/enter + strip on paste
# pasteOnlyText: true
# maxlength:     123
# multiline:     true / disable enter + strip on paste
# placeholder:   'some placeholder'
*/

  var pluginName = 'ce',
  defaults = {
    debug:     false,
    mode:      'richtext',
    multiline: true,
    allowKey:  {
      8: true, // backspace
      9: true, // tab
      16: true, // shift
      17: true, // ctrl
      18: true, // alt
      20: true, // cabslock
      37: true, // up
      38: true, // right
      39: true, // down
      40: true, // left
      91: true, // cmd left
      92: true, // cmd right
      224: true, // cmd left
    },
    extraAllowKey: {
      65: true, // a + ctrl - select all
      67: true, // c + ctrl - copy
      86: true, // v + ctrl - paste
      88: true, // x + ctrl - cut
      90: true, // z + ctrl - undo
    },
    richTextFormatKey: {
      66: true, // b
      73: true, // i
      85: true, // u
    },
    //maxlength: 20,
  };

  function Plugin( element, options ) {
    this.element  = element;
    this.$element = $(element)

    this.options = $.extend( {}, defaults, options) ;

    this._defaults = defaults;
    this._name     = pluginName;
    this._setTimeOutReformat = false;

    // take placeholder from markup
    if ( !this.options.placeholder && this.$element.data('placeholder') ) {
      this.options.placeholder = this.$element.data('placeholder')
    }

    this.preventInput = false

    this.init();
  }


  Plugin.prototype.init = function () {
    var _this = this

    // handle enter
    this.$element.on('keydown', function (e) {
      _this.log('keydown', e.keyCode)
      if ( _this.preventInput ) {
        this.log('preventInput', _this.preventInput)
        return
      }

      // strap the return key being pressed
      if (e.keyCode === 13) {

        // disbale multi line
        if ( !_this.options.multiline ) {
          e.preventDefault()
          return
        }

        // breack <blockquote> after enter on empty line
        sel = window.getSelection()
        node = $(sel.anchorNode)
        if (node.parent().is('blockquote')) {
          e.preventDefault()
          document.execCommand('Insertparagraph')
          document.execCommand('Outdent')
        }
      }

      // on zammad metaKey + ctrlKey + i/b/u
      // + metaKey + ctrlKey + u -> Toggles the current selection between underlined and not underlined
      // + metaKey + ctrlKey + b -> Toggles the current selection between bold and non-bold
      // + metaKey + ctrlKey + i -> Toggles the current selection between italic and non-italic
      // + metaKey + ctrlKey + r -> Removes the formatting tags from the current selection
      // + metaKey + ctrlKey + h -> Inserts a Horizontal Rule
      // + metaKey + ctrlKey + l -> Toggles the text selection between an unordered list and a normal block
      // + metaKey + ctrlKey + k -> Toggles the text selection between an ordered list and a normal block
      // + metaKey + ctrlKey + o -> Draws a line through the middle of the current selection
      // + metaKey + ctrlKey + r -> Removes any hyperlink from the current selection
      if ( !e.altKey && e.ctrlKey && e.metaKey && (_this.options.richTextFormatKey[ e.keyCode ]
        || e.keyCode == 82
        || e.keyCode == 72
        || e.keyCode == 76
        || e.keyCode == 75
        || e.keyCode == 79
        || e.keyCode == 87)) {
        e.preventDefault()<commit_msg>Fixed typos.<commit_after>(function ($) {

/*
# mode:          textonly/richtext / disable b/i/u/enter + strip on paste
# pasteOnlyText: true
# maxlength:     123
# multiline:     true / disable enter + strip on paste
# placeholder:   'some placeholder'
*/

  var pluginName = 'ce',
  defaults = {
    debug:     false,
    mode:      'richtext',
    multiline: true,
    allowKey:  {
      8: true, // backspace
      9: true, // tab
      16: true, // shift
      17: true, // ctrl
      18: true, // alt
      20: true, // cabslock
      37: true, // up
      38: true, // right
      39: true, // down
      40: true, // left
      91: true, // cmd left
      92: true, // cmd right
      224: true, // cmd left
    },
    extraAllowKey: {
      65: true, // a + ctrl - select all
      67: true, // c + ctrl - copy
      86: true, // v + ctrl - paste
      88: true, // x + ctrl - cut
      90: true, // z + ctrl - undo
    },
    richTextFormatKey: {
      66: true, // b
      73: true, // i
      85: true, // u
    },
    //maxlength: 20,
  };

  function Plugin( element, options ) {
    this.element  = element;
    this.$element = $(element)

    this.options = $.extend( {}, defaults, options) ;

    this._defaults = defaults;
    this._name     = pluginName;
    this._setTimeOutReformat = false;

    // take placeholder from markup
    if ( !this.options.placeholder && this.$element.data('placeholder') ) {
      this.options.placeholder = this.$element.data('placeholder')
    }

    this.preventInput = false

    this.init();
  }


  Plugin.prototype.init = function () {
    var _this = this

    // handle enter
    this.$element.on('keydown', function (e) {
      _this.log('keydown', e.keyCode)
      if ( _this.preventInput ) {
        this.log('preventInput', _this.preventInput)
        return
      }

      // strap the return key being pressed
      if (e.keyCode === 13) {

        // disbale multi line
        if ( !_this.options.multiline ) {
          e.preventDefault()
          return
        }

        // break <blockquote> after enter on empty line
        sel = window.getSelection()
        node = $(sel.anchorNode)
        if (node.parent().is('blockquote')) {
          e.preventDefault()
          document.execCommand('Insertparagraph')
          document.execCommand('Outdent')
        }
      }

      // on zammad metaKey + ctrlKey + i/b/u
      //  metaKey + ctrlKey + u -> Toggles the current selection between underlined and not underlined
      //  metaKey + ctrlKey + b -> Toggles the current selection between bold and non-bold
      //  metaKey + ctrlKey + i -> Toggles the current selection between italic and non-italic
      //  metaKey + ctrlKey + r -> Removes the formatting tags from the current selection
      //  metaKey + ctrlKey + h -> Inserts a Horizontal Rule
      //  metaKey + ctrlKey + l -> Toggles the text selection between an unordered list and a normal block
      //  metaKey + ctrlKey + k -> Toggles the text selection between an ordered list and a normal block
      //  metaKey + ctrlKey + o -> Draws a line through the middle of the current selection
      //  metaKey + ctrlKey + w -> Removes any hyperlink from the current selection
      if ( !e.altKey && e.ctrlKey && e.metaKey && (_this.options.richTextFormatKey[ e.keyCode ]
        || e.keyCode == 82
        || e.keyCode == 72
        || e.keyCode == 76
        || e.keyCode == 75
        || e.keyCode == 79
        || e.keyCode == 87)) {
        e.preventDefault()
{'fraction_non_alphanumeric': 0.12640569395017795, 'fraction_numerical': 0.01708185053380783, 'mean_word_length': 1.897319587628866, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 23, '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': '7485973', 'n_tokens_mistral': 2194, 'n_tokens_neox': 2071, 'n_words': 644}