group each plugin in its own folder
This commit is contained in:
10
dist/editor/extensions/ext-webappfind/ext-webappfind.js
vendored
Normal file
10
dist/editor/extensions/ext-webappfind/ext-webappfind.js
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
function asyncGeneratorStep(e,n,t,r,a,o,i){try{var c=e[o](i),s=c.value}catch(e){return void t(e)}c.done?n(s):Promise.resolve(s).then(r,a)}
|
||||
/**
|
||||
* Depends on Firefox add-on and executables from
|
||||
* {@link https://github.com/brettz9/webappfind}.
|
||||
* @author Brett Zamir
|
||||
* @license MIT
|
||||
* @todo See WebAppFind Readme for SVG-related todos
|
||||
*/
|
||||
var e={name:"webappfind",init:function init(e){var n=this;return function _asyncToGenerator(e){return function(){var n=this,t=arguments;return new Promise((function(r,a){var o=e.apply(n,t);function _next(e){asyncGeneratorStep(o,r,a,_next,_throw,"next",e)}function _throw(e){asyncGeneratorStep(o,r,a,_next,_throw,"throw",e)}_next(void 0)}))}}(regeneratorRuntime.mark((function _callee(){var t,r,a,o,i,c,s,p;return regeneratorRuntime.wrap((function _callee$(u){for(;;)switch(u.prev=u.next){case 0:return t=e.$,r=n,u.next=4,import("./locale/".concat(r.curPrefs.lang,".js"));case 4:return a=u.sent,o=a.default,"read",c=["read",i="save"],n.canvas.bind("message",(function(e,n){var a,o,i=n.data,p=n.origin;try{var u=i.webappfind;if(a=u.type,s=u.pathID,o=u.content,p!==location.origin||c.includes(a))return}catch(e){return}switch(a){case"view":r.loadFromString(o);break;case"save-end":t.alert("save complete for pathID ".concat(s,"!"));break;default:throw new Error("Unexpected WebAppFind event type")}})),p=[{id:"webappfind_save",icon:"webappfind.png",type:"app_menu",position:4,events:{click:function click(){s&&window.postMessage({webappfind:{type:i,pathID:s,content:r.canvas.getSvgString()}},"null"===window.location.origin?"*":window.location.origin)}}}],u.abrupt("return",{name:o.name,svgicons:"webappfind-icon.svg",buttons:o.buttons.map((function(e,n){return Object.assign(p[n],e)}))});case 10:case"end":return u.stop()}}),_callee)})))()}};export default e;
|
||||
//# sourceMappingURL=ext-webappfind.js.map
|
||||
1
dist/editor/extensions/ext-webappfind/ext-webappfind.js.map
vendored
Normal file
1
dist/editor/extensions/ext-webappfind/ext-webappfind.js.map
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"ext-webappfind.js","sources":["../../../../src/editor/extensions/ext-webappfind/ext-webappfind.js"],"sourcesContent":["/**\n* Depends on Firefox add-on and executables from\n* {@link https://github.com/brettz9/webappfind}.\n* @author Brett Zamir\n* @license MIT\n* @todo See WebAppFind Readme for SVG-related todos\n*/\n\nexport default {\n name: 'webappfind',\n async init ({$}) {\n const svgEditor = this;\n // eslint-disable-next-line node/no-unsupported-features/es-syntax\n const {default: strings} = await import(`./locale/${svgEditor.curPrefs.lang}.js`);\n const saveMessage = 'save',\n readMessage = 'read',\n excludedMessages = [readMessage, saveMessage];\n\n let pathID;\n this.canvas.bind(\n 'message',\n /**\n * @param {external:Window} win\n * @param {PlainObject} info\n * @param {module:svgcanvas.SvgCanvas#event:message} info.data\n * @param {string} info.origin\n * @listens module:svgcanvas.SvgCanvas#event:message\n * @throws {Error} Unexpected event type\n * @returns {void}\n */\n (win, {data, origin}) => { // eslint-disable-line no-shadow\n // console.log('data, origin', data, origin);\n let type, content;\n try {\n ({type, pathID, content} = data.webappfind); // May throw if data is not an object\n if (origin !== location.origin || // We are only interested in a message sent as though within this URL by our browser add-on\n excludedMessages.includes(type) // Avoid our post below (other messages might be possible in the future which may also need to be excluded if your subsequent code makes assumptions on the type of message this is)\n ) {\n return;\n }\n } catch (err) {\n return;\n }\n\n switch (type) {\n case 'view':\n // Populate the contents\n svgEditor.loadFromString(content);\n\n /* if ($('#tool_save_file')) {\n $('#tool_save_file').disabled = false;\n } */\n break;\n case 'save-end':\n $.alert(`save complete for pathID ${pathID}!`);\n break;\n default:\n throw new Error('Unexpected WebAppFind event type');\n }\n }\n );\n\n /*\n window.postMessage({\n webappfind: {\n type: readMessage\n }\n }, window.location.origin === 'null'\n // Avoid \"null\" string error for `file:` protocol (even though\n // file protocol not currently supported by Firefox)\n ? '*'\n : window.location.origin\n );\n */\n const buttons = [{\n id: 'webappfind_save', //\n icon: 'webappfind.png',\n type: 'app_menu',\n position: 4, // Before 0-based index position 4 (after the regular \"Save Image (S)\")\n events: {\n click () {\n if (!pathID) { // Not ready yet as haven't received first payload\n return;\n }\n window.postMessage(\n {\n webappfind: {\n type: saveMessage,\n pathID,\n content: svgEditor.canvas.getSvgString()\n }\n }, window.location.origin === 'null'\n // Avoid \"null\" string error for `file:` protocol (even\n // though file protocol not currently supported by add-on)\n ? '*'\n : window.location.origin\n );\n }\n }\n }];\n\n return {\n name: strings.name,\n svgicons: 'webappfind-icon.svg',\n buttons: strings.buttons.map((button, i) => {\n return Object.assign(buttons[i], button);\n })\n };\n }\n};\n"],"names":["name","init","$","svgEditor","_this","import","curPrefs","lang","strings","excludedMessages","saveMessage","canvas","bind","win","type","content","data","origin","webappfind","pathID","location","includes","err","loadFromString","alert","Error","buttons","id","icon","position","events","click","window","postMessage","getSvgString","svgicons","map","button","i","Object","assign"],"mappings":";;;;;;;;AAQA,MAAe,CACbA,KAAM,aACAC,6dAAOC,IAAAA,EACLC,EAAYC,WAEeC,0BAAmBF,EAAUG,SAASC,oCAAvDC,YAEA,OACdC,EAAmB,CADL,OADVC,EAAc,QAKpBN,EAAKO,OAAOC,KACV,oBAUCC,SAEKC,EAAMC,EAFLC,IAAAA,KAAMC,IAAAA,iBAIkBD,EAAKE,cAA9BJ,IAAAA,KAAMK,IAAAA,OAAQJ,IAAAA,QACZE,IAAWG,SAASH,QACpBR,EAAiBY,SAASP,UAI9B,MAAOQ,iBAIDR,OACH,OAEHX,EAAUoB,eAAeR,aAMtB,WACHb,EAAEsB,yCAAkCL,4BAG9B,IAAIM,MAAM,wCAiBhBC,EAAU,CAAC,CACfC,GAAI,kBACJC,KAAM,iBACNd,KAAM,WACNe,SAAU,EACVC,OAAQ,CACNC,uBACOZ,GAGLa,OAAOC,YACL,CACEf,WAAY,CACVJ,KAAMJ,EACNS,OAAAA,EACAJ,QAASZ,EAAUQ,OAAOuB,iBAEA,SAA3BF,OAAOZ,SAASH,OAGf,IACAe,OAAOZ,SAASH,8BAMrB,CACLjB,KAAMQ,EAAQR,KACdmC,SAAU,sBACVT,QAASlB,EAAQkB,QAAQU,KAAI,SAACC,EAAQC,UAC7BC,OAAOC,OAAOd,EAAQY,GAAID"}
|
||||
Reference in New Issue
Block a user