Update shortcode library

This commit is contained in:
Robin Cornett
2018-03-17 13:54:23 -04:00
parent 0264f8a8e2
commit b5107cd843
5 changed files with 13 additions and 10 deletions
@@ -102,6 +102,9 @@ If an image ID is required, Six/Ten Press image fields in a group will work, as
### Changelog
#### 0.3.8
* fixed: content now copies to editor with formatting
#### 0.3.7
* removed: document ready from JS
@@ -218,7 +218,7 @@
if ( ! content ) {
var editor = $id.find( "textarea[id*='" + slug + "']" ).attr( 'id' );
if ( editor !== 'undefined' && editor.length ) {
content = tinymce.get( editor ).getContent( {format: 'text'} );
content = tinymce.get( editor ).getContent( {format: 'raw'} );
}
}
return content;
@@ -1 +1 @@
!function(t,e,i){"use strict";function n(t){var n=[];return e(t).each(function(t){var r=e(this).attr("id");i!==r&&(n[r]=e(this).val()),e(this).is(":checked")&&(n[r]="checked")}),n}function r(t,i){var n="";return e(t).each(function(t){var r=e(this).attr("id"),a=e(this).val(),c=this.type;if(r){var o=r.substr(r.lastIndexOf("-")+1);if(o.includes("nonce")&&(a=""),"checkbox"===c)if(i.group.length&&o.includes(i.group))a="";else if(e(this).is(":checked")){var s=[1,"1","on"],d=s.indexOf(a);a=-1!==d?"true":a}else a=e(this).is(":required")?"false":"";"button"===c&&(a=""),"textarea"!==c||i.self||(a=""),(a||e(this).is(":required"))&&(n+=" "+o+'="'+a+'"')}}),n}function a(t,i){var n=e("#"+i),r=n.find("textarea").val();if(!r){var a=n.find("textarea[id*='"+t+"']").attr("id");"undefined"!==a&&a.length&&(r=tinymce.get(a).getContent({format:"text"}))}return r}function c(t,i){var n="";return e(t).each(function(t,r){var a=e("#"+i).find("[id*='"+r+"']"),c=[];e(a).each(function(t){e(this).is(":checked")&&c.push(e(this).val())}),n+=c.length?" "+r+'="'+c.toString()+'"':""}),n}var o={};o.init=function(){Object.keys(o.params).forEach(function(i){function s(i){i.preventDefault(),v=i.target,m=!0,e(k).show(),e(".media-modal-close, .media-modal-backdrop, .sixtenpress-cancel-insertion").click(u),e(t).on("keydown",function(t){27===t.keyCode&&m&&u(t)})}function d(t){if(t.preventDefault(),e(v).hasClass(p.button)){var i=r(g,p),n=p.group?c(p.group,p.slug):"",o="";i&&(o="["+p.shortcode+n+i+"]",p.self||(o+=a(p.slug,p.modal)+"[/"+p.shortcode+"]"),tinymce.get(e(v).attr("data-editor")).execCommand("mceInsertContent",!1,o))}u(t)}function u(t){t.preventDefault(),e(k).hide(),f(),v=m=!1}function f(){e(g).each(function(t){var i=e(this).attr("id");if("checkbox"===this.type){var n="checked"===x[i];e(this).attr("checked",n)}else e(this).val(x[i])}),e(k+" .upload-file-preview").remove(),h(),l()}function h(){var t=e(k).find(".wp-picker-container");t.length&&t.each(function(){var t=e(this).parent();t.html(t.find('input[type="text"].color-field').attr("style","")),t.find('input[type="text"].wp-color-picker').each(function(){var t=e(this),i=t.data("colorpicker")||{};t.wpColorPicker(e.extend({},!1,i))})})}function l(){var t=e(k).find("textarea[id*='"+p.slug+"']");if(t.length){var i=t.attr("id");tinymce.get(i).setContent("")}}if(o.params.hasOwnProperty(i)){var p=o.params[i],v=!1,m=!1,k="."+p.modal,g=e("#"+p.modal).find(":input"),x=n(g),y=p.button.replace(" ",".");e("."+y).click(s),e(k+".sixtenpress-default-ui .sixtenpress-insert").click(d)}})},o.params="undefined"==typeof SixTenShortcodes?"":SixTenShortcodes,void 0!==o.params&&o.init()}(document,jQuery);
!function(t,e,i){"use strict";function n(t){var n=[];return e(t).each(function(t){var r=e(this).attr("id");i!==r&&(n[r]=e(this).val()),e(this).is(":checked")&&(n[r]="checked")}),n}function r(t,i){var n="";return e(t).each(function(t){var r=e(this).attr("id"),a=e(this).val(),c=this.type;if(r){var o=r.substr(r.lastIndexOf("-")+1);if(o.includes("nonce")&&(a=""),"checkbox"===c)if(i.group.length&&o.includes(i.group))a="";else if(e(this).is(":checked")){var s=[1,"1","on"],d=s.indexOf(a);a=-1!==d?"true":a}else a=e(this).is(":required")?"false":"";"button"===c&&(a=""),"textarea"!==c||i.self||(a=""),(a||e(this).is(":required"))&&(n+=" "+o+'="'+a+'"')}}),n}function a(t,i){var n=e("#"+i),r=n.find("textarea").val();if(!r){var a=n.find("textarea[id*='"+t+"']").attr("id");"undefined"!==a&&a.length&&(r=tinymce.get(a).getContent({format:"raw"}))}return r}function c(t,i){var n="";return e(t).each(function(t,r){var a=e("#"+i).find("[id*='"+r+"']"),c=[];e(a).each(function(t){e(this).is(":checked")&&c.push(e(this).val())}),n+=c.length?" "+r+'="'+c.toString()+'"':""}),n}var o={};o.init=function(){Object.keys(o.params).forEach(function(i){function s(i){i.preventDefault(),v=i.target,m=!0,e(k).show(),e(".media-modal-close, .media-modal-backdrop, .sixtenpress-cancel-insertion").click(u),e(t).on("keydown",function(t){27===t.keyCode&&m&&u(t)})}function d(t){if(t.preventDefault(),e(v).hasClass(p.button)){var i=r(g,p),n=p.group?c(p.group,p.slug):"",o="";i&&(o="["+p.shortcode+n+i+"]",p.self||(o+=a(p.slug,p.modal)+"[/"+p.shortcode+"]"),tinymce.get(e(v).attr("data-editor")).execCommand("mceInsertContent",!1,o))}u(t)}function u(t){t.preventDefault(),e(k).hide(),f(),v=m=!1}function f(){e(g).each(function(t){var i=e(this).attr("id");if("checkbox"===this.type){var n="checked"===x[i];e(this).attr("checked",n)}else e(this).val(x[i])}),e(k+" .upload-file-preview").remove(),h(),l()}function h(){var t=e(k).find(".wp-picker-container");t.length&&t.each(function(){var t=e(this).parent();t.html(t.find('input[type="text"].color-field').attr("style","")),t.find('input[type="text"].wp-color-picker').each(function(){var t=e(this),i=t.data("colorpicker")||{};t.wpColorPicker(e.extend({},!1,i))})})}function l(){var t=e(k).find("textarea[id*='"+p.slug+"']");if(t.length){var i=t.attr("id");tinymce.get(i).setContent("")}}if(o.params.hasOwnProperty(i)){var p=o.params[i],v=!1,m=!1,k="."+p.modal,g=e("#"+p.modal).find(":input"),x=n(g),y=p.button.replace(" ",".");e("."+y).click(s),e(k+".sixtenpress-default-ui .sixtenpress-insert").click(d)}})},o.params="undefined"==typeof SixTenShortcodes?"":SixTenShortcodes,void 0!==o.params&&o.init()}(document,jQuery);
@@ -1,4 +1,4 @@
# Copyright (C) 2017 A drop in class for adding shortcode buttons to the editor.
# Copyright (C) 2018 A drop in class for adding shortcode buttons to the editor.
# This file is distributed under the same license as the A drop in class for adding shortcode buttons to the editor. package.
msgid ""
msgstr ""
@@ -10,7 +10,7 @@
* @author Robin Cornett <hello@robincornett.com>
* @copyright 2016 Robin Cornett <hello@robincornett.com>
* @license GPL-2.0+
* @version 0.3.7
* @version 0.3.8
* @link https://gitlab.com/robincornett/sixtenpress-shortcodes
* @since 0.1.0
*/
@@ -37,7 +37,7 @@
* Loader versioning: http://jtsternberg.github.io/wp-lib-loader/
*/
if ( ! class_exists( 'SixTenPressShortcodes_037', false ) ) {
if ( ! class_exists( 'SixTenPressShortcodes_038', false ) ) {
/**
* Versioned loader class-name
@@ -48,18 +48,18 @@ if ( ! class_exists( 'SixTenPressShortcodes_037', false ) ) {
* @package SixTenPressShortcodes
* @author Robin Cornett <hello@robincornett.com>
* @license GPL-2.0+
* @version 0.3.7
* @version 0.3.8
* @link https://gitlab.com/robincornett/sixtenpress-shortcodes
* @since 0.1.0
*/
class SixTenPressShortcodes_037 {
class SixTenPressShortcodes_038 {
/**
* SixTenPressShortcodes version number
* @var string
* @since 0.1.0
*/
const VERSION = '0.3.7';
const VERSION = '0.3.8';
/**
* Current version hook priority.
@@ -68,7 +68,7 @@ if ( ! class_exists( 'SixTenPressShortcodes_037', false ) ) {
* @var int
* @since 0.1.0
*/
const PRIORITY = 9987;
const PRIORITY = 9986;
/**
* Starts the version checking process.
@@ -152,5 +152,5 @@ if ( ! class_exists( 'SixTenPressShortcodes_037', false ) ) {
}
// Kick it off.
new SixTenPressShortcodes_037();
new SixTenPressShortcodes_038();
}