12/3/2023 0 Comments Tinymce windowmanager buttonsWindow manager reference, use this to open new windows and dialogs. Thankfully, the PHP is not as involved as the JavaScript. URI object to current document that holds the TinyMCE editor instance. Var returnText = '' + selectedText + '' Įd.execCommand('mceInsertContent', 0, returnText) We’ll use the create method of the tinymce object to create the plugin: Now, let’s work on the JavaScript! Start with the opening functions. Once you’re done making your icon image, place it in the img folder. HINT: There is an excellent project called Font-Awesome-SVG-PNG that has black and white SVG and PNG versions of Font Awesome’s icon sets. It seems the only way I can get it to work is by placing the onAction event handler at the dialog level and not at the button level. When I click on the Upload button, or drag and drop a file into the FileManager, nothing happens. 1 I've had the same issue trying to get the event from my custom button in a dialog. All of the features of the FileManager work, except for uploading files. You can do this however you want, but you’ll want to end up with a 48px x 48px image file. I have been able to successfully get it to load in TinyMCE's windowManager dialog. So, your theme folder should contain the following: We will need to create a js folder (if you don’t already have one), and inside that, create a tiny-mce folder in which we’ll create an img folder and a tiny-mce.js file. As with the previous tutorial, we’re going to write our PHP in the regular functions.php file, although again, I’d recommend having a separate functions folder with dedicated files, and requiring those, for a tidier approach. The TinyMCE editor is loaded in to the page using: wpeditor ('', 'iistest', 'teeny' > true) I've tried reinitialising the editor in the open dialog function and in many other places but I can't get this working properly. Plugin base class, this is a pseudo class that describes how a plugin is to be created for TinyMCE. Our final blockquote functionality with custom button File structure You can't click any of the buttons to actually do anything (please see image below).
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |