Skip to content

Commit 4582189

Browse files
authored
New QuickbarInsertImage command that is executed by the quickimage button. (#3557)
1 parent f87b6f6 commit 4582189

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

modules/ROOT/pages/7.6.0-release-notes.adoc

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,32 @@ tinymce.init({
267267
=== New `QuickbarInsertImage` command that is executed by the `quickimage` button.
268268
// #TINY-11399
269269

270+
The **Quickbars** Plugin now allows integrators to overwrite the `+QuickbarInsertImage+` command, enabling customization of the quickimage button's behavior.
271+
272+
.Example of how to override the `+QuickbarInsertImage+` command:
273+
[source,js]
274+
----
275+
tinymce.init({
276+
selector: 'textarea',
277+
plugins: 'quickbars',
278+
toolbar: false,
279+
setup: (editor) => {
280+
editor.addCommand('QuickbarInsertImage', () => { // Add a custom command to the editor named "QuickbarInsertImage"
281+
const input = document.createElement('input'); // Create a new <input> element for file selection
282+
input.type = 'file'; // Set the input type to "file" for uploading files
283+
input.accept = 'image/*'; // Restrict the input to accept only image files
284+
input.onchange = (e) => { // Add an event listener to handle the file selection event
285+
const file = (e.target as HTMLInputElement).files?.[0]; // Get the selected file from the input element
286+
if (file) {
287+
console.log(file);
288+
}
289+
};
290+
input.click();
291+
});
292+
}
293+
});
294+
----
295+
270296
=== New `onSetup` function for context forms
271297
// #TINY-11494
272298

0 commit comments

Comments
 (0)