19declare(strict_types=1);
37 bool $a_int_links =
false,
38 bool $a_wiki_links =
false,
39 bool $a_keywords =
false,
41 $a_paragraph_styles =
true,
42 $a_save_return =
true,
47 $style_service = $this->style_service;
49 $user_id = $this->domain_service->user()->getId();
50 $ui_wrapper = $this->gui_service->edit()->uiWrapper();
51 $lng = $this->domain_service->lng();
52 $lng->loadLanguageModule(
"copg");
53 $ctrl = $this->gui_service->ctrl();
54 $ui = $this->gui_service->ui();
56 $ui->renderer()->renderAsync($ui->factory()->legacy()->content(
""));
58 $page_config = $this->domain_service->pageConfig($a_par_type);
60 $style_access_manager = $style_service->domain()->access(
64 $char_manager = $style_service->domain()->characteristic(
69 $aset = new \ilSetting(
"adve");
71 $f =
static function (
string $type,
string $code) use ($char_manager,
$lng):
string {
72 $title = $char_manager->getPresentationTitle(
"text_inline", $type);
73 if ($title === $type) {
74 $title =
$lng->txt(
"cont_char_style_" . $code);
81 if ($a_style_id === 0) {
83 "Comment" => array(
"code" =>
"com",
"txt" =>
$f(
"Comment",
"com")),
84 "Quotation" => array(
"code" =>
"quot",
"txt" =>
$f(
"Quotation",
"quot")),
85 "Accent" => array(
"code" =>
"acc",
"txt" =>
$f(
"Accent",
"acc")),
86 "Code" => array(
"code" =>
"code",
"txt" =>
$f(
"Code",
"code"))
89 foreach (\ilPCParagraphGUI::_getTextCharacteristics($a_style_id,
true) as
$c) {
90 if (in_array(
$c, [
"Strong",
"Important",
"Emph"])) {
93 if (!isset($chars[
$c])) {
94 $title = $char_manager->getPresentationTitle(
"text_inline",
$c);
97 $chars[
"Code"] = array(
"code" =>
"code",
"txt" =>
$f(
"Code",
"code"));
100 $chars[
"Comment"] = array(
"code" =>
"com",
"txt" =>
$f(
"Comment",
"com"));
103 $chars[
"Quotation"] = array(
"code" =>
"quot",
"txt" =>
$f(
"Quotation",
"quot"));
106 $chars[
"Accent"] = array(
"code" =>
"acc",
"txt" =>
$f(
"Accent",
"acc"));
109 $chars[
$c] = array(
"code" =>
"",
"txt" => $title);
115 foreach ($chars as $key => $char) {
118 "active_" . $char[
"code"],
124 case "Code": $tag =
"code";
127 $html =
'<' . $tag .
' class="ilc_' . $t .
'_' . $key .
'" style="font-size:90%; margin-top:2px; margin-bottom:2px; position:static;">' . $char[
"txt"] .
"</" . $tag .
">";
128 $char_formats[] = [
"text" => $html,
"action" =>
"selection.format",
"data" => [
"format" => $key]];
133 $numbered_list = $ui->renderer()->render(
134 $ui->factory()->symbol()->glyph()->numberedlist(
null)
137 $bullet_list = $ui->renderer()->render(
138 $ui->factory()->symbol()->glyph()->bulletlist(
null)
141 $indent = $ui->renderer()->render(
142 $ui->factory()->symbol()->glyph()->listindent(
null)
145 $outdent = $ui->renderer()->render(
146 $ui->factory()->symbol()->glyph()->listoutdent(
null)
153 if ($aset->get(
"use_physical")) {
159 foreach ([
"str",
"emp",
"imp",
"sup",
"sub"] as
$c) {
167 $c_formats[] = [
"text" =>
'<span class="ilc_text_inline_Strong">' . $str .
'</span>',
168 "action" =>
"selection.format",
169 "data" => [
"format" =>
"Strong"],
170 "aria-label" =>
$lng->txt(
"cont_text_str")
174 $c_formats[] = [
"text" =>
'<span class="ilc_text_inline_Emph">' . $emp .
'</span>',
175 "action" =>
"selection.format",
176 "data" => [
"format" =>
"Emph"],
177 "aria-label" =>
$lng->txt(
"cont_text_emp")
181 $c_formats[] = [
"text" =>
'<span class="ilc_text_inline_Important">' . $imp .
'</span>',
182 "action" =>
"selection.format",
183 "data" => [
"format" =>
"Important"],
184 "aria-label" =>
$lng->txt(
"cont_text_imp")
188 $c_formats[] = [
"text" =>
'x<sup>2</sup>',
189 "action" =>
"selection.format",
190 "data" => [
"format" =>
"Sup"],
191 "aria-label" =>
$lng->txt(
"cont_text_sup")
195 $c_formats[] = [
"text" =>
'x<sub>2</sub>',
196 "action" =>
"selection.format",
197 "data" => [
"format" =>
"Sub"],
198 "aria-label" =>
$lng->txt(
"cont_text_sub")
204 $c_formats[] = [
"text" =>
"<i>A</i>",
205 "action" => $char_formats,
206 "aria-label" =>
$lng->txt(
"copg_more_character_formats")
208 $c_formats[] = [
"text" =>
'<i><strong><u>T</u></strong><sub>x</sub></i>',
209 "action" =>
"selection.removeFormat",
211 "aria-label" =>
$lng->txt(
"copg_remove_formats")
214 "cont_char_format" => $c_formats,
217 "text" => $bullet_list,
218 "action" =>
"list.bullet",
220 "aria-label" =>
$lng->txt(
"cont_bullet_list")
223 "text" => $numbered_list,
224 "action" =>
"list.number",
226 "aria-label" =>
$lng->txt(
"cont_numbered_list")
230 "action" =>
"list.outdent",
232 "aria-label" =>
$lng->txt(
"cont_list_outdent")
236 "action" =>
"list.indent",
238 "aria-label" =>
$lng->txt(
"cont_list_indent")
247 if (count($ulists) > 1) {
249 foreach ($ulists as
$c) {
250 $la[] = [
"action" =>
"list.bulletStyle",
"text" =>
$c,
"data" => [
"format" =>
$c]];
252 $menu[
"copg_list_styles"][] = [
"text" =>
$lng->txt(
"copg_list_style"),
"action" => $la];
254 if (count($olists) > 1) {
256 foreach ($olists as
$c) {
257 $la[] = [
"action" =>
"list.numberStyle",
"text" =>
$c,
"data" => [
"format" =>
$c]];
259 $menu[
"copg_list_styles"][] = [
"text" =>
$lng->txt(
"copg_list_style"),
"action" => $la];
261 if (count($ilists) > 1) {
263 foreach ($ilists as
$c) {
264 $la[] = [
"action" =>
"list.itemStyle",
"text" =>
$c,
"data" => [
"format" =>
$c]];
266 $menu[
"copg_list_styles"][] = [
"text" =>
$lng->txt(
"copg_list_item_style"),
"action" => $la];
274 $links[] = [
"text" =>
$lng->txt(
"cont_wiki_link_dialog"),
"action" =>
"link.wikiSelection",
"data" => [
275 "url" => $ctrl->getLinkTargetByClass(
"ilwikipagegui",
"")]];
276 $links[] = [
"text" =>
"[[" .
$lng->txt(
"cont_wiki_page") .
"]]",
"action" =>
"link.wiki",
"data" => []];
279 $links[] = [
"text" =>
$lng->txt(
"cont_text_iln_link"),
"action" =>
"link.internal",
"data" => []];
286 $links[] = [
"text" =>
$lng->txt(
"cont_text_xln"),
"action" =>
"link.external",
"data" => []];
289 $links[] = [
"text" =>
$lng->txt(
"cont_link_user"),
"action" =>
"link.user",
"data" => []];
294 $menu[
"cont_more_functions"] = [];
295 $menu[
"cont_more_functions"][] = [
"text" =>
$lng->txt(
"cont_link") .
'<i class="mce-ico mce-i-link"></i>',
"action" => $links];
298 $menu[
"cont_more_functions"][] = [
"text" =>
$lng->txt(
"cont_keyword"),
"action" =>
"selection.keyword",
"data" => []];
300 $mathJaxSetting = new \ilSetting(
"MathJax");
306 $menu[
"cont_more_functions"][] = [
"text" =>
'Tex',
"action" =>
"selection.tex",
"data" => []];
313 $menu[
"cont_more_functions"][] = [
"text" =>
$lng->txt(
"cont_footnote"),
"action" =>
"selection.fn",
"data" => []];
316 $menu[
"cont_more_functions"][] = [
"text" =>
$lng->txt(
"cont_anchor"),
"action" =>
"selection.anchor",
"data" => []];
321 foreach ($page_config->getTextTemplates() as $k => $v) {
322 $k = $this->gui_service->html()->escape($k);
323 $v = $this->gui_service->html()->escape($v);
324 $templates[] = [
"text" => $k,
"action" =>
"text.template",
"data" => [
328 if (count($templates) > 0) {
329 $menu[
""][] = [
"text" => $page_config->getTextTemplatesDropdownCaption() .
'<i class="mce-ico mce-i-link"></i>',
"action" => $templates];
332 $btpl = new \ilTemplate(
"tpl.tiny_menu.html",
true,
true,
"components/ILIAS/COPage");
334 foreach ($menu as $section_title => $section) {
335 foreach ($section as $item) {
336 if (is_array($item[
"action"])) {
338 foreach ($item[
"action"] as $i) {
339 $buttons[] = $ui_wrapper->getButton(
346 $i[
"aria-label"] ??
""
349 $dd = $ui->factory()->dropdown()->standard($buttons)->withLabel($item[
"text"])
350 ->withAriaLabel($item[
"aria-label"] ??
"");
351 $btpl->setCurrentBlock(
"button");
352 $btpl->setVariable(
"BUTTON", $ui->renderer()->renderAsync($dd));
354 $b = $ui_wrapper->getRenderedButton(
361 $item[
"aria-label"] ??
""
363 $btpl->setCurrentBlock(
"button");
364 $btpl->setVariable(
"BUTTON",
$b);
366 $btpl->parseCurrentBlock();
368 if ($section_title !==
"") {
369 $btpl->setCurrentBlock(
"sec_head");
370 $btpl->setVariable(
"TXT_SECTION",
$lng->txt($section_title));
371 $btpl->parseCurrentBlock();
373 $btpl->setCurrentBlock(
"section");
374 $btpl->parseCurrentBlock();
378 if ($a_paragraph_styles) {
379 $sel = new \ParagraphStyleSelector($ui_wrapper, $a_style_id);
380 $dd = $sel->getStyleSelector(
" ");
381 $btpl->setCurrentBlock(
"par_edit");
382 $btpl->setVariable(
"TXT_PAR_FORMAT",
$lng->txt(
"cont_par_format"));
384 $btpl->setVariable(
"STYLE_SELECTOR", $ui->renderer()->renderAsync($dd));
386 $btpl->parseCurrentBlock();
390 $sel = new \SectionStyleSelector($ui_wrapper, $a_style_id);
391 $dd = $sel->getStyleSelector(
" ", $type =
"par-action", $action =
"sec.class", $attr =
"class",
true);
392 $btpl->setVariable(
"TXT_BLOCK",
$lng->txt(
"cont_sur_block_format"));
393 $btpl->setVariable(
"BLOCK_STYLE_SELECTOR", $ui->renderer()->renderAsync($dd));
395 $btpl->setVariable(
"TINY_HEADER",
$lng->txt(
"cont_text_editing"));
398 $ui_wrapper->getRenderedButton(
$lng->txt(
"cont_quit_text_editing"),
"par-action",
"save.return")
401 $btpl->setVariable(
"TXT_SAVING",
$lng->txt(
"cont_saving"));
static _getListCharacteristics(int $a_style_id, string $type)
static lookupSettingByParentType(string $a_par_type, string $a_name, string $a_default='0')
Lookup setting by parent type.
static getImagePath(string $image_name, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Interface Observer \BackgroundTasks Contains several chained tasks and infos about them.