<commit_before>/**
 * plugin.js
 *
 * Copyright 2014, Seapine Software Inc
 * Released under LGPL License.
 *
 * License: http://tinymce.moxiecode.com/license
 */

/*global tinymce:true, $: false */

(function () {

  /**
   * @class
   *
   * TinyMCE plugin for general Seapine modifications.
   */
  tinymce.create('tinymce.plugins.SeapinePlugin', {

    /**
     * tracks whether this tinymce instance is set to read only or not.
     * @type {Boolean}
     * @default
     */
    readonly: false,

    /**
     * Initializes the plugin, this will be executed after the plugin has been created.
     * This call is done before the editor instance has finished it's initialization so use the onInit event
     * of the editor instance to intercept that event.
     *
     * @param {tinymce.Editor} ed Editor instance that the plugin is initialized in.
     */
    init : function (ed) {
      // Override some formats.
      ed.on('init', function () {
        this.formatter.register({
          alignleft : [
            {selector : 'p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li', attributes : {'align' : 'left'}},
            {selector : 'img,table', collapsed : false, styles : {'float' : 'left'}}
          ],

          aligncenter : [
            {selector : 'p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li', attributes: {'align' : 'center'}},
            {selector : 'img', collapsed : false, styles : {display : 'block', marginLeft : 'auto', marginRight : 'auto'}},
            {selector : 'table', collapsed : false, styles : {marginLeft : 'auto', marginRight : 'auto'}}
          ],

          alignright : [
            {selector : 'p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li', attributes : {'align' : 'right'}},
            {selector : 'img,table', collapsed : false, styles : {'float' : 'right'}}
          ],

          alignfull : [
            {selector : 'p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li', attributes : {'align' : 'justify'}}
          ],

          removefontsize: {inline: 'span', styles: {fontSize: ''}, links: true, remove_similar: true},

          removefontname: {inline: 'span', styles: {fontFamily: ''}, links: true, remove_similar: true},

          emptyspan: {selector: 'span', attributes: ['style', 'class'], remove: 'empty', split: true, expand: false, deep: true}

        });
      });

      tinymce.extend(ed, {
        /**
         * Makes the editor readonly. This turns off contentEditable on the editor body element,
         * disables the toolbar buttons, and saves the selection so it can be restored when the
         * editor becomes editable again.
         *
         * @param {Boolean} ro Whether to make the editor readonly or not.
         */
        makeReadOnly: function (ro) {

          var body = this.getBody(),
            $body = $(body);
<commit_msg>Added li selector to alignment formats<commit_after>/**
 * plugin.js
 *
 * Copyright 2014, Seapine Software Inc
 * Released under LGPL License.
 *
 * License: http://tinymce.moxiecode.com/license
 */

/*global tinymce:true, $: false */

(function () {

  /**
   * @class
   *
   * TinyMCE plugin for general Seapine modifications.
   */
  tinymce.create('tinymce.plugins.SeapinePlugin', {

    /**
     * tracks whether this tinymce instance is set to read only or not.
     * @type {Boolean}
     * @default
     */
    readonly: false,

    /**
     * Initializes the plugin, this will be executed after the plugin has been created.
     * This call is done before the editor instance has finished it's initialization so use the onInit event
     * of the editor instance to intercept that event.
     *
     * @param {tinymce.Editor} ed Editor instance that the plugin is initialized in.
     */
    init : function (ed) {
      // Override some formats.
      ed.on('init', function () {
        this.formatter.register({
          alignleft : [
            {selector : 'p,h1,h2,h3,h4,h5,h6,td,th,div', attributes : {'align' : 'left'}},
            {selector : 'li', styles: {'list-style-position': '', 'text-align': 'left'},
              remove_similar: true,
              expand: true,
              split: true,
              deep: true,
              inherit: false},
            {selector : 'img,table', collapsed : false, styles : {'float' : 'left'}}
          ],

          aligncenter : [
            {selector : 'p,h1,h2,h3,h4,h5,h6,td,th,div', attributes: {'align' : 'center'}},
            {selector : 'li', styles: {'list-style-position': 'inside', 'text-align': 'center'},
              remove_similar: true,
              expand: true,
              split: true,
              deep: true,
              inherit: false},
            {selector : 'img', collapsed : false, styles : {display : 'block', marginLeft : 'auto', marginRight : 'auto'}},
            {selector : 'table', collapsed : false, styles : {marginLeft : 'auto', marginRight : 'auto'}}
          ],

          alignright : [
            {selector : 'p,h1,h2,h3,h4,h5,h6,td,th,div', attributes : {'align' : 'right'}},
            {selector : 'li', styles: {'list-style-position': 'inside', 'text-align': 'right'},
              remove_similar: true,
              expand: true,
              split: true,
              deep: true,
              inherit: false},
            {selector : 'img,table', collapsed : false, styles : {'float' : 'right'}}
          ],

          alignfull : [
            {selector : 'p,h1,h2,h3,h4,h5,h6,td,th,div', attributes : {'align' : 'justify'}},
            {selector : 'li', styles: {'list-style-position': '', 'text-align': 'justify'},
              remove_similar: true,
              expand: true,
              split: true,
              deep: true,
              inherit: false}
          ],

          removefontsize: {inline: 'span', styles: {fontSize: ''}, links: true, remove_similar: true},

          removefontname: {inline: 'span', styles: {fontFamily: ''}, links: true, remove_similar: true},

          emptyspan: {selector: 'span', attributes: ['style', 'class'], remove: 'empty', split: true, expand: false, deep: true}

        });
      });

      tinymce.extend(ed, {
        /**
         * Makes the editor readonly. This turns off contentEditable on the editor body element,
         * disables the toolbar buttons, and saves the selection so it can be restored when the
         * editor becomes editable again.
         *
         * @param {Boolean} ro Whether to make the editor readonly or not.
         */
        makeReadOnly: function (ro) {

          var body = this.getBody(),
            $body = $(body);

{'fraction_non_alphanumeric': 0.14366326063748666, 'fraction_numerical': 0.008540491078237, 'mean_word_length': 2.2084148727984343, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '5033986', 'n_tokens_mistral': 1969, 'n_tokens_neox': 1904, 'n_words': 555}