Proyectos de Subversion Moodle

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 efrain 1
---
2
layout: docs
3
title: "Emojipicker"
4
date: 2020-02-04T09:40:32+01:00
5
draft: false
6
tags:
7
- MDL-65896
8
- 3.8
9
---
10
 
11
## How it works
12
 
13
The emoji picker is used in the Moodle messaging interface and in Atto. It allows you to select an emoji which then is returned for use in your input element.
14
 
15
## Source files
16
 
17
* `lib/amd/src/emoji/picker.js`
18
* `lib/templates/emoji/picker.mustache`
19
 
20
## Examples
21
 
22
{{< example >}}
23
<div class="row">
24
    <div data-region="emojipickertest" class="col-md-9">
25
    </div>
26
<div class="col-md-3">
27
  <h4>Emoji picker result:<h4>
28
  <div data-region="emojivalue" style="font-size: 3rem"></div>
29
</div>
30
 
31
{{#js}}
32
require(
33
[
34
    'jquery',
35
    'core/templates',
36
    'core/emoji/picker'
37
],
38
function(
39
    $,
40
    templates,
41
    emojiPicker
42
) {
43
  var emojiCallback = function(emoji) {
44
    $('[data-region="emojivalue"]').html(emoji);
45
  }
46
 
47
    var testArea = $('[data-region="emojipickertest"]');
48
    templates.render('core/emoji/picker', {}).done(function(html, js) {
49
        templates.replaceNodeContents(testArea, html, js);
50
          emojiPicker(testArea[0], emojiCallback);
51
    });
52
 
53
});
54
{{/js}}
55
{{< /example >}}
56
 
57
## Usage
58
 
59
Fetch / render the core template ```core/emoji/picker.mustache``` and load the ```core/emoji/picker.js```. Render the template and run the js on the new domnode.
60
 
61
{{< highlight js >}}
62
emojiPicker(domNode, callback);
63
{{< /highlight >}}