From b5107cd84317ff7302d1a0282e249eb408be250e Mon Sep 17 00:00:00 2001 From: Robin Cornett Date: Sat, 17 Mar 2018 13:54:23 -0400 Subject: [PATCH] Update shortcode library --- includes/sixtenpress-shortcodes/README.md | 3 +++ .../includes/js/shortcode-editor.js | 2 +- .../includes/js/shortcode-editor.min.js | 2 +- .../languages/sixtenpress-shortcodes.pot | 2 +- .../sixtenpress-shortcodes.php | 14 +++++++------- 5 files changed, 13 insertions(+), 10 deletions(-) diff --git a/includes/sixtenpress-shortcodes/README.md b/includes/sixtenpress-shortcodes/README.md index 8d7bc2f..fd0fadd 100644 --- a/includes/sixtenpress-shortcodes/README.md +++ b/includes/sixtenpress-shortcodes/README.md @@ -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 diff --git a/includes/sixtenpress-shortcodes/includes/js/shortcode-editor.js b/includes/sixtenpress-shortcodes/includes/js/shortcode-editor.js index d0d7c44..bca52bf 100644 --- a/includes/sixtenpress-shortcodes/includes/js/shortcode-editor.js +++ b/includes/sixtenpress-shortcodes/includes/js/shortcode-editor.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; diff --git a/includes/sixtenpress-shortcodes/includes/js/shortcode-editor.min.js b/includes/sixtenpress-shortcodes/includes/js/shortcode-editor.min.js index 71f42e8..6c9cb24 100644 --- a/includes/sixtenpress-shortcodes/includes/js/shortcode-editor.min.js +++ b/includes/sixtenpress-shortcodes/includes/js/shortcode-editor.min.js @@ -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); \ No newline at end of file +!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); \ No newline at end of file diff --git a/includes/sixtenpress-shortcodes/languages/sixtenpress-shortcodes.pot b/includes/sixtenpress-shortcodes/languages/sixtenpress-shortcodes.pot index 2fbf8bb..569df80 100644 --- a/includes/sixtenpress-shortcodes/languages/sixtenpress-shortcodes.pot +++ b/includes/sixtenpress-shortcodes/languages/sixtenpress-shortcodes.pot @@ -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 "" diff --git a/includes/sixtenpress-shortcodes/sixtenpress-shortcodes.php b/includes/sixtenpress-shortcodes/sixtenpress-shortcodes.php index a94ed95..d635214 100644 --- a/includes/sixtenpress-shortcodes/sixtenpress-shortcodes.php +++ b/includes/sixtenpress-shortcodes/sixtenpress-shortcodes.php @@ -10,7 +10,7 @@ * @author Robin Cornett * @copyright 2016 Robin Cornett * @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 * @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(); }