Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 690858f7

Von Sven Schöling vor etwa 1 Jahr hinzugefügt

  • ID 690858f74e099d1c6b4c7b067ca180fe88102100
  • Vorgänger fdb9921e
  • Nachfolger 6ba1d201

ckeditor5: ckeditor keypress events in actionbar accesskeys ignorieren

Unterschiede anzeigen:

js/kivi.ActionBar.js
94 94
              || (e.target.tagName == 'SELECT')))
95 95
        return true;
96 96

  
97
      // special case ckeditor: if the event originates from the editable area of the ckeditor, ignore it, otherwise we drown in Enter events
98
      if (e.target.classList.contains('ck-content'))
99
        return true;
100

  
101
      console.warn(e);
102
      console.warn(this);
103

  
97 104
      if ((target in kivi.ActionBar.Accesskeys.actions) && (accesskey in kivi.ActionBar.Accesskeys.actions[target])) {
98 105
        e.stopPropagation();
99 106
        kivi.ActionBar.Accesskeys.actions[target][accesskey].click();
templates/webpages/test/ckeditor.html
19 19
</form>
20 20
</fieldset>
21 21

  
22
<h3>inside div with enter listener</h3>
23

  
24
<fieldset>
25
  <div id='name3div'>
26
    [% P.textarea_tag('name3', "<p>Try to hit enter here</p>", class="texteditor") %]
27
  </div>
28
  <script>
29
    document.querySelector('#name3div').addEventListener('keypress', function(e) {
30
      alert("got keypressed event!" + e);
31
    });
32
  </script>
33
</fieldset>
34

  
35
<h3>inside div with jquery enter listener</h3>
36

  
37
<fieldset>
38
  <div id='name4div'>
39
    [% P.textarea_tag('name4', "<p>Try to hit enter here</p>", class="texteditor") %]
40
  </div>
41
  <script>
42
    $('#name4div').on('keypress', function(e) {
43
      alert("got keypressed event!" + e);
44
    });
45
  </script>
46
</fieldset>
47

  
22 48
<h3>initial focus</h3>
23 49

  
24
[% P.textarea_tag('name4', "<p>this is a text</p>", class="texteditor texteditor-autofocus") %]
50
[% P.textarea_tag('name5', "<p>this is a text</p>", class="texteditor texteditor-autofocus") %]
25 51

  
26 52
<h3>with custom width/height</h3>
27 53

  
28
[% P.textarea_tag('name5', "<p>this is a text</p>", style="width: 350px; height: 150px", class="texteditor") %]
54
[% P.textarea_tag('name6', "<p>this is a text</p>", style="width: 350px; height: 150px", class="texteditor") %]

Auch abrufbar als: Unified diff