Version Description
We've removed the compatibility shim for the placeholder attribute argument. You should register a placeholder for your field using the meta argument.
Download this release
Release Info
| Developer | danielbachhuber |
| Plugin | |
| Version | 0.4.0 |
| Comparing to | |
| See all releases | |
Code changes from version 0.3.0 to 0.4.0
- Gruntfile.js +1 -0
- css/sass/_field-image.scss +50 -4
- css/sass/shortcode-ui-editor-styles.scss +5 -0
- css/shortcode-ui-editor-styles.css +5 -0
- css/shortcode-ui-editor-styles.css.map +1 -1
- css/shortcode-ui.css +40 -5
- css/shortcode-ui.css.map +1 -1
- inc/class-shortcode-ui.php +13 -9
- inc/fields/class-field-attachment.php +4 -1
- inc/fields/class-field-color.php +1 -1
- inc/fields/class-field-post-select.php +1 -2
- inc/templates/edit-form.tpl.php +3 -3
- js/build/field-attachment.js +43 -17
- js/build/field-color.js +36 -14
- js/build/shortcode-ui.js +55 -21
- js/src/field-attachment.js +7 -3
- js/src/models/shortcode-attribute.js +1 -1
- js/src/models/shortcode.js +5 -1
- js/src/utils/shortcode-view-constructor.js +14 -1
- js/src/views/edit-attribute-field.js +30 -12
- js/src/views/edit-shortcode-form.js +4 -5
- js/src/views/media-frame.js +1 -1
- languages/shortcode-ui-es_ES.mo +0 -0
- languages/shortcode-ui-es_ES.po +98 -0
- languages/shortcode-ui-fr_FR.mo +0 -0
- languages/shortcode-ui-fr_FR.po +97 -0
- languages/shortcode-ui-zh_CN.mo +0 -0
- languages/shortcode-ui-zh_CN.po +97 -0
- languages/shortcode-ui.pot +14 -14
- lib/wp-js-hooks/wp-js-hooks.js +264 -0
- lib/wp-js-hooks/wp-js-hooks.min.js +1 -0
- readme.txt +22 -4
- shortcode-ui.php +4 -4
Gruntfile.js
CHANGED
|
@@ -125,6 +125,7 @@ module.exports = function( grunt ) {
|
|
| 125 |
'js-tests/vendor/underscore.js',
|
| 126 |
'js-tests/vendor/backbone.js',
|
| 127 |
'js-tests/vendor/wp-util.js',
|
|
|
|
| 128 |
'js-tests/vendor/mock-ajax.js',
|
| 129 |
],
|
| 130 |
}
|
| 125 |
'js-tests/vendor/underscore.js',
|
| 126 |
'js-tests/vendor/backbone.js',
|
| 127 |
'js-tests/vendor/wp-util.js',
|
| 128 |
+
'js-tests/vendor/wp-editors.js',
|
| 129 |
'js-tests/vendor/mock-ajax.js',
|
| 130 |
],
|
| 131 |
}
|
css/sass/_field-image.scss
CHANGED
|
@@ -37,6 +37,7 @@
|
|
| 37 |
width: 24px;
|
| 38 |
height: 24px;
|
| 39 |
padding: 0;
|
|
|
|
| 40 |
|
| 41 |
&:after {
|
| 42 |
content: "\00d7";
|
|
@@ -55,10 +56,37 @@
|
|
| 55 |
|
| 56 |
&.loading .loading-indicator {
|
| 57 |
display: block;
|
| 58 |
-
position:
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 62 |
}
|
| 63 |
|
| 64 |
.filename {
|
|
@@ -75,3 +103,21 @@
|
|
| 75 |
}
|
| 76 |
|
| 77 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 37 |
width: 24px;
|
| 38 |
height: 24px;
|
| 39 |
padding: 0;
|
| 40 |
+
overflow:hidden;
|
| 41 |
|
| 42 |
&:after {
|
| 43 |
content: "\00d7";
|
| 56 |
|
| 57 |
&.loading .loading-indicator {
|
| 58 |
display: block;
|
| 59 |
+
position: relative;
|
| 60 |
+
width: 100%;
|
| 61 |
+
height: 100%;
|
| 62 |
+
}
|
| 63 |
+
|
| 64 |
+
.loading-indicator {
|
| 65 |
+
.dashicons {
|
| 66 |
+
font-size: 80px;
|
| 67 |
+
height: 100px;
|
| 68 |
+
line-height: 100px;
|
| 69 |
+
width: 100%;
|
| 70 |
+
text-align: center;
|
| 71 |
+
vertical-align: middle;
|
| 72 |
+
}
|
| 73 |
+
.attachment-preview-loading {
|
| 74 |
+
width: 60px;
|
| 75 |
+
height: 5px;
|
| 76 |
+
overflow: hidden;
|
| 77 |
+
background-color: transparent;
|
| 78 |
+
margin: -30px auto 0;
|
| 79 |
+
|
| 80 |
+
ins {
|
| 81 |
+
background-color: #464646;
|
| 82 |
+
margin: 0 0 0 -60px;
|
| 83 |
+
width: 60px;
|
| 84 |
+
height: 5px;
|
| 85 |
+
display: block;
|
| 86 |
+
-webkit-animation: attachment-preview-loading 1.3s infinite 1s linear;
|
| 87 |
+
animation: attachment-preview-loading 1.3s infinite 1s linear;
|
| 88 |
+
}
|
| 89 |
+
}
|
| 90 |
}
|
| 91 |
|
| 92 |
.filename {
|
| 103 |
}
|
| 104 |
|
| 105 |
}
|
| 106 |
+
|
| 107 |
+
@-webkit-keyframes attachment-preview-loading {
|
| 108 |
+
0% {
|
| 109 |
+
margin-left: -60px;
|
| 110 |
+
}
|
| 111 |
+
100% {
|
| 112 |
+
margin-left: 60px;
|
| 113 |
+
}
|
| 114 |
+
}
|
| 115 |
+
|
| 116 |
+
@keyframes attachment-preview-loading {
|
| 117 |
+
0% {
|
| 118 |
+
margin-left: -60px;
|
| 119 |
+
}
|
| 120 |
+
100% {
|
| 121 |
+
margin-left: 60px;
|
| 122 |
+
}
|
| 123 |
+
}
|
css/sass/shortcode-ui-editor-styles.scss
CHANGED
|
@@ -16,5 +16,10 @@
|
|
| 16 |
color: #666;
|
| 17 |
font-size: 14px;
|
| 18 |
}
|
|
|
|
| 19 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 20 |
}
|
| 16 |
color: #666;
|
| 17 |
font-size: 14px;
|
| 18 |
}
|
| 19 |
+
}
|
| 20 |
|
| 21 |
+
body#wpview-iframe-sandbox {
|
| 22 |
+
display: inline-block;
|
| 23 |
+
width: 100%;
|
| 24 |
+
overflow: hidden;
|
| 25 |
}
|
css/shortcode-ui-editor-styles.css
CHANGED
|
@@ -8,4 +8,9 @@
|
|
| 8 |
color: #666;
|
| 9 |
font-size: 14px; }
|
| 10 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
/*# sourceMappingURL=shortcode-ui-editor-styles.css.map */
|
| 8 |
color: #666;
|
| 9 |
font-size: 14px; }
|
| 10 |
|
| 11 |
+
body#wpview-iframe-sandbox {
|
| 12 |
+
display: inline-block;
|
| 13 |
+
width: 100%;
|
| 14 |
+
overflow: hidden; }
|
| 15 |
+
|
| 16 |
/*# sourceMappingURL=shortcode-ui-editor-styles.css.map */
|
css/shortcode-ui-editor-styles.css.map
CHANGED
|
@@ -5,6 +5,6 @@
|
|
| 5 |
"../shortcode-ui-editor-styles.scss"
|
| 6 |
],
|
| 7 |
"sourcesContent": [],
|
| 8 |
-
"mappings": "AAGA,AAAY,AAA0B;EACnC,AAAS;AAIZ,AAAa;EACX,AAAO;EACP,AAAa;AAGf,AAAa;EACX,AAAa;EACb,AAAO;EACP,AAAW",
|
| 9 |
"names": []
|
| 10 |
}
|
| 5 |
"../shortcode-ui-editor-styles.scss"
|
| 6 |
],
|
| 7 |
"sourcesContent": [],
|
| 8 |
+
"mappings": "AAGA,AAAY,AAA0B;EACnC,AAAS;AAIZ,AAAa;EACX,AAAO;EACP,AAAa;AAGf,AAAa;EACX,AAAa;EACb,AAAO;EACP,AAAW;;AAIb,AAAI;EACH,AAAS;EACT,AAAO;EACP,AAAU",
|
| 9 |
"names": []
|
| 10 |
}
|
css/shortcode-ui.css
CHANGED
|
@@ -121,7 +121,8 @@
|
|
| 121 |
whitespace: nowrap;
|
| 122 |
width: 24px;
|
| 123 |
height: 24px;
|
| 124 |
-
padding: 0;
|
|
|
|
| 125 |
.edit-shortcode-form .shortcake-attachment-preview .button.remove:after {
|
| 126 |
content: "\00d7";
|
| 127 |
position: absolute;
|
|
@@ -133,10 +134,30 @@
|
|
| 133 |
display: none; }
|
| 134 |
.edit-shortcode-form .shortcake-attachment-preview.loading .loading-indicator {
|
| 135 |
display: block;
|
| 136 |
-
position:
|
| 137 |
-
|
| 138 |
-
|
| 139 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 140 |
.edit-shortcode-form .shortcake-attachment-preview .filename {
|
| 141 |
line-height: 1.4em; }
|
| 142 |
.edit-shortcode-form .shortcake-attachment-preview.has-attachment .button.add {
|
|
@@ -144,4 +165,18 @@
|
|
| 144 |
.edit-shortcode-form .shortcake-attachment-preview.has-attachment .button.remove {
|
| 145 |
display: block; }
|
| 146 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 147 |
/*# sourceMappingURL=shortcode-ui.css.map */
|
| 121 |
whitespace: nowrap;
|
| 122 |
width: 24px;
|
| 123 |
height: 24px;
|
| 124 |
+
padding: 0;
|
| 125 |
+
overflow: hidden; }
|
| 126 |
.edit-shortcode-form .shortcake-attachment-preview .button.remove:after {
|
| 127 |
content: "\00d7";
|
| 128 |
position: absolute;
|
| 134 |
display: none; }
|
| 135 |
.edit-shortcode-form .shortcake-attachment-preview.loading .loading-indicator {
|
| 136 |
display: block;
|
| 137 |
+
position: relative;
|
| 138 |
+
width: 100%;
|
| 139 |
+
height: 100%; }
|
| 140 |
+
.edit-shortcode-form .shortcake-attachment-preview .loading-indicator .dashicons {
|
| 141 |
+
font-size: 80px;
|
| 142 |
+
height: 100px;
|
| 143 |
+
line-height: 100px;
|
| 144 |
+
width: 100%;
|
| 145 |
+
text-align: center;
|
| 146 |
+
vertical-align: middle; }
|
| 147 |
+
.edit-shortcode-form .shortcake-attachment-preview .loading-indicator .attachment-preview-loading {
|
| 148 |
+
width: 60px;
|
| 149 |
+
height: 5px;
|
| 150 |
+
overflow: hidden;
|
| 151 |
+
background-color: transparent;
|
| 152 |
+
margin: -30px auto 0; }
|
| 153 |
+
.edit-shortcode-form .shortcake-attachment-preview .loading-indicator .attachment-preview-loading ins {
|
| 154 |
+
background-color: #464646;
|
| 155 |
+
margin: 0 0 0 -60px;
|
| 156 |
+
width: 60px;
|
| 157 |
+
height: 5px;
|
| 158 |
+
display: block;
|
| 159 |
+
-webkit-animation: attachment-preview-loading 1.3s infinite 1s linear;
|
| 160 |
+
animation: attachment-preview-loading 1.3s infinite 1s linear; }
|
| 161 |
.edit-shortcode-form .shortcake-attachment-preview .filename {
|
| 162 |
line-height: 1.4em; }
|
| 163 |
.edit-shortcode-form .shortcake-attachment-preview.has-attachment .button.add {
|
| 165 |
.edit-shortcode-form .shortcake-attachment-preview.has-attachment .button.remove {
|
| 166 |
display: block; }
|
| 167 |
|
| 168 |
+
@-webkit-keyframes attachment-preview-loading {
|
| 169 |
+
0% {
|
| 170 |
+
margin-left: -60px; }
|
| 171 |
+
|
| 172 |
+
100% {
|
| 173 |
+
margin-left: 60px; } }
|
| 174 |
+
|
| 175 |
+
@keyframes attachment-preview-loading {
|
| 176 |
+
0% {
|
| 177 |
+
margin-left: -60px; }
|
| 178 |
+
|
| 179 |
+
100% {
|
| 180 |
+
margin-left: 60px; } }
|
| 181 |
+
|
| 182 |
/*# sourceMappingURL=shortcode-ui.css.map */
|
css/shortcode-ui.css.map
CHANGED
|
@@ -6,6 +6,6 @@
|
|
| 6 |
"../_field-image.scss"
|
| 7 |
],
|
| 8 |
"sourcesContent": [],
|
| 9 |
-
"mappings": "AAAA,AAAY,AAAO;EAClB,AAAc;;AAKf,AAA2B;EACzB,AAAW;EACX,AAAY;EACZ,AAAQ;AAGV,AAA2B;EACzB,AAAK;;AAKP;EACC,AAAS;EAEV,AAAoB;IAElB,AAAQ;IACR,AAAO;IAEP,AAAsD;IACtD,AAA8C;IAC9C,AAAY;IACZ,AAAQ;IACR,AAAU;IACV,AAAY;IACZ,AAAO;IACP,AAAQ;IAEV,AAAoB,AAAqB;MAEtC,AAAW;MACX,AAAa;MACb,AAAgB;MAEnB,AAAoB,AAAqB,AAA8B;QACnE,AAAS;QACT,AAAW;QACX,AAAa;QACb,AAAO;QACP,AAAQ;QACR,AAAU;QACV,AAAK;IAKT,AAAoB,AAAqB;MACtC,AAAQ;MACR,AAAS;MACT,AAAU;MACV,AAAM;MACN,AAAO;MACP,AAAQ;MACR,AAAU;MACV,AAAY;MACZ,AAAW;MACX,AAAY;MACZ,AAAa;MACb,AAAY;MACZ,AAAoB;MACpB,AAAY;;AAOf,AAAsB;EACpB,AAAQ;EACR,AAAS;AAGX,AAAsB;EACpB,AAAS;EACT,AAAY;AAGd,AAAsB,AAAC;EACrB,AAAe;AAGjB,AAAsB;EACpB,AAAU;EACV,AAAQ;;AAIV;EAEC,AAAS;EAEV,AAAqB;IACnB,AAAS;IACT,AAAO;EAGT,AAAqB,AAAO,AAAqB;IAE/C,AAAQ;IACR,AAAoB;IACpB,AAAY;IACZ,AAAkB;IAClB,AAAO;IACP,AAAS;IACT,AAAoB;IACpB,AAAY;IACZ,AAAW;EAGb,AAAqB;IACnB,AAAO;IACP,AAAW;IACX,AAAY;EAId,AAAqB,AAA8B;IAAzC,AAAe;EAGzB,AAAqB;IACnB,AAAS;IACX,AAAqB,AAAa;MAC/B,AAAS;MACT,AAAe;EAIlB,AAAqB;IAInB,AAAa;IAHf,AAAqB,AAAc;MAChC,AAAS;;ACxIZ,AAAqB;EAEpB,AAAO;EACP,AAAQ;EACR,AAAQ;EACR,AAAa;EACb,AAAY;EACZ,AAAS;EAEV,AAAqB,AAA6B;IAChD,AAAS;EAGX,AAAqB,AAA6B,AAAK;IACrD,AAAQ;IACR,AAAe;IACf,AAAY;IACZ,AAAY;EAGd,AAAqB,AAA8B,AAAO;IACxD,AAAgB;IAChB,AAAS;EAGX,AAAqB,AAA8B,AAAO;IAExD,AAAS;IACT,AAAS;IACT,AAAU;IACV,AAAK;IACL,AAAO;IACP,AAAQ;IACR,AAAY;IACZ,AAAa;IACb,AAAY;IACZ,AAAO;IACP,AAAQ;IACR,AAAS;IAEX,AAAqB,AAA8B,AAAO,AAAO;MAC9D,AAAS;MACT,AAAU;MACV,AAAK;MACL,AAAM;MACN,AAAW;MACX,AAAa;EAIhB,AAAqB,AAA8B,AAAoB,AAAqB,AAA6B,AAAS,AAAO;IAEvI,AAAS;EAGX,AAAqB,AAA6B,AAAS;IACzD,AAAS;IACT,AAAU;IACV,
|
| 10 |
"names": []
|
| 11 |
}
|
| 6 |
"../_field-image.scss"
|
| 7 |
],
|
| 8 |
"sourcesContent": [],
|
| 9 |
+
"mappings": "AAAA,AAAY,AAAO;EAClB,AAAc;;AAKf,AAA2B;EACzB,AAAW;EACX,AAAY;EACZ,AAAQ;AAGV,AAA2B;EACzB,AAAK;;AAKP;EACC,AAAS;EAEV,AAAoB;IAElB,AAAQ;IACR,AAAO;IAEP,AAAsD;IACtD,AAA8C;IAC9C,AAAY;IACZ,AAAQ;IACR,AAAU;IACV,AAAY;IACZ,AAAO;IACP,AAAQ;IAEV,AAAoB,AAAqB;MAEtC,AAAW;MACX,AAAa;MACb,AAAgB;MAEnB,AAAoB,AAAqB,AAA8B;QACnE,AAAS;QACT,AAAW;QACX,AAAa;QACb,AAAO;QACP,AAAQ;QACR,AAAU;QACV,AAAK;IAKT,AAAoB,AAAqB;MACtC,AAAQ;MACR,AAAS;MACT,AAAU;MACV,AAAM;MACN,AAAO;MACP,AAAQ;MACR,AAAU;MACV,AAAY;MACZ,AAAW;MACX,AAAY;MACZ,AAAa;MACb,AAAY;MACZ,AAAoB;MACpB,AAAY;;AAOf,AAAsB;EACpB,AAAQ;EACR,AAAS;AAGX,AAAsB;EACpB,AAAS;EACT,AAAY;AAGd,AAAsB,AAAC;EACrB,AAAe;AAGjB,AAAsB;EACpB,AAAU;EACV,AAAQ;;AAIV;EAEC,AAAS;EAEV,AAAqB;IACnB,AAAS;IACT,AAAO;EAGT,AAAqB,AAAO,AAAqB;IAE/C,AAAQ;IACR,AAAoB;IACpB,AAAY;IACZ,AAAkB;IAClB,AAAO;IACP,AAAS;IACT,AAAoB;IACpB,AAAY;IACZ,AAAW;EAGb,AAAqB;IACnB,AAAO;IACP,AAAW;IACX,AAAY;EAId,AAAqB,AAA8B;IAAzC,AAAe;EAGzB,AAAqB;IACnB,AAAS;IACX,AAAqB,AAAa;MAC/B,AAAS;MACT,AAAe;EAIlB,AAAqB;IAInB,AAAa;IAHf,AAAqB,AAAc;MAChC,AAAS;;ACxIZ,AAAqB;EAEpB,AAAO;EACP,AAAQ;EACR,AAAQ;EACR,AAAa;EACb,AAAY;EACZ,AAAS;EAEV,AAAqB,AAA6B;IAChD,AAAS;EAGX,AAAqB,AAA6B,AAAK;IACrD,AAAQ;IACR,AAAe;IACf,AAAY;IACZ,AAAY;EAGd,AAAqB,AAA8B,AAAO;IACxD,AAAgB;IAChB,AAAS;EAGX,AAAqB,AAA8B,AAAO;IAExD,AAAS;IACT,AAAS;IACT,AAAU;IACV,AAAK;IACL,AAAO;IACP,AAAQ;IACR,AAAY;IACZ,AAAa;IACb,AAAY;IACZ,AAAO;IACP,AAAQ;IACR,AAAS;IACT,AAAS;IAEX,AAAqB,AAA8B,AAAO,AAAO;MAC9D,AAAS;MACT,AAAU;MACV,AAAK;MACL,AAAM;MACN,AAAW;MACX,AAAa;EAIhB,AAAqB,AAA8B,AAAoB,AAAqB,AAA6B,AAAS,AAAO;IAEvI,AAAS;EAGX,AAAqB,AAA6B,AAAS;IACzD,AAAS;IACT,AAAU;IACV,AAAO;IACP,AAAQ;EAIV,AAAqB,AAA8B,AAAmB;IACnE,AAAW;IACX,AAAQ;IACR,AAAa;IACb,AAAO;IACP,AAAY;IACZ,AAAgB;EAEnB,AAAqB,AAA8B,AAAmB;IACnE,AAAO;IACP,AAAQ;IACR,AAAU;IACV,AAAkB;IAClB,AAAQ;IAEX,AAAqB,AAA8B,AAAmB,AAA4B;MAC9F,AAAkB;MAClB,AAAQ;MACR,AAAO;MACP,AAAQ;MACR,AAAS;MACT,AAAmB;MACnB,AAAW;EAKf,AAAqB,AAA8B;IACjD,AAAa;EAIf,AAAqB,AAA6B,AAAgB,AAAO;IACtE,AAAS;EAEZ,AAAqB,AAA6B,AAAgB,AAAO;IACtE,AAAS;;mBAMO;EACnB;IACE,AAAa;;EAEf;IACE,AAAa;;WAIJ;EACX;IACE,AAAa;;EAEf;IACE,AAAa",
|
| 10 |
"names": []
|
| 11 |
}
|
inc/class-shortcode-ui.php
CHANGED
|
@@ -39,7 +39,6 @@ class Shortcode_UI {
|
|
| 39 |
$args['inner_content'] = array(
|
| 40 |
'label' => esc_html__( 'Inner Content', 'shortcode-ui' ),
|
| 41 |
'description' => '',
|
| 42 |
-
'placeholder' => '',
|
| 43 |
);
|
| 44 |
}
|
| 45 |
|
|
@@ -53,13 +52,14 @@ class Shortcode_UI {
|
|
| 53 |
}
|
| 54 |
|
| 55 |
public function get_shortcodes() {
|
| 56 |
-
return $this->shortcodes;
|
| 57 |
}
|
| 58 |
|
| 59 |
public function get_shortcode( $shortcode_tag ) {
|
| 60 |
|
| 61 |
-
|
| 62 |
-
|
|
|
|
| 63 |
}
|
| 64 |
|
| 65 |
}
|
|
@@ -69,7 +69,7 @@ class Shortcode_UI {
|
|
| 69 |
*/
|
| 70 |
public function action_admin_enqueue_scripts() {
|
| 71 |
// Editor styles needs to be added before wp_enqueue_editor
|
| 72 |
-
add_editor_style( $this->plugin_url . '
|
| 73 |
}
|
| 74 |
|
| 75 |
public function enqueue() {
|
|
@@ -81,8 +81,8 @@ class Shortcode_UI {
|
|
| 81 |
// make sure media library is queued
|
| 82 |
wp_enqueue_media();
|
| 83 |
|
| 84 |
-
$shortcodes = array_values( $this->
|
| 85 |
-
$screen = get_current_screen();
|
| 86 |
if ( $screen && ! empty( $screen->post_type ) ) {
|
| 87 |
foreach ( $shortcodes as $key => $args ) {
|
| 88 |
if ( ! empty( $args['post_type'] ) && ! in_array( $screen->post_type, $args['post_type'] ) ) {
|
|
@@ -97,7 +97,11 @@ class Shortcode_UI {
|
|
| 97 |
|
| 98 |
usort( $shortcodes, array( $this, 'compare_shortcodes_by_label' ) );
|
| 99 |
|
| 100 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 101 |
wp_enqueue_style( 'shortcode-ui', $this->plugin_url . 'css/shortcode-ui.css', array(), $this->plugin_version );
|
| 102 |
wp_localize_script( 'shortcode-ui', ' shortcodeUIData', array(
|
| 103 |
'shortcodes' => $shortcodes,
|
|
@@ -117,7 +121,7 @@ class Shortcode_UI {
|
|
| 117 |
'nonces' => array(
|
| 118 |
'preview' => wp_create_nonce( 'shortcode-ui-preview' ),
|
| 119 |
'thumbnailImage' => wp_create_nonce( 'shortcode-ui-get-thumbnail-image' ),
|
| 120 |
-
)
|
| 121 |
) );
|
| 122 |
|
| 123 |
// queue templates
|
| 39 |
$args['inner_content'] = array(
|
| 40 |
'label' => esc_html__( 'Inner Content', 'shortcode-ui' ),
|
| 41 |
'description' => '',
|
|
|
|
| 42 |
);
|
| 43 |
}
|
| 44 |
|
| 52 |
}
|
| 53 |
|
| 54 |
public function get_shortcodes() {
|
| 55 |
+
return apply_filters( 'shortcode_ui_shortcodes', $this->shortcodes );
|
| 56 |
}
|
| 57 |
|
| 58 |
public function get_shortcode( $shortcode_tag ) {
|
| 59 |
|
| 60 |
+
$shortcodes = $this->get_shortcodes();
|
| 61 |
+
if ( isset( $shortcodes[ $shortcode_tag ] ) ) {
|
| 62 |
+
return $shortcodes[ $shortcode_tag ];
|
| 63 |
}
|
| 64 |
|
| 65 |
}
|
| 69 |
*/
|
| 70 |
public function action_admin_enqueue_scripts() {
|
| 71 |
// Editor styles needs to be added before wp_enqueue_editor
|
| 72 |
+
add_editor_style( trailingslashit( $this->plugin_url ) . 'css/shortcode-ui-editor-styles.css' );
|
| 73 |
}
|
| 74 |
|
| 75 |
public function enqueue() {
|
| 81 |
// make sure media library is queued
|
| 82 |
wp_enqueue_media();
|
| 83 |
|
| 84 |
+
$shortcodes = array_values( $this->get_shortcodes() );
|
| 85 |
+
$screen = function_exists( 'get_current_screen' ) ? get_current_screen() : false;
|
| 86 |
if ( $screen && ! empty( $screen->post_type ) ) {
|
| 87 |
foreach ( $shortcodes as $key => $args ) {
|
| 88 |
if ( ! empty( $args['post_type'] ) && ! in_array( $screen->post_type, $args['post_type'] ) ) {
|
| 97 |
|
| 98 |
usort( $shortcodes, array( $this, 'compare_shortcodes_by_label' ) );
|
| 99 |
|
| 100 |
+
// Load minified version of wp-js-hooks if not debugging.
|
| 101 |
+
$wp_js_hooks_file = 'wp-js-hooks' . ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '.min' : '' ) . '.js';
|
| 102 |
+
|
| 103 |
+
wp_enqueue_script( 'shortcode-ui-js-hooks', $this->plugin_url . 'lib/wp-js-hooks/' . $wp_js_hooks_file, array(), '2015-03-19' );
|
| 104 |
+
wp_enqueue_script( 'shortcode-ui', $this->plugin_url . 'js/build/shortcode-ui.js', array( 'jquery', 'backbone', 'mce-view', 'shortcode-ui-js-hooks' ), $this->plugin_version );
|
| 105 |
wp_enqueue_style( 'shortcode-ui', $this->plugin_url . 'css/shortcode-ui.css', array(), $this->plugin_version );
|
| 106 |
wp_localize_script( 'shortcode-ui', ' shortcodeUIData', array(
|
| 107 |
'shortcodes' => $shortcodes,
|
| 121 |
'nonces' => array(
|
| 122 |
'preview' => wp_create_nonce( 'shortcode-ui-preview' ),
|
| 123 |
'thumbnailImage' => wp_create_nonce( 'shortcode-ui-get-thumbnail-image' ),
|
| 124 |
+
),
|
| 125 |
) );
|
| 126 |
|
| 127 |
// queue templates
|
inc/fields/class-field-attachment.php
CHANGED
|
@@ -63,7 +63,10 @@ class Shortcake_Field_Attachment {
|
|
| 63 |
<div class="shortcake-attachment-preview attachment-preview attachment">
|
| 64 |
<button id="{{ data.attr }}" class="button button-small add">{{ data.addButton }}</button>
|
| 65 |
<button class="button button-small remove">×</button>
|
| 66 |
-
<
|
|
|
|
|
|
|
|
|
|
| 67 |
</div>
|
| 68 |
</div>
|
| 69 |
</script>
|
| 63 |
<div class="shortcake-attachment-preview attachment-preview attachment">
|
| 64 |
<button id="{{ data.attr }}" class="button button-small add">{{ data.addButton }}</button>
|
| 65 |
<button class="button button-small remove">×</button>
|
| 66 |
+
<div class="loading-indicator">
|
| 67 |
+
<span class="dashicons dashicons-format-image"></span>
|
| 68 |
+
<div class="attachment-preview-loading"><ins></ins></div>
|
| 69 |
+
</div>
|
| 70 |
</div>
|
| 71 |
</div>
|
| 72 |
</script>
|
inc/fields/class-field-color.php
CHANGED
|
@@ -87,7 +87,7 @@ class Shortcake_Field_Color {
|
|
| 87 |
<script type="text/html" id="tmpl-fusion-shortcake-field-color">
|
| 88 |
<div class="field-block">
|
| 89 |
<label for="{{ data.attr }}">{{ data.label }}</label>
|
| 90 |
-
<input type="text" name="{{ data.attr }}" id="{{ data.attr }}" value="{{ data.value }}"
|
| 91 |
<# if ( typeof data.description == 'string' ) { #>
|
| 92 |
<p class="description">{{ data.description }}</p>
|
| 93 |
<# } #>
|
| 87 |
<script type="text/html" id="tmpl-fusion-shortcake-field-color">
|
| 88 |
<div class="field-block">
|
| 89 |
<label for="{{ data.attr }}">{{ data.label }}</label>
|
| 90 |
+
<input type="text" name="{{ data.attr }}" id="{{ data.attr }}" value="{{ data.value }}" data-default-color="{{ data.value }}" {{{ data.meta }}}/>
|
| 91 |
<# if ( typeof data.description == 'string' ) { #>
|
| 92 |
<p class="description">{{ data.description }}</p>
|
| 93 |
<# } #>
|
inc/fields/class-field-post-select.php
CHANGED
|
@@ -115,7 +115,6 @@ class Shortcode_UI_Field_Post_Select {
|
|
| 115 |
// Shortcode not found.
|
| 116 |
if ( ! isset( $shortcodes[ $requested_shortcode ] ) ) {
|
| 117 |
wp_send_json_error( $response );
|
| 118 |
-
die;
|
| 119 |
}
|
| 120 |
|
| 121 |
$shortcode = $shortcodes[ $requested_shortcode ];
|
|
@@ -129,7 +128,6 @@ class Shortcode_UI_Field_Post_Select {
|
|
| 129 |
// Query not found.
|
| 130 |
if ( empty( $query_args ) ) {
|
| 131 |
wp_send_json_error( $response );
|
| 132 |
-
die;
|
| 133 |
}
|
| 134 |
|
| 135 |
// Hardcoded query args.
|
|
@@ -148,6 +146,7 @@ class Shortcode_UI_Field_Post_Select {
|
|
| 148 |
$post__in = is_array( $_GET['post__in'] ) ? $_GET['post__in'] : explode( ',', $_GET['post__in'] );
|
| 149 |
$query_args['post__in'] = array_map( 'intval', $post__in );
|
| 150 |
$query_args['orderby'] = 'post__in';
|
|
|
|
| 151 |
}
|
| 152 |
|
| 153 |
$query = new WP_Query( $query_args );
|
| 115 |
// Shortcode not found.
|
| 116 |
if ( ! isset( $shortcodes[ $requested_shortcode ] ) ) {
|
| 117 |
wp_send_json_error( $response );
|
|
|
|
| 118 |
}
|
| 119 |
|
| 120 |
$shortcode = $shortcodes[ $requested_shortcode ];
|
| 128 |
// Query not found.
|
| 129 |
if ( empty( $query_args ) ) {
|
| 130 |
wp_send_json_error( $response );
|
|
|
|
| 131 |
}
|
| 132 |
|
| 133 |
// Hardcoded query args.
|
| 146 |
$post__in = is_array( $_GET['post__in'] ) ? $_GET['post__in'] : explode( ',', $_GET['post__in'] );
|
| 147 |
$query_args['post__in'] = array_map( 'intval', $post__in );
|
| 148 |
$query_args['orderby'] = 'post__in';
|
| 149 |
+
$query_args['ignore_sticky_posts'] = true;
|
| 150 |
}
|
| 151 |
|
| 152 |
$query = new WP_Query( $query_args );
|
inc/templates/edit-form.tpl.php
CHANGED
|
@@ -18,7 +18,7 @@
|
|
| 18 |
<script type="text/html" id="tmpl-shortcode-ui-field-text">
|
| 19 |
<div class="field-block">
|
| 20 |
<label for="{{ data.id }}">{{ data.label }}</label>
|
| 21 |
-
<input type="text" name="{{ data.attr }}" id="{{ data.id }}" value="{{ data.value }}" {{{ data.meta }}}/>
|
| 22 |
<# if ( typeof data.description == 'string' ) { #>
|
| 23 |
<p class="description">{{ data.description }}</p>
|
| 24 |
<# } #>
|
|
@@ -89,7 +89,7 @@
|
|
| 89 |
<script type="text/html" id="tmpl-shortcode-ui-field-email">
|
| 90 |
<div class="field-block">
|
| 91 |
<label for="{{ data.id }}">{{ data.label }}</label>
|
| 92 |
-
<input type="email" name="{{ data.attr }}" id="{{ data.id }}" value="{{ data.value}}" {{{ data.meta }}}/>
|
| 93 |
<# if ( typeof data.description == 'string' ) { #>
|
| 94 |
<p class="description">{{ data.description }}</p>
|
| 95 |
<# } #>
|
|
@@ -99,7 +99,7 @@
|
|
| 99 |
<script type="text/html" id="tmpl-shortcode-ui-field-number">
|
| 100 |
<div class="field-block">
|
| 101 |
<label for="{{ data.id }}">{{ data.label }}</label>
|
| 102 |
-
<input type="number" name="{{ data.attr }}" id="{{ data.id }}" value="{{ data.value}}" {{{ data.meta }}}/>
|
| 103 |
<# if ( typeof data.description == 'string' ) { #>
|
| 104 |
<p class="description">{{ data.description }}</p>
|
| 105 |
<# } #>
|
| 18 |
<script type="text/html" id="tmpl-shortcode-ui-field-text">
|
| 19 |
<div class="field-block">
|
| 20 |
<label for="{{ data.id }}">{{ data.label }}</label>
|
| 21 |
+
<input type="text" class="regular-text" name="{{ data.attr }}" id="{{ data.id }}" value="{{ data.value }}" {{{ data.meta }}}/>
|
| 22 |
<# if ( typeof data.description == 'string' ) { #>
|
| 23 |
<p class="description">{{ data.description }}</p>
|
| 24 |
<# } #>
|
| 89 |
<script type="text/html" id="tmpl-shortcode-ui-field-email">
|
| 90 |
<div class="field-block">
|
| 91 |
<label for="{{ data.id }}">{{ data.label }}</label>
|
| 92 |
+
<input type="email" class="regular-text" name="{{ data.attr }}" id="{{ data.id }}" value="{{ data.value}}" {{{ data.meta }}}/>
|
| 93 |
<# if ( typeof data.description == 'string' ) { #>
|
| 94 |
<p class="description">{{ data.description }}</p>
|
| 95 |
<# } #>
|
| 99 |
<script type="text/html" id="tmpl-shortcode-ui-field-number">
|
| 100 |
<div class="field-block">
|
| 101 |
<label for="{{ data.id }}">{{ data.label }}</label>
|
| 102 |
+
<input type="number" class="regular-text" name="{{ data.attr }}" id="{{ data.id }}" value="{{ data.value}}" {{{ data.meta }}}/>
|
| 103 |
<# if ( typeof data.description == 'string' ) { #>
|
| 104 |
<p class="description">{{ data.description }}</p>
|
| 105 |
<# } #>
|
js/build/field-attachment.js
CHANGED
|
@@ -124,10 +124,14 @@ sui.views.editAttributeFieldAttachment = editAttributeField.extend( {
|
|
| 124 |
|
| 125 |
} else {
|
| 126 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 127 |
$( '<img/>', {
|
| 128 |
-
src:
|
| 129 |
-
width:
|
| 130 |
-
height:
|
| 131 |
alt: attachment.alt,
|
| 132 |
} ) .appendTo( $thumbnail )
|
| 133 |
|
|
@@ -216,7 +220,7 @@ var ShortcodeAttribute = Backbone.Model.extend({
|
|
| 216 |
description: '',
|
| 217 |
meta: {
|
| 218 |
placeholder: '',
|
| 219 |
-
}
|
| 220 |
},
|
| 221 |
});
|
| 222 |
|
|
@@ -306,7 +310,11 @@ Shortcode = Backbone.Model.extend({
|
|
| 306 |
content = this.get( 'inner_content' ).get( 'value' );
|
| 307 |
}
|
| 308 |
|
| 309 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 310 |
|
| 311 |
if ( content && content.length > 0 ) {
|
| 312 |
template += "{{ content }}[/{{ shortcode }}]"
|
|
@@ -338,9 +346,9 @@ module.exports = window.Shortcode_UI;
|
|
| 338 |
|
| 339 |
},{"./../collections/shortcodes.js":2}],8:[function(require,module,exports){
|
| 340 |
(function (global){
|
| 341 |
-
var Backbone
|
| 342 |
-
sui
|
| 343 |
-
$
|
| 344 |
|
| 345 |
var editAttributeField = Backbone.View.extend( {
|
| 346 |
|
|
@@ -364,13 +372,6 @@ var editAttributeField = Backbone.View.extend( {
|
|
| 364 |
id: 'shortcode-ui-' + this.model.get( 'attr' ) + '-' + this.model.cid,
|
| 365 |
}, this.model.toJSON() );
|
| 366 |
|
| 367 |
-
// Handle legacy custom meta.
|
| 368 |
-
// Can be removed in 0.4.
|
| 369 |
-
if ( data.placeholder ) {
|
| 370 |
-
data.meta.placeholder = data.placeholder;
|
| 371 |
-
delete data.placeholder;
|
| 372 |
-
}
|
| 373 |
-
|
| 374 |
// Convert meta JSON to attribute string.
|
| 375 |
var _meta = [];
|
| 376 |
for ( var key in data.meta ) {
|
|
@@ -394,6 +395,7 @@ var editAttributeField = Backbone.View.extend( {
|
|
| 394 |
data.meta = _meta.join( ' ' );
|
| 395 |
|
| 396 |
this.$el.html( this.template( data ) );
|
|
|
|
| 397 |
|
| 398 |
return this
|
| 399 |
},
|
|
@@ -402,7 +404,8 @@ var editAttributeField = Backbone.View.extend( {
|
|
| 402 |
* Input Changed Update Callback.
|
| 403 |
*
|
| 404 |
* If the input field that has changed is for content or a valid attribute,
|
| 405 |
-
* then it should update the model.
|
|
|
|
| 406 |
*/
|
| 407 |
updateValue: function( e ) {
|
| 408 |
|
|
@@ -419,7 +422,30 @@ var editAttributeField = Backbone.View.extend( {
|
|
| 419 |
} else {
|
| 420 |
this.model.set( 'value', $el.val() );
|
| 421 |
}
|
| 422 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 423 |
|
| 424 |
} );
|
| 425 |
|
| 124 |
|
| 125 |
} else {
|
| 126 |
|
| 127 |
+
attachmentThumb = (typeof attachment.sizes.thumbnail !== 'undefined') ?
|
| 128 |
+
attachment.sizes.thumbnail :
|
| 129 |
+
_.first( _.sortBy( attachment.sizes, 'width' ) );
|
| 130 |
+
|
| 131 |
$( '<img/>', {
|
| 132 |
+
src: attachmentThumb.url,
|
| 133 |
+
width: attachmentThumb.width,
|
| 134 |
+
height: attachmentThumb.height,
|
| 135 |
alt: attachment.alt,
|
| 136 |
} ) .appendTo( $thumbnail )
|
| 137 |
|
| 220 |
description: '',
|
| 221 |
meta: {
|
| 222 |
placeholder: '',
|
| 223 |
+
},
|
| 224 |
},
|
| 225 |
});
|
| 226 |
|
| 310 |
content = this.get( 'inner_content' ).get( 'value' );
|
| 311 |
}
|
| 312 |
|
| 313 |
+
if ( attrs.length > 0 ) {
|
| 314 |
+
template = "[{{ shortcode }} {{ attributes }}]"
|
| 315 |
+
} else {
|
| 316 |
+
template = "[{{ shortcode }}]"
|
| 317 |
+
}
|
| 318 |
|
| 319 |
if ( content && content.length > 0 ) {
|
| 320 |
template += "{{ content }}[/{{ shortcode }}]"
|
| 346 |
|
| 347 |
},{"./../collections/shortcodes.js":2}],8:[function(require,module,exports){
|
| 348 |
(function (global){
|
| 349 |
+
var Backbone = (typeof window !== "undefined" ? window.Backbone : typeof global !== "undefined" ? global.Backbone : null),
|
| 350 |
+
sui = require('./../utils/sui.js'),
|
| 351 |
+
$ = (typeof window !== "undefined" ? window.jQuery : typeof global !== "undefined" ? global.jQuery : null);
|
| 352 |
|
| 353 |
var editAttributeField = Backbone.View.extend( {
|
| 354 |
|
| 372 |
id: 'shortcode-ui-' + this.model.get( 'attr' ) + '-' + this.model.cid,
|
| 373 |
}, this.model.toJSON() );
|
| 374 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 375 |
// Convert meta JSON to attribute string.
|
| 376 |
var _meta = [];
|
| 377 |
for ( var key in data.meta ) {
|
| 395 |
data.meta = _meta.join( ' ' );
|
| 396 |
|
| 397 |
this.$el.html( this.template( data ) );
|
| 398 |
+
this.updateValue();
|
| 399 |
|
| 400 |
return this
|
| 401 |
},
|
| 404 |
* Input Changed Update Callback.
|
| 405 |
*
|
| 406 |
* If the input field that has changed is for content or a valid attribute,
|
| 407 |
+
* then it should update the model. If a callback function is registered
|
| 408 |
+
* for this attribute, it should be called as well.
|
| 409 |
*/
|
| 410 |
updateValue: function( e ) {
|
| 411 |
|
| 422 |
} else {
|
| 423 |
this.model.set( 'value', $el.val() );
|
| 424 |
}
|
| 425 |
+
|
| 426 |
+
var shortcodeName = this.shortcode.attributes.shortcode_tag,
|
| 427 |
+
attributeName = this.model.get( 'attr' ),
|
| 428 |
+
hookName = [ shortcodeName, attributeName ].join( '.' ),
|
| 429 |
+
changed = this.model.changed,
|
| 430 |
+
collection = _.flatten( _.values( this.views.parent.views._views ) ),
|
| 431 |
+
shortcode = this.shortcode;
|
| 432 |
+
|
| 433 |
+
/*
|
| 434 |
+
* Action run when an attribute value changes on a shortcode
|
| 435 |
+
*
|
| 436 |
+
* Called as `{shortcodeName}.{attributeName}`.
|
| 437 |
+
*
|
| 438 |
+
* @param changed (object)
|
| 439 |
+
* The update, ie. { "changed": "newValue" }
|
| 440 |
+
* @param viewModels (array)
|
| 441 |
+
* The collections of views (editAttributeFields)
|
| 442 |
+
* which make up this shortcode UI form
|
| 443 |
+
* @param shortcode (object)
|
| 444 |
+
* Reference to the shortcode model which this attribute belongs to.
|
| 445 |
+
*/
|
| 446 |
+
wp.shortcake.hooks.doAction( hookName, changed, collection, shortcode );
|
| 447 |
+
|
| 448 |
+
}
|
| 449 |
|
| 450 |
} );
|
| 451 |
|
js/build/field-color.js
CHANGED
|
@@ -87,7 +87,7 @@ var ShortcodeAttribute = Backbone.Model.extend({
|
|
| 87 |
description: '',
|
| 88 |
meta: {
|
| 89 |
placeholder: '',
|
| 90 |
-
}
|
| 91 |
},
|
| 92 |
});
|
| 93 |
|
|
@@ -177,7 +177,11 @@ Shortcode = Backbone.Model.extend({
|
|
| 177 |
content = this.get( 'inner_content' ).get( 'value' );
|
| 178 |
}
|
| 179 |
|
| 180 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 181 |
|
| 182 |
if ( content && content.length > 0 ) {
|
| 183 |
template += "{{ content }}[/{{ shortcode }}]"
|
|
@@ -209,9 +213,9 @@ module.exports = window.Shortcode_UI;
|
|
| 209 |
|
| 210 |
},{"./../collections/shortcodes.js":2}],8:[function(require,module,exports){
|
| 211 |
(function (global){
|
| 212 |
-
var Backbone
|
| 213 |
-
sui
|
| 214 |
-
$
|
| 215 |
|
| 216 |
var editAttributeField = Backbone.View.extend( {
|
| 217 |
|
|
@@ -235,13 +239,6 @@ var editAttributeField = Backbone.View.extend( {
|
|
| 235 |
id: 'shortcode-ui-' + this.model.get( 'attr' ) + '-' + this.model.cid,
|
| 236 |
}, this.model.toJSON() );
|
| 237 |
|
| 238 |
-
// Handle legacy custom meta.
|
| 239 |
-
// Can be removed in 0.4.
|
| 240 |
-
if ( data.placeholder ) {
|
| 241 |
-
data.meta.placeholder = data.placeholder;
|
| 242 |
-
delete data.placeholder;
|
| 243 |
-
}
|
| 244 |
-
|
| 245 |
// Convert meta JSON to attribute string.
|
| 246 |
var _meta = [];
|
| 247 |
for ( var key in data.meta ) {
|
|
@@ -265,6 +262,7 @@ var editAttributeField = Backbone.View.extend( {
|
|
| 265 |
data.meta = _meta.join( ' ' );
|
| 266 |
|
| 267 |
this.$el.html( this.template( data ) );
|
|
|
|
| 268 |
|
| 269 |
return this
|
| 270 |
},
|
|
@@ -273,7 +271,8 @@ var editAttributeField = Backbone.View.extend( {
|
|
| 273 |
* Input Changed Update Callback.
|
| 274 |
*
|
| 275 |
* If the input field that has changed is for content or a valid attribute,
|
| 276 |
-
* then it should update the model.
|
|
|
|
| 277 |
*/
|
| 278 |
updateValue: function( e ) {
|
| 279 |
|
|
@@ -290,7 +289,30 @@ var editAttributeField = Backbone.View.extend( {
|
|
| 290 |
} else {
|
| 291 |
this.model.set( 'value', $el.val() );
|
| 292 |
}
|
| 293 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 294 |
|
| 295 |
} );
|
| 296 |
|
| 87 |
description: '',
|
| 88 |
meta: {
|
| 89 |
placeholder: '',
|
| 90 |
+
},
|
| 91 |
},
|
| 92 |
});
|
| 93 |
|
| 177 |
content = this.get( 'inner_content' ).get( 'value' );
|
| 178 |
}
|
| 179 |
|
| 180 |
+
if ( attrs.length > 0 ) {
|
| 181 |
+
template = "[{{ shortcode }} {{ attributes }}]"
|
| 182 |
+
} else {
|
| 183 |
+
template = "[{{ shortcode }}]"
|
| 184 |
+
}
|
| 185 |
|
| 186 |
if ( content && content.length > 0 ) {
|
| 187 |
template += "{{ content }}[/{{ shortcode }}]"
|
| 213 |
|
| 214 |
},{"./../collections/shortcodes.js":2}],8:[function(require,module,exports){
|
| 215 |
(function (global){
|
| 216 |
+
var Backbone = (typeof window !== "undefined" ? window.Backbone : typeof global !== "undefined" ? global.Backbone : null),
|
| 217 |
+
sui = require('./../utils/sui.js'),
|
| 218 |
+
$ = (typeof window !== "undefined" ? window.jQuery : typeof global !== "undefined" ? global.jQuery : null);
|
| 219 |
|
| 220 |
var editAttributeField = Backbone.View.extend( {
|
| 221 |
|
| 239 |
id: 'shortcode-ui-' + this.model.get( 'attr' ) + '-' + this.model.cid,
|
| 240 |
}, this.model.toJSON() );
|
| 241 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 242 |
// Convert meta JSON to attribute string.
|
| 243 |
var _meta = [];
|
| 244 |
for ( var key in data.meta ) {
|
| 262 |
data.meta = _meta.join( ' ' );
|
| 263 |
|
| 264 |
this.$el.html( this.template( data ) );
|
| 265 |
+
this.updateValue();
|
| 266 |
|
| 267 |
return this
|
| 268 |
},
|
| 271 |
* Input Changed Update Callback.
|
| 272 |
*
|
| 273 |
* If the input field that has changed is for content or a valid attribute,
|
| 274 |
+
* then it should update the model. If a callback function is registered
|
| 275 |
+
* for this attribute, it should be called as well.
|
| 276 |
*/
|
| 277 |
updateValue: function( e ) {
|
| 278 |
|
| 289 |
} else {
|
| 290 |
this.model.set( 'value', $el.val() );
|
| 291 |
}
|
| 292 |
+
|
| 293 |
+
var shortcodeName = this.shortcode.attributes.shortcode_tag,
|
| 294 |
+
attributeName = this.model.get( 'attr' ),
|
| 295 |
+
hookName = [ shortcodeName, attributeName ].join( '.' ),
|
| 296 |
+
changed = this.model.changed,
|
| 297 |
+
collection = _.flatten( _.values( this.views.parent.views._views ) ),
|
| 298 |
+
shortcode = this.shortcode;
|
| 299 |
+
|
| 300 |
+
/*
|
| 301 |
+
* Action run when an attribute value changes on a shortcode
|
| 302 |
+
*
|
| 303 |
+
* Called as `{shortcodeName}.{attributeName}`.
|
| 304 |
+
*
|
| 305 |
+
* @param changed (object)
|
| 306 |
+
* The update, ie. { "changed": "newValue" }
|
| 307 |
+
* @param viewModels (array)
|
| 308 |
+
* The collections of views (editAttributeFields)
|
| 309 |
+
* which make up this shortcode UI form
|
| 310 |
+
* @param shortcode (object)
|
| 311 |
+
* Reference to the shortcode model which this attribute belongs to.
|
| 312 |
+
*/
|
| 313 |
+
wp.shortcake.hooks.doAction( hookName, changed, collection, shortcode );
|
| 314 |
+
|
| 315 |
+
}
|
| 316 |
|
| 317 |
} );
|
| 318 |
|
js/build/shortcode-ui.js
CHANGED
|
@@ -120,7 +120,7 @@ var ShortcodeAttribute = Backbone.Model.extend({
|
|
| 120 |
description: '',
|
| 121 |
meta: {
|
| 122 |
placeholder: '',
|
| 123 |
-
}
|
| 124 |
},
|
| 125 |
});
|
| 126 |
|
|
@@ -210,7 +210,11 @@ Shortcode = Backbone.Model.extend({
|
|
| 210 |
content = this.get( 'inner_content' ).get( 'value' );
|
| 211 |
}
|
| 212 |
|
| 213 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 214 |
|
| 215 |
if ( content && content.length > 0 ) {
|
| 216 |
template += "{{ content }}[/{{ shortcode }}]"
|
|
@@ -448,13 +452,26 @@ var shortcodeViewConstructor = {
|
|
| 448 |
|
| 449 |
if ( matches[3] ) {
|
| 450 |
var inner_content = currentShortcode.get( 'inner_content' );
|
| 451 |
-
inner_content.set( 'value', matches[3] );
|
| 452 |
}
|
| 453 |
|
| 454 |
return currentShortcode;
|
| 455 |
|
| 456 |
},
|
| 457 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 458 |
// Backwards compatability for Pre WP 4.2.
|
| 459 |
View: {
|
| 460 |
|
|
@@ -586,9 +603,9 @@ module.exports = window.Shortcode_UI;
|
|
| 586 |
|
| 587 |
},{"./../collections/shortcodes.js":2}],10:[function(require,module,exports){
|
| 588 |
(function (global){
|
| 589 |
-
var Backbone
|
| 590 |
-
sui
|
| 591 |
-
$
|
| 592 |
|
| 593 |
var editAttributeField = Backbone.View.extend( {
|
| 594 |
|
|
@@ -612,13 +629,6 @@ var editAttributeField = Backbone.View.extend( {
|
|
| 612 |
id: 'shortcode-ui-' + this.model.get( 'attr' ) + '-' + this.model.cid,
|
| 613 |
}, this.model.toJSON() );
|
| 614 |
|
| 615 |
-
// Handle legacy custom meta.
|
| 616 |
-
// Can be removed in 0.4.
|
| 617 |
-
if ( data.placeholder ) {
|
| 618 |
-
data.meta.placeholder = data.placeholder;
|
| 619 |
-
delete data.placeholder;
|
| 620 |
-
}
|
| 621 |
-
|
| 622 |
// Convert meta JSON to attribute string.
|
| 623 |
var _meta = [];
|
| 624 |
for ( var key in data.meta ) {
|
|
@@ -642,6 +652,7 @@ var editAttributeField = Backbone.View.extend( {
|
|
| 642 |
data.meta = _meta.join( ' ' );
|
| 643 |
|
| 644 |
this.$el.html( this.template( data ) );
|
|
|
|
| 645 |
|
| 646 |
return this
|
| 647 |
},
|
|
@@ -650,7 +661,8 @@ var editAttributeField = Backbone.View.extend( {
|
|
| 650 |
* Input Changed Update Callback.
|
| 651 |
*
|
| 652 |
* If the input field that has changed is for content or a valid attribute,
|
| 653 |
-
* then it should update the model.
|
|
|
|
| 654 |
*/
|
| 655 |
updateValue: function( e ) {
|
| 656 |
|
|
@@ -667,7 +679,30 @@ var editAttributeField = Backbone.View.extend( {
|
|
| 667 |
} else {
|
| 668 |
this.model.set( 'value', $el.val() );
|
| 669 |
}
|
| 670 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 671 |
|
| 672 |
} );
|
| 673 |
|
|
@@ -696,12 +731,11 @@ var EditShortcodeForm = wp.Backbone.View.extend({
|
|
| 696 |
if ( innerContent && typeof innerContent.attributes.type !== 'undefined' ) {
|
| 697 |
|
| 698 |
// add UI for inner_content
|
| 699 |
-
var view = new editAttributeField( {
|
| 700 |
-
|
| 701 |
-
|
| 702 |
-
|
| 703 |
|
| 704 |
-
view.template = wp.media.template( 'shortcode-ui-content' );
|
| 705 |
t.views.add( '.edit-shortcode-form-fields', view );
|
| 706 |
|
| 707 |
}
|
|
@@ -889,7 +923,7 @@ var mediaFrame = postMediaFrame.extend( {
|
|
| 889 |
},
|
| 890 |
|
| 891 |
resetMediaController: function( event ) {
|
| 892 |
-
if ( this.state().props.get('currentShortcode') ) {
|
| 893 |
this.mediaController.reset();
|
| 894 |
this.contentRender( 'shortcode-ui', 'insert' );
|
| 895 |
}
|
| 120 |
description: '',
|
| 121 |
meta: {
|
| 122 |
placeholder: '',
|
| 123 |
+
},
|
| 124 |
},
|
| 125 |
});
|
| 126 |
|
| 210 |
content = this.get( 'inner_content' ).get( 'value' );
|
| 211 |
}
|
| 212 |
|
| 213 |
+
if ( attrs.length > 0 ) {
|
| 214 |
+
template = "[{{ shortcode }} {{ attributes }}]"
|
| 215 |
+
} else {
|
| 216 |
+
template = "[{{ shortcode }}]"
|
| 217 |
+
}
|
| 218 |
|
| 219 |
if ( content && content.length > 0 ) {
|
| 220 |
template += "{{ content }}[/{{ shortcode }}]"
|
| 452 |
|
| 453 |
if ( matches[3] ) {
|
| 454 |
var inner_content = currentShortcode.get( 'inner_content' );
|
| 455 |
+
inner_content.set( 'value', this.unAutoP( matches[3] ) );
|
| 456 |
}
|
| 457 |
|
| 458 |
return currentShortcode;
|
| 459 |
|
| 460 |
},
|
| 461 |
|
| 462 |
+
/**
|
| 463 |
+
* Strip 'p' and 'br' tags, replace with line breaks.
|
| 464 |
+
* Reverse the effect of the WP editor autop functionality.
|
| 465 |
+
*/
|
| 466 |
+
unAutoP: function( content ) {
|
| 467 |
+
if ( switchEditors && switchEditors.pre_wpautop ) {
|
| 468 |
+
content = switchEditors.pre_wpautop( content );
|
| 469 |
+
}
|
| 470 |
+
|
| 471 |
+
return content;
|
| 472 |
+
|
| 473 |
+
},
|
| 474 |
+
|
| 475 |
// Backwards compatability for Pre WP 4.2.
|
| 476 |
View: {
|
| 477 |
|
| 603 |
|
| 604 |
},{"./../collections/shortcodes.js":2}],10:[function(require,module,exports){
|
| 605 |
(function (global){
|
| 606 |
+
var Backbone = (typeof window !== "undefined" ? window.Backbone : typeof global !== "undefined" ? global.Backbone : null),
|
| 607 |
+
sui = require('./../utils/sui.js'),
|
| 608 |
+
$ = (typeof window !== "undefined" ? window.jQuery : typeof global !== "undefined" ? global.jQuery : null);
|
| 609 |
|
| 610 |
var editAttributeField = Backbone.View.extend( {
|
| 611 |
|
| 629 |
id: 'shortcode-ui-' + this.model.get( 'attr' ) + '-' + this.model.cid,
|
| 630 |
}, this.model.toJSON() );
|
| 631 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 632 |
// Convert meta JSON to attribute string.
|
| 633 |
var _meta = [];
|
| 634 |
for ( var key in data.meta ) {
|
| 652 |
data.meta = _meta.join( ' ' );
|
| 653 |
|
| 654 |
this.$el.html( this.template( data ) );
|
| 655 |
+
this.updateValue();
|
| 656 |
|
| 657 |
return this
|
| 658 |
},
|
| 661 |
* Input Changed Update Callback.
|
| 662 |
*
|
| 663 |
* If the input field that has changed is for content or a valid attribute,
|
| 664 |
+
* then it should update the model. If a callback function is registered
|
| 665 |
+
* for this attribute, it should be called as well.
|
| 666 |
*/
|
| 667 |
updateValue: function( e ) {
|
| 668 |
|
| 679 |
} else {
|
| 680 |
this.model.set( 'value', $el.val() );
|
| 681 |
}
|
| 682 |
+
|
| 683 |
+
var shortcodeName = this.shortcode.attributes.shortcode_tag,
|
| 684 |
+
attributeName = this.model.get( 'attr' ),
|
| 685 |
+
hookName = [ shortcodeName, attributeName ].join( '.' ),
|
| 686 |
+
changed = this.model.changed,
|
| 687 |
+
collection = _.flatten( _.values( this.views.parent.views._views ) ),
|
| 688 |
+
shortcode = this.shortcode;
|
| 689 |
+
|
| 690 |
+
/*
|
| 691 |
+
* Action run when an attribute value changes on a shortcode
|
| 692 |
+
*
|
| 693 |
+
* Called as `{shortcodeName}.{attributeName}`.
|
| 694 |
+
*
|
| 695 |
+
* @param changed (object)
|
| 696 |
+
* The update, ie. { "changed": "newValue" }
|
| 697 |
+
* @param viewModels (array)
|
| 698 |
+
* The collections of views (editAttributeFields)
|
| 699 |
+
* which make up this shortcode UI form
|
| 700 |
+
* @param shortcode (object)
|
| 701 |
+
* Reference to the shortcode model which this attribute belongs to.
|
| 702 |
+
*/
|
| 703 |
+
wp.shortcake.hooks.doAction( hookName, changed, collection, shortcode );
|
| 704 |
+
|
| 705 |
+
}
|
| 706 |
|
| 707 |
} );
|
| 708 |
|
| 731 |
if ( innerContent && typeof innerContent.attributes.type !== 'undefined' ) {
|
| 732 |
|
| 733 |
// add UI for inner_content
|
| 734 |
+
var view = new editAttributeField( { model: innerContent } );
|
| 735 |
+
|
| 736 |
+
view.shortcode = t.model;
|
| 737 |
+
view.template = wp.media.template( 'shortcode-ui-content' );
|
| 738 |
|
|
|
|
| 739 |
t.views.add( '.edit-shortcode-form-fields', view );
|
| 740 |
|
| 741 |
}
|
| 923 |
},
|
| 924 |
|
| 925 |
resetMediaController: function( event ) {
|
| 926 |
+
if ( this.state() && this.state().props.get('currentShortcode') ) {
|
| 927 |
this.mediaController.reset();
|
| 928 |
this.contentRender( 'shortcode-ui', 'insert' );
|
| 929 |
}
|
js/src/field-attachment.js
CHANGED
|
@@ -88,10 +88,14 @@ sui.views.editAttributeFieldAttachment = editAttributeField.extend( {
|
|
| 88 |
|
| 89 |
} else {
|
| 90 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 91 |
$( '<img/>', {
|
| 92 |
-
src:
|
| 93 |
-
width:
|
| 94 |
-
height:
|
| 95 |
alt: attachment.alt,
|
| 96 |
} ) .appendTo( $thumbnail )
|
| 97 |
|
| 88 |
|
| 89 |
} else {
|
| 90 |
|
| 91 |
+
attachmentThumb = (typeof attachment.sizes.thumbnail !== 'undefined') ?
|
| 92 |
+
attachment.sizes.thumbnail :
|
| 93 |
+
_.first( _.sortBy( attachment.sizes, 'width' ) );
|
| 94 |
+
|
| 95 |
$( '<img/>', {
|
| 96 |
+
src: attachmentThumb.url,
|
| 97 |
+
width: attachmentThumb.width,
|
| 98 |
+
height: attachmentThumb.height,
|
| 99 |
alt: attachment.alt,
|
| 100 |
} ) .appendTo( $thumbnail )
|
| 101 |
|
js/src/models/shortcode-attribute.js
CHANGED
|
@@ -9,7 +9,7 @@ var ShortcodeAttribute = Backbone.Model.extend({
|
|
| 9 |
description: '',
|
| 10 |
meta: {
|
| 11 |
placeholder: '',
|
| 12 |
-
}
|
| 13 |
},
|
| 14 |
});
|
| 15 |
|
| 9 |
description: '',
|
| 10 |
meta: {
|
| 11 |
placeholder: '',
|
| 12 |
+
},
|
| 13 |
},
|
| 14 |
});
|
| 15 |
|
js/src/models/shortcode.js
CHANGED
|
@@ -79,7 +79,11 @@ Shortcode = Backbone.Model.extend({
|
|
| 79 |
content = this.get( 'inner_content' ).get( 'value' );
|
| 80 |
}
|
| 81 |
|
| 82 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 83 |
|
| 84 |
if ( content && content.length > 0 ) {
|
| 85 |
template += "{{ content }}[/{{ shortcode }}]"
|
| 79 |
content = this.get( 'inner_content' ).get( 'value' );
|
| 80 |
}
|
| 81 |
|
| 82 |
+
if ( attrs.length > 0 ) {
|
| 83 |
+
template = "[{{ shortcode }} {{ attributes }}]"
|
| 84 |
+
} else {
|
| 85 |
+
template = "[{{ shortcode }}]"
|
| 86 |
+
}
|
| 87 |
|
| 88 |
if ( content && content.length > 0 ) {
|
| 89 |
template += "{{ content }}[/{{ shortcode }}]"
|
js/src/utils/shortcode-view-constructor.js
CHANGED
|
@@ -184,13 +184,26 @@ var shortcodeViewConstructor = {
|
|
| 184 |
|
| 185 |
if ( matches[3] ) {
|
| 186 |
var inner_content = currentShortcode.get( 'inner_content' );
|
| 187 |
-
inner_content.set( 'value', matches[3] );
|
| 188 |
}
|
| 189 |
|
| 190 |
return currentShortcode;
|
| 191 |
|
| 192 |
},
|
| 193 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 194 |
// Backwards compatability for Pre WP 4.2.
|
| 195 |
View: {
|
| 196 |
|
| 184 |
|
| 185 |
if ( matches[3] ) {
|
| 186 |
var inner_content = currentShortcode.get( 'inner_content' );
|
| 187 |
+
inner_content.set( 'value', this.unAutoP( matches[3] ) );
|
| 188 |
}
|
| 189 |
|
| 190 |
return currentShortcode;
|
| 191 |
|
| 192 |
},
|
| 193 |
|
| 194 |
+
/**
|
| 195 |
+
* Strip 'p' and 'br' tags, replace with line breaks.
|
| 196 |
+
* Reverse the effect of the WP editor autop functionality.
|
| 197 |
+
*/
|
| 198 |
+
unAutoP: function( content ) {
|
| 199 |
+
if ( switchEditors && switchEditors.pre_wpautop ) {
|
| 200 |
+
content = switchEditors.pre_wpautop( content );
|
| 201 |
+
}
|
| 202 |
+
|
| 203 |
+
return content;
|
| 204 |
+
|
| 205 |
+
},
|
| 206 |
+
|
| 207 |
// Backwards compatability for Pre WP 4.2.
|
| 208 |
View: {
|
| 209 |
|
js/src/views/edit-attribute-field.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
-
var Backbone
|
| 2 |
-
sui
|
| 3 |
-
$
|
| 4 |
|
| 5 |
var editAttributeField = Backbone.View.extend( {
|
| 6 |
|
|
@@ -24,13 +24,6 @@ var editAttributeField = Backbone.View.extend( {
|
|
| 24 |
id: 'shortcode-ui-' + this.model.get( 'attr' ) + '-' + this.model.cid,
|
| 25 |
}, this.model.toJSON() );
|
| 26 |
|
| 27 |
-
// Handle legacy custom meta.
|
| 28 |
-
// Can be removed in 0.4.
|
| 29 |
-
if ( data.placeholder ) {
|
| 30 |
-
data.meta.placeholder = data.placeholder;
|
| 31 |
-
delete data.placeholder;
|
| 32 |
-
}
|
| 33 |
-
|
| 34 |
// Convert meta JSON to attribute string.
|
| 35 |
var _meta = [];
|
| 36 |
for ( var key in data.meta ) {
|
|
@@ -54,6 +47,7 @@ var editAttributeField = Backbone.View.extend( {
|
|
| 54 |
data.meta = _meta.join( ' ' );
|
| 55 |
|
| 56 |
this.$el.html( this.template( data ) );
|
|
|
|
| 57 |
|
| 58 |
return this
|
| 59 |
},
|
|
@@ -62,7 +56,8 @@ var editAttributeField = Backbone.View.extend( {
|
|
| 62 |
* Input Changed Update Callback.
|
| 63 |
*
|
| 64 |
* If the input field that has changed is for content or a valid attribute,
|
| 65 |
-
* then it should update the model.
|
|
|
|
| 66 |
*/
|
| 67 |
updateValue: function( e ) {
|
| 68 |
|
|
@@ -79,7 +74,30 @@ var editAttributeField = Backbone.View.extend( {
|
|
| 79 |
} else {
|
| 80 |
this.model.set( 'value', $el.val() );
|
| 81 |
}
|
| 82 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 83 |
|
| 84 |
} );
|
| 85 |
|
| 1 |
+
var Backbone = require('backbone'),
|
| 2 |
+
sui = require('sui-utils/sui'),
|
| 3 |
+
$ = require('jquery');
|
| 4 |
|
| 5 |
var editAttributeField = Backbone.View.extend( {
|
| 6 |
|
| 24 |
id: 'shortcode-ui-' + this.model.get( 'attr' ) + '-' + this.model.cid,
|
| 25 |
}, this.model.toJSON() );
|
| 26 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 27 |
// Convert meta JSON to attribute string.
|
| 28 |
var _meta = [];
|
| 29 |
for ( var key in data.meta ) {
|
| 47 |
data.meta = _meta.join( ' ' );
|
| 48 |
|
| 49 |
this.$el.html( this.template( data ) );
|
| 50 |
+
this.updateValue();
|
| 51 |
|
| 52 |
return this
|
| 53 |
},
|
| 56 |
* Input Changed Update Callback.
|
| 57 |
*
|
| 58 |
* If the input field that has changed is for content or a valid attribute,
|
| 59 |
+
* then it should update the model. If a callback function is registered
|
| 60 |
+
* for this attribute, it should be called as well.
|
| 61 |
*/
|
| 62 |
updateValue: function( e ) {
|
| 63 |
|
| 74 |
} else {
|
| 75 |
this.model.set( 'value', $el.val() );
|
| 76 |
}
|
| 77 |
+
|
| 78 |
+
var shortcodeName = this.shortcode.attributes.shortcode_tag,
|
| 79 |
+
attributeName = this.model.get( 'attr' ),
|
| 80 |
+
hookName = [ shortcodeName, attributeName ].join( '.' ),
|
| 81 |
+
changed = this.model.changed,
|
| 82 |
+
collection = _.flatten( _.values( this.views.parent.views._views ) ),
|
| 83 |
+
shortcode = this.shortcode;
|
| 84 |
+
|
| 85 |
+
/*
|
| 86 |
+
* Action run when an attribute value changes on a shortcode
|
| 87 |
+
*
|
| 88 |
+
* Called as `{shortcodeName}.{attributeName}`.
|
| 89 |
+
*
|
| 90 |
+
* @param changed (object)
|
| 91 |
+
* The update, ie. { "changed": "newValue" }
|
| 92 |
+
* @param viewModels (array)
|
| 93 |
+
* The collections of views (editAttributeFields)
|
| 94 |
+
* which make up this shortcode UI form
|
| 95 |
+
* @param shortcode (object)
|
| 96 |
+
* Reference to the shortcode model which this attribute belongs to.
|
| 97 |
+
*/
|
| 98 |
+
wp.shortcake.hooks.doAction( hookName, changed, collection, shortcode );
|
| 99 |
+
|
| 100 |
+
}
|
| 101 |
|
| 102 |
} );
|
| 103 |
|
js/src/views/edit-shortcode-form.js
CHANGED
|
@@ -17,12 +17,11 @@ var EditShortcodeForm = wp.Backbone.View.extend({
|
|
| 17 |
if ( innerContent && typeof innerContent.attributes.type !== 'undefined' ) {
|
| 18 |
|
| 19 |
// add UI for inner_content
|
| 20 |
-
var view = new editAttributeField( {
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
|
| 25 |
-
view.template = wp.media.template( 'shortcode-ui-content' );
|
| 26 |
t.views.add( '.edit-shortcode-form-fields', view );
|
| 27 |
|
| 28 |
}
|
| 17 |
if ( innerContent && typeof innerContent.attributes.type !== 'undefined' ) {
|
| 18 |
|
| 19 |
// add UI for inner_content
|
| 20 |
+
var view = new editAttributeField( { model: innerContent } );
|
| 21 |
+
|
| 22 |
+
view.shortcode = t.model;
|
| 23 |
+
view.template = wp.media.template( 'shortcode-ui-content' );
|
| 24 |
|
|
|
|
| 25 |
t.views.add( '.edit-shortcode-form-fields', view );
|
| 26 |
|
| 27 |
}
|
js/src/views/media-frame.js
CHANGED
|
@@ -52,7 +52,7 @@ var mediaFrame = postMediaFrame.extend( {
|
|
| 52 |
},
|
| 53 |
|
| 54 |
resetMediaController: function( event ) {
|
| 55 |
-
if ( this.state().props.get('currentShortcode') ) {
|
| 56 |
this.mediaController.reset();
|
| 57 |
this.contentRender( 'shortcode-ui', 'insert' );
|
| 58 |
}
|
| 52 |
},
|
| 53 |
|
| 54 |
resetMediaController: function( event ) {
|
| 55 |
+
if ( this.state() && this.state().props.get('currentShortcode') ) {
|
| 56 |
this.mediaController.reset();
|
| 57 |
this.contentRender( 'shortcode-ui', 'insert' );
|
| 58 |
}
|
languages/shortcode-ui-es_ES.mo
ADDED
|
Binary file
|
languages/shortcode-ui-es_ES.po
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Copyright (C) 2015 Fusion Engineering and community
|
| 2 |
+
# This file is distributed under the GPL v2 or later.
|
| 3 |
+
msgid ""
|
| 4 |
+
msgstr ""
|
| 5 |
+
"Project-Id-Version: Shortcode UI v0.3-alpha\n"
|
| 6 |
+
"Report-Msgid-Bugs-To: http://wordpress.org/support/plugin/"
|
| 7 |
+
"shortcode-ui\n"
|
| 8 |
+
"POT-Creation-Date: 2015-04-22 16:48:40+00:00\n"
|
| 9 |
+
"MIME-Version: 1.0\n"
|
| 10 |
+
"Content-Type: text/plain; charset=UTF-8\n"
|
| 11 |
+
"Content-Transfer-Encoding: 8bit\n"
|
| 12 |
+
"PO-Revision-Date: 2015-04-28 00:03+0100\n"
|
| 13 |
+
"X-Generator: Poedit 1.7.6\n"
|
| 14 |
+
"X-Poedit-KeywordsList: __;_e;_x:1,2c;_ex:1,2c;_n:1,2;_nx:1,2,4c;"
|
| 15 |
+
"_n_noop:1,2;_nx_noop:1,2,3c;esc_attr__;esc_html__;esc_attr_e;"
|
| 16 |
+
"esc_html_e;esc_attr_x:1,2c;esc_html_x:1,2c\n"
|
| 17 |
+
"Language: es\n"
|
| 18 |
+
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
| 19 |
+
"X-Poedit-SourceCharset: UTF-8\n"
|
| 20 |
+
"X-Poedit-Basepath: ../\n"
|
| 21 |
+
"X-Textdomain-Support: yes\n"
|
| 22 |
+
"Last-Translator: David <david@closemarketing.es>\n"
|
| 23 |
+
"Language-Team: Closemarketing <david@closemarketing.es>\n"
|
| 24 |
+
"X-Poedit-SearchPath-0: .\n"
|
| 25 |
+
|
| 26 |
+
#: inc/class-shortcode-ui.php:40
|
| 27 |
+
msgid "Inner Content"
|
| 28 |
+
msgstr "Contenido Inicial"
|
| 29 |
+
|
| 30 |
+
#: inc/class-shortcode-ui.php:101 inc/class-shortcode-ui.php:102
|
| 31 |
+
msgid "Insert Post Element"
|
| 32 |
+
msgstr "Insertar elemento en Entrada"
|
| 33 |
+
|
| 34 |
+
#: inc/class-shortcode-ui.php:103
|
| 35 |
+
msgid "%s Details"
|
| 36 |
+
msgstr "%s Detalles"
|
| 37 |
+
|
| 38 |
+
#: inc/class-shortcode-ui.php:104
|
| 39 |
+
msgid "Insert Element"
|
| 40 |
+
msgstr "Insertar elemento"
|
| 41 |
+
|
| 42 |
+
#: inc/class-shortcode-ui.php:105
|
| 43 |
+
msgid "Update"
|
| 44 |
+
msgstr "Actualizar"
|
| 45 |
+
|
| 46 |
+
#: inc/class-shortcode-ui.php:106
|
| 47 |
+
msgid "There are no attributes to configure for this Post Element."
|
| 48 |
+
msgstr ""
|
| 49 |
+
"No hay ningún atributo para configurar para este elemento Post."
|
| 50 |
+
|
| 51 |
+
#: inc/class-shortcode-ui.php:107
|
| 52 |
+
msgid "Edit"
|
| 53 |
+
msgstr "Editar"
|
| 54 |
+
|
| 55 |
+
#: inc/class-shortcode-ui.php:108
|
| 56 |
+
msgid "Preview"
|
| 57 |
+
msgstr "Vista Previa"
|
| 58 |
+
|
| 59 |
+
#: inc/class-shortcode-ui.php:109
|
| 60 |
+
msgid "Failed to load preview"
|
| 61 |
+
msgstr "No se pudo cargar vista previa"
|
| 62 |
+
|
| 63 |
+
#: inc/class-shortcode-ui.php:110
|
| 64 |
+
msgid "Search"
|
| 65 |
+
msgstr "Buscar"
|
| 66 |
+
|
| 67 |
+
#: inc/class-shortcode-ui.php:111
|
| 68 |
+
msgid "Insert Content"
|
| 69 |
+
msgstr "Insertar contenido"
|
| 70 |
+
|
| 71 |
+
#: inc/class-shortcode-ui.php:205
|
| 72 |
+
msgid "Something's rotten in the state of Denmark"
|
| 73 |
+
msgstr "Algo está podrido en el estado de Dinamarca"
|
| 74 |
+
|
| 75 |
+
#: inc/fields/class-field-attachment.php:47
|
| 76 |
+
#: inc/fields/class-field-attachment.php:48
|
| 77 |
+
msgid "Select Attachment"
|
| 78 |
+
msgstr "Seleccionar Adjunto"
|
| 79 |
+
|
| 80 |
+
#: inc/templates/edit-form.tpl.php:3
|
| 81 |
+
msgid "Back to list"
|
| 82 |
+
msgstr "Volver a la lista"
|
| 83 |
+
|
| 84 |
+
#. Plugin Name of the plugin/theme
|
| 85 |
+
msgid "Shortcode UI"
|
| 86 |
+
msgstr "Shortcode UI"
|
| 87 |
+
|
| 88 |
+
#. Description of the plugin/theme
|
| 89 |
+
msgid "User Interface for adding shortcodes."
|
| 90 |
+
msgstr "Interfaz de usuario para agregar códigos cortos."
|
| 91 |
+
|
| 92 |
+
#. Author of the plugin/theme
|
| 93 |
+
msgid "Fusion Engineering and community"
|
| 94 |
+
msgstr "Fusion Engineering and community"
|
| 95 |
+
|
| 96 |
+
#. Author URI of the plugin/theme
|
| 97 |
+
msgid "http://next.fusion.net/tag/shortcode-ui/"
|
| 98 |
+
msgstr "http://Next.Fusion.net/tag/shortcode-UI/"
|
languages/shortcode-ui-fr_FR.mo
ADDED
|
Binary file
|
languages/shortcode-ui-fr_FR.po
ADDED
|
@@ -0,0 +1,97 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Copyright (C) 2015 Fusion Engineering and community
|
| 2 |
+
# This file is distributed under the GPL v2 or later.
|
| 3 |
+
msgid ""
|
| 4 |
+
msgstr ""
|
| 5 |
+
"Project-Id-Version: Shortcode UI v0.3-alpha\n"
|
| 6 |
+
"Report-Msgid-Bugs-To: http://wordpress.org/support/plugin/"
|
| 7 |
+
"shortcode-ui\n"
|
| 8 |
+
"POT-Creation-Date: 2015-04-22 16:48:40+00:00\n"
|
| 9 |
+
"MIME-Version: 1.0\n"
|
| 10 |
+
"Content-Type: text/plain; charset=UTF-8\n"
|
| 11 |
+
"Content-Transfer-Encoding: 8bit\n"
|
| 12 |
+
"PO-Revision-Date: 2015-04-28 23:36+0100\n"
|
| 13 |
+
"X-Generator: Poedit 1.7.6\n"
|
| 14 |
+
"X-Poedit-KeywordsList: __;_e;_x:1,2c;_ex:1,2c;_n:1,2;_nx:1,2,4c;"
|
| 15 |
+
"_n_noop:1,2;_nx_noop:1,2,3c;esc_attr__;esc_html__;esc_attr_e;"
|
| 16 |
+
"esc_html_e;esc_attr_x:1,2c;esc_html_x:1,2c\n"
|
| 17 |
+
"Language: fr\n"
|
| 18 |
+
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
|
| 19 |
+
"X-Poedit-SourceCharset: UTF-8\n"
|
| 20 |
+
"X-Poedit-Basepath: ../\n"
|
| 21 |
+
"X-Textdomain-Support: yes\n"
|
| 22 |
+
"Last-Translator: \n"
|
| 23 |
+
"Language-Team: Frédéric Serva <fred.serva@gmail.com>\n"
|
| 24 |
+
"X-Poedit-SearchPath-0: .\n"
|
| 25 |
+
|
| 26 |
+
#: inc/class-shortcode-ui.php:40
|
| 27 |
+
msgid "Inner Content"
|
| 28 |
+
msgstr "Contenu interieur"
|
| 29 |
+
|
| 30 |
+
#: inc/class-shortcode-ui.php:101 inc/class-shortcode-ui.php:102
|
| 31 |
+
msgid "Insert Post Element"
|
| 32 |
+
msgstr "Insérer un élément d'article"
|
| 33 |
+
|
| 34 |
+
#: inc/class-shortcode-ui.php:103
|
| 35 |
+
msgid "%s Details"
|
| 36 |
+
msgstr "%s Détails"
|
| 37 |
+
|
| 38 |
+
#: inc/class-shortcode-ui.php:104
|
| 39 |
+
msgid "Insert Element"
|
| 40 |
+
msgstr "Insérer un élément"
|
| 41 |
+
|
| 42 |
+
#: inc/class-shortcode-ui.php:105
|
| 43 |
+
msgid "Update"
|
| 44 |
+
msgstr "Mettre à jour"
|
| 45 |
+
|
| 46 |
+
#: inc/class-shortcode-ui.php:106
|
| 47 |
+
msgid "There are no attributes to configure for this Post Element."
|
| 48 |
+
msgstr "Aucun attribut à configurer pour cet élément d'article."
|
| 49 |
+
|
| 50 |
+
#: inc/class-shortcode-ui.php:107
|
| 51 |
+
msgid "Edit"
|
| 52 |
+
msgstr "Modifier"
|
| 53 |
+
|
| 54 |
+
#: inc/class-shortcode-ui.php:108
|
| 55 |
+
msgid "Preview"
|
| 56 |
+
msgstr "Aperçu"
|
| 57 |
+
|
| 58 |
+
#: inc/class-shortcode-ui.php:109
|
| 59 |
+
msgid "Failed to load preview"
|
| 60 |
+
msgstr "Impossible de charger l'aperçu"
|
| 61 |
+
|
| 62 |
+
#: inc/class-shortcode-ui.php:110
|
| 63 |
+
msgid "Search"
|
| 64 |
+
msgstr "Recherche"
|
| 65 |
+
|
| 66 |
+
#: inc/class-shortcode-ui.php:111
|
| 67 |
+
msgid "Insert Content"
|
| 68 |
+
msgstr "Insérer le contenu"
|
| 69 |
+
|
| 70 |
+
#: inc/class-shortcode-ui.php:205
|
| 71 |
+
msgid "Something's rotten in the state of Denmark"
|
| 72 |
+
msgstr "Il y a quelque chose de pourri au royaume du Danemark"
|
| 73 |
+
|
| 74 |
+
#: inc/fields/class-field-attachment.php:47
|
| 75 |
+
#: inc/fields/class-field-attachment.php:48
|
| 76 |
+
msgid "Select Attachment"
|
| 77 |
+
msgstr "Sélectionnez le fichier à télécharger"
|
| 78 |
+
|
| 79 |
+
#: inc/templates/edit-form.tpl.php:3
|
| 80 |
+
msgid "Back to list"
|
| 81 |
+
msgstr "Retour à la liste"
|
| 82 |
+
|
| 83 |
+
#. Plugin Name of the plugin/theme
|
| 84 |
+
msgid "Shortcode UI"
|
| 85 |
+
msgstr "Shortcode UI"
|
| 86 |
+
|
| 87 |
+
#. Description of the plugin/theme
|
| 88 |
+
msgid "User Interface for adding shortcodes."
|
| 89 |
+
msgstr "Interface utilisateur facilitant l'ajout de shortcodes."
|
| 90 |
+
|
| 91 |
+
#. Author of the plugin/theme
|
| 92 |
+
msgid "Fusion Engineering and community"
|
| 93 |
+
msgstr "Fusion Engineering and community"
|
| 94 |
+
|
| 95 |
+
#. Author URI of the plugin/theme
|
| 96 |
+
msgid "http://next.fusion.net/tag/shortcode-ui/"
|
| 97 |
+
msgstr "http://next.fusion.net/tag/shortcode-ui/"
|
languages/shortcode-ui-zh_CN.mo
ADDED
|
Binary file
|
languages/shortcode-ui-zh_CN.po
ADDED
|
@@ -0,0 +1,97 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Copyright (C) 2015 Fusion Engineering and community
|
| 2 |
+
# This file is distributed under the GPL v2 or later.
|
| 3 |
+
msgid ""
|
| 4 |
+
msgstr ""
|
| 5 |
+
"Project-Id-Version: Shortcode UI v0.3-alpha\n"
|
| 6 |
+
"Report-Msgid-Bugs-To: http://wordpress.org/support/plugin/"
|
| 7 |
+
"shortcode-ui\n"
|
| 8 |
+
"POT-Creation-Date: 2015-04-22 16:48:40+00:00\n"
|
| 9 |
+
"MIME-Version: 1.0\n"
|
| 10 |
+
"Content-Type: text/plain; charset=UTF-8\n"
|
| 11 |
+
"Content-Transfer-Encoding: 8bit\n"
|
| 12 |
+
"PO-Revision-Date: 2015-04-28 09:58+0800\n"
|
| 13 |
+
"X-Generator: Poedit 1.7.5\n"
|
| 14 |
+
"X-Poedit-KeywordsList: __;_e;_x:1,2c;_ex:1,2c;_n:1,2;_nx:1,2,4c;"
|
| 15 |
+
"_n_noop:1,2;_nx_noop:1,2,3c;esc_attr__;esc_html__;esc_attr_e;"
|
| 16 |
+
"esc_html_e;esc_attr_x:1,2c;esc_html_x:1,2c\n"
|
| 17 |
+
"Language: zh_CN\n"
|
| 18 |
+
"Plural-Forms: nplurals=1; plural=0;\n"
|
| 19 |
+
"X-Poedit-SourceCharset: UTF-8\n"
|
| 20 |
+
"X-Poedit-Basepath: ../\n"
|
| 21 |
+
"X-Textdomain-Support: yes\n"
|
| 22 |
+
"Last-Translator: Amos Lee <iwillhappy1314@gmail.com>\n"
|
| 23 |
+
"Language-Team: Amos Lee <iwillhappy1314@gmail.com>\n"
|
| 24 |
+
"X-Poedit-SearchPath-0: .\n"
|
| 25 |
+
|
| 26 |
+
#: inc/class-shortcode-ui.php:40
|
| 27 |
+
msgid "Inner Content"
|
| 28 |
+
msgstr "插入内容"
|
| 29 |
+
|
| 30 |
+
#: inc/class-shortcode-ui.php:101 inc/class-shortcode-ui.php:102
|
| 31 |
+
msgid "Insert Post Element"
|
| 32 |
+
msgstr "插入文章内容"
|
| 33 |
+
|
| 34 |
+
#: inc/class-shortcode-ui.php:103
|
| 35 |
+
msgid "%s Details"
|
| 36 |
+
msgstr "%s 详情"
|
| 37 |
+
|
| 38 |
+
#: inc/class-shortcode-ui.php:104
|
| 39 |
+
msgid "Insert Element"
|
| 40 |
+
msgstr "插入元素"
|
| 41 |
+
|
| 42 |
+
#: inc/class-shortcode-ui.php:105
|
| 43 |
+
msgid "Update"
|
| 44 |
+
msgstr "更新"
|
| 45 |
+
|
| 46 |
+
#: inc/class-shortcode-ui.php:106
|
| 47 |
+
msgid "There are no attributes to configure for this Post Element."
|
| 48 |
+
msgstr "此文章元素没有属性需要设置"
|
| 49 |
+
|
| 50 |
+
#: inc/class-shortcode-ui.php:107
|
| 51 |
+
msgid "Edit"
|
| 52 |
+
msgstr "编辑"
|
| 53 |
+
|
| 54 |
+
#: inc/class-shortcode-ui.php:108
|
| 55 |
+
msgid "Preview"
|
| 56 |
+
msgstr "预览"
|
| 57 |
+
|
| 58 |
+
#: inc/class-shortcode-ui.php:109
|
| 59 |
+
msgid "Failed to load preview"
|
| 60 |
+
msgstr "加载预览失败"
|
| 61 |
+
|
| 62 |
+
#: inc/class-shortcode-ui.php:110
|
| 63 |
+
msgid "Search"
|
| 64 |
+
msgstr "搜索"
|
| 65 |
+
|
| 66 |
+
#: inc/class-shortcode-ui.php:111
|
| 67 |
+
msgid "Insert Content"
|
| 68 |
+
msgstr "插入内容"
|
| 69 |
+
|
| 70 |
+
#: inc/class-shortcode-ui.php:205
|
| 71 |
+
msgid "Something's rotten in the state of Denmark"
|
| 72 |
+
msgstr "Something's rotten in the state of Denmark"
|
| 73 |
+
|
| 74 |
+
#: inc/fields/class-field-attachment.php:47
|
| 75 |
+
#: inc/fields/class-field-attachment.php:48
|
| 76 |
+
msgid "Select Attachment"
|
| 77 |
+
msgstr "选择附件"
|
| 78 |
+
|
| 79 |
+
#: inc/templates/edit-form.tpl.php:3
|
| 80 |
+
msgid "Back to list"
|
| 81 |
+
msgstr "返回列表"
|
| 82 |
+
|
| 83 |
+
#. Plugin Name of the plugin/theme
|
| 84 |
+
msgid "Shortcode UI"
|
| 85 |
+
msgstr "简码UI"
|
| 86 |
+
|
| 87 |
+
#. Description of the plugin/theme
|
| 88 |
+
msgid "User Interface for adding shortcodes."
|
| 89 |
+
msgstr "添加简码的用户界面"
|
| 90 |
+
|
| 91 |
+
#. Author of the plugin/theme
|
| 92 |
+
msgid "Fusion Engineering and community"
|
| 93 |
+
msgstr "Fusion Engineering and community"
|
| 94 |
+
|
| 95 |
+
#. Author URI of the plugin/theme
|
| 96 |
+
msgid "http://next.fusion.net/tag/shortcode-ui/"
|
| 97 |
+
msgstr "http://next.fusion.net/tag/shortcode-ui/"
|
languages/shortcode-ui.pot
CHANGED
|
@@ -2,16 +2,16 @@
|
|
| 2 |
# This file is distributed under the GPL v2 or later.
|
| 3 |
msgid ""
|
| 4 |
msgstr ""
|
| 5 |
-
"Project-Id-Version: Shortcode UI
|
| 6 |
"Report-Msgid-Bugs-To: http://wordpress.org/support/plugin/shortcode-ui\n"
|
| 7 |
-
"POT-Creation-Date: 2015-
|
| 8 |
"MIME-Version: 1.0\n"
|
| 9 |
"Content-Type: text/plain; charset=utf-8\n"
|
| 10 |
"Content-Transfer-Encoding: 8bit\n"
|
| 11 |
"PO-Revision-Date: 2015-MO-DA HO:MI+ZONE\n"
|
| 12 |
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
| 13 |
"Language-Team: LANGUAGE <LL@li.org>\n"
|
| 14 |
-
"X-Generator: grunt-wp-i18n 0.5.
|
| 15 |
"X-Poedit-KeywordsList: "
|
| 16 |
"__;_e;_x:1,2c;_ex:1,2c;_n:1,2;_nx:1,2,4c;_n_noop:1,2;_nx_noop:1,2,3c;esc_"
|
| 17 |
"attr__;esc_html__;esc_attr_e;esc_html_e;esc_attr_x:1,2c;esc_html_x:1,2c;\n"
|
|
@@ -28,47 +28,47 @@ msgstr ""
|
|
| 28 |
msgid "Inner Content"
|
| 29 |
msgstr ""
|
| 30 |
|
| 31 |
-
#: inc/class-shortcode-ui.php:
|
| 32 |
msgid "Insert Post Element"
|
| 33 |
msgstr ""
|
| 34 |
|
| 35 |
-
#: inc/class-shortcode-ui.php:
|
| 36 |
msgid "%s Details"
|
| 37 |
msgstr ""
|
| 38 |
|
| 39 |
-
#: inc/class-shortcode-ui.php:
|
| 40 |
msgid "Insert Element"
|
| 41 |
msgstr ""
|
| 42 |
|
| 43 |
-
#: inc/class-shortcode-ui.php:
|
| 44 |
msgid "Update"
|
| 45 |
msgstr ""
|
| 46 |
|
| 47 |
-
#: inc/class-shortcode-ui.php:
|
| 48 |
msgid "There are no attributes to configure for this Post Element."
|
| 49 |
msgstr ""
|
| 50 |
|
| 51 |
-
#: inc/class-shortcode-ui.php:
|
| 52 |
msgid "Edit"
|
| 53 |
msgstr ""
|
| 54 |
|
| 55 |
-
#: inc/class-shortcode-ui.php:
|
| 56 |
msgid "Preview"
|
| 57 |
msgstr ""
|
| 58 |
|
| 59 |
-
#: inc/class-shortcode-ui.php:
|
| 60 |
msgid "Failed to load preview"
|
| 61 |
msgstr ""
|
| 62 |
|
| 63 |
-
#: inc/class-shortcode-ui.php:
|
| 64 |
msgid "Search"
|
| 65 |
msgstr ""
|
| 66 |
|
| 67 |
-
#: inc/class-shortcode-ui.php:
|
| 68 |
msgid "Insert Content"
|
| 69 |
msgstr ""
|
| 70 |
|
| 71 |
-
#: inc/class-shortcode-ui.php:
|
| 72 |
msgid "Something's rotten in the state of Denmark"
|
| 73 |
msgstr ""
|
| 74 |
|
| 2 |
# This file is distributed under the GPL v2 or later.
|
| 3 |
msgid ""
|
| 4 |
msgstr ""
|
| 5 |
+
"Project-Id-Version: Shortcode UI 0.4.0-alpha\n"
|
| 6 |
"Report-Msgid-Bugs-To: http://wordpress.org/support/plugin/shortcode-ui\n"
|
| 7 |
+
"POT-Creation-Date: 2015-06-22 19:53:12+00:00\n"
|
| 8 |
"MIME-Version: 1.0\n"
|
| 9 |
"Content-Type: text/plain; charset=utf-8\n"
|
| 10 |
"Content-Transfer-Encoding: 8bit\n"
|
| 11 |
"PO-Revision-Date: 2015-MO-DA HO:MI+ZONE\n"
|
| 12 |
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
| 13 |
"Language-Team: LANGUAGE <LL@li.org>\n"
|
| 14 |
+
"X-Generator: grunt-wp-i18n 0.5.2\n"
|
| 15 |
"X-Poedit-KeywordsList: "
|
| 16 |
"__;_e;_x:1,2c;_ex:1,2c;_n:1,2;_nx:1,2,4c;_n_noop:1,2;_nx_noop:1,2,3c;esc_"
|
| 17 |
"attr__;esc_html__;esc_attr_e;esc_html_e;esc_attr_x:1,2c;esc_html_x:1,2c;\n"
|
| 28 |
msgid "Inner Content"
|
| 29 |
msgstr ""
|
| 30 |
|
| 31 |
+
#: inc/class-shortcode-ui.php:109 inc/class-shortcode-ui.php:110
|
| 32 |
msgid "Insert Post Element"
|
| 33 |
msgstr ""
|
| 34 |
|
| 35 |
+
#: inc/class-shortcode-ui.php:111
|
| 36 |
msgid "%s Details"
|
| 37 |
msgstr ""
|
| 38 |
|
| 39 |
+
#: inc/class-shortcode-ui.php:112
|
| 40 |
msgid "Insert Element"
|
| 41 |
msgstr ""
|
| 42 |
|
| 43 |
+
#: inc/class-shortcode-ui.php:113
|
| 44 |
msgid "Update"
|
| 45 |
msgstr ""
|
| 46 |
|
| 47 |
+
#: inc/class-shortcode-ui.php:114
|
| 48 |
msgid "There are no attributes to configure for this Post Element."
|
| 49 |
msgstr ""
|
| 50 |
|
| 51 |
+
#: inc/class-shortcode-ui.php:115
|
| 52 |
msgid "Edit"
|
| 53 |
msgstr ""
|
| 54 |
|
| 55 |
+
#: inc/class-shortcode-ui.php:116
|
| 56 |
msgid "Preview"
|
| 57 |
msgstr ""
|
| 58 |
|
| 59 |
+
#: inc/class-shortcode-ui.php:117
|
| 60 |
msgid "Failed to load preview"
|
| 61 |
msgstr ""
|
| 62 |
|
| 63 |
+
#: inc/class-shortcode-ui.php:118
|
| 64 |
msgid "Search"
|
| 65 |
msgstr ""
|
| 66 |
|
| 67 |
+
#: inc/class-shortcode-ui.php:119
|
| 68 |
msgid "Insert Content"
|
| 69 |
msgstr ""
|
| 70 |
|
| 71 |
+
#: inc/class-shortcode-ui.php:213
|
| 72 |
msgid "Something's rotten in the state of Denmark"
|
| 73 |
msgstr ""
|
| 74 |
|
lib/wp-js-hooks/wp-js-hooks.js
ADDED
|
@@ -0,0 +1,264 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/**
|
| 2 |
+
* This code is taken from @carldanley's WP-JS-Hooks library:
|
| 3 |
+
* https://github.com/carldanley/WP-JS-Hooks
|
| 4 |
+
*
|
| 5 |
+
* This is a basic event manager based on the one proposed for WordPress core
|
| 6 |
+
* in https://core.trac.wordpress.org/attachment/ticket/21170.
|
| 7 |
+
*
|
| 8 |
+
* Modifications for this plugin: The EventManager methods are all namespaced
|
| 9 |
+
* to `wp.shortcake.hooks` to avoid collisions with the proposed system of
|
| 10 |
+
* hooks for core, which are intended to be adopted at `wp.hooks`. However, we
|
| 11 |
+
* plan to keep basic feature parity and interoperability with the proposed JS
|
| 12 |
+
* hooks and filters system for core, with the end goal of using the same API
|
| 13 |
+
* as what is finally decided on there.
|
| 14 |
+
*/
|
| 15 |
+
|
| 16 |
+
( function( window, undefined ) {
|
| 17 |
+
'use strict';
|
| 18 |
+
|
| 19 |
+
/**
|
| 20 |
+
* Handles managing all events for whatever you plug it into. Priorities for hooks are based on lowest to highest in
|
| 21 |
+
* that, lowest priority hooks are fired first.
|
| 22 |
+
*/
|
| 23 |
+
var EventManager = function() {
|
| 24 |
+
var slice = Array.prototype.slice;
|
| 25 |
+
|
| 26 |
+
/**
|
| 27 |
+
* Maintain a reference to the object scope so our public methods never get confusing.
|
| 28 |
+
*/
|
| 29 |
+
var MethodsAvailable = {
|
| 30 |
+
removeFilter : removeFilter,
|
| 31 |
+
applyFilters : applyFilters,
|
| 32 |
+
addFilter : addFilter,
|
| 33 |
+
removeAction : removeAction,
|
| 34 |
+
doAction : doAction,
|
| 35 |
+
addAction : addAction
|
| 36 |
+
};
|
| 37 |
+
|
| 38 |
+
/**
|
| 39 |
+
* Contains the hooks that get registered with this EventManager. The array for storage utilizes a "flat"
|
| 40 |
+
* object literal such that looking up the hook utilizes the native object literal hash.
|
| 41 |
+
*/
|
| 42 |
+
var STORAGE = {
|
| 43 |
+
actions : {},
|
| 44 |
+
filters : {}
|
| 45 |
+
};
|
| 46 |
+
|
| 47 |
+
/**
|
| 48 |
+
* Adds an action to the event manager.
|
| 49 |
+
*
|
| 50 |
+
* @param action Must contain namespace.identifier
|
| 51 |
+
* @param callback Must be a valid callback function before this action is added
|
| 52 |
+
* @param [priority=10] Used to control when the function is executed in relation to other callbacks bound to the same hook
|
| 53 |
+
* @param [context] Supply a value to be used for this
|
| 54 |
+
*/
|
| 55 |
+
function addAction( action, callback, priority, context ) {
|
| 56 |
+
if( typeof action === 'string' && typeof callback === 'function' ) {
|
| 57 |
+
priority = parseInt( ( priority || 10 ), 10 );
|
| 58 |
+
_addHook( 'actions', action, callback, priority, context );
|
| 59 |
+
}
|
| 60 |
+
|
| 61 |
+
return MethodsAvailable;
|
| 62 |
+
}
|
| 63 |
+
|
| 64 |
+
/**
|
| 65 |
+
* Performs an action if it exists. You can pass as many arguments as you want to this function; the only rule is
|
| 66 |
+
* that the first argument must always be the action.
|
| 67 |
+
*/
|
| 68 |
+
function doAction( /* action, arg1, arg2, ... */ ) {
|
| 69 |
+
var args = slice.call( arguments );
|
| 70 |
+
var action = args.shift();
|
| 71 |
+
|
| 72 |
+
if( typeof action === 'string' ) {
|
| 73 |
+
_runHook( 'actions', action, args );
|
| 74 |
+
}
|
| 75 |
+
|
| 76 |
+
return MethodsAvailable;
|
| 77 |
+
}
|
| 78 |
+
|
| 79 |
+
/**
|
| 80 |
+
* Removes the specified action if it contains a namespace.identifier & exists.
|
| 81 |
+
*
|
| 82 |
+
* @param action The action to remove
|
| 83 |
+
* @param [callback] Callback function to remove
|
| 84 |
+
*/
|
| 85 |
+
function removeAction( action, callback ) {
|
| 86 |
+
if( typeof action === 'string' ) {
|
| 87 |
+
_removeHook( 'actions', action, callback );
|
| 88 |
+
}
|
| 89 |
+
|
| 90 |
+
return MethodsAvailable;
|
| 91 |
+
}
|
| 92 |
+
|
| 93 |
+
/**
|
| 94 |
+
* Adds a filter to the event manager.
|
| 95 |
+
*
|
| 96 |
+
* @param filter Must contain namespace.identifier
|
| 97 |
+
* @param callback Must be a valid callback function before this action is added
|
| 98 |
+
* @param [priority=10] Used to control when the function is executed in relation to other callbacks bound to the same hook
|
| 99 |
+
* @param [context] Supply a value to be used for this
|
| 100 |
+
*/
|
| 101 |
+
function addFilter( filter, callback, priority, context ) {
|
| 102 |
+
if( typeof filter === 'string' && typeof callback === 'function' ) {
|
| 103 |
+
priority = parseInt( ( priority || 10 ), 10 );
|
| 104 |
+
_addHook( 'filters', filter, callback, priority, context );
|
| 105 |
+
}
|
| 106 |
+
|
| 107 |
+
return MethodsAvailable;
|
| 108 |
+
}
|
| 109 |
+
|
| 110 |
+
/**
|
| 111 |
+
* Performs a filter if it exists. You should only ever pass 1 argument to be filtered. The only rule is that
|
| 112 |
+
* the first argument must always be the filter.
|
| 113 |
+
*/
|
| 114 |
+
function applyFilters( /* filter, filtered arg, arg2, ... */ ) {
|
| 115 |
+
var args = slice.call( arguments );
|
| 116 |
+
var filter = args.shift();
|
| 117 |
+
|
| 118 |
+
if( typeof filter === 'string' ) {
|
| 119 |
+
return _runHook( 'filters', filter, args );
|
| 120 |
+
}
|
| 121 |
+
|
| 122 |
+
return MethodsAvailable;
|
| 123 |
+
}
|
| 124 |
+
|
| 125 |
+
/**
|
| 126 |
+
* Removes the specified filter if it contains a namespace.identifier & exists.
|
| 127 |
+
*
|
| 128 |
+
* @param filter The action to remove
|
| 129 |
+
* @param [callback] Callback function to remove
|
| 130 |
+
*/
|
| 131 |
+
function removeFilter( filter, callback ) {
|
| 132 |
+
if( typeof filter === 'string') {
|
| 133 |
+
_removeHook( 'filters', filter, callback );
|
| 134 |
+
}
|
| 135 |
+
|
| 136 |
+
return MethodsAvailable;
|
| 137 |
+
}
|
| 138 |
+
|
| 139 |
+
/**
|
| 140 |
+
* Removes the specified hook by resetting the value of it.
|
| 141 |
+
*
|
| 142 |
+
* @param type Type of hook, either 'actions' or 'filters'
|
| 143 |
+
* @param hook The hook (namespace.identifier) to remove
|
| 144 |
+
* @private
|
| 145 |
+
*/
|
| 146 |
+
function _removeHook( type, hook, callback, context ) {
|
| 147 |
+
var handlers, handler, i;
|
| 148 |
+
|
| 149 |
+
if ( !STORAGE[ type ][ hook ] ) {
|
| 150 |
+
return;
|
| 151 |
+
}
|
| 152 |
+
if ( !callback ) {
|
| 153 |
+
STORAGE[ type ][ hook ] = [];
|
| 154 |
+
} else {
|
| 155 |
+
handlers = STORAGE[ type ][ hook ];
|
| 156 |
+
if ( !context ) {
|
| 157 |
+
for ( i = handlers.length; i--; ) {
|
| 158 |
+
if ( handlers[i].callback === callback ) {
|
| 159 |
+
handlers.splice( i, 1 );
|
| 160 |
+
}
|
| 161 |
+
}
|
| 162 |
+
}
|
| 163 |
+
else {
|
| 164 |
+
for ( i = handlers.length; i--; ) {
|
| 165 |
+
handler = handlers[i];
|
| 166 |
+
if ( handler.callback === callback && handler.context === context) {
|
| 167 |
+
handlers.splice( i, 1 );
|
| 168 |
+
}
|
| 169 |
+
}
|
| 170 |
+
}
|
| 171 |
+
}
|
| 172 |
+
}
|
| 173 |
+
|
| 174 |
+
/**
|
| 175 |
+
* Adds the hook to the appropriate storage container
|
| 176 |
+
*
|
| 177 |
+
* @param type 'actions' or 'filters'
|
| 178 |
+
* @param hook The hook (namespace.identifier) to add to our event manager
|
| 179 |
+
* @param callback The function that will be called when the hook is executed.
|
| 180 |
+
* @param priority The priority of this hook. Must be an integer.
|
| 181 |
+
* @param [context] A value to be used for this
|
| 182 |
+
* @private
|
| 183 |
+
*/
|
| 184 |
+
function _addHook( type, hook, callback, priority, context ) {
|
| 185 |
+
var hookObject = {
|
| 186 |
+
callback : callback,
|
| 187 |
+
priority : priority,
|
| 188 |
+
context : context
|
| 189 |
+
};
|
| 190 |
+
|
| 191 |
+
// Utilize 'prop itself' : http://jsperf.com/hasownproperty-vs-in-vs-undefined/19
|
| 192 |
+
var hooks = STORAGE[ type ][ hook ];
|
| 193 |
+
if( hooks ) {
|
| 194 |
+
hooks.push( hookObject );
|
| 195 |
+
hooks = _hookInsertSort( hooks );
|
| 196 |
+
}
|
| 197 |
+
else {
|
| 198 |
+
hooks = [ hookObject ];
|
| 199 |
+
}
|
| 200 |
+
|
| 201 |
+
STORAGE[ type ][ hook ] = hooks;
|
| 202 |
+
}
|
| 203 |
+
|
| 204 |
+
/**
|
| 205 |
+
* Use an insert sort for keeping our hooks organized based on priority. This function is ridiculously faster
|
| 206 |
+
* than bubble sort, etc: http://jsperf.com/javascript-sort
|
| 207 |
+
*
|
| 208 |
+
* @param hooks The custom array containing all of the appropriate hooks to perform an insert sort on.
|
| 209 |
+
* @private
|
| 210 |
+
*/
|
| 211 |
+
function _hookInsertSort( hooks ) {
|
| 212 |
+
var tmpHook, j, prevHook;
|
| 213 |
+
for( var i = 1, len = hooks.length; i < len; i++ ) {
|
| 214 |
+
tmpHook = hooks[ i ];
|
| 215 |
+
j = i;
|
| 216 |
+
while( ( prevHook = hooks[ j - 1 ] ) && prevHook.priority > tmpHook.priority ) {
|
| 217 |
+
hooks[ j ] = hooks[ j - 1 ];
|
| 218 |
+
--j;
|
| 219 |
+
}
|
| 220 |
+
hooks[ j ] = tmpHook;
|
| 221 |
+
}
|
| 222 |
+
|
| 223 |
+
return hooks;
|
| 224 |
+
}
|
| 225 |
+
|
| 226 |
+
/**
|
| 227 |
+
* Runs the specified hook. If it is an action, the value is not modified but if it is a filter, it is.
|
| 228 |
+
*
|
| 229 |
+
* @param type 'actions' or 'filters'
|
| 230 |
+
* @param hook The hook ( namespace.identifier ) to be ran.
|
| 231 |
+
* @param args Arguments to pass to the action/filter. If it's a filter, args is actually a single parameter.
|
| 232 |
+
* @private
|
| 233 |
+
*/
|
| 234 |
+
function _runHook( type, hook, args ) {
|
| 235 |
+
var handlers = STORAGE[ type ][ hook ], i, len;
|
| 236 |
+
|
| 237 |
+
if ( !handlers ) {
|
| 238 |
+
return (type === 'filters') ? args[0] : false;
|
| 239 |
+
}
|
| 240 |
+
|
| 241 |
+
len = handlers.length;
|
| 242 |
+
if ( type === 'filters' ) {
|
| 243 |
+
for ( i = 0; i < len; i++ ) {
|
| 244 |
+
args[ 0 ] = handlers[ i ].callback.apply( handlers[ i ].context, args );
|
| 245 |
+
}
|
| 246 |
+
} else {
|
| 247 |
+
for ( i = 0; i < len; i++ ) {
|
| 248 |
+
handlers[ i ].callback.apply( handlers[ i ].context, args );
|
| 249 |
+
}
|
| 250 |
+
}
|
| 251 |
+
|
| 252 |
+
return ( type === 'filters' ) ? args[ 0 ] : true;
|
| 253 |
+
}
|
| 254 |
+
|
| 255 |
+
// return all of the publicly available methods
|
| 256 |
+
return MethodsAvailable;
|
| 257 |
+
|
| 258 |
+
};
|
| 259 |
+
|
| 260 |
+
window.wp = window.wp || {};
|
| 261 |
+
window.wp.shortcake = window.wp.shortcake || {};
|
| 262 |
+
window.wp.shortcake.hooks = new EventManager();
|
| 263 |
+
|
| 264 |
+
} )( window );
|
lib/wp-js-hooks/wp-js-hooks.min.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
| 1 |
+
!function(t){"use strict";var r=function(){function t(t,r,n,e){return"string"==typeof t&&"function"==typeof r&&(n=parseInt(n||10,10),f("actions",t,r,n,e)),p}function r(){var t=s.call(arguments),r=t.shift();return"string"==typeof r&&l("actions",r,t),p}function n(t,r){return"string"==typeof t&&c("actions",t,r),p}function e(t,r,n,e){return"string"==typeof t&&"function"==typeof r&&(n=parseInt(n||10,10),f("filters",t,r,n,e)),p}function i(){var t=s.call(arguments),r=t.shift();return"string"==typeof r?l("filters",r,t):p}function o(t,r){return"string"==typeof t&&c("filters",t,r),p}function c(t,r,n,e){var i,o,c;if(u[t][r])if(n)if(i=u[t][r],e)for(c=i.length;c--;)o=i[c],o.callback===n&&o.context===e&&i.splice(c,1);else for(c=i.length;c--;)i[c].callback===n&&i.splice(c,1);else u[t][r]=[]}function f(t,r,n,e,i){var o={callback:n,priority:e,context:i},c=u[t][r];c?(c.push(o),c=a(c)):c=[o],u[t][r]=c}function a(t){for(var r,n,e,i=1,o=t.length;o>i;i++){for(r=t[i],n=i;(e=t[n-1])&&e.priority>r.priority;)t[n]=t[n-1],--n;t[n]=r}return t}function l(t,r,n){var e,i,o=u[t][r];if(!o)return"filters"===t?n[0]:!1;if(i=o.length,"filters"===t)for(e=0;i>e;e++)n[0]=o[e].callback.apply(o[e].context,n);else for(e=0;i>e;e++)o[e].callback.apply(o[e].context,n);return"filters"===t?n[0]:!0}var s=Array.prototype.slice,p={removeFilter:o,applyFilters:i,addFilter:e,removeAction:n,doAction:r,addAction:t},u={actions:{},filters:{}};return p};t.wp=t.wp||{},t.wp.shortcake=t.wp.shortcake||{},t.wp.shortcake.hooks=new r}(window);
|
readme.txt
CHANGED
|
@@ -1,9 +1,9 @@
|
|
| 1 |
=== Shortcake (Shortcode UI) ===
|
| 2 |
-
Contributors: fusionengineering, mattheu, danielbachhuber, zebulonj, jitendraharpalani, sanchothefat, bfintal, davisshaver
|
| 3 |
Tags: shortcodes
|
| 4 |
Requires at least: 4.1
|
| 5 |
Tested up to: 4.2.1
|
| 6 |
-
Stable tag: 0.
|
| 7 |
License: GPLv2 or later
|
| 8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
| 9 |
|
|
@@ -23,6 +23,8 @@ Shortcake can be installed like any other WordPress plugin.
|
|
| 23 |
|
| 24 |
Once you've done so, you'll need to [register the UI for your code](https://github.com/fusioneng/Shortcake/wiki/Registering-Shortcode-UI).
|
| 25 |
|
|
|
|
|
|
|
| 26 |
== Screenshots ==
|
| 27 |
|
| 28 |
1. Without Shortcake, shortcodes have a minimal UI.
|
|
@@ -32,13 +34,29 @@ Once you've done so, you'll need to [register the UI for your code](https://gith
|
|
| 32 |
|
| 33 |
== Upgrade Notice ==
|
| 34 |
|
| 35 |
-
= 0.
|
|
|
|
|
|
|
|
|
|
|
|
|
| 36 |
|
| 37 |
We've removed the compatibility shim for the magical `content` attribute. If you were using this to support editing inner content, you'll need to change your UI registration to use `inner_content`.
|
| 38 |
|
| 39 |
== Changelog ==
|
| 40 |
|
| 41 |
-
= 0.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 42 |
* **Breaking change**: We've removed the compatibility shim for the magical `content` attribute. If you were using this to support editing inner content, you'll need to change your UI registration to use `inner_content`.
|
| 43 |
* New `post_select` field type for selecting from a list of posts. Supports an additional `query` parameter to modify the search query.
|
| 44 |
* Using a new `post_type` argument, shortcode UI can be registered for specific post types. This is helpful if you want the UI for a given shortcode to only appear on specific post types.
|
| 1 |
=== Shortcake (Shortcode UI) ===
|
| 2 |
+
Contributors: fusionengineering, mattheu, danielbachhuber, zebulonj, goldenapples, jitendraharpalani, sanchothefat, bfintal, davisshaver
|
| 3 |
Tags: shortcodes
|
| 4 |
Requires at least: 4.1
|
| 5 |
Tested up to: 4.2.1
|
| 6 |
+
Stable tag: 0.4.0
|
| 7 |
License: GPLv2 or later
|
| 8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
| 9 |
|
| 23 |
|
| 24 |
Once you've done so, you'll need to [register the UI for your code](https://github.com/fusioneng/Shortcake/wiki/Registering-Shortcode-UI).
|
| 25 |
|
| 26 |
+
New in 0.4.0 is the ability to [attach javascript functions to event attribute updates](https://github.com/fusioneng/Shortcake/wiki/Event-Attribute-Callbacks). Action hooks can be used to dynamically show or hide a field based on the value of another, or to implement custom validation rules.
|
| 27 |
+
|
| 28 |
== Screenshots ==
|
| 29 |
|
| 30 |
1. Without Shortcake, shortcodes have a minimal UI.
|
| 34 |
|
| 35 |
== Upgrade Notice ==
|
| 36 |
|
| 37 |
+
= 0.4.0 =
|
| 38 |
+
|
| 39 |
+
We've removed the compatibility shim for the `placeholder` attribute argument. You should register a placeholder for your field using the `meta` argument.
|
| 40 |
+
|
| 41 |
+
= 0.3.0 =
|
| 42 |
|
| 43 |
We've removed the compatibility shim for the magical `content` attribute. If you were using this to support editing inner content, you'll need to change your UI registration to use `inner_content`.
|
| 44 |
|
| 45 |
== Changelog ==
|
| 46 |
|
| 47 |
+
= 0.4.0 (June 22, 2015) =
|
| 48 |
+
* Using [carldanley/wp-js-hooks](https://github.com/carldanley/WP-JS-Hooks) for a basic API to register JS callbacks on shortcode attributes.
|
| 49 |
+
* Attachment field uses a loading indicator when the preview for an attachment is loading.
|
| 50 |
+
* Added Chinese translation.
|
| 51 |
+
* Added French translation.
|
| 52 |
+
* Added Spanish translation.
|
| 53 |
+
* Bug fix: Prevents fataling when editor is loaded in the frontend context.
|
| 54 |
+
* Bug fix: Color field also supports `meta` argument.
|
| 55 |
+
* Bug fix: Removes trailing whitespace from shortcodes without attributes.
|
| 56 |
+
* Bug fix: Removes double slash in editor css path.
|
| 57 |
+
* [Full release notes](http://fusion.net/story/154890/introducing-shortcake-v0-4-0-strawberry/)
|
| 58 |
+
|
| 59 |
+
= 0.3.0 (April 27, 2015) =
|
| 60 |
* **Breaking change**: We've removed the compatibility shim for the magical `content` attribute. If you were using this to support editing inner content, you'll need to change your UI registration to use `inner_content`.
|
| 61 |
* New `post_select` field type for selecting from a list of posts. Supports an additional `query` parameter to modify the search query.
|
| 62 |
* Using a new `post_type` argument, shortcode UI can be registered for specific post types. This is helpful if you want the UI for a given shortcode to only appear on specific post types.
|
shortcode-ui.php
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
<?php
|
| 2 |
/**
|
| 3 |
-
* Plugin Name: Shortcode UI
|
| 4 |
-
* Version: 0.
|
| 5 |
* Description: User Interface for adding shortcodes.
|
| 6 |
* Author: Fusion Engineering and community
|
| 7 |
* Author URI: http://next.fusion.net/tag/shortcode-ui/
|
|
@@ -19,7 +19,7 @@
|
|
| 19 |
* GNU General Public License for more details.
|
| 20 |
*/
|
| 21 |
|
| 22 |
-
define( 'SHORTCODE_UI_VERSION', '0.
|
| 23 |
|
| 24 |
require_once dirname( __FILE__ ) . '/inc/class-shortcode-ui.php';
|
| 25 |
require_once dirname( __FILE__ ) . '/inc/fields/class-shortcode-ui-fields.php';
|
|
@@ -66,7 +66,7 @@ function shortcode_ui_register_for_shortcode( $shortcode_tag, $args = array() )
|
|
| 66 |
* @param array $args
|
| 67 |
* @return null
|
| 68 |
*/
|
| 69 |
-
function shortcode_ui_get_register_shortcode( $shortcode_tag
|
| 70 |
return Shortcode_UI::get_instance()->get_shortcode( $shortcode_tag );
|
| 71 |
}
|
| 72 |
|
| 1 |
<?php
|
| 2 |
/**
|
| 3 |
+
* Plugin Name: Shortcake (Shortcode UI)
|
| 4 |
+
* Version: 0.4.0
|
| 5 |
* Description: User Interface for adding shortcodes.
|
| 6 |
* Author: Fusion Engineering and community
|
| 7 |
* Author URI: http://next.fusion.net/tag/shortcode-ui/
|
| 19 |
* GNU General Public License for more details.
|
| 20 |
*/
|
| 21 |
|
| 22 |
+
define( 'SHORTCODE_UI_VERSION', '0.4.0' );
|
| 23 |
|
| 24 |
require_once dirname( __FILE__ ) . '/inc/class-shortcode-ui.php';
|
| 25 |
require_once dirname( __FILE__ ) . '/inc/fields/class-shortcode-ui-fields.php';
|
| 66 |
* @param array $args
|
| 67 |
* @return null
|
| 68 |
*/
|
| 69 |
+
function shortcode_ui_get_register_shortcode( $shortcode_tag ) {
|
| 70 |
return Shortcode_UI::get_instance()->get_shortcode( $shortcode_tag );
|
| 71 |
}
|
| 72 |
|
