Skip to content

Commit db05438

Browse files
committed
Remove the toolbar button
This feature should only be in the Insert menu.
1 parent ba660f1 commit db05438

File tree

7 files changed

+6
-47
lines changed

7 files changed

+6
-47
lines changed

amd/build/commands.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

amd/build/commands.min.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

amd/build/configuration.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

amd/build/configuration.min.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

amd/src/commands.js

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -67,13 +67,6 @@ const registerManagerCommand = async(editor, buttonText, buttonImage) => {
6767
};
6868

6969
editor.ui.registry.addIcon(icon, buttonImage.html);
70-
editor.ui.registry.addButton(buttonName, {
71-
icon: icon,
72-
tooltip: buttonText,
73-
onAction: async() => {
74-
await handleDialogManager();
75-
}
76-
});
7770

7871
editor.ui.registry.addMenuItem(buttonName, {
7972
icon: icon,
@@ -82,20 +75,4 @@ const registerManagerCommand = async(editor, buttonText, buttonImage) => {
8275
await handleDialogManager();
8376
}
8477
});
85-
86-
// Register the Menu Button as a toggle.
87-
editor.ui.registry.addToggleButton(buttonName, {
88-
icon: icon,
89-
tooltip: buttonText,
90-
onAction: async() => {
91-
await handleDialogManager();
92-
},
93-
onSetup: (api) => {
94-
editor.on('NodeChange', () => {
95-
const dialog = new DialogManager(editor);
96-
// Set the button to be active if the current selection matches the embed question code format.
97-
api.setActive(!!dialog.getEmbedCodeFromTextSelection(editor));
98-
});
99-
},
100-
});
10178
};

amd/src/configuration.js

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -22,18 +22,7 @@
2222
*/
2323

2424
import {buttonName} from './common';
25-
import {addMenubarItem, addToolbarButton} from 'editor_tiny/utils';
26-
27-
/**
28-
* This function control where the button is display in the editor.
29-
*
30-
* @param {Object} toolbar
31-
* @returns {addToolbarButton}
32-
*/
33-
const configureToolbar = (toolbar) => {
34-
toolbar = addToolbarButton(toolbar, 'formatting', buttonName);
35-
return toolbar;
36-
};
25+
import {addMenubarItem} from 'editor_tiny/utils';
3726

3827
/**
3928
* This function control where the button is display in the menu bar of the editor.
@@ -43,7 +32,6 @@ const configureToolbar = (toolbar) => {
4332
*/
4433
export const configure = (instanceConfig) => {
4534
return {
46-
toolbar: configureToolbar(instanceConfig.toolbar),
4735
menu: addMenubarItem(instanceConfig.menu, 'insert', buttonName),
4836
};
4937
};

classes/plugininfo.php

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
* @copyright 2024 The Open University
3030
* @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
3131
*/
32-
class plugininfo extends plugin implements plugin_with_buttons, plugin_with_configuration {
32+
class plugininfo extends plugin implements plugin_with_configuration {
3333

3434
public static function is_enabled(context $context, array $options, array $fpoptions,
3535
?\editor_tiny\editor $editor = null): bool {
@@ -39,12 +39,6 @@ public static function is_enabled(context $context, array $options, array $fpopt
3939
return has_any_capability(['moodle/question:useall', 'moodle/question:usemine'], $context);
4040
}
4141

42-
public static function get_available_buttons(): array {
43-
return [
44-
'tiny_embedquestion',
45-
];
46-
}
47-
4842
public static function get_plugin_configuration_for_context(
4943
context $context,
5044
array $options,

0 commit comments

Comments
 (0)