Plugin Directory

Changeset 2725704


Ignore:
Timestamp:
05/17/2022 11:14:00 PM (4 years ago)
Author:
cleanplugins
Message:

Compatibility update with Oxygen builder 4.0

Location:
erropix-hydrogen-paste/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • erropix-hydrogen-paste/trunk/erropix-hydrogen-paste.php

    r2456645 r2725704  
    44 * Plugin URI: https://www.cleanplugins.com/products/hydrogen-pack/
    55 * Description: This plugin allows you to paste any elements copied using Hydrogen Pack
    6  * Version: 1.2
     6 * Version: 1.3
     7 * Requires PHP: 7.0
     8 * Requires at least: 5.0
    79 * Author: Clean Plugins
    810 * Author URI: https://www.cleanplugins.com/
     
    3032add_action("oxygen_enqueue_iframe_scripts", function () {
    3133    $url = plugin_dir_url(__FILE__);
    32     wp_enqueue_script("hydrogen-paste", "{$url}js/paste.js", [], "1.2", true);
     34    wp_enqueue_script("hydrogen-paste", "{$url}js/paste.js", [], "1.3", true);
     35   
     36    wp_localize_script("hydrogen-paste", "HP_Options", [
     37        "OxyKeydownConflict" => version_compare(CT_VERSION, "3.9.9", ">="),
     38    ]);
    3339});
    3440
     
    3844    if ($basename == $file) {
    3945        $plugin_actions = [
    40             "upgrade" => "<a href='https://www.cleanplugins.com/products/hydrogen-pack/' target='_blank'>Upgrade to PRO</a>",
     46            "upgrade" => "<a href='https://www.cleanplugins.com/products/hydrogen-pack/' target='_blank'>Upgrade</a>",
    4147        ];
    4248        $actions = array_merge($plugin_actions, $actions);
  • erropix-hydrogen-paste/trunk/js/paste.js

    r2456645 r2725704  
    1 !function(){function e(e,t){var o=angular.element("body"),n=parent.angular.element("body"),i=e.component.active,r=["ct_id","ct_parent","ct_content","nicename","selector","activeselector"],c=["href","url","target","globalConditionsResult","globalconditions","use-custom","custom-code","code-php","code-css","code-js","full_shortcode","embed_src","src","image_type","attachment_height","attachment_id","attachment_size","attachment_url","attachment_width"];function s(t){var o=null;return function e(n){void 0!==n.id&&n.id==t?o=n:n.children&&n.children.forEach(e)}(e.componentsTree),o}function a(t,o){for(key in"object"!=typeof e.styleFolders[o]&&(e.styleFolders[o]={status:1,key:o}),t)t[key].parent=o;e.classes=Object.assign(t,e.classes),e.classesCached=!1}function l(t,o,n,i){var r={},c=e.globalColorSets,s=_.findWhere(c.sets,{name:i});function a(e,t){return"color("+r[parseInt(t)]+")"}function l(e){_.each(e,(function(t,o){var n=/color\((\d*)\)/g;"string"==typeof t&&n.test(t)?e[o]=t.replace(n,a):"object"==typeof t&&l(e[o])}))}return"object"!=typeof s&&(s={id:++c.setsIncrement,name:i},c.sets.push(s)),_.each(t,(function(e){var t=_.findWhere(c.colors,{name:e.name,set:s.id});"object"!=typeof t&&(t={id:++c.colorsIncrement,name:e.name,value:e.value,set:s.id},c.colors.push(t)),r[e.id]=t.id})),l(o),l(n),r}function d(o){var n=i.id,d=function(e){try{return JSON.parse(decodeURIComponent(escape(atob(e))))}catch(e){console.error(e)}return!1}(o),p=!t.isActiveActionTab("contentEditing")&&(i.id>0||0),u="Imported";if(d.constructor!==Object)throw new Error("Invalid clipboard contents");if("object"==typeof d.component){var h=d.component,f=d.classes;l(d.colors,h,f,u),a(f,u);var m={id:0,depth:0,name:"root",children:[]};Array.isArray(h)?m.children=h:m.children.push(h),t.showLoadingOverlay(),setTimeout((function(){try{e.addReusableChildren(m,null,n)}catch(e){console.error(e)}t.hideLoadingOverlay()}))}if("object"==typeof d.style){if(!0!==p)throw new error("Can not apply styles to the selected element");if(h=s(n)){var y=h.options,b=d.style,v=b.currentClass;f=d.classes;l(d.colors,b,f,u),a(f,u),_.extend(b.original,_.pick(y.original,c)),_.extend(b,_.pick(y,r)),delete b.currentClass,h.options=b,e.componentsClasses[n]=b.classes,e.component.options[n]=_.pick(e.component.options[n],r),e.rebuildDOM(n),v?e.setCurrentClass(v):e.switchEditToId(!0),e.adjustResizeBox()}}if("object"==typeof d.conditions){if(!0!==p)throw new Error("Can not apply conditions! The selected element is invalid");(h=s(n))&&(e.setOptionModel("globalconditions",d.conditions,n,name),e.setOptionModel("conditionstype",d.conditionstype,n,name))}}function p(t){var o=t.target;if(!["INPUT","TEXTAREA"].includes(o.nodeName)&&!o.isContentEditable){try{var n=t.originalEvent.clipboardData.getData("Text").trim();if(!n)throw new Error("The clipboard is empty");d(n)}catch(t){console.error(t),setTimeout((function(){var o;o="Failed to process the clipboard contents<br/>"+t,setTimeout((function(){e.showNoticeModal("<div>"+o+"</div>"),e.$$phase||e.$digest()}),100)}),100)}return!1}}o.on("paste","[contenteditable]",(function(e){this.isContentEditable||(e.stopImmediatePropagation(),p(e))})),o.on("paste",p),n.on("paste",p)}CTFrontendBuilder.directive("hydrogenPaste",["$parentScope",function(t){return{restrict:"A",link:function(o){e(o,t)}}}])}();
     1!function(){var e=angular.element("body"),t=parent.angular.element("body");function o(o,n){var i=o.component.active,r=["ct_id","ct_parent","ct_content","nicename","selector","activeselector"],c=["href","url","target","globalConditionsResult","globalconditions","use-custom","custom-code","code-php","code-css","code-js","full_shortcode","embed_src","src","image_type","attachment_height","attachment_id","attachment_size","attachment_url","attachment_width"];function s(e){var t=null;return function o(n){void 0!==n.id&&n.id==e?t=n:n.children&&n.children.forEach(o)}(o.componentsTree),t}function a(e,t){for(key in"object"!=typeof o.styleFolders[t]&&(o.styleFolders[t]={status:1,key:t}),e)e[key].parent=t;o.classes=Object.assign(e,o.classes),o.classesCached=!1}function l(e,t,n,i){var r={},c=o.globalColorSets,s=_.findWhere(c.sets,{name:i});function a(e,t){return"color("+r[parseInt(t)]+")"}function l(e){_.each(e,(function(t,o){var n=/color\((\d*)\)/g;"string"==typeof t&&n.test(t)?e[o]=t.replace(n,a):"object"==typeof t&&l(e[o])}))}return"object"!=typeof s&&(s={id:++c.setsIncrement,name:i},c.sets.push(s)),_.each(e,(function(e){var t=_.findWhere(c.colors,{name:e.name,set:s.id});"object"!=typeof t&&(t={id:++c.colorsIncrement,name:e.name,value:e.value,set:s.id},c.colors.push(t)),r[e.id]=t.id})),l(t),l(n),r}function d(e){var t=i.id,d=function(e){try{return JSON.parse(decodeURIComponent(escape(atob(e))))}catch(e){console.error(e)}return!1}(e),p=!n.isActiveActionTab("contentEditing")&&(i.id>0||0),u="Imported";if(d.constructor!==Object)throw new Error("Invalid clipboard contents");if("object"==typeof d.component){var f=d.component,h=d.classes;l(d.colors,f,h,u),a(h,u);var m={id:0,depth:0,name:"root",children:[]};Array.isArray(f)?m.children=f:m.children.push(f),n.showLoadingOverlay(),setTimeout((function(){try{o.addReusableChildren(m,null,t)}catch(e){console.error(e)}n.hideLoadingOverlay()}))}if("object"==typeof d.style){if(!0!==p)throw new error("Can not apply styles to the selected element");if(f=s(t)){var y=f.options,b=d.style,v=b.currentClass;h=d.classes;l(d.colors,b,h,u),a(h,u),_.extend(b.original,_.pick(y.original,c)),_.extend(b,_.pick(y,r)),delete b.currentClass,f.options=b,o.componentsClasses[t]=b.classes,o.component.options[t]=_.pick(o.component.options[t],r),o.rebuildDOM(t),v?o.setCurrentClass(v):o.switchEditToId(!0),o.adjustResizeBox()}}if("object"==typeof d.conditions){if(!0!==p)throw new Error("Can not apply conditions! The selected element is invalid");(f=s(t))&&(o.setOptionModel("globalconditions",d.conditions,t,name),o.setOptionModel("conditionstype",d.conditionstype,t,name))}}function p(e){var t=e.target;if(!["INPUT","TEXTAREA"].includes(t.nodeName)&&!t.isContentEditable){try{var n=e.originalEvent.clipboardData.getData("Text").trim();if(!n)throw new Error("The clipboard is empty");d(n)}catch(e){console.error(e),setTimeout((function(){var t;t="Failed to process the clipboard contents<br/>"+e,setTimeout((function(){o.showNoticeModal("<div>"+t+"</div>"),o.$$phase||o.$digest()}),100)}),100)}return!1}}e.on("paste","[contenteditable]",(function(e){this.isContentEditable||(e.stopImmediatePropagation(),p(e))})),e.on("paste",p),t.on("paste",p)}if(CTFrontendBuilder.directive("hydrogenPaste",["$parentScope",function(e){return{restrict:"A",link:function(t){o(t,e)}}}]),HP_Options&&HP_Options.OxyKeydownConflict){function n(e){(e.ctrlKey||e.metaKey)&&86==e.keyCode&&e.stopImmediatePropagation()}e.on("keydown",n),t.on("keydown",n)}}();
  • erropix-hydrogen-paste/trunk/readme.txt

    r2456645 r2725704  
    11=== Hydrogen Paste ===
    2 Contributors: erropix
     2Contributors: erropix, cleanplugins
    33Donate link: https://www.paypal.me/erropix
    44Tags: Oxygen Builder, Hydrogen Pack, Copy Paste
    55Requires at least: 5.0
    6 Tested up to: 5.6
    7 Stable tag: 1.2
     6Tested up to: 5.9.3
     7Stable tag: 1.3
    88Requires PHP: 7.0
    99License: GPLv2 or later
     
    2525
    2626== Changelog ==
     27
     28= 1.3 =
     29* Compatibility update with Oxygen builder 4.0
    2730
    2831= 1.2 =
Note: See TracChangeset for help on using the changeset viewer.