Version Description
(March 18, 2015) =
- Ensure use of jQuery respects jQuery.noConflict() mode in WP.
Download this release
Release Info
Developer | danielbachhuber |
Plugin | Shortcake (Shortcode UI) |
Version | 0.2.1 |
Comparing to | |
See all releases |
Code changes from version 0.2.0 to 0.2.1
- js/build/field-attachment.js +7 -7
- js/build/field-color.js +3 -3
- js/build/shortcode-ui.js +18 -18
- js/field-attachment.js +5 -5
- js/field-color.js +1 -1
- js/shortcode-ui.js +3 -3
- js/utils/shortcode-view-constructor.js +4 -4
- js/views/edit-attribute-field.js +2 -2
- js/views/shortcode-preview.js +6 -6
- js/views/shortcode-ui.js +2 -2
- js/views/tabbed-view.js +1 -1
- readme.txt +5 -1
- shortcode-ui.php +1 -1
js/build/field-attachment.js
CHANGED
@@ -36,7 +36,7 @@ module.exports = Shortcodes;
|
|
36 |
(function (global){
|
37 |
var sui = require('./utils/sui.js'),
|
38 |
editAttributeField = require('./views/edit-attribute-field.js'),
|
39 |
-
|
40 |
|
41 |
// Cache attachment IDs for quicker loading.
|
42 |
var iDCache = {};
|
@@ -108,23 +108,23 @@ sui.views.editAttributeFieldAttachment = editAttributeField.extend( {
|
|
108 |
*/
|
109 |
var renderPreview = function( attachment ) {
|
110 |
|
111 |
-
var $thumbnail =
|
112 |
|
113 |
if ( 'image' !== attachment.type ) {
|
114 |
|
115 |
-
|
116 |
src: attachment.icon,
|
117 |
alt: attachment.title,
|
118 |
} ).appendTo( $thumbnail );
|
119 |
|
120 |
-
|
121 |
class: 'filename',
|
122 |
html: '<div>' + attachment.title + '</div>',
|
123 |
} ).appendTo( $thumbnail );
|
124 |
|
125 |
} else {
|
126 |
|
127 |
-
|
128 |
src: attachment.sizes.thumbnail.url,
|
129 |
width: attachment.sizes.thumbnail.width,
|
130 |
height: attachment.sizes.thumbnail.height,
|
@@ -362,9 +362,9 @@ var editAttributeField = Backbone.View.extend( {
|
|
362 |
updateValue: function( e ) {
|
363 |
|
364 |
if ( this.model.get( 'attr' ) ) {
|
365 |
-
var $el =
|
366 |
} else {
|
367 |
-
var $el =
|
368 |
}
|
369 |
|
370 |
if ( 'radio' === this.model.attributes.type ) {
|
36 |
(function (global){
|
37 |
var sui = require('./utils/sui.js'),
|
38 |
editAttributeField = require('./views/edit-attribute-field.js'),
|
39 |
+
jQuery = (typeof window !== "undefined" ? window.jQuery : typeof global !== "undefined" ? global.jQuery : null);
|
40 |
|
41 |
// Cache attachment IDs for quicker loading.
|
42 |
var iDCache = {};
|
108 |
*/
|
109 |
var renderPreview = function( attachment ) {
|
110 |
|
111 |
+
var $thumbnail = jQuery('<div class="thumbnail"></div>');
|
112 |
|
113 |
if ( 'image' !== attachment.type ) {
|
114 |
|
115 |
+
jQuery( '<img/>', {
|
116 |
src: attachment.icon,
|
117 |
alt: attachment.title,
|
118 |
} ).appendTo( $thumbnail );
|
119 |
|
120 |
+
jQuery( '<div/>', {
|
121 |
class: 'filename',
|
122 |
html: '<div>' + attachment.title + '</div>',
|
123 |
} ).appendTo( $thumbnail );
|
124 |
|
125 |
} else {
|
126 |
|
127 |
+
jQuery( '<img/>', {
|
128 |
src: attachment.sizes.thumbnail.url,
|
129 |
width: attachment.sizes.thumbnail.width,
|
130 |
height: attachment.sizes.thumbnail.height,
|
362 |
updateValue: function( e ) {
|
363 |
|
364 |
if ( this.model.get( 'attr' ) ) {
|
365 |
+
var $el = jQuery( this.el ).find( '[name=' + this.model.get( 'attr' ) + ']' );
|
366 |
} else {
|
367 |
+
var $el = jQuery( this.el ).find( '[name="inner_content"]' );
|
368 |
}
|
369 |
|
370 |
if ( 'radio' === this.model.attributes.type ) {
|
js/build/field-color.js
CHANGED
@@ -36,7 +36,7 @@ module.exports = Shortcodes;
|
|
36 |
(function (global){
|
37 |
var sui = require('./utils/sui.js'),
|
38 |
editAttributeField = require('./views/edit-attribute-field.js'),
|
39 |
-
|
40 |
|
41 |
sui.views.editAttributeFieldColor = editAttributeField.extend( {
|
42 |
|
@@ -233,9 +233,9 @@ var editAttributeField = Backbone.View.extend( {
|
|
233 |
updateValue: function( e ) {
|
234 |
|
235 |
if ( this.model.get( 'attr' ) ) {
|
236 |
-
var $el =
|
237 |
} else {
|
238 |
-
var $el =
|
239 |
}
|
240 |
|
241 |
if ( 'radio' === this.model.attributes.type ) {
|
36 |
(function (global){
|
37 |
var sui = require('./utils/sui.js'),
|
38 |
editAttributeField = require('./views/edit-attribute-field.js'),
|
39 |
+
jQuery = (typeof window !== "undefined" ? window.jQuery : typeof global !== "undefined" ? global.jQuery : null);
|
40 |
|
41 |
sui.views.editAttributeFieldColor = editAttributeField.extend( {
|
42 |
|
233 |
updateValue: function( e ) {
|
234 |
|
235 |
if ( this.model.get( 'attr' ) ) {
|
236 |
+
var $el = jQuery( this.el ).find( '[name=' + this.model.get( 'attr' ) + ']' );
|
237 |
} else {
|
238 |
+
var $el = jQuery( this.el ).find( '[name="inner_content"]' );
|
239 |
}
|
240 |
|
241 |
if ( 'radio' === this.model.attributes.type ) {
|
js/build/shortcode-ui.js
CHANGED
@@ -226,9 +226,9 @@ var sui = require('./utils/sui.js'),
|
|
226 |
shortcodeViewConstructor = require('./utils/shortcode-view-constructor.js'),
|
227 |
mediaFrame = require('./views/media-frame.js'),
|
228 |
wp = (typeof window !== "undefined" ? window.wp : typeof global !== "undefined" ? global.wp : null),
|
229 |
-
|
230 |
|
231 |
-
|
232 |
|
233 |
// Create collection of shortcode models from data.
|
234 |
sui.shortcodes.add( shortcodeUIData.shortcodes );
|
@@ -242,7 +242,7 @@ $(document).ready(function(){
|
|
242 |
shortcode.get('shortcode_tag'),
|
243 |
// Must extend for 4.1.
|
244 |
// This is handled by wp.mce.views.register in 4.2.
|
245 |
-
|
246 |
);
|
247 |
}
|
248 |
} );
|
@@ -254,7 +254,7 @@ $(document).ready(function(){
|
|
254 |
(function (global){
|
255 |
sui = require('./sui.js');
|
256 |
wp = (typeof window !== "undefined" ? window.wp : typeof global !== "undefined" ? global.wp : null);
|
257 |
-
|
258 |
|
259 |
/**
|
260 |
* Generic shortcode mce view constructor.
|
@@ -330,7 +330,7 @@ var shortcodeViewConstructor = {
|
|
330 |
this.fetching = true;
|
331 |
|
332 |
wp.ajax.post( 'do_shortcode', {
|
333 |
-
post_id:
|
334 |
shortcode: this.shortcodeModel.formatShortcode(),
|
335 |
nonce: shortcodeUIData.nonces.preview,
|
336 |
}).done( function( response ) {
|
@@ -357,7 +357,7 @@ var shortcodeViewConstructor = {
|
|
357 |
|
358 |
// Backwards compatability for WP pre-4.2
|
359 |
if ( 'object' === typeof( shortcodeString ) ) {
|
360 |
-
shortcodeString = decodeURIComponent(
|
361 |
}
|
362 |
|
363 |
currentShortcode = this.parseShortcodeString( shortcodeString );
|
@@ -486,7 +486,7 @@ var shortcodeViewConstructor = {
|
|
486 |
if ( ! this.parsed ) {
|
487 |
|
488 |
wp.ajax.post( 'do_shortcode', {
|
489 |
-
post_id:
|
490 |
shortcode: this.shortcode.formatShortcode(),
|
491 |
nonce: shortcodeUIData.nonces.preview,
|
492 |
}).done( function( response ) {
|
@@ -604,9 +604,9 @@ var editAttributeField = Backbone.View.extend( {
|
|
604 |
updateValue: function( e ) {
|
605 |
|
606 |
if ( this.model.get( 'attr' ) ) {
|
607 |
-
var $el =
|
608 |
} else {
|
609 |
-
var $el =
|
610 |
}
|
611 |
|
612 |
if ( 'radio' === this.model.attributes.type ) {
|
@@ -1018,7 +1018,7 @@ var ShortcodePreview = Backbone.View.extend({
|
|
1018 |
|
1019 |
_.defaults( params || {}, { 'head': '', 'body': '', 'body_classes': 'shortcake shortcake-preview' });
|
1020 |
|
1021 |
-
$iframe =
|
1022 |
src: tinymce.Env.ie ? 'javascript:""' : '',
|
1023 |
frameBorder: '0',
|
1024 |
allowTransparency: 'true',
|
@@ -1033,10 +1033,10 @@ var ShortcodePreview = Backbone.View.extend({
|
|
1033 |
*/
|
1034 |
$iframe.load( function() {
|
1035 |
|
1036 |
-
self.autoresizeIframe(
|
1037 |
|
1038 |
-
var head =
|
1039 |
-
body =
|
1040 |
|
1041 |
head.html( params.head );
|
1042 |
body.html( params.body );
|
@@ -1099,7 +1099,7 @@ var ShortcodePreview = Backbone.View.extend({
|
|
1099 |
fetchShortcode: function( callback ) {
|
1100 |
|
1101 |
wp.ajax.post( 'do_shortcode', {
|
1102 |
-
post_id:
|
1103 |
shortcode: this.model.formatShortcode(),
|
1104 |
nonce: shortcodeUIData.nonces.preview,
|
1105 |
}).done( function( response ) {
|
@@ -1127,7 +1127,7 @@ var ShortcodePreview = Backbone.View.extend({
|
|
1127 |
});
|
1128 |
|
1129 |
styles = _.map( _.keys( styles ), function( href ) {
|
1130 |
-
return
|
1131 |
});
|
1132 |
|
1133 |
return styles;
|
@@ -1147,7 +1147,7 @@ var Backbone = (typeof window !== "undefined" ? window.Backbone : typeof global
|
|
1147 |
Toolbar = require('./media-toolbar.js'),
|
1148 |
SearchShortcode = require('./search-shortcode.js'),
|
1149 |
sui = require('./../utils/sui.js');
|
1150 |
-
|
1151 |
|
1152 |
var Shortcode_UI = Backbone.View.extend({
|
1153 |
|
@@ -1247,7 +1247,7 @@ var Shortcode_UI = Backbone.View.extend({
|
|
1247 |
|
1248 |
select: function(e) {
|
1249 |
this.controller.props.set( 'action', 'insert' );
|
1250 |
-
var target =
|
1251 |
var shortcode = sui.shortcodes.findWhere( { shortcode_tag: target.attr( 'data-shortcode' ) } );
|
1252 |
|
1253 |
if ( ! shortcode ) {
|
@@ -1341,7 +1341,7 @@ var TabbedView = Backbone.View.extend({
|
|
1341 |
event.stopPropagation();
|
1342 |
event.preventDefault();
|
1343 |
|
1344 |
-
var target =
|
1345 |
|
1346 |
this.select(target);
|
1347 |
},
|
226 |
shortcodeViewConstructor = require('./utils/shortcode-view-constructor.js'),
|
227 |
mediaFrame = require('./views/media-frame.js'),
|
228 |
wp = (typeof window !== "undefined" ? window.wp : typeof global !== "undefined" ? global.wp : null),
|
229 |
+
jQuery = (typeof window !== "undefined" ? window.jQuery : typeof global !== "undefined" ? global.jQuery : null);
|
230 |
|
231 |
+
jQuery(document).ready(function(){
|
232 |
|
233 |
// Create collection of shortcode models from data.
|
234 |
sui.shortcodes.add( shortcodeUIData.shortcodes );
|
242 |
shortcode.get('shortcode_tag'),
|
243 |
// Must extend for 4.1.
|
244 |
// This is handled by wp.mce.views.register in 4.2.
|
245 |
+
jQuery.extend( true, {}, shortcodeViewConstructor )
|
246 |
);
|
247 |
}
|
248 |
} );
|
254 |
(function (global){
|
255 |
sui = require('./sui.js');
|
256 |
wp = (typeof window !== "undefined" ? window.wp : typeof global !== "undefined" ? global.wp : null);
|
257 |
+
jQuery = (typeof window !== "undefined" ? window.jQuery : typeof global !== "undefined" ? global.jQuery : null);
|
258 |
|
259 |
/**
|
260 |
* Generic shortcode mce view constructor.
|
330 |
this.fetching = true;
|
331 |
|
332 |
wp.ajax.post( 'do_shortcode', {
|
333 |
+
post_id: jQuery( '#post_ID' ).val(),
|
334 |
shortcode: this.shortcodeModel.formatShortcode(),
|
335 |
nonce: shortcodeUIData.nonces.preview,
|
336 |
}).done( function( response ) {
|
357 |
|
358 |
// Backwards compatability for WP pre-4.2
|
359 |
if ( 'object' === typeof( shortcodeString ) ) {
|
360 |
+
shortcodeString = decodeURIComponent( jQuery(shortcodeString).attr('data-wpview-text') );
|
361 |
}
|
362 |
|
363 |
currentShortcode = this.parseShortcodeString( shortcodeString );
|
486 |
if ( ! this.parsed ) {
|
487 |
|
488 |
wp.ajax.post( 'do_shortcode', {
|
489 |
+
post_id: jQuery( '#post_ID' ).val(),
|
490 |
shortcode: this.shortcode.formatShortcode(),
|
491 |
nonce: shortcodeUIData.nonces.preview,
|
492 |
}).done( function( response ) {
|
604 |
updateValue: function( e ) {
|
605 |
|
606 |
if ( this.model.get( 'attr' ) ) {
|
607 |
+
var $el = jQuery( this.el ).find( '[name=' + this.model.get( 'attr' ) + ']' );
|
608 |
} else {
|
609 |
+
var $el = jQuery( this.el ).find( '[name="inner_content"]' );
|
610 |
}
|
611 |
|
612 |
if ( 'radio' === this.model.attributes.type ) {
|
1018 |
|
1019 |
_.defaults( params || {}, { 'head': '', 'body': '', 'body_classes': 'shortcake shortcake-preview' });
|
1020 |
|
1021 |
+
$iframe = jQuery( '<iframe/>', {
|
1022 |
src: tinymce.Env.ie ? 'javascript:""' : '',
|
1023 |
frameBorder: '0',
|
1024 |
allowTransparency: 'true',
|
1033 |
*/
|
1034 |
$iframe.load( function() {
|
1035 |
|
1036 |
+
self.autoresizeIframe( jQuery(this) );
|
1037 |
|
1038 |
+
var head = jQuery(this).contents().find('head'),
|
1039 |
+
body = jQuery(this).contents().find('body');
|
1040 |
|
1041 |
head.html( params.head );
|
1042 |
body.html( params.body );
|
1099 |
fetchShortcode: function( callback ) {
|
1100 |
|
1101 |
wp.ajax.post( 'do_shortcode', {
|
1102 |
+
post_id: jQuery( '#post_ID' ).val(),
|
1103 |
shortcode: this.model.formatShortcode(),
|
1104 |
nonce: shortcodeUIData.nonces.preview,
|
1105 |
}).done( function( response ) {
|
1127 |
});
|
1128 |
|
1129 |
styles = _.map( _.keys( styles ), function( href ) {
|
1130 |
+
return jQuery( '<link rel="stylesheet" type="text/css">' ).attr( 'href', href )[0].outerHTML;
|
1131 |
});
|
1132 |
|
1133 |
return styles;
|
1147 |
Toolbar = require('./media-toolbar.js'),
|
1148 |
SearchShortcode = require('./search-shortcode.js'),
|
1149 |
sui = require('./../utils/sui.js');
|
1150 |
+
jQuery = (typeof window !== "undefined" ? window.jQuery : typeof global !== "undefined" ? global.jQuery : null);
|
1151 |
|
1152 |
var Shortcode_UI = Backbone.View.extend({
|
1153 |
|
1247 |
|
1248 |
select: function(e) {
|
1249 |
this.controller.props.set( 'action', 'insert' );
|
1250 |
+
var target = jQuery(e.currentTarget).closest( '.shortcode-list-item' );
|
1251 |
var shortcode = sui.shortcodes.findWhere( { shortcode_tag: target.attr( 'data-shortcode' ) } );
|
1252 |
|
1253 |
if ( ! shortcode ) {
|
1341 |
event.stopPropagation();
|
1342 |
event.preventDefault();
|
1343 |
|
1344 |
+
var target = jQuery(event.currentTarget).attr('data-target');
|
1345 |
|
1346 |
this.select(target);
|
1347 |
},
|
js/field-attachment.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
var sui = require('sui-utils/sui'),
|
2 |
editAttributeField = require( 'sui-views/edit-attribute-field' ),
|
3 |
-
|
4 |
|
5 |
// Cache attachment IDs for quicker loading.
|
6 |
var iDCache = {};
|
@@ -72,23 +72,23 @@ sui.views.editAttributeFieldAttachment = editAttributeField.extend( {
|
|
72 |
*/
|
73 |
var renderPreview = function( attachment ) {
|
74 |
|
75 |
-
var $thumbnail =
|
76 |
|
77 |
if ( 'image' !== attachment.type ) {
|
78 |
|
79 |
-
|
80 |
src: attachment.icon,
|
81 |
alt: attachment.title,
|
82 |
} ).appendTo( $thumbnail );
|
83 |
|
84 |
-
|
85 |
class: 'filename',
|
86 |
html: '<div>' + attachment.title + '</div>',
|
87 |
} ).appendTo( $thumbnail );
|
88 |
|
89 |
} else {
|
90 |
|
91 |
-
|
92 |
src: attachment.sizes.thumbnail.url,
|
93 |
width: attachment.sizes.thumbnail.width,
|
94 |
height: attachment.sizes.thumbnail.height,
|
1 |
var sui = require('sui-utils/sui'),
|
2 |
editAttributeField = require( 'sui-views/edit-attribute-field' ),
|
3 |
+
jQuery = require('jquery');
|
4 |
|
5 |
// Cache attachment IDs for quicker loading.
|
6 |
var iDCache = {};
|
72 |
*/
|
73 |
var renderPreview = function( attachment ) {
|
74 |
|
75 |
+
var $thumbnail = jQuery('<div class="thumbnail"></div>');
|
76 |
|
77 |
if ( 'image' !== attachment.type ) {
|
78 |
|
79 |
+
jQuery( '<img/>', {
|
80 |
src: attachment.icon,
|
81 |
alt: attachment.title,
|
82 |
} ).appendTo( $thumbnail );
|
83 |
|
84 |
+
jQuery( '<div/>', {
|
85 |
class: 'filename',
|
86 |
html: '<div>' + attachment.title + '</div>',
|
87 |
} ).appendTo( $thumbnail );
|
88 |
|
89 |
} else {
|
90 |
|
91 |
+
jQuery( '<img/>', {
|
92 |
src: attachment.sizes.thumbnail.url,
|
93 |
width: attachment.sizes.thumbnail.width,
|
94 |
height: attachment.sizes.thumbnail.height,
|
js/field-color.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
var sui = require('sui-utils/sui'),
|
2 |
editAttributeField = require( 'sui-views/edit-attribute-field' ),
|
3 |
-
|
4 |
|
5 |
sui.views.editAttributeFieldColor = editAttributeField.extend( {
|
6 |
|
1 |
var sui = require('sui-utils/sui'),
|
2 |
editAttributeField = require( 'sui-views/edit-attribute-field' ),
|
3 |
+
jQuery = require('jquery');
|
4 |
|
5 |
sui.views.editAttributeFieldColor = editAttributeField.extend( {
|
6 |
|
js/shortcode-ui.js
CHANGED
@@ -3,9 +3,9 @@ var sui = require('sui-utils/sui'),
|
|
3 |
shortcodeViewConstructor = require('sui-utils/shortcode-view-constructor'),
|
4 |
mediaFrame = require('sui-views/media-frame'),
|
5 |
wp = require('wp'),
|
6 |
-
|
7 |
|
8 |
-
|
9 |
|
10 |
// Create collection of shortcode models from data.
|
11 |
sui.shortcodes.add( shortcodeUIData.shortcodes );
|
@@ -19,7 +19,7 @@ $(document).ready(function(){
|
|
19 |
shortcode.get('shortcode_tag'),
|
20 |
// Must extend for 4.1.
|
21 |
// This is handled by wp.mce.views.register in 4.2.
|
22 |
-
|
23 |
);
|
24 |
}
|
25 |
} );
|
3 |
shortcodeViewConstructor = require('sui-utils/shortcode-view-constructor'),
|
4 |
mediaFrame = require('sui-views/media-frame'),
|
5 |
wp = require('wp'),
|
6 |
+
jQuery = require('jquery');
|
7 |
|
8 |
+
jQuery(document).ready(function(){
|
9 |
|
10 |
// Create collection of shortcode models from data.
|
11 |
sui.shortcodes.add( shortcodeUIData.shortcodes );
|
19 |
shortcode.get('shortcode_tag'),
|
20 |
// Must extend for 4.1.
|
21 |
// This is handled by wp.mce.views.register in 4.2.
|
22 |
+
jQuery.extend( true, {}, shortcodeViewConstructor )
|
23 |
);
|
24 |
}
|
25 |
} );
|
js/utils/shortcode-view-constructor.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
sui = require('sui-utils/sui');
|
2 |
wp = require('wp');
|
3 |
-
|
4 |
|
5 |
/**
|
6 |
* Generic shortcode mce view constructor.
|
@@ -76,7 +76,7 @@ var shortcodeViewConstructor = {
|
|
76 |
this.fetching = true;
|
77 |
|
78 |
wp.ajax.post( 'do_shortcode', {
|
79 |
-
post_id:
|
80 |
shortcode: this.shortcodeModel.formatShortcode(),
|
81 |
nonce: shortcodeUIData.nonces.preview,
|
82 |
}).done( function( response ) {
|
@@ -103,7 +103,7 @@ var shortcodeViewConstructor = {
|
|
103 |
|
104 |
// Backwards compatability for WP pre-4.2
|
105 |
if ( 'object' === typeof( shortcodeString ) ) {
|
106 |
-
shortcodeString = decodeURIComponent(
|
107 |
}
|
108 |
|
109 |
currentShortcode = this.parseShortcodeString( shortcodeString );
|
@@ -232,7 +232,7 @@ var shortcodeViewConstructor = {
|
|
232 |
if ( ! this.parsed ) {
|
233 |
|
234 |
wp.ajax.post( 'do_shortcode', {
|
235 |
-
post_id:
|
236 |
shortcode: this.shortcode.formatShortcode(),
|
237 |
nonce: shortcodeUIData.nonces.preview,
|
238 |
}).done( function( response ) {
|
1 |
sui = require('sui-utils/sui');
|
2 |
wp = require('wp');
|
3 |
+
jQuery = require('jquery');
|
4 |
|
5 |
/**
|
6 |
* Generic shortcode mce view constructor.
|
76 |
this.fetching = true;
|
77 |
|
78 |
wp.ajax.post( 'do_shortcode', {
|
79 |
+
post_id: jQuery( '#post_ID' ).val(),
|
80 |
shortcode: this.shortcodeModel.formatShortcode(),
|
81 |
nonce: shortcodeUIData.nonces.preview,
|
82 |
}).done( function( response ) {
|
103 |
|
104 |
// Backwards compatability for WP pre-4.2
|
105 |
if ( 'object' === typeof( shortcodeString ) ) {
|
106 |
+
shortcodeString = decodeURIComponent( jQuery(shortcodeString).attr('data-wpview-text') );
|
107 |
}
|
108 |
|
109 |
currentShortcode = this.parseShortcodeString( shortcodeString );
|
232 |
if ( ! this.parsed ) {
|
233 |
|
234 |
wp.ajax.post( 'do_shortcode', {
|
235 |
+
post_id: jQuery( '#post_ID' ).val(),
|
236 |
shortcode: this.shortcode.formatShortcode(),
|
237 |
nonce: shortcodeUIData.nonces.preview,
|
238 |
}).done( function( response ) {
|
js/views/edit-attribute-field.js
CHANGED
@@ -31,9 +31,9 @@ var editAttributeField = Backbone.View.extend( {
|
|
31 |
updateValue: function( e ) {
|
32 |
|
33 |
if ( this.model.get( 'attr' ) ) {
|
34 |
-
var $el =
|
35 |
} else {
|
36 |
-
var $el =
|
37 |
}
|
38 |
|
39 |
if ( 'radio' === this.model.attributes.type ) {
|
31 |
updateValue: function( e ) {
|
32 |
|
33 |
if ( this.model.get( 'attr' ) ) {
|
34 |
+
var $el = jQuery( this.el ).find( '[name=' + this.model.get( 'attr' ) + ']' );
|
35 |
} else {
|
36 |
+
var $el = jQuery( this.el ).find( '[name="inner_content"]' );
|
37 |
}
|
38 |
|
39 |
if ( 'radio' === this.model.attributes.type ) {
|
js/views/shortcode-preview.js
CHANGED
@@ -61,7 +61,7 @@ var ShortcodePreview = Backbone.View.extend({
|
|
61 |
|
62 |
_.defaults( params || {}, { 'head': '', 'body': '', 'body_classes': 'shortcake shortcake-preview' });
|
63 |
|
64 |
-
$iframe =
|
65 |
src: tinymce.Env.ie ? 'javascript:""' : '',
|
66 |
frameBorder: '0',
|
67 |
allowTransparency: 'true',
|
@@ -76,10 +76,10 @@ var ShortcodePreview = Backbone.View.extend({
|
|
76 |
*/
|
77 |
$iframe.load( function() {
|
78 |
|
79 |
-
self.autoresizeIframe(
|
80 |
|
81 |
-
var head =
|
82 |
-
body =
|
83 |
|
84 |
head.html( params.head );
|
85 |
body.html( params.body );
|
@@ -142,7 +142,7 @@ var ShortcodePreview = Backbone.View.extend({
|
|
142 |
fetchShortcode: function( callback ) {
|
143 |
|
144 |
wp.ajax.post( 'do_shortcode', {
|
145 |
-
post_id:
|
146 |
shortcode: this.model.formatShortcode(),
|
147 |
nonce: shortcodeUIData.nonces.preview,
|
148 |
}).done( function( response ) {
|
@@ -170,7 +170,7 @@ var ShortcodePreview = Backbone.View.extend({
|
|
170 |
});
|
171 |
|
172 |
styles = _.map( _.keys( styles ), function( href ) {
|
173 |
-
return
|
174 |
});
|
175 |
|
176 |
return styles;
|
61 |
|
62 |
_.defaults( params || {}, { 'head': '', 'body': '', 'body_classes': 'shortcake shortcake-preview' });
|
63 |
|
64 |
+
$iframe = jQuery( '<iframe/>', {
|
65 |
src: tinymce.Env.ie ? 'javascript:""' : '',
|
66 |
frameBorder: '0',
|
67 |
allowTransparency: 'true',
|
76 |
*/
|
77 |
$iframe.load( function() {
|
78 |
|
79 |
+
self.autoresizeIframe( jQuery(this) );
|
80 |
|
81 |
+
var head = jQuery(this).contents().find('head'),
|
82 |
+
body = jQuery(this).contents().find('body');
|
83 |
|
84 |
head.html( params.head );
|
85 |
body.html( params.body );
|
142 |
fetchShortcode: function( callback ) {
|
143 |
|
144 |
wp.ajax.post( 'do_shortcode', {
|
145 |
+
post_id: jQuery( '#post_ID' ).val(),
|
146 |
shortcode: this.model.formatShortcode(),
|
147 |
nonce: shortcodeUIData.nonces.preview,
|
148 |
}).done( function( response ) {
|
170 |
});
|
171 |
|
172 |
styles = _.map( _.keys( styles ), function( href ) {
|
173 |
+
return jQuery( '<link rel="stylesheet" type="text/css">' ).attr( 'href', href )[0].outerHTML;
|
174 |
});
|
175 |
|
176 |
return styles;
|
js/views/shortcode-ui.js
CHANGED
@@ -6,7 +6,7 @@ var Backbone = require('backbone'),
|
|
6 |
Toolbar = require('sui-views/media-toolbar'),
|
7 |
SearchShortcode = require('sui-views/search-shortcode'),
|
8 |
sui = require('sui-utils/sui');
|
9 |
-
|
10 |
|
11 |
var Shortcode_UI = Backbone.View.extend({
|
12 |
|
@@ -106,7 +106,7 @@ var Shortcode_UI = Backbone.View.extend({
|
|
106 |
|
107 |
select: function(e) {
|
108 |
this.controller.props.set( 'action', 'insert' );
|
109 |
-
var target =
|
110 |
var shortcode = sui.shortcodes.findWhere( { shortcode_tag: target.attr( 'data-shortcode' ) } );
|
111 |
|
112 |
if ( ! shortcode ) {
|
6 |
Toolbar = require('sui-views/media-toolbar'),
|
7 |
SearchShortcode = require('sui-views/search-shortcode'),
|
8 |
sui = require('sui-utils/sui');
|
9 |
+
jQuery = require('jquery');
|
10 |
|
11 |
var Shortcode_UI = Backbone.View.extend({
|
12 |
|
106 |
|
107 |
select: function(e) {
|
108 |
this.controller.props.set( 'action', 'insert' );
|
109 |
+
var target = jQuery(e.currentTarget).closest( '.shortcode-list-item' );
|
110 |
var shortcode = sui.shortcodes.findWhere( { shortcode_tag: target.attr( 'data-shortcode' ) } );
|
111 |
|
112 |
if ( ! shortcode ) {
|
js/views/tabbed-view.js
CHANGED
@@ -72,7 +72,7 @@ var TabbedView = Backbone.View.extend({
|
|
72 |
event.stopPropagation();
|
73 |
event.preventDefault();
|
74 |
|
75 |
-
var target =
|
76 |
|
77 |
this.select(target);
|
78 |
},
|
72 |
event.stopPropagation();
|
73 |
event.preventDefault();
|
74 |
|
75 |
+
var target = jQuery(event.currentTarget).attr('data-target');
|
76 |
|
77 |
this.select(target);
|
78 |
},
|
readme.txt
CHANGED
@@ -3,7 +3,7 @@ Contributors: mattheu, danielbachhuber, jitendraharpalani, sanchothefat, bfintal
|
|
3 |
Tags: shortcodes
|
4 |
Requires at least: 4.1
|
5 |
Tested up to: 4.2
|
6 |
-
Stable tag: 0.2.
|
7 |
License: GPLv2 or later
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
@@ -28,6 +28,10 @@ Shortcake can be installed like any other WordPress plugin. Once you've done so,
|
|
28 |
|
29 |
== Changelog ==
|
30 |
|
|
|
|
|
|
|
|
|
31 |
= 0.2.0 (March 18, 2015) =
|
32 |
|
33 |
* JS abstracted using Browserify.
|
3 |
Tags: shortcodes
|
4 |
Requires at least: 4.1
|
5 |
Tested up to: 4.2
|
6 |
+
Stable tag: 0.2.1
|
7 |
License: GPLv2 or later
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
28 |
|
29 |
== Changelog ==
|
30 |
|
31 |
+
= 0.2.1 (March 18, 2015) =
|
32 |
+
|
33 |
+
* Ensure use of jQuery respects jQuery.noConflict() mode in WP.
|
34 |
+
|
35 |
= 0.2.0 (March 18, 2015) =
|
36 |
|
37 |
* JS abstracted using Browserify.
|
shortcode-ui.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
* Plugin Name: Shortcode UI
|
4 |
-
* Version: v0.2.
|
5 |
* Description: User Interface for adding shortcodes.
|
6 |
* Author: Fusion Engineering and community
|
7 |
* Author URI: http://next.fusion.net/tag/shortcode-ui/
|
1 |
<?php
|
2 |
/**
|
3 |
* Plugin Name: Shortcode UI
|
4 |
+
* Version: v0.2.1
|
5 |
* Description: User Interface for adding shortcodes.
|
6 |
* Author: Fusion Engineering and community
|
7 |
* Author URI: http://next.fusion.net/tag/shortcode-ui/
|