Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

COPage Editor: Add entrypoint for custom functions #8853

Open
wants to merge 1 commit into
base: trunk
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* https://www.ilias.de
* https://github.com/ILIAS-eLearning
*
******************************************************************** */
*********************************************************************/

const ACTIONS = {

Expand Down Expand Up @@ -57,5 +57,6 @@ const ACTIONS = {
SPLIT_PARAGRAPH: 'par.split',
MERGE_PREVIOUS: 'merge.previous',
SECTION_CLASS: 'sec.class', // section format
CUSTOM: 'custom',
};
export default ACTIONS;
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
import ACTIONS from '../actions/paragraph-action-types.js';
import PAGE_ACTIONS from '../../page/actions/page-action-types.js';
import TinyWrapper from './tiny-wrapper.js';
import TINY_CB from './tiny-wrapper-cb-types.js';
import AutoSave from './auto-save.js';

/**
* This file is part of ILIAS, a powerful learning management system
* published by ILIAS open source e-Learning e.V.
Expand All @@ -18,7 +12,13 @@ import AutoSave from './auto-save.js';
* https://www.ilias.de
* https://github.com/ILIAS-eLearning
*
******************************************************************** */
*********************************************************************/

import ACTIONS from '../actions/paragraph-action-types.js';
import PAGE_ACTIONS from '../../page/actions/page-action-types.js';
import TinyWrapper from './tiny-wrapper.js';
import TINY_CB from './tiny-wrapper-cb-types.js';
import AutoSave from './auto-save.js';

/**
* paragraph ui
Expand Down Expand Up @@ -1001,6 +1001,12 @@ export default class ParagraphUI {
});
break;

case ACTIONS.CUSTOM:
char_button.addEventListener('click', (event) => {
this.addBBCode(char_button.dataset.copgEdParContent, '')
});
break;

default:
char_button.addEventListener('click', (event) => {
dispatch.dispatch(map[actionType]());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public function getEditorElements(
int $style_id
): array {
$cfg = $page_gui->getPageConfig();
$menu = ilPageObjectGUI::getTinyMenu(
$menu = $page_gui->getTinyMenu(
$page_type,
$cfg->getEnableInternalLinks(),
$cfg->getEnableWikiLinks(),
Expand Down
8 changes: 6 additions & 2 deletions components/ILIAS/COPage/classes/class.ilPageObjectGUI.php
Original file line number Diff line number Diff line change
Expand Up @@ -1705,7 +1705,7 @@ public function setEditMode(): void
/**
* Get Tiny Menu
*/
public static function getTinyMenu(
public function getTinyMenu(
string $a_par_type,
bool $a_int_links = false,
bool $a_wiki_links = false,
Expand Down Expand Up @@ -1962,7 +1962,7 @@ public static function getTinyMenu(


// more
$menu["cont_more_functions"] = [];
$menu["cont_more_functions"] = $this->getCustomFunctions();
$menu["cont_more_functions"][] = ["text" => $lng->txt("cont_link") . '<i class="mce-ico mce-i-link"></i>', "action" => $links];

if ($a_keywords) {
Expand Down Expand Up @@ -3184,4 +3184,8 @@ public function afterDeleteContents(): void
{
}

protected function getCustomFunctions(): array
{
return [];
}
}
Loading