Skip to content

Commit 23ab20e

Browse files
committed
New QuickbarInsertImage command that is executed by the quickimage button.
1 parent 9dd1fb6 commit 23ab20e

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
@@ -230,6 +230,32 @@ For more details on configuring context toolbar groups and labels, see: xref:con
230230
=== New `QuickbarInsertImage` command that is executed by the `quickimage` button.
231231
// #TINY-11399
232232

233+
The **Quickbars** Plugin now allows integrators to overwrite the `+QuickbarInsertImage+` command, enabling customization of the quickimage button's behavior.
234+
235+
.Example of how to override the `+QuickbarInsertImage+` command:
236+
[source,js]
237+
----
238+
tinymce.init({
239+
selector: 'textarea',
240+
plugins: 'quickbars',
241+
toolbar: false,
242+
setup: (editor) => {
243+
editor.addCommand('QuickbarInsertImage', () => { // Add a custom command to the editor named "QuickbarInsertImage"
244+
const input = document.createElement('input'); // Create a new <input> element for file selection
245+
input.type = 'file'; // Set the input type to "file" for uploading files
246+
input.accept = 'image/*'; // Restrict the input to accept only image files
247+
input.onchange = (e) => { // Add an event listener to handle the file selection event
248+
const file = (e.target as HTMLInputElement).files?.[0]; // Get the selected file from the input element
249+
if (file) {
250+
console.log(file);
251+
}
252+
};
253+
input.click();
254+
});
255+
}
256+
});
257+
----
258+
233259
=== New `onSetup` function for context forms
234260
// #TINY-11494
235261

0 commit comments

Comments
 (0)