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. git-svn-id: https://develop.svn.wordpress.org/trunk@28775 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
39cf46851b
commit
9642d17ff8
@ -124,10 +124,10 @@ window.wp = window.wp || {};
|
|||||||
*/
|
*/
|
||||||
register: function( type, constructor ) {
|
register: function( type, constructor ) {
|
||||||
var defaultConstructor = {
|
var defaultConstructor = {
|
||||||
shortcode: type,
|
type: type,
|
||||||
View: {},
|
View: {},
|
||||||
toView: function( content ) {
|
toView: function( content ) {
|
||||||
var match = wp.shortcode.next( this.shortcode, content );
|
var match = wp.shortcode.next( this.type, content );
|
||||||
|
|
||||||
if ( ! match ) {
|
if ( ! match ) {
|
||||||
return;
|
return;
|
||||||
@ -488,7 +488,7 @@ window.wp = window.wp || {};
|
|||||||
* @param {HTMLElement} node
|
* @param {HTMLElement} node
|
||||||
*/
|
*/
|
||||||
edit: function( node ) {
|
edit: function( node ) {
|
||||||
var media = wp.media[ this.shortcode ],
|
var media = wp.media[ this.type ],
|
||||||
self = this,
|
self = this,
|
||||||
frame, data, callback;
|
frame, data, callback;
|
||||||
|
|
||||||
@ -501,7 +501,7 @@ window.wp = window.wp || {};
|
|||||||
} );
|
} );
|
||||||
|
|
||||||
callback = function( selection ) {
|
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 ) );
|
$( node ).attr( 'data-wpview-text', window.encodeURIComponent( shortcode ) );
|
||||||
wp.mce.views.refreshView( self, shortcode );
|
wp.mce.views.refreshView( self, shortcode );
|
||||||
frame.detach();
|
frame.detach();
|
||||||
@ -819,7 +819,7 @@ window.wp = window.wp || {};
|
|||||||
self = this,
|
self = this,
|
||||||
frame,
|
frame,
|
||||||
data,
|
data,
|
||||||
isURL = 'embedURL' === this.shortcode;
|
isURL = 'embedURL' === this.type;
|
||||||
|
|
||||||
$( document ).trigger( 'media:edit' );
|
$( document ).trigger( 'media:edit' );
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user