mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-23 17:48:01 +01:00
Diambiguate type
and shortcode
in TinyMCE view classes and their attached view.View
class. Has the added feature of not causing JS errors.
See #28532. Built from https://develop.svn.wordpress.org/trunk@28775 git-svn-id: http://core.svn.wordpress.org/trunk@28588 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
c504fb41a1
commit
9834317785
@ -124,10 +124,10 @@ window.wp = window.wp || {};
|
||||
*/
|
||||
register: function( type, constructor ) {
|
||||
var defaultConstructor = {
|
||||
shortcode: type,
|
||||
type: type,
|
||||
View: {},
|
||||
toView: function( content ) {
|
||||
var match = wp.shortcode.next( this.shortcode, content );
|
||||
var match = wp.shortcode.next( this.type, content );
|
||||
|
||||
if ( ! match ) {
|
||||
return;
|
||||
@ -488,7 +488,7 @@ window.wp = window.wp || {};
|
||||
* @param {HTMLElement} node
|
||||
*/
|
||||
edit: function( node ) {
|
||||
var media = wp.media[ this.shortcode ],
|
||||
var media = wp.media[ this.type ],
|
||||
self = this,
|
||||
frame, data, callback;
|
||||
|
||||
@ -501,7 +501,7 @@ window.wp = window.wp || {};
|
||||
} );
|
||||
|
||||
callback = function( selection ) {
|
||||
var shortcode = wp.media[ self.shortcode ].shortcode( selection ).string();
|
||||
var shortcode = wp.media[ self.type ].shortcode( selection ).string();
|
||||
$( node ).attr( 'data-wpview-text', window.encodeURIComponent( shortcode ) );
|
||||
wp.mce.views.refreshView( self, shortcode );
|
||||
frame.detach();
|
||||
@ -819,7 +819,7 @@ window.wp = window.wp || {};
|
||||
self = this,
|
||||
frame,
|
||||
data,
|
||||
isURL = 'embedURL' === this.shortcode;
|
||||
isURL = 'embedURL' === this.type;
|
||||
|
||||
$( document ).trigger( 'media:edit' );
|
||||
|
||||
|
2
wp-includes/js/mce-view.min.js
vendored
2
wp-includes/js/mce-view.min.js
vendored
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user