Changeset 2301343
- Timestamp:
- 05/09/2020 02:12:51 AM (6 years ago)
- Location:
- erropix-hydrogen-paste
- Files:
-
- 5 edited
- 5 copied
-
. (modified) (1 prop)
-
tags/1.1.1 (copied) (copied from erropix-hydrogen-paste/trunk)
-
tags/1.1.1/erropix-hydrogen-paste.php (copied) (copied from erropix-hydrogen-paste/trunk/erropix-hydrogen-paste.php) (2 diffs)
-
tags/1.1.1/js (copied) (copied from erropix-hydrogen-paste/trunk/js) (1 prop)
-
tags/1.1.1/js/paste.js (copied) (copied from erropix-hydrogen-paste/trunk/js/paste.js) (1 diff)
-
tags/1.1.1/readme.txt (copied) (copied from erropix-hydrogen-paste/trunk/readme.txt) (2 diffs)
-
trunk/erropix-hydrogen-paste.php (modified) (2 diffs)
-
trunk/js (modified) (1 prop)
-
trunk/js/paste.js (modified) (1 diff)
-
trunk/readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
erropix-hydrogen-paste
-
Property
svn:ignore
set to
.vscode
-
Property
svn:ignore
set to
-
erropix-hydrogen-paste/tags/1.1.1/erropix-hydrogen-paste.php
r2291302 r2301343 4 4 * Plugin URI: https://www.erropix.com/products/hydrogen-pack/ 5 5 * Description: This plugin allows you to paste any elements copied using Hydrogen Pack 6 * Version: 1.1 6 * Version: 1.1.1 7 7 * Author: ERROPiX 8 8 * Author URI: https://www.erropix.com … … 23 23 add_action('oxygen_enqueue_iframe_scripts', function () { 24 24 $url = plugin_dir_url(__FILE__); 25 wp_enqueue_script("epxhydro-paste", "{$url}js/paste.js", [], '1.1 ', true);25 wp_enqueue_script("epxhydro-paste", "{$url}js/paste.js", [], '1.1.1', true); 26 26 }); 27 27 -
erropix-hydrogen-paste/tags/1.1.1/js
-
Property
svn:ignore
set to
paste.dev.js
-
Property
svn:ignore
set to
-
erropix-hydrogen-paste/tags/1.1.1/js/paste.js
r2291302 r2301343 1 window.addEventListener("load",function(){var $body=angular.element("body");var $parentBody=parent.angular.element("body");var $scope=iframeScope;var $parentScope=iframeScope.parentScope;var activeComponent=$scope.component.active;function decode(hash){try{return JSON.parse(decodeURIComponent(escape(atob(hash))))}catch(error){console.log(error.message)}return false}function checkComponent(){if($parentScope.isActiveActionTab("contentEditing")){return false}return activeComponent.id>0?true:0}function executeCommandPaste(clipboard){var id=activeComponent.id;var data=decode(clipboard);if(data.constructor===Object){if(data.component.constructor===Object){var source=data.source;if(source){delete data.source;var json=JSON.stringify(data);$scope.addComponentFromSource(json,id,source,"hydrogen");return true}}}alert("Invalid clipboard contents")}function pasteHandler(event){var target=event.target;var excluded=["INPUT","TEXTAREA"];if(excluded.includes(target.nodeName)||target.isContentEditable){return}if(checkComponent()!==false){try{var clipboardText=event.originalEvent.clipboardData.getData("Text").trim();if(clipboardText){executeCommandPaste(clipboardText)}}catch(error){alert("Failed to read clipboard contents")}return false}}$body.on("paste","[contenteditable]",function(event){if(!this.isContentEditable){event.stopImmediatePropagation();pasteHandler(event)}});$body.on("paste",pasteHandler);$parentBody.on("paste",pasteHandler)});1 window.addEventListener("load",function(){var e=angular.element("body"),t=parent.angular.element("body"),p=iframeScope,u=iframeScope.parentScope,h=p.component.active,m=["ct_id","ct_parent","ct_content","nicename","selector","activeselector"],f=["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 y(e,t){for(key in"object"!=typeof p.styleFolders[t]&&(p.styleFolders[t]={status:1,key:t}),e)e[key].parent=t;p.classes=Object.assign(e,p.classes),p.classesCached=!1}function b(e,t,o,n){var r={},c=p.globalColorSets,s=_.findWhere(c.sets,{name:n});function i(e,t){return"color("+r[parseInt(t)]+")"}function a(n){_.each(n,function(e,t){var o=/color\((\d*)\)/g;"string"==typeof e&&o.test(e)?n[t]=e.replace(o,i):"object"==typeof e&&a(n[t])})}return"object"!=typeof s&&(s={id:++c.setsIncrement,name:n},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}),a(t),a(o),r}function n(e){var t=h.id,o=function(e){try{return JSON.parse(decodeURIComponent(escape(atob(e))))}catch(e){console.error(e)}return!1}(e),n=!u.isActiveActionTab("contentEditing")&&(0<h.id||0),r="Imported";if(o.constructor!==Object)throw new Error("Invalid clipboard contents");if("object"==typeof o.component){var c=o.component,s=o.classes;b(o.colors,c,s,r),y(s,r);var i={id:0,depth:0,name:"root",children:[]};Array.isArray(c)?i.children=c:i.children.push(c),u.showLoadingOverlay(),setTimeout(function(){try{p.addReusableChildren(i,null,t)}catch(e){console.error(e)}u.hideLoadingOverlay()})}if("object"==typeof o.style){if(!0!==n)throw new error("Can not apply styles to the selected element");if(c=function(o){var n=null;return function e(t){void 0!==t.id&&t.id==o?n=t:t.children&&t.children.forEach(e)}(p.componentsTree),n}(t)){var a=c.options,l=o.style,d=l.currentClass;s=o.classes;b(o.colors,l,s,r),y(s,r),_.extend(l.original,_.pick(a.original,f)),_.extend(l,_.pick(a,m)),delete l.currentClass,c.options=l,p.componentsClasses[t]=l.classes,p.component.options[t]=_.pick(p.component.options[t],m),p.rebuildDOM(t),d?p.setCurrentClass(d):p.switchEditToId(!0),p.adjustResizeBox()}}}function o(e){var t=e.target;if(!["INPUT","TEXTAREA"].includes(t.nodeName)&&!t.isContentEditable){try{var o=e.originalEvent.clipboardData.getData("Text").trim();if(!o)throw new Error("The clipboard is empty");n(o)}catch(e){console.error(e),setTimeout(function(){!function(e){setTimeout(function(){p.showNoticeModal("<div>"+e+"</div>"),p.$$phase||p.$digest()},100)}("Failed to process the clipboard contents<br/>"+e)},100)}return!1}}e.on("paste","[contenteditable]",function(e){this.isContentEditable||(e.stopImmediatePropagation(),o(e))}),e.on("paste",o),t.on("paste",o)}); -
erropix-hydrogen-paste/tags/1.1.1/readme.txt
r2291303 r2301343 4 4 Tags: Oxygen Builder, Hydrogen Pack, Copy Paste 5 5 Requires at least: 4.9 6 Tested up to: 5.4 7 Stable tag: 1.1 6 Tested up to: 5.4.1 7 Stable tag: 1.1.1 8 8 Requires PHP: 7.0 9 9 License: GPLv2 or later … … 26 26 == Changelog == 27 27 28 = 1.1.1 = 29 * Ability to paste full page 30 * Ability to paste styles 31 * Bug fixes and checked compatibility with Hydrogen Pack 1.1 32 28 33 = 1.1 = 29 34 * Fixed minor bugs -
erropix-hydrogen-paste/trunk/erropix-hydrogen-paste.php
r2291302 r2301343 4 4 * Plugin URI: https://www.erropix.com/products/hydrogen-pack/ 5 5 * Description: This plugin allows you to paste any elements copied using Hydrogen Pack 6 * Version: 1.1 6 * Version: 1.1.1 7 7 * Author: ERROPiX 8 8 * Author URI: https://www.erropix.com … … 23 23 add_action('oxygen_enqueue_iframe_scripts', function () { 24 24 $url = plugin_dir_url(__FILE__); 25 wp_enqueue_script("epxhydro-paste", "{$url}js/paste.js", [], '1.1 ', true);25 wp_enqueue_script("epxhydro-paste", "{$url}js/paste.js", [], '1.1.1', true); 26 26 }); 27 27 -
erropix-hydrogen-paste/trunk/js
-
Property
svn:ignore
set to
paste.dev.js
-
Property
svn:ignore
set to
-
erropix-hydrogen-paste/trunk/js/paste.js
r2291302 r2301343 1 window.addEventListener("load",function(){var $body=angular.element("body");var $parentBody=parent.angular.element("body");var $scope=iframeScope;var $parentScope=iframeScope.parentScope;var activeComponent=$scope.component.active;function decode(hash){try{return JSON.parse(decodeURIComponent(escape(atob(hash))))}catch(error){console.log(error.message)}return false}function checkComponent(){if($parentScope.isActiveActionTab("contentEditing")){return false}return activeComponent.id>0?true:0}function executeCommandPaste(clipboard){var id=activeComponent.id;var data=decode(clipboard);if(data.constructor===Object){if(data.component.constructor===Object){var source=data.source;if(source){delete data.source;var json=JSON.stringify(data);$scope.addComponentFromSource(json,id,source,"hydrogen");return true}}}alert("Invalid clipboard contents")}function pasteHandler(event){var target=event.target;var excluded=["INPUT","TEXTAREA"];if(excluded.includes(target.nodeName)||target.isContentEditable){return}if(checkComponent()!==false){try{var clipboardText=event.originalEvent.clipboardData.getData("Text").trim();if(clipboardText){executeCommandPaste(clipboardText)}}catch(error){alert("Failed to read clipboard contents")}return false}}$body.on("paste","[contenteditable]",function(event){if(!this.isContentEditable){event.stopImmediatePropagation();pasteHandler(event)}});$body.on("paste",pasteHandler);$parentBody.on("paste",pasteHandler)});1 window.addEventListener("load",function(){var e=angular.element("body"),t=parent.angular.element("body"),p=iframeScope,u=iframeScope.parentScope,h=p.component.active,m=["ct_id","ct_parent","ct_content","nicename","selector","activeselector"],f=["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 y(e,t){for(key in"object"!=typeof p.styleFolders[t]&&(p.styleFolders[t]={status:1,key:t}),e)e[key].parent=t;p.classes=Object.assign(e,p.classes),p.classesCached=!1}function b(e,t,o,n){var r={},c=p.globalColorSets,s=_.findWhere(c.sets,{name:n});function i(e,t){return"color("+r[parseInt(t)]+")"}function a(n){_.each(n,function(e,t){var o=/color\((\d*)\)/g;"string"==typeof e&&o.test(e)?n[t]=e.replace(o,i):"object"==typeof e&&a(n[t])})}return"object"!=typeof s&&(s={id:++c.setsIncrement,name:n},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}),a(t),a(o),r}function n(e){var t=h.id,o=function(e){try{return JSON.parse(decodeURIComponent(escape(atob(e))))}catch(e){console.error(e)}return!1}(e),n=!u.isActiveActionTab("contentEditing")&&(0<h.id||0),r="Imported";if(o.constructor!==Object)throw new Error("Invalid clipboard contents");if("object"==typeof o.component){var c=o.component,s=o.classes;b(o.colors,c,s,r),y(s,r);var i={id:0,depth:0,name:"root",children:[]};Array.isArray(c)?i.children=c:i.children.push(c),u.showLoadingOverlay(),setTimeout(function(){try{p.addReusableChildren(i,null,t)}catch(e){console.error(e)}u.hideLoadingOverlay()})}if("object"==typeof o.style){if(!0!==n)throw new error("Can not apply styles to the selected element");if(c=function(o){var n=null;return function e(t){void 0!==t.id&&t.id==o?n=t:t.children&&t.children.forEach(e)}(p.componentsTree),n}(t)){var a=c.options,l=o.style,d=l.currentClass;s=o.classes;b(o.colors,l,s,r),y(s,r),_.extend(l.original,_.pick(a.original,f)),_.extend(l,_.pick(a,m)),delete l.currentClass,c.options=l,p.componentsClasses[t]=l.classes,p.component.options[t]=_.pick(p.component.options[t],m),p.rebuildDOM(t),d?p.setCurrentClass(d):p.switchEditToId(!0),p.adjustResizeBox()}}}function o(e){var t=e.target;if(!["INPUT","TEXTAREA"].includes(t.nodeName)&&!t.isContentEditable){try{var o=e.originalEvent.clipboardData.getData("Text").trim();if(!o)throw new Error("The clipboard is empty");n(o)}catch(e){console.error(e),setTimeout(function(){!function(e){setTimeout(function(){p.showNoticeModal("<div>"+e+"</div>"),p.$$phase||p.$digest()},100)}("Failed to process the clipboard contents<br/>"+e)},100)}return!1}}e.on("paste","[contenteditable]",function(e){this.isContentEditable||(e.stopImmediatePropagation(),o(e))}),e.on("paste",o),t.on("paste",o)}); -
erropix-hydrogen-paste/trunk/readme.txt
r2291303 r2301343 4 4 Tags: Oxygen Builder, Hydrogen Pack, Copy Paste 5 5 Requires at least: 4.9 6 Tested up to: 5.4 7 Stable tag: 1.1 6 Tested up to: 5.4.1 7 Stable tag: 1.1.1 8 8 Requires PHP: 7.0 9 9 License: GPLv2 or later … … 26 26 == Changelog == 27 27 28 = 1.1.1 = 29 * Ability to paste full page 30 * Ability to paste styles 31 * Bug fixes and checked compatibility with Hydrogen Pack 1.1 32 28 33 = 1.1 = 29 34 * Fixed minor bugs
Note: See TracChangeset
for help on using the changeset viewer.