TinyMCE: wptextpattern: add docs
Props DrewAPicture and iseulde. See #31441. git-svn-id: https://develop.svn.wordpress.org/trunk@32703 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
9dcaac39e2
commit
fc74e695f5
@ -1,9 +1,29 @@
|
||||
/**
|
||||
* Text pattern plugin for TinyMCE
|
||||
*
|
||||
* @since 4.3.0
|
||||
*
|
||||
* This plugin can automatically format text patterns as you type. It includes two patterns:
|
||||
* - Unordered list (`* ` and `- `).
|
||||
* - Ordered list (`1. ` and `1) `).
|
||||
*
|
||||
* If the transformation in unwanted, the user can undo the change by pressing backspace,
|
||||
* using the undo shortcut, or the undo button in the toolbar.
|
||||
*/
|
||||
( function( tinymce, setTimeout ) {
|
||||
tinymce.PluginManager.add( 'wptextpattern', function( editor ) {
|
||||
var $$ = editor.$,
|
||||
patterns = [],
|
||||
canUndo = false;
|
||||
|
||||
/**
|
||||
* Add a pattern to format with a callback.
|
||||
*
|
||||
* @since 4.3.0
|
||||
*
|
||||
* @param {RegExp} regExp
|
||||
* @param {Function} callback
|
||||
*/
|
||||
function add( regExp, callback ) {
|
||||
patterns.push( {
|
||||
regExp: regExp,
|
||||
|
Loading…
Reference in New Issue
Block a user