TinyMCE::type()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 5
ccs 0
cts 3
cp 0
rs 9.4285
cc 1
eloc 2
nc 1
nop 2
crap 2
1
<?php
2
/**
3
 * @author Sergii Bondarenko, <[email protected]>
4
 */
5
namespace Drupal\TqExtension\Utils\Wysiwyg;
6
7
// Contexts.
8
use Drupal\TqExtension\Context\RawTqContext;
9
10
class TinyMCE extends Wysiwyg
11
{
12
    public function __construct(RawTqContext $context)
13
    {
14
        $this->setContext($context);
15
        $this->setObject("tinyMCE.get('%s')");
16
    }
17
18
    /**
19
     * {@inheritdoc}
20
     */
21
    public function fill($text, $selector = '')
22
    {
23
        $this->execute('setContent', $selector, [$text]);
24
    }
25
26
    /**
27
     * {@inheritdoc}
28
     */
29
    public function type($text, $selector = '')
30
    {
31
        // Unfortunately, TinyMCE cannot type to an editor.
32
        $this->fill($text, $selector);
33
    }
34
35
    /**
36
     * {@inheritdoc}
37
     */
38
    public function read($selector = '')
39
    {
40
        return $this->execute('getContent', $selector);
41
    }
42
}
43