Code Duplication    Length = 43-43 lines in 2 locations

public/js/tinymce/themes/inlite/theme.js 1 location

@@ 6863-6905 (lines=43) @@
6860
      var title = linkDetails.title;
6861
      return title.raw ? title.raw : title;
6862
    };
6863
    var setupAutoCompleteHandler = function (ctrl, editorSettings, bodyElm, fileType) {
6864
      var autocomplete = function (term) {
6865
        var linkTargets = LinkTargets.find(bodyElm);
6866
        var menuItems = createMenuItems(term, linkTargets, fileType, editorSettings);
6867
        ctrl.showAutoComplete(menuItems, term);
6868
      };
6869
      ctrl.on('autocomplete', function () {
6870
        autocomplete(ctrl.value());
6871
      });
6872
      ctrl.on('selectitem', function (e) {
6873
        var linkDetails = e.value;
6874
        ctrl.value(linkDetails.url);
6875
        var title = getTitle(linkDetails);
6876
        if (fileType === 'image') {
6877
          ctrl.fire('change', {
6878
            meta: {
6879
              alt: title,
6880
              attach: linkDetails.attach
6881
            }
6882
          });
6883
        } else {
6884
          ctrl.fire('change', {
6885
            meta: {
6886
              text: title,
6887
              attach: linkDetails.attach
6888
            }
6889
          });
6890
        }
6891
        ctrl.focus();
6892
      });
6893
      ctrl.on('click', function (e) {
6894
        if (ctrl.value().length === 0 && e.target.nodeName === 'INPUT') {
6895
          autocomplete('');
6896
        }
6897
      });
6898
      ctrl.on('PostRender', function () {
6899
        ctrl.getRoot().on('submit', function (e) {
6900
          if (!e.isDefaultPrevented()) {
6901
            addToHistory(ctrl.value(), fileType);
6902
          }
6903
        });
6904
      });
6905
    };
6906
    var statusToUiState = function (result) {
6907
      var status = result.status, message = result.message;
6908
      if (status === 'valid') {

public/js/tinymce/themes/modern/theme.js 1 location

@@ 6705-6747 (lines=43) @@
6702
      var title = linkDetails.title;
6703
      return title.raw ? title.raw : title;
6704
    };
6705
    var setupAutoCompleteHandler = function (ctrl, editorSettings, bodyElm, fileType) {
6706
      var autocomplete = function (term) {
6707
        var linkTargets = LinkTargets.find(bodyElm);
6708
        var menuItems = createMenuItems(term, linkTargets, fileType, editorSettings);
6709
        ctrl.showAutoComplete(menuItems, term);
6710
      };
6711
      ctrl.on('autocomplete', function () {
6712
        autocomplete(ctrl.value());
6713
      });
6714
      ctrl.on('selectitem', function (e) {
6715
        var linkDetails = e.value;
6716
        ctrl.value(linkDetails.url);
6717
        var title = getTitle(linkDetails);
6718
        if (fileType === 'image') {
6719
          ctrl.fire('change', {
6720
            meta: {
6721
              alt: title,
6722
              attach: linkDetails.attach
6723
            }
6724
          });
6725
        } else {
6726
          ctrl.fire('change', {
6727
            meta: {
6728
              text: title,
6729
              attach: linkDetails.attach
6730
            }
6731
          });
6732
        }
6733
        ctrl.focus();
6734
      });
6735
      ctrl.on('click', function (e) {
6736
        if (ctrl.value().length === 0 && e.target.nodeName === 'INPUT') {
6737
          autocomplete('');
6738
        }
6739
      });
6740
      ctrl.on('PostRender', function () {
6741
        ctrl.getRoot().on('submit', function (e) {
6742
          if (!e.isDefaultPrevented()) {
6743
            addToHistory(ctrl.value(), fileType);
6744
          }
6745
        });
6746
      });
6747
    };
6748
    var statusToUiState = function (result) {
6749
      var status = result.status, message = result.message;
6750
      if (status === 'valid') {