1
|
|
|
<?php |
2
|
|
|
declare(strict_types=1); |
3
|
|
|
|
4
|
|
|
/** |
5
|
|
|
* Saito - The Threaded Web Forum |
6
|
|
|
* |
7
|
|
|
* @copyright Copyright (c) the Saito Project Developers |
8
|
|
|
* @link https://github.com/Schlaefer/Saito |
9
|
|
|
* @license http://opensource.org/licenses/MIT |
10
|
|
|
*/ |
11
|
|
|
|
12
|
|
|
namespace BbcodeParser\Lib; |
13
|
|
|
|
14
|
|
|
use App\View\Helper\ParserHelper; |
15
|
|
|
|
16
|
|
|
class Editor |
17
|
|
|
{ |
18
|
|
|
/** |
19
|
|
|
* {@inheritDoc} |
20
|
|
|
*/ |
21
|
|
|
public function getEditorHelp(ParserHelper $helper): string |
22
|
|
|
{ |
23
|
|
|
return $helper->SaitoHelp->icon( |
24
|
|
|
'BbcodeParser.1', |
25
|
|
|
['label' => __d('bbcode_parser', 'parsedAsBbcode')] |
26
|
|
|
); |
27
|
|
|
} |
28
|
|
|
|
29
|
|
|
/** |
30
|
|
|
* {@inheritDoc} |
31
|
|
|
*/ |
32
|
|
|
public function getMarkupSet(): array |
33
|
|
|
{ |
34
|
|
|
return [ |
35
|
|
|
[ |
36
|
|
|
'name' => "<i class='fa fa-bold'></i>", |
37
|
|
|
'title' => __('Bold'), |
38
|
|
|
'className' => 'btn-markup-Bold', |
39
|
|
|
'type' => 'enclose', |
40
|
|
|
'openWith' => '[b]', |
41
|
|
|
'closeWith' => '[/b]', |
42
|
|
|
], |
43
|
|
|
[ |
44
|
|
|
'name' => "<i class='fa fa-italic'></i>", |
45
|
|
|
'title' => __('Italic'), |
46
|
|
|
'className' => 'btn-markup-Italic', |
47
|
|
|
'type' => 'enclose', |
48
|
|
|
'openWith' => '[i]', |
49
|
|
|
'closeWith' => '[/i]', |
50
|
|
|
], |
51
|
|
|
[ |
52
|
|
|
'name' => "<i class='fa fa-strikethrough'></i>", |
53
|
|
|
'title' => __('Strike Through'), |
54
|
|
|
'className' => 'btn-markup-Stroke', |
55
|
|
|
'type' => 'enclose', |
56
|
|
|
'openWith' => '[strike]', |
57
|
|
|
'closeWith' => '[/strike]', |
58
|
|
|
], |
59
|
|
|
[ |
60
|
|
|
'name' => "<i class='fa fa-s-code'></i>", |
61
|
|
|
'title' => __('Code'), |
62
|
|
|
'className' => 'btn-markup-Code', |
63
|
|
|
'type' => 'enclose', |
64
|
|
|
'openWith' => "[code=text]\n", |
65
|
|
|
'closeWith' => "\n[/code]", |
66
|
|
|
], |
67
|
|
|
[ |
68
|
|
|
'name' => "<i class='fa fa-list-ul'></i>", |
69
|
|
|
'title' => __('Bullet List'), |
70
|
|
|
'className' => 'btn-markup-List', |
71
|
|
|
'type' => 'enclose', |
72
|
|
|
'openWith' => "[list]\n[*] ", |
73
|
|
|
'closeWith' => "\n[*]\n[/list]", |
74
|
|
|
], |
75
|
|
|
[ |
76
|
|
|
'name' => "<i class='fa fa-stop'></i>", |
77
|
|
|
'className' => 'btn-markup-Spoiler', |
78
|
|
|
'title' => __('Spoiler'), |
79
|
|
|
'type' => 'enclose', |
80
|
|
|
'openWith' => '[spoiler]', |
81
|
|
|
'closeWith' => '[/spoiler]', |
82
|
|
|
], |
83
|
|
|
[ |
84
|
|
|
'name' => "<i class='fa fa-quote-left'></i>", |
85
|
|
|
'className' => 'btn-markup-Quote', |
86
|
|
|
'title' => __('Cite'), |
87
|
|
|
'type' => 'enclose', |
88
|
|
|
'openWith' => '[quote]', |
89
|
|
|
'closeWith' => '[/quote]', |
90
|
|
|
], |
91
|
|
|
[ |
92
|
|
|
'type' => 'separator', |
93
|
|
|
], |
94
|
|
|
[ |
95
|
|
|
'name' => "<i class='fa fa-link'></i>", |
96
|
|
|
'title' => __('Link'), |
97
|
|
|
'className' => 'btn-markup-Link', |
98
|
|
|
'type' => 'saito-link', |
99
|
|
|
'handler' => 'link', |
100
|
|
|
], |
101
|
|
|
[ |
102
|
|
|
'name' => "<i class='fa fa-multimedia'></i>", |
103
|
|
|
'className' => 'btn-markup-Media', |
104
|
|
|
'title' => __('Media'), |
105
|
|
|
'type' => 'saito-media', |
106
|
|
|
'handler' => 'media', |
107
|
|
|
], |
108
|
|
|
[ |
109
|
|
|
'name' => '<i class=\'fa fa-upload\'></i>', |
110
|
|
|
'title' => __('Upload'), |
111
|
|
|
'className' => 'btn-markup-Upload', |
112
|
|
|
'type' => 'saito-upload', |
113
|
|
|
'handler' => 'upload', |
114
|
|
|
], |
115
|
|
|
]; |
116
|
|
|
} |
117
|
|
|
} |
118
|
|
|
|