<commit_before>/**
 * **************************************************************
 * Angular JS module used to show HTML editor and toolbar on a page
 * @require:
 *  AngularJS
 *  TinyMce
 *  RcmHtmlEditor
 */

angular.module(
        'rcmAdmin',
        ['RcmHtmlEditor']
    )
/**
 * rcmAdminService
 */
    .factory(
        'rcmAdminService',
        [
            function () {
                return RcmAdminService;
            }
        ]
    )
/**
 * rcmAdmin.rcmAdminMenuActions
 */
    .directive(
        'rcmAdminMenuActions',
        [
            '$compile',
            'rcmAdminService',
            function ($compile, rcmAdminService) {

                var thisLink = function (scope, elm, attrs) {
                    scope.rcmAdminPage = rcmAdminService.getPage(
                        $compile(elm.contents())(scope)
                    );
                };

                return {
                    restrict: 'A',
                    link: thisLink
                }
            }
        ]
    )
/**
 * rcmAdmin.rcmAdminEditButton
 */
    .directive(
        'rcmAdminEditButton',
        [
            'rcmAdminService',
            function (rcmAdminService) {

                var thisLink = function (scope, elm, attrs) {

                    scope.rcmAdminPage = rcmAdminService.getPage();

                    elm.on('click', null, null, function () {

                        scope.rcmAdminPage.build(
                            function (page) {

                                var editingState = attrs.rcmAdminEditButton;

                                if (!editingState) {
                                    editingState = 'page';
                                }

                                if (editingState == 'cancel') {
                                    scope.rcmAdminPage.cancel();
                                    scope.$apply();
                                    return;
                                }

                                if (editingState == 'save') {
                                    scope.rcmAdminPage.save();
                                    scope.$apply();
                                    return;
                                }
<commit_msg>Fix double events<commit_after>/**
 * **************************************************************
 * Angular JS module used to show HTML editor and toolbar on a page
 * @require:
 *  AngularJS
 *  TinyMce
 *  RcmHtmlEditor
 */

angular.module(
        'rcmAdmin',
        ['RcmHtmlEditor']
    )
/**
 * rcmAdminService
 */
    .factory(
        'rcmAdminService',
        [
            function () {
                return RcmAdminService;
            }
        ]
    )
/**
 * rcmAdmin.rcmAdminMenuActions
 */
    .directive(
        'rcmAdminMenuActions',
        [
            '$compile',
            'rcmAdminService',
            function ($compile, rcmAdminService) {

                var thisLink = function (scope, elm, attrs) {
                    scope.rcmAdminPage = rcmAdminService.getPage(
                        $compile(elm.contents())(scope)
                    );
                };

                return {
                    restrict: 'A',
                    link: thisLink
                }
            }
        ]
    )
/**
 * rcmAdmin.rcmAdminEditButton
 */
    .directive(
        'rcmAdminEditButton',
        [
            'rcmAdminService',
            function (rcmAdminService) {

                var thisLink = function (scope, elm, attrs) {

                    scope.rcmAdminPage = rcmAdminService.getPage();

                    elm.unbind();
                    elm.bind('click', null, function () {

                        scope.rcmAdminPage.build(
                            function (page) {

                                var editingState = attrs.rcmAdminEditButton;

                                if (!editingState) {
                                    editingState = 'page';
                                }

                                if (editingState == 'cancel') {
                                    scope.rcmAdminPage.cancel();
                                    scope.$apply();
                                    return;
                                }

                                if (editingState == 'save') {
                                    scope.rcmAdminPage.save();
                                    scope.$apply();
                                    return;
                                }

{'fraction_non_alphanumeric': 0.1161504424778761, 'fraction_numerical': 0.0, 'mean_word_length': 0.9173027989821882, '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': 22, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '508373', 'n_tokens_mistral': 1106, 'n_tokens_neox': 1029, 'n_words': 180}