Last active
June 2, 2023 05:14
-
-
Save rheinardkorf/aec4d46d3833d2f7a6a27c4481ba0b44 to your computer and use it in GitHub Desktop.
Example usage of JS editor API WordPress 4.8+
This file contains hidden or 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
// Remember to wp_enqueue_editor(); inside PHP. | |
// Add editor | |
wp.editor.initialize( | |
'test-editor', | |
{ | |
tinymce: { | |
wpautop:true, | |
plugins : 'charmap colorpicker compat3x directionality fullscreen hr image lists media paste tabfocus textcolor wordpress wpautoresize wpdialogs wpeditimage wpemoji wpgallery wplink wptextpattern wpview', | |
toolbar1: 'formatselect bold italic | bullist numlist | blockquote | alignleft aligncenter alignright | link unlink | wp_more | spellchecker' | |
}, | |
quicktags: true | |
} | |
); | |
// Remove editor | |
wp.editor.remove('test-editor'); |
Awesome @rheinardkorf!
Very good !
Except I have after that a toolbar with the shorthand buttons with the 'quicktags' property setted to 'true' and ability to switch between View & Text (code).
Okay done...
The quicktags to false removes as well the shorthand, but View-Text are removed too !
You save me an hour @rheinardkorf ;)
Glad that helped you @Web-Medias ... I completely forgot about this snippet :)
how to remove h1 tag form this api
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It didn't work, please write the full example including html