Last active
June 22, 2020 16:51
-
-
Save webhasan/44aa034d5ffc9be05eec91f8c357d0a2 to your computer and use it in GitHub Desktop.
User WordPress tinymce including media uploader in JavaScript
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// also need to enqueue script and style for tinymce | |
// by wp_enqueue_editor(); in php side | |
let {tinymce: tinymceObj, quicktags: quicktagsObj} = wp.editor.getDefaultSettings(); | |
// textarea-id = id of the field | |
wp.editor.initialize('textarea-id', { | |
tinymce: { | |
...tinymceObj, | |
"toolbar1": "formatselect,bold,italic,bullist,numlist,blockquote,alignleft,aligncenter,alignright,link,unlink,wp_more,spellchecker,wp_add_media,wp_adv", | |
"toolbar2": "strikethrough,hr,forecolor,pastetext,removeformat,charmap,outdent,indent,undo,redo,wp_help", | |
"plugins": "charmap,colorpicker,hr,lists,media,paste,tabfocus,textcolor,fullscreen,wordpress,wpautoresize,wpeditimage,wpemoji,wpgallery,wplink,wpdialogs,wptextpattern,wpview", | |
}, | |
quicktags: quicktagsObj | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment