Projet

Général

Profil

Révision 59ae487e

Ajouté par Assos Assos il y a presque 7 ans

Weekly update of contrib modules

Voir les différences:

drupal7/sites/all/modules/media_ckeditor/js/plugins/media/plugin.js
17 17
    // disabled by default.
18 18
    hasWidgetSupport: false,
19 19
    mediaLegacyWrappers: false,
20
    hidpi: true,
20 21
    onLoad: function() {
21 22
      // Check if this instance has widget support.
22 23
      mediaPluginDefinition.hasWidgetSupport = typeof(CKEDITOR.plugins.registered.widget) != 'undefined';
......
37 38
            content: ''
38 39
          };
39 40
          var selection = editor.getSelection();
40

  
41 41
          if (selection) {
42 42
            data.node = selection.getSelectedElement();
43

  
43 44
            if (data.node) {
44 45
              data.node = data.node.$;
45 46
            }
......
56 57
              data.content = data.node.parentNode.innerHTML;
57 58
            }
58 59
          }
60

  
61
          // If we are inside another media element, we need to move the cursor to the end of the element
62
          var selected_element = selection.getStartElement();
63
          var parent = selected_element.getParent();
64
          //if we are inside "a" tag and inside "span" (with class media-element)
65
          if (selected_element.is('a') && parent.is('span') && parent.hasClass('media-element')) {
66
            selection.selectElement(parent);
67
            selected_ranges = selection.getRanges();
68
            selected_ranges[0].collapse(false);
69
            selection.selectRanges(selected_ranges);
70
          }
71
          //if we are outside "a" tag but inside "span" (with class media-element)
72
          else if (selected_element.is('span') && selected_element.hasClass('media-element')) {
73
              selection.selectElement(selected_element);
74
              selected_ranges = selection.getRanges();
75
              selected_ranges[0].collapse(false);
76
              selection.selectRanges(selected_ranges);
77
          }
59 78
          Drupal.settings.ckeditor.plugins['media'].invoke(data, Drupal.settings.ckeditor.plugins['media'], editor.name);
60 79
        }
61 80
      });
......
88 107
      editor.ui.addButton( 'Media',
89 108
      {
90 109
        label: 'Add media',
91
        command: 'media',
92
        icon: this.path + 'images/icon.gif'
110
        command: 'media'
93 111
      });
94 112

  
95 113
      var ckeditorversion = parseFloat(CKEDITOR.version);

Formats disponibles : Unified diff