@silexlabs/silex 3.0.0-alpha.102 → 3.0.0-alpha.103
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/client/grapesjs/img.d.ts +6 -0
- package/dist/client/js/main.js +2 -2
- package/dist/plugins/client/client/grapesjs/img.d.ts +6 -0
- package/dist/plugins/client/client/grapesjs/img.js +89 -0
- package/dist/plugins/client/client/grapesjs/img.js.map +1 -0
- package/dist/plugins/client/client/grapesjs/index.js +2 -0
- package/dist/plugins/client/client/grapesjs/index.js.map +1 -1
- package/package.json +1 -1
- package/src/ts/client/grapesjs/img.ts +90 -0
- package/src/ts/client/grapesjs/index.ts +2 -0
package/dist/client/js/main.js
CHANGED
|
@@ -228,7 +228,7 @@ var silex;(()=>{var t={357:function(t){var e;"undefined"!=typeof globalThis?glob
|
|
|
228
228
|
@click=${()=>this.editor.Commands.stop(yr)}
|
|
229
229
|
>Close</button>
|
|
230
230
|
</footer>
|
|
231
|
-
`}}displayPending(t,e){this.errorMessage=null,this.renderDialog(t,e)}displayError(t,e,n){console.info(t),this.errorMessage=t,this.renderDialog(e,n)}async closeDialog(){this.isOpen=!1,this.renderDialog(null,null),this.sender&&this.sender.set("active",0),this.sender=null}async toggleDialog(){this.isOpen?this.closeDialog():this.openDialog()}async openDialog(){this.isOpen=!0;const t=this.editor.Panels.getPanel("options")?.view.el.querySelector(".publish-button");if(t){const e=t.getBoundingClientRect(),n=450,r=20,o=50;this.move({left:e.right-n-r,top:e.bottom+10,width:n,minHeight:o})}else console.error("Unable to find publish button");this.renderDialog(null,Ir.STATUS_NONE)}}var _r;function xr(t,e){t.Pages.getAll().forEach((t=>{t.getMainComponent().onAll((t=>e(t)))}))}!function(t){t.STARTUP_START="silex:startup:start",t.STARTUP_END="silex:startup:end",t.GRAPESJS_START="silex:grapesjs:start",t.GRAPESJS_END="silex:grapesjs:end",t.PUBLISH_START="silex:publish:start",t.PUBLISH_DATA="silex:publish:data",t.PUBLISH_END="silex:publish:end",t.PUBLISH_ERROR="silex:publish:error",t.PUBLISH_LOGIN_START="silex:publish:login:start",t.PUBLISH_LOGIN_END="silex:publish:login:end",t.ASSET_WRITE_END="silex:asset:write:end",t.WRITE_END="silex:write:end"}(_r||(_r={}));const Cr="tmp-pre-publication-transformer-tohtml",Sr="tmp-pre-publication-transformer-src",Or="tmp-pre-publication-transformer-attributes-src",Tr="tmp-pre-publication-transformer-inline-css",Er="tmp-pre-publication-transformer-href",kr="tmp-pre-publication-transformer-tocss";function Ar(t,e){const n=e["background-image"],r=n?.match(/url\(["']?(.*?)["']?\)/)?.pop();return r?{...e,"background-image":`url(${Pr(t,r,$.ASSET)})`}:e}function Pr(t,e,n){return t.getModel().get("config").publicationTransformers.reduce(((t,e)=>{try{return e.transformPermalink?e.transformPermalink(t,n)??t:t}catch(e){return console.error("Publication transformer: error transforming path",t,e),t}}),e)}function jr(t,e,n){return t.getModel().get("config").publicationTransformers.reduce(((t,e)=>{try{return e.transformPath?e.transformPath(t,n)??t:t}catch(e){return console.error("Publication transformer: error transforming path",t,e),t}}),e)}const Mr="publish",Lr="publish-login",Nr="publish-logout";var Ir;function Dr(t,e){t.PublicationManager=new Hr(t,e)}function $r(t){switch(t){case H.IN_PROGRESS:return Ir.STATUS_PENDING;case H.ERROR:return Ir.STATUS_ERROR;case H.SUCCESS:return Ir.STATUS_SUCCESS}throw new Error(`Unknown job status ${t}`)}!function(t){t.STATUS_NONE="STATUS_NONE",t.STATUS_PENDING="STATUS_PENDING",t.STATUS_ERROR="STATUS_ERROR",t.STATUS_SUCCESS="STATUS_SUCCESS",t.STATUS_LOGGED_OUT="STATUS_AUTH_ERROR"}(Ir||(Ir={}));const Rr=window.location.origin+window.location.pathname.replace(/\/$/,"");class Hr{editor;dialog;_settings;get settings(){return this._settings}set settings(t){this._settings=t,this.dialog&&(this.dialog.settings=t)}options;job=null;status=Ir.STATUS_NONE;constructor(t,e){this.editor=t,this.options={appendTo:"options",...e},t.on("storage:start:store",(t=>{t.publication=this.settings})),t.on("storage:end:load",(t=>{this.settings=t.publication??{},fn({type:R.HOSTING,connectorId:this.settings.connector?.connectorId}).then((t=>{})).catch((t=>{this.status=Ir.STATUS_LOGGED_OUT,this.settings={},this.dialog&&this.dialog.displayError("Please login",this.job,this.status)}))})),t.Commands.add(Mr,(()=>this.startPublication())),t.Commands.add(Lr,((t,e,n)=>this.goLogin(n))),t.Commands.add(Nr,(()=>this.goLogout())),this.options.appendTo?this.dialog=new wr(t,{appendTo:this.options.appendTo}):console.info("PublicationUi is disabled because no appendTo option is set")}async goLogin(t){if(t.isLoggedIn)return this.settings={...this.settings,connector:t},this.status=Ir.STATUS_NONE,this.editor.store(null),void(this.dialog&&this.dialog.displayPending(this.job,this.status));this.settings={},this.status=Ir.STATUS_LOGGED_OUT,this.dialog&&this.dialog.displayPending(this.job,this.status);const e=t.connectorId,n=t.type;return window.open(t.oauthUrl||`${Rr}${f}${h}${y}?connectorId=${e}&type=${n}`,"_blank"),new Promise((e=>{const n=async e=>{const r=e.data;"login"===r?.type&&(window.removeEventListener("message",n),r.error?(this.status=Ir.STATUS_LOGGED_OUT,this.settings={},this.dialog&&this.dialog.displayError(r.message,this.job,this.status)):(this.editor.trigger(_r.PUBLISH_LOGIN_END),this.settings.connector=t,this.settings.options=r.options,this.status=Ir.STATUS_NONE,this.editor.store(null),this.dialog&&this.dialog.displayPending(this.job,this.status)))};window.addEventListener("message",n,!1)}))}async goLogout(){try{await hn({type:R.HOSTING,connectorId:this.settings.connector.connectorId}),this.settings={},this.dialog&&this.dialog.displayPending(this.job,this.status)}catch(t){console.error("logout error",t),this.status=Ir.STATUS_ERROR,this.dialog&&this.dialog.displayError(t.message,this.job,this.status)}}async startPublication(){if(this.status===Ir.STATUS_PENDING)throw new Error("Publication is already in progress");this.status=Ir.STATUS_PENDING,this.job=null,this.dialog&&this.dialog.displayPending(this.job,this.status),this.editor.trigger(_r.PUBLISH_START);const t=this.editor.getModel().get("user");if(!t)throw new Error("User not logged in to a storage connector");if(!this.settings.connector?.connectorId)throw new Error("User not logged in to a hosting connector");const e=this.options.websiteId,n=t.storage.connectorId;this.setPublicationTransformers();const r=this.editor.getProjectData(),o=this.editor.getModel().get("settings"),i=(await this.getHtmlFiles(o)).flatMap((t=>[{path:t.htmlPath,content:t.html,type:$.HTML},{path:t.cssPath,content:t.css,type:$.CSS}])).concat(r.assets.map((t=>{const e=jr(this.editor,t.src,$.ASSET),n=Pr(this.editor,t.src,$.ASSET);return{...t,path:e,src:n,type:$.ASSET}}))),s={...r,settings:o,publication:this.settings,files:i};this.resetPublicationTransformers(),function(t,e){const n=t.getModel().get("config");e.files=n.publicationTransformers.reduce(((t,n)=>t.map(((t,r)=>{try{return e.pages[r],n.transformFile?n.transformFile(t)??t:t}catch(e){return console.error("Publication transformer: error transforming file",t,e),t}}))),e.files)}(this.editor,s),this.editor.trigger(_r.PUBLISH_DATA,s);try{const[t,r]=await gn({websiteId:e,hostingId:this.settings.connector.connectorId,storageId:n,data:s,options:this.settings.options});this.job=r,this.status=$r(this.job.status),this.trackProgress()}catch(t){return console.error("publish error",t),401===t.code||401===t.httpStatusCode?(this.status=Ir.STATUS_LOGGED_OUT,this.settings={},this.dialog&&this.dialog.displayError("Please login.",this.job,this.status)):(this.status=Ir.STATUS_ERROR,this.dialog&&this.dialog.displayError(`An error occured, your site is not published. ${t.message}`,this.job,this.status)),this.editor.trigger(_r.PUBLISH_ERROR,{success:!1,message:t.message}),void this.editor.trigger(_r.PUBLISH_END,{success:!1,message:t.message})}}async getHtmlFiles(t){return this.editor.Pages.getAll().map((e=>{const n=e.get("settings");function r(e){return(n||{})[e]||(t||[])[e]||""}const o=e.getMainComponent(),i=hr(e.get("name")),s=`/css/${i}.css`,a=`/${i}.html`,l=Pr(this.editor,s,$.CSS),c=jr(this.editor,s,$.CSS),u=jr(this.editor,a,$.HTML),p=this.editor.getHtml({component:o});return{html:`<!DOCTYPE html>\n<html lang="${r("lang")}">\n<head>\n<link rel="stylesheet" href="${l}" />\n${t?.head||""}\n${n?.head||""}\n<title>${r("title")}</title>\n<link rel="icon" href="${r("favicon")}" />\n${["description","og:title","og:description","og:image"].map((t=>`<meta property="${t}" content="${r(t)}"/>`)).join("\n")}\n</head>\n${p}\n</html>`,css:this.editor.getCss({component:o}),cssPath:c,htmlPath:u}}))}async trackProgress(){try{this.job=await vn({jobId:this.job.jobId}),this.status=$r(this.job.status)}catch(t){return this.status=Ir.STATUS_ERROR,this.dialog&&this.dialog.displayError(`An error occured, your site is not published. ${t.message}`,this.job,this.status),this.editor.trigger(_r.PUBLISH_END,{success:!1,message:t.message}),void this.editor.trigger(_r.PUBLISH_ERROR,{success:!1,message:t.message})}this.job.status===H.IN_PROGRESS?setTimeout((()=>this.trackProgress()),2e3):this.editor.trigger(_r.PUBLISH_END,{success:this.job.status===H.SUCCESS,message:this.job.message}),this.dialog&&this.dialog.displayPending(this.job,this.status)}setPublicationTransformers(){!function(t){const e=t.getModel().get("config");xr(t,(n=>{if(n.get(Cr))console.warn("Publication transformer: HTML transform already altered",n);else{const r=n.toHTML.bind(n);n[Cr]=n.toHTML;const o=n.getStyle.bind(n);n[Tr]=n.getStyle;const i=n.get("attributes").href;if(i?.startsWith("./")&&(n[Er]=i,n.set("attributes",{...n.get("attributes"),href:Pr(t,i,$.HTML)})),n.get("attributes").src){n[Sr]=n.get("attributes").src;const e=Pr(t,n.get("attributes").src,$.ASSET);n.set("attributes",{...n.get("attributes"),src:e})}if(n.get("src")){n[Or]=n.get("src");const e=Pr(t,n.get("src"),$.ASSET);n.set("src",e)}n.toHTML=()=>e.publicationTransformers.reduce(((t,e)=>{try{return e.renderComponent?e.renderComponent(n,(()=>t))??t:t}catch(e){return console.error("Publication transformer: error rendering component",n,e),t}}),r()),n.getStyle=()=>Ar(t,o())}}))}(this.editor),function(t){const e=t.getModel().get("config");t.Css.getAll().forEach((n=>{if(n[kr])console.warn("Publication transformer: CSS transform already altered",n);else{const r=n.getStyle.bind(n);n[kr]=n.getStyle,n.getStyle=()=>{try{const n=e.publicationTransformers.reduce(((t,e)=>({...e.renderCssRule?e.renderCssRule(t,r)??t:t})),Ar(t,r()));return n}catch(t){return console.error("Publication transformer: error rendering style",n,t),r()}}}}))}(this.editor)}resetPublicationTransformers(){!function(t){xr(t,(t=>{t[Cr]&&(t.toHTML=t[Cr],delete t[Cr]),t[Tr]&&(t.getStyle=t[Tr],delete t[Tr]),t[Sr]&&(t.set("attributes",{...t.get("attributes"),src:t[Sr]}),delete t[Sr]),t[Or]&&(t.set("src",t[Or]),delete t[Or]),t[Er]&&(t.set("attributes",{...t.get("attributes"),href:t[Er]}),delete t[Er])}))}(this.editor),function(t){t.Css.getAll().forEach((t=>{t[kr]&&(t.getStyle=t[kr],delete t[kr])}))}(this.editor)}}const Fr=[{name:"./project-bar",value:or},{name:"grapesjs-style-bg",value:qn()},{name:"./settings",value:(t,e)=>{try{lr="3.0.0-alpha.102"}catch(t){}console.info("Silex version:",lr),t.Commands.add(ar,{run:(e,n,{page:r})=>{sr=t.Modal.open({title:r?"Page settings":"Site Settings",content:"",attributes:{class:"settings-dialog"}}).onceClose((()=>{n.set("active",0),t.stopCommand(ar)})),function(t,e,n=t.getModel()){const r=n.get("settings")||{};n.set("settings",r),Ae(ue`
|
|
231
|
+
`}}displayPending(t,e){this.errorMessage=null,this.renderDialog(t,e)}displayError(t,e,n){console.info(t),this.errorMessage=t,this.renderDialog(e,n)}async closeDialog(){this.isOpen=!1,this.renderDialog(null,null),this.sender&&this.sender.set("active",0),this.sender=null}async toggleDialog(){this.isOpen?this.closeDialog():this.openDialog()}async openDialog(){this.isOpen=!0;const t=this.editor.Panels.getPanel("options")?.view.el.querySelector(".publish-button");if(t){const e=t.getBoundingClientRect(),n=450,r=20,o=50;this.move({left:e.right-n-r,top:e.bottom+10,width:n,minHeight:o})}else console.error("Unable to find publish button");this.renderDialog(null,Ir.STATUS_NONE)}}var _r;function xr(t,e){t.Pages.getAll().forEach((t=>{t.getMainComponent().onAll((t=>e(t)))}))}!function(t){t.STARTUP_START="silex:startup:start",t.STARTUP_END="silex:startup:end",t.GRAPESJS_START="silex:grapesjs:start",t.GRAPESJS_END="silex:grapesjs:end",t.PUBLISH_START="silex:publish:start",t.PUBLISH_DATA="silex:publish:data",t.PUBLISH_END="silex:publish:end",t.PUBLISH_ERROR="silex:publish:error",t.PUBLISH_LOGIN_START="silex:publish:login:start",t.PUBLISH_LOGIN_END="silex:publish:login:end",t.ASSET_WRITE_END="silex:asset:write:end",t.WRITE_END="silex:write:end"}(_r||(_r={}));const Cr="tmp-pre-publication-transformer-tohtml",Sr="tmp-pre-publication-transformer-src",Or="tmp-pre-publication-transformer-attributes-src",Tr="tmp-pre-publication-transformer-inline-css",Er="tmp-pre-publication-transformer-href",kr="tmp-pre-publication-transformer-tocss";function Ar(t,e){const n=e["background-image"],r=n?.match(/url\(["']?(.*?)["']?\)/)?.pop();return r?{...e,"background-image":`url(${Pr(t,r,$.ASSET)})`}:e}function Pr(t,e,n){return t.getModel().get("config").publicationTransformers.reduce(((t,e)=>{try{return e.transformPermalink?e.transformPermalink(t,n)??t:t}catch(e){return console.error("Publication transformer: error transforming path",t,e),t}}),e)}function jr(t,e,n){return t.getModel().get("config").publicationTransformers.reduce(((t,e)=>{try{return e.transformPath?e.transformPath(t,n)??t:t}catch(e){return console.error("Publication transformer: error transforming path",t,e),t}}),e)}const Mr="publish",Lr="publish-login",Nr="publish-logout";var Ir;function Dr(t,e){t.PublicationManager=new Hr(t,e)}function $r(t){switch(t){case H.IN_PROGRESS:return Ir.STATUS_PENDING;case H.ERROR:return Ir.STATUS_ERROR;case H.SUCCESS:return Ir.STATUS_SUCCESS}throw new Error(`Unknown job status ${t}`)}!function(t){t.STATUS_NONE="STATUS_NONE",t.STATUS_PENDING="STATUS_PENDING",t.STATUS_ERROR="STATUS_ERROR",t.STATUS_SUCCESS="STATUS_SUCCESS",t.STATUS_LOGGED_OUT="STATUS_AUTH_ERROR"}(Ir||(Ir={}));const Rr=window.location.origin+window.location.pathname.replace(/\/$/,"");class Hr{editor;dialog;_settings;get settings(){return this._settings}set settings(t){this._settings=t,this.dialog&&(this.dialog.settings=t)}options;job=null;status=Ir.STATUS_NONE;constructor(t,e){this.editor=t,this.options={appendTo:"options",...e},t.on("storage:start:store",(t=>{t.publication=this.settings})),t.on("storage:end:load",(t=>{this.settings=t.publication??{},fn({type:R.HOSTING,connectorId:this.settings.connector?.connectorId}).then((t=>{})).catch((t=>{this.status=Ir.STATUS_LOGGED_OUT,this.settings={},this.dialog&&this.dialog.displayError("Please login",this.job,this.status)}))})),t.Commands.add(Mr,(()=>this.startPublication())),t.Commands.add(Lr,((t,e,n)=>this.goLogin(n))),t.Commands.add(Nr,(()=>this.goLogout())),this.options.appendTo?this.dialog=new wr(t,{appendTo:this.options.appendTo}):console.info("PublicationUi is disabled because no appendTo option is set")}async goLogin(t){if(t.isLoggedIn)return this.settings={...this.settings,connector:t},this.status=Ir.STATUS_NONE,this.editor.store(null),void(this.dialog&&this.dialog.displayPending(this.job,this.status));this.settings={},this.status=Ir.STATUS_LOGGED_OUT,this.dialog&&this.dialog.displayPending(this.job,this.status);const e=t.connectorId,n=t.type;return window.open(t.oauthUrl||`${Rr}${f}${h}${y}?connectorId=${e}&type=${n}`,"_blank"),new Promise((e=>{const n=async e=>{const r=e.data;"login"===r?.type&&(window.removeEventListener("message",n),r.error?(this.status=Ir.STATUS_LOGGED_OUT,this.settings={},this.dialog&&this.dialog.displayError(r.message,this.job,this.status)):(this.editor.trigger(_r.PUBLISH_LOGIN_END),this.settings.connector=t,this.settings.options=r.options,this.status=Ir.STATUS_NONE,this.editor.store(null),this.dialog&&this.dialog.displayPending(this.job,this.status)))};window.addEventListener("message",n,!1)}))}async goLogout(){try{await hn({type:R.HOSTING,connectorId:this.settings.connector.connectorId}),this.settings={},this.dialog&&this.dialog.displayPending(this.job,this.status)}catch(t){console.error("logout error",t),this.status=Ir.STATUS_ERROR,this.dialog&&this.dialog.displayError(t.message,this.job,this.status)}}async startPublication(){if(this.status===Ir.STATUS_PENDING)throw new Error("Publication is already in progress");this.status=Ir.STATUS_PENDING,this.job=null,this.dialog&&this.dialog.displayPending(this.job,this.status),this.editor.trigger(_r.PUBLISH_START);const t=this.editor.getModel().get("user");if(!t)throw new Error("User not logged in to a storage connector");if(!this.settings.connector?.connectorId)throw new Error("User not logged in to a hosting connector");const e=this.options.websiteId,n=t.storage.connectorId;this.setPublicationTransformers();const r=this.editor.getProjectData(),o=this.editor.getModel().get("settings"),i=(await this.getHtmlFiles(o)).flatMap((t=>[{path:t.htmlPath,content:t.html,type:$.HTML},{path:t.cssPath,content:t.css,type:$.CSS}])).concat(r.assets.map((t=>{const e=jr(this.editor,t.src,$.ASSET),n=Pr(this.editor,t.src,$.ASSET);return{...t,path:e,src:n,type:$.ASSET}}))),s={...r,settings:o,publication:this.settings,files:i};this.resetPublicationTransformers(),function(t,e){const n=t.getModel().get("config");e.files=n.publicationTransformers.reduce(((t,n)=>t.map(((t,r)=>{try{return e.pages[r],n.transformFile?n.transformFile(t)??t:t}catch(e){return console.error("Publication transformer: error transforming file",t,e),t}}))),e.files)}(this.editor,s),this.editor.trigger(_r.PUBLISH_DATA,s);try{const[t,r]=await gn({websiteId:e,hostingId:this.settings.connector.connectorId,storageId:n,data:s,options:this.settings.options});this.job=r,this.status=$r(this.job.status),this.trackProgress()}catch(t){return console.error("publish error",t),401===t.code||401===t.httpStatusCode?(this.status=Ir.STATUS_LOGGED_OUT,this.settings={},this.dialog&&this.dialog.displayError("Please login.",this.job,this.status)):(this.status=Ir.STATUS_ERROR,this.dialog&&this.dialog.displayError(`An error occured, your site is not published. ${t.message}`,this.job,this.status)),this.editor.trigger(_r.PUBLISH_ERROR,{success:!1,message:t.message}),void this.editor.trigger(_r.PUBLISH_END,{success:!1,message:t.message})}}async getHtmlFiles(t){return this.editor.Pages.getAll().map((e=>{const n=e.get("settings");function r(e){return(n||{})[e]||(t||[])[e]||""}const o=e.getMainComponent(),i=hr(e.get("name")),s=`/css/${i}.css`,a=`/${i}.html`,l=Pr(this.editor,s,$.CSS),c=jr(this.editor,s,$.CSS),u=jr(this.editor,a,$.HTML),p=this.editor.getHtml({component:o});return{html:`<!DOCTYPE html>\n<html lang="${r("lang")}">\n<head>\n<link rel="stylesheet" href="${l}" />\n${t?.head||""}\n${n?.head||""}\n<title>${r("title")}</title>\n<link rel="icon" href="${r("favicon")}" />\n${["description","og:title","og:description","og:image"].map((t=>`<meta property="${t}" content="${r(t)}"/>`)).join("\n")}\n</head>\n${p}\n</html>`,css:this.editor.getCss({component:o}),cssPath:c,htmlPath:u}}))}async trackProgress(){try{this.job=await vn({jobId:this.job.jobId}),this.status=$r(this.job.status)}catch(t){return this.status=Ir.STATUS_ERROR,this.dialog&&this.dialog.displayError(`An error occured, your site is not published. ${t.message}`,this.job,this.status),this.editor.trigger(_r.PUBLISH_END,{success:!1,message:t.message}),void this.editor.trigger(_r.PUBLISH_ERROR,{success:!1,message:t.message})}this.job.status===H.IN_PROGRESS?setTimeout((()=>this.trackProgress()),2e3):this.editor.trigger(_r.PUBLISH_END,{success:this.job.status===H.SUCCESS,message:this.job.message}),this.dialog&&this.dialog.displayPending(this.job,this.status)}setPublicationTransformers(){!function(t){const e=t.getModel().get("config");xr(t,(n=>{if(n.get(Cr))console.warn("Publication transformer: HTML transform already altered",n);else{const r=n.toHTML.bind(n);n[Cr]=n.toHTML;const o=n.getStyle.bind(n);n[Tr]=n.getStyle;const i=n.get("attributes").href;if(i?.startsWith("./")&&(n[Er]=i,n.set("attributes",{...n.get("attributes"),href:Pr(t,i,$.HTML)})),n.get("attributes").src){n[Sr]=n.get("attributes").src;const e=Pr(t,n.get("attributes").src,$.ASSET);n.set("attributes",{...n.get("attributes"),src:e})}if(n.get("src")){n[Or]=n.get("src");const e=Pr(t,n.get("src"),$.ASSET);n.set("src",e)}n.toHTML=()=>e.publicationTransformers.reduce(((t,e)=>{try{return e.renderComponent?e.renderComponent(n,(()=>t))??t:t}catch(e){return console.error("Publication transformer: error rendering component",n,e),t}}),r()),n.getStyle=()=>Ar(t,o())}}))}(this.editor),function(t){const e=t.getModel().get("config");t.Css.getAll().forEach((n=>{if(n[kr])console.warn("Publication transformer: CSS transform already altered",n);else{const r=n.getStyle.bind(n);n[kr]=n.getStyle,n.getStyle=()=>{try{const n=e.publicationTransformers.reduce(((t,e)=>({...e.renderCssRule?e.renderCssRule(t,r)??t:t})),Ar(t,r()));return n}catch(t){return console.error("Publication transformer: error rendering style",n,t),r()}}}}))}(this.editor)}resetPublicationTransformers(){!function(t){xr(t,(t=>{t[Cr]&&(t.toHTML=t[Cr],delete t[Cr]),t[Tr]&&(t.getStyle=t[Tr],delete t[Tr]),t[Sr]&&(t.set("attributes",{...t.get("attributes"),src:t[Sr]}),delete t[Sr]),t[Or]&&(t.set("src",t[Or]),delete t[Or]),t[Er]&&(t.set("attributes",{...t.get("attributes"),href:t[Er]}),delete t[Er])}))}(this.editor),function(t){t.Css.getAll().forEach((t=>{t[kr]&&(t.getStyle=t[kr],delete t[kr])}))}(this.editor)}}const Fr=[{name:"./project-bar",value:or},{name:"grapesjs-style-bg",value:qn()},{name:"./settings",value:(t,e)=>{try{lr="3.0.0-alpha.103"}catch(t){}console.info("Silex version:",lr),t.Commands.add(ar,{run:(e,n,{page:r})=>{sr=t.Modal.open({title:r?"Page settings":"Site Settings",content:"",attributes:{class:"settings-dialog"}}).onceClose((()=>{n.set("active",0),t.stopCommand(ar)})),function(t,e,n=t.getModel()){const r=n.get("settings")||{};n.set("settings",r),Ae(ue`
|
|
232
232
|
<p>The page settings will override site settings, <a href="https://github.com/silexlabs/Silex/wiki/Settings" target="_blank">more info about settings here</a>.</p>
|
|
233
233
|
<form class="silex-form">
|
|
234
234
|
<h2>General settings</h2>
|
|
@@ -318,4 +318,4 @@ var silex;(()=>{var t={357:function(t){var e;"undefined"!=typeof globalThis?glob
|
|
|
318
318
|
<option value="${t}" ?selected=${e.toUpperCase()===t}>${t}</option>
|
|
319
319
|
`))}
|
|
320
320
|
</select>
|
|
321
|
-
`,t)}function r(e){n(e,t.getSelected()?.get("tagName")||"")}t.DomComponents.getTypes().map((e=>{t.DomComponents.addType(e.id,{model:{defaults:{traits:[...t.DomComponents.getType(e.id).model.prototype.defaults.traits,{label:"Tag name",type:"tag-name"}]}}})})),t.TraitManager.addType("tag-name",{createInput({trait:e}){const n=document.createElement("div");return t.on("page",(()=>r(n))),r(n),n},onEvent({elInput:t,component:e,event:n}){const r=t.querySelector("#semantic__select").value;e.get("tagName").toUpperCase()===r.toUpperCase()||e.set("tagName",r)},onUpdate({elInput:t,component:e}){n(t,e.get("tagName"))}})}},{name:"./rich-text",value:(t,e)=>{t.RichTextEditor.add("orderedList",{icon:"1.",attributes:{title:"Ordered List"},result:t=>t.exec("insertOrderedList")}),t.RichTextEditor.add("unorderedList",{icon:'<i class="fa fa-list-ul"></i>',attributes:{title:"Unordered List"},result:t=>t.exec("insertUnorderedList")})}},{name:"grapesjs-style-filter",value:lt()},{name:"grapesjs-plugin-forms",value:ut()},{name:"grapesjs-custom-code",value:dt()},{name:"./internal-links",value:mr},{name:"@silexlabs/grapesjs-ui-suggest-classes",value:ht()},{name:"./symbolDialogs",value:(t,e)=>{t.Commands.add(ln,{run:(e,n)=>{const r=prompt("Label",function(e){let n=1;for(;t.Symbols.find((t=>t.get("label")===e+n));)n++;return e+n}("Symbol "));t.runCommand(en,{label:r,icon:"fa-gem"})}})}},{name:"@silexlabs/grapesjs-symbols",value:nn},{name:"./PublicationManager",value:Dr},{name:"./storage",value:t=>{function e(e){const n="string"==typeof e?JSON.parse(e):e;if(console.error("Error with loading or saving website or uploading asset",n,n instanceof N),!(n instanceof N))return t.Modal.open({title:"Error",content:`An error occured.<br>${n.message}`});switch(console.error("ApiError",n.httpStatusCode,n.message),n.httpStatusCode){case 404:return t.Modal.open({title:"Website not found",content:`This website could not be found.<br><hr>${n.message}`});case 403:return t.Modal.open({title:"Access denied",content:`You are not allowed to access this website.<br><hr>${n.message}`});case 401:return void t.trigger(Ln);default:return t.Modal.open({title:"Error",content:`An error occured.<br>${n.message}`})}}t.Storage.add("connector",{async load(e){try{const i=await Nn(t)??await In(t,R.STORAGE,e.connectorId);if(!i)throw new N("Not logged in",401);const s=await bn({websiteId:e.id,connectorId:i.storage.connectorId});return s.assets&&(s.assets=(n=s.assets,r=e.id,o=i.storage.connectorId,n.map((t=>t.src?{...t,src:U(t.src,r,o)}:t)))),s.pages&&(s.pages=function(t,e,n){return t.map((t=>({...t,frames:t.frames.map((t=>({...t,component:W(t.component,e,n)})))})))}(s.pages,e.id,i.storage.connectorId)),s.styles&&(s.styles=function(t,e,n){return new RegExp(/(.*)(url\((["']?)([^"']+?)\1\))*(.*)/,"g"),t.map((t=>{if(t.style&&t.style["background-image"]){const r=t.style["background-image"].replace(/url\((['"]?)([^'"]+)\1\)/g,((t,r,o)=>`url(${r}${U(o,e,n)}${r})`));return{...t,style:{...t.style,"background-image":r}}}return t}))}(s.styles,e.id,i.storage.connectorId)),s}catch(n){throw 401===n.httpStatusCode&&(t.once(jn,(async()=>{try{t.StorageManager.setAutosave(!1);const n=await t.Storage.load(e);t.StorageManager.setAutosave(!0),t.loadProjectData(n)}catch(t){throw console.error("connectorPlugin load error",t),t}})),t.Commands.run(kn)),console.error("connectorPlugin load error",n),n}var n,r,o},async store(e,n){try{if(await Nn(t)){const r=await Nn(t);e.assets=e.assets.map((t=>t.src?{...t,src:B(t.src)}:t)),e.pages=e.pages.map((t=>({...t,frames:t.frames.map((t=>({...t,component:q(t.component)})))}))),e.styles=e.styles.map((t=>{if(t.style&&t.style["background-image"]){const e=t.style["background-image"].replace(/url\((['"]?)([^'"]+)\1\)/g,((t,e,n)=>`url(${e}${B(n)}${e})`));return{...t,style:{...t.style,"background-image":e}}}return t})),await wn({websiteId:n.id,connectorId:r.storage.connectorId,data:e})}else t.once(jn,(()=>t.Storage.store())),t.Commands.run(kn)}catch(t){throw console.error("connectorPlugin store error",t),t}}}),t.on("storage:error:load",(t=>{e(t)})),t.on("storage:error:store",(t=>{e(t)})),t.on("asset:upload:end",(e=>{t.store()})),t.on("asset:upload:error",(t=>{e(t)}))}},{name:"./LoginDialog",value:Hn},{name:"@silexlabs/grapesjs-loading",value:on()},{name:"./breadcrumbs",value:function(t,e){let n;var r;function o(){let e=t.getSelected()??t.Pages.getSelected().getMainComponent();if(!n)return;for(n.innerHTML="";e;){const t=i(e);n.prepend(t),e=e.parent()}const r=document.createElement("span");r.innerHTML="<h3>Selection: </h3>",n.prepend(r)}function i(e){const n=document.createElement("span");return e.model,n.onclick=()=>{t.select(e)},n.classList.add("breadcrumb"),n.innerHTML=`<span>${e.getName()??e.get("tagName")}</span>`,n}r=t=>{n=document.createElement("div"),n.id="breadcrumbs-container",t.prepend(n);const e=document.createElement("style");e.innerHTML='\n #breadcrumbs-container {\n display: flex;\n align-items: center;\n height: 100%;\n padding: 0 10px;\n font-size: 12px;\n color: #999;\n overflow-x: auto;\n overflow-y: hidden;\n }\n #breadcrumbs-container h3 {\n font-size: inherit;\n margin: 0;\n }\n #breadcrumbs-container .breadcrumb {\n margin: 0 5px;\n font-size: 14px;\n line-height: 1;\n cursor: pointer;\n white-space: nowrap;\n }\n #breadcrumbs-container .breadcrumb::after {\n content: "➔";\n margin-left: 10px;\n }\n\n #breadcrumbs-container .breadcrumb:last-child::after {\n content: "";\n }\n ',t.prepend(e),o()},Fn?r(Fn):Vn.push(r),t.on("component:selected style:target component:drag:end",(()=>o()))}},{name:"./footer",value:function(t,e){const n=t.Panels.addPanel({id:"footer",visible:!0,buttons:[{id:"myNewButton",className:"someClass",command:"someCommand",attributes:{title:"Some title"},active:!1}]});setTimeout((()=>{Fn=n.view?.el,Vn.forEach((t=>t(Fn))),Vn=[]}))}},{name:"@silexlabs/grapesjs-storage-rate-limit",value:Un},{name:"grapesjs-style-border",value:zn()}];Fr.filter((t=>"function"!=typeof t.value)).forEach((t=>{throw new Error(`Plugin ${t.name} could not be loaded correctly (${t.value})`)}));const Vr="#333333",Ur="#ddd",Br="#8873FE",zr="#A291FF",Wr="#363636",qr="#575757",Gr="Containers",Kr="Components";function Yr(t,e,n){return{container:"#gjs",height:"100%",showOffsets:!0,showDevices:!0,layerManager:{appendTo:".layer-manager-container"},blockManager:{appendTo:".block-manager-container"},assetManager:{upload:`${n}${f}${S}${j}/?websiteId=${t}${e?`&connectorId=${e}`:""}`},storageManager:{autoload:!1,type:"connector",options:{connector:{id:t,connectorId:e}}},cssIcons:"./css/all.min.css",canvasCss:`\n :root {\n --primaryColor: ${Vr};\n --secondaryColor: ${Ur};\n --tertiaryColor: ${Br};\n --quaternaryColor: ${zr};\n --darkerPrimaryColor: ${Wr};\n --lighterPrimaryColor: ${qr};\n }\n .gjs-frame-selected {\n box-shadow: 0 0 0 2px rgba(255, 0, 0, 0.5) !important; // Change to red border\n }\n .gjs-selected {\n outline: 2px solid var(--tertiaryColor) !important;\n outline-offset: -2px;\n }\n `,plugins:Fr.map((t=>t.value)),pluginsOpts:{[st()]:{blocks:["text","image","video","map"],category:Gr},[or]:{panels:[{id:"dash",className:"logo",attributes:{title:"Dashboard"},command:()=>{window.location.href="/"}},{id:"block-manager-btn",className:"block-manager-btn fa fa-fw fa-plus",attributes:{title:"Blocks",containerClassName:"block-manager-container"},command:"open-blocks"},{id:"symbols-btn",className:"symbols-btn fa-regular fa-gem",attributes:{title:"Symbols",containerClassName:"symbols-list-container"},command:"open-symbols",buttons:[{id:"symbol-create-button",className:"pages__add-page fa-solid fa-plus",label:"Create symbol from selection",command:ln}]},{id:"page-panel-btn",className:"page-panel-btn fa fa-fw fa-file",attributes:{title:"Pages",containerClassName:"page-panel-container"},command:Kn,buttons:[{className:"pages__add-page fa fa-file",command:Yn,text:"+"}]},{id:"layer-manager-btn",className:"layer-manager-btn fa-solid fa-layer-group",attributes:{title:"Layers",containerClassName:"layer-manager-container"},command:"open-layers"},{id:"font-dialog-btn",className:"font-manager-btn fa-solid fa-font",attributes:{title:"Fonts"},command:()=>{Jr.runCommand(sn.cmdOpenFonts)}},{id:"settings-dialog-btn",className:"page-panel-btn fa-solid fa-gears",attributes:{title:"Settings"},command:ar},{id:"spacer",attributes:{},className:"project-bar-spacer"},{id:"dash2",className:"fa-solid fa-house",attributes:{title:"Dashboard"},command:()=>{window.location.href="/"}},{id:"help",className:"fa fa-fw fa-question-circle",attributes:{title:"Documentation"},command:()=>{window.open("https://docs.silex.me/","_blank")}},{id:"logout-button",className:"page-panel-btn fa fa-fw fa-sign-out",attributes:{title:"Sign out"},command:An}]},[Dr]:{appendTo:"options",websiteId:t},[Xn]:{cmdOpenNewPageDialog:rr,cmdOpenSettings:ar,appendTo:".page-panel-container"},[ht()]:{enableCount:!1,enablePerformance:!1},[mr]:{onError:t=>console.warn("Links errors:",t)},[dt()]:{blockLabel:"HTML",blockCustomCode:{category:Kr}},[nn]:{appendTo:".symbols-list-container",emptyText:"No symbol yet.",primaryColor:Vr,secondaryColor:Ur,highlightColor:Br},[an()]:{api_key:"AIzaSyAdJTYSLPlKz4w5Iqyy-JAF2o8uQKd1FKc"},[Hn]:{id:t},[Un]:{time:5e3}}}}let Jr;async function Xr(t){if(Jr)throw new Error("Grapesjs editor already created");return new Promise(((e,n)=>{try{Jr=ot().init(t)}catch(t){console.error("Error initializing GrapesJs with plugins:",Fr,t),n(t)}["text"].forEach((t=>Jr.Blocks.get(t)?.set("category","Basics"))),["image","video"].forEach((t=>Jr.Blocks.get(t)?.set("category","Media"))),["map"].forEach((t=>Jr.Blocks.get(t)?.set("category","Components"))),Jr.Blocks.render([]),Jr.Commands.add("gjs-open-import-webpage",function(t,e){const n=t.getConfig("stylePrefix"),r=t.Modal,o=t.CodeManager.getViewer("CodeMirror").clone(),i=document.createElement("div"),s=e.modalImportLabel,a=e.modalImportContent;let l=o.editor;const c=document.createElement("button");return c.type="button",c.innerHTML=e.modalImportButton,c.className=`${n}btn-prim ${n}btn-import`,c.onclick=e=>{t.setComponents(l.getValue().trim()),r.close()},o.set({codeName:"htmlmixed",theme:"hopscotch",readOnly:0,...e.importViewerOptions}),{run(u){if(!l){const t=document.createElement("textarea");if(s){const t=document.createElement("div");t.className=`${n}import-label`,t.innerHTML=s,i.appendChild(t)}i.appendChild(t),i.appendChild(c),o.init(t),l=o.editor}r.setTitle(e.modalImportTitle),r.setContent(i);const p="function"==typeof a?a(t):a;o.setContent(p||""),r.open().getModel().once("change:open",(()=>t.stopCommand(this.id))),l.refresh()},stop(){r.close()}}}(Jr,{modalImportLabel:"",modalImportContent:"Paste a web page HTML code here.",modalImportButton:"Import",modalImportTitle:"Import from website"})),Jr.on("load",(()=>{Jr.Panels.getPanel("views").buttons.remove("open-blocks"),Jr.Panels.getPanel("views").buttons.remove("open-layers"),Jr.Panels.getPanel("views").view.el.firstChild.style.justifyContent="initial",Jr.Panels.getPanel("options").buttons.remove("export-template"),Jr.BlockManager.render(null),Jr.StyleManager.addProperty("extra",{extend:"filter"}),e(Jr)}))}))}function Zr(){return Jr}class Qr extends nt{api=o;websiteId=new URL(location.href).searchParams.get("id")??u;storageId=new URL(location.href).searchParams.get("connectorId");lang=new URL(location.href).searchParams.get("lang")??p;rootUrl=window.location.origin+window.location.pathname.replace(/\/$/,"");debug=!1;grapesJsConfig;clientConfigUrl=`${this.rootUrl}/${d}`;initGrapesConfig(){this.grapesJsConfig=Yr(this.websiteId,this.storageId,this.rootUrl)}getEditor(){return Zr()}publicationTransformers=[];addPublicationTransformers(t){Array.isArray(t)||(t=[t]),t.forEach((t=>{!function(t){const e=["renderComponent","renderCssRule","transformFile","transformPermalink","transformPath"];Object.keys(t).forEach((t=>{if(!e.includes(t))throw new Error(`Publication transformer: unknown property ${t}`)})),e.forEach((e=>{if("function"!=typeof t[e]&&void 0!==t[e])throw new Error(`Publication transformer: ${e} must be a function`)}))}(t)})),this.publicationTransformers=this.publicationTransformers.concat(t)}}async function to(t={}){const e=new Qr;Object.assign(e,t),e.addPublicationTransformers(z),await e.addPlugin(e.clientConfigUrl,{}),e.debug&&console.warn("Silex starting in debug mode.",{config:e}),e.emit(_r.STARTUP_START),e.initGrapesConfig(),e.emit(_r.GRAPESJS_START);try{await Xr(e.grapesJsConfig)}catch(t){throw console.error("Error starting Silex",t),t}const n=Zr();n.getModel().set("config",e),e.emit(_r.GRAPESJS_END,{editor:n}),n.I18n.setLocale(e.lang),n.StorageManager.setAutosave(!1);try{await n.load(null)}catch(t){t.httpStatusCode}finally{setTimeout((()=>{n.editor.set("changesCount",0),n.StorageManager.setAutosave(!0),document.querySelector(".silex-loader").classList.add("silex-dialog-hide"),document.querySelector("#gjs").classList.remove("silex-dialog-hide"),e.emit(_r.STARTUP_END,{editor:n,config:e})}),100)}}console.info("\nSilex client loaded\n")})(),silex=r})();
|
|
321
|
+
`,t)}function r(e){n(e,t.getSelected()?.get("tagName")||"")}t.DomComponents.getTypes().map((e=>{t.DomComponents.addType(e.id,{model:{defaults:{traits:[...t.DomComponents.getType(e.id).model.prototype.defaults.traits,{label:"Tag name",type:"tag-name"}]}}})})),t.TraitManager.addType("tag-name",{createInput({trait:e}){const n=document.createElement("div");return t.on("page",(()=>r(n))),r(n),n},onEvent({elInput:t,component:e,event:n}){const r=t.querySelector("#semantic__select").value;e.get("tagName").toUpperCase()===r.toUpperCase()||e.set("tagName",r)},onUpdate({elInput:t,component:e}){n(t,e.get("tagName"))}})}},{name:"./rich-text",value:(t,e)=>{t.RichTextEditor.add("orderedList",{icon:"1.",attributes:{title:"Ordered List"},result:t=>t.exec("insertOrderedList")}),t.RichTextEditor.add("unorderedList",{icon:'<i class="fa fa-list-ul"></i>',attributes:{title:"Unordered List"},result:t=>t.exec("insertUnorderedList")})}},{name:"grapesjs-style-filter",value:lt()},{name:"grapesjs-plugin-forms",value:ut()},{name:"grapesjs-custom-code",value:dt()},{name:"./internal-links",value:mr},{name:"@silexlabs/grapesjs-ui-suggest-classes",value:ht()},{name:"./symbolDialogs",value:(t,e)=>{t.Commands.add(ln,{run:(e,n)=>{const r=prompt("Label",function(e){let n=1;for(;t.Symbols.find((t=>t.get("label")===e+n));)n++;return e+n}("Symbol "));t.runCommand(en,{label:r,icon:"fa-gem"})}})}},{name:"@silexlabs/grapesjs-symbols",value:nn},{name:"./PublicationManager",value:Dr},{name:"./storage",value:t=>{function e(e){const n="string"==typeof e?JSON.parse(e):e;if(console.error("Error with loading or saving website or uploading asset",n,n instanceof N),!(n instanceof N))return t.Modal.open({title:"Error",content:`An error occured.<br>${n.message}`});switch(console.error("ApiError",n.httpStatusCode,n.message),n.httpStatusCode){case 404:return t.Modal.open({title:"Website not found",content:`This website could not be found.<br><hr>${n.message}`});case 403:return t.Modal.open({title:"Access denied",content:`You are not allowed to access this website.<br><hr>${n.message}`});case 401:return void t.trigger(Ln);default:return t.Modal.open({title:"Error",content:`An error occured.<br>${n.message}`})}}t.Storage.add("connector",{async load(e){try{const i=await Nn(t)??await In(t,R.STORAGE,e.connectorId);if(!i)throw new N("Not logged in",401);const s=await bn({websiteId:e.id,connectorId:i.storage.connectorId});return s.assets&&(s.assets=(n=s.assets,r=e.id,o=i.storage.connectorId,n.map((t=>t.src?{...t,src:U(t.src,r,o)}:t)))),s.pages&&(s.pages=function(t,e,n){return t.map((t=>({...t,frames:t.frames.map((t=>({...t,component:W(t.component,e,n)})))})))}(s.pages,e.id,i.storage.connectorId)),s.styles&&(s.styles=function(t,e,n){return new RegExp(/(.*)(url\((["']?)([^"']+?)\1\))*(.*)/,"g"),t.map((t=>{if(t.style&&t.style["background-image"]){const r=t.style["background-image"].replace(/url\((['"]?)([^'"]+)\1\)/g,((t,r,o)=>`url(${r}${U(o,e,n)}${r})`));return{...t,style:{...t.style,"background-image":r}}}return t}))}(s.styles,e.id,i.storage.connectorId)),s}catch(n){throw 401===n.httpStatusCode&&(t.once(jn,(async()=>{try{t.StorageManager.setAutosave(!1);const n=await t.Storage.load(e);t.StorageManager.setAutosave(!0),t.loadProjectData(n)}catch(t){throw console.error("connectorPlugin load error",t),t}})),t.Commands.run(kn)),console.error("connectorPlugin load error",n),n}var n,r,o},async store(e,n){try{if(await Nn(t)){const r=await Nn(t);e.assets=e.assets.map((t=>t.src?{...t,src:B(t.src)}:t)),e.pages=e.pages.map((t=>({...t,frames:t.frames.map((t=>({...t,component:q(t.component)})))}))),e.styles=e.styles.map((t=>{if(t.style&&t.style["background-image"]){const e=t.style["background-image"].replace(/url\((['"]?)([^'"]+)\1\)/g,((t,e,n)=>`url(${e}${B(n)}${e})`));return{...t,style:{...t.style,"background-image":e}}}return t})),await wn({websiteId:n.id,connectorId:r.storage.connectorId,data:e})}else t.once(jn,(()=>t.Storage.store())),t.Commands.run(kn)}catch(t){throw console.error("connectorPlugin store error",t),t}}}),t.on("storage:error:load",(t=>{e(t)})),t.on("storage:error:store",(t=>{e(t)})),t.on("asset:upload:end",(e=>{t.store()})),t.on("asset:upload:error",(t=>{e(t)}))}},{name:"./LoginDialog",value:Hn},{name:"@silexlabs/grapesjs-loading",value:on()},{name:"./breadcrumbs",value:function(t,e){let n;var r;function o(){let e=t.getSelected()??t.Pages.getSelected().getMainComponent();if(!n)return;for(n.innerHTML="";e;){const t=i(e);n.prepend(t),e=e.parent()}const r=document.createElement("span");r.innerHTML="<h3>Selection: </h3>",n.prepend(r)}function i(e){const n=document.createElement("span");return e.model,n.onclick=()=>{t.select(e)},n.classList.add("breadcrumb"),n.innerHTML=`<span>${e.getName()??e.get("tagName")}</span>`,n}r=t=>{n=document.createElement("div"),n.id="breadcrumbs-container",t.prepend(n);const e=document.createElement("style");e.innerHTML='\n #breadcrumbs-container {\n display: flex;\n align-items: center;\n height: 100%;\n padding: 0 10px;\n font-size: 12px;\n color: #999;\n overflow-x: auto;\n overflow-y: hidden;\n }\n #breadcrumbs-container h3 {\n font-size: inherit;\n margin: 0;\n }\n #breadcrumbs-container .breadcrumb {\n margin: 0 5px;\n font-size: 14px;\n line-height: 1;\n cursor: pointer;\n white-space: nowrap;\n }\n #breadcrumbs-container .breadcrumb::after {\n content: "➔";\n margin-left: 10px;\n }\n\n #breadcrumbs-container .breadcrumb:last-child::after {\n content: "";\n }\n ',t.prepend(e),o()},Fn?r(Fn):Vn.push(r),t.on("component:selected style:target component:drag:end",(()=>o()))}},{name:"./img",value:(t,e)=>{t.on("load",(()=>{const e=t.StyleManager.addSector("image",{name:"Image",open:!1,properties:[{label:"object-fit",property:"object-fit",type:"select",default:"",options:[{id:"",label:""},{id:"fill",label:"fill"},{id:"contain",label:"contain"},{id:"cover",label:"cover"},{id:"none",label:"none"},{id:"scale-down",label:"scale-down"},{id:"initial",label:"initial"},{id:"inherit",label:"inherit"},{id:"auto",label:"auto"}]},{label:"object-position",property:"object-position",type:"select",default:"",options:[{id:"",label:""},{id:"left top",label:"left top"},{id:"left center",label:"left center"},{id:"left bottom",label:"left bottom"},{id:"right top",label:"right top"},{id:"right center",label:"right center"},{id:"right bottom",label:"right bottom"},{id:"center top",label:"center top"},{id:"center center",label:"center center"},{id:"center bottom",label:"center bottom"},{id:"initial",label:"initial"},{id:"inherit",label:"inherit"},{id:"unset",label:"unset"}]}]},{at:1});let n=!1;t.on("component:selected",(t=>{t&&"image"===t.get("type")?n=!0:(n=!1,e.set("visible",!1))})),e.on("change:visible",((t,r)=>{e.get("visible")!==n&&e.set("visible",n)}))}))}},{name:"./footer",value:function(t,e){const n=t.Panels.addPanel({id:"footer",visible:!0,buttons:[{id:"myNewButton",className:"someClass",command:"someCommand",attributes:{title:"Some title"},active:!1}]});setTimeout((()=>{Fn=n.view?.el,Vn.forEach((t=>t(Fn))),Vn=[]}))}},{name:"@silexlabs/grapesjs-storage-rate-limit",value:Un},{name:"grapesjs-style-border",value:zn()}];Fr.filter((t=>"function"!=typeof t.value)).forEach((t=>{throw new Error(`Plugin ${t.name} could not be loaded correctly (${t.value})`)}));const Vr="#333333",Ur="#ddd",Br="#8873FE",zr="#A291FF",Wr="#363636",qr="#575757",Gr="Containers",Kr="Components";function Yr(t,e,n){return{container:"#gjs",height:"100%",showOffsets:!0,showDevices:!0,layerManager:{appendTo:".layer-manager-container"},blockManager:{appendTo:".block-manager-container"},assetManager:{upload:`${n}${f}${S}${j}/?websiteId=${t}${e?`&connectorId=${e}`:""}`},storageManager:{autoload:!1,type:"connector",options:{connector:{id:t,connectorId:e}}},cssIcons:"./css/all.min.css",canvasCss:`\n :root {\n --primaryColor: ${Vr};\n --secondaryColor: ${Ur};\n --tertiaryColor: ${Br};\n --quaternaryColor: ${zr};\n --darkerPrimaryColor: ${Wr};\n --lighterPrimaryColor: ${qr};\n }\n .gjs-frame-selected {\n box-shadow: 0 0 0 2px rgba(255, 0, 0, 0.5) !important; // Change to red border\n }\n .gjs-selected {\n outline: 2px solid var(--tertiaryColor) !important;\n outline-offset: -2px;\n }\n `,plugins:Fr.map((t=>t.value)),pluginsOpts:{[st()]:{blocks:["text","image","video","map"],category:Gr},[or]:{panels:[{id:"dash",className:"logo",attributes:{title:"Dashboard"},command:()=>{window.location.href="/"}},{id:"block-manager-btn",className:"block-manager-btn fa fa-fw fa-plus",attributes:{title:"Blocks",containerClassName:"block-manager-container"},command:"open-blocks"},{id:"symbols-btn",className:"symbols-btn fa-regular fa-gem",attributes:{title:"Symbols",containerClassName:"symbols-list-container"},command:"open-symbols",buttons:[{id:"symbol-create-button",className:"pages__add-page fa-solid fa-plus",label:"Create symbol from selection",command:ln}]},{id:"page-panel-btn",className:"page-panel-btn fa fa-fw fa-file",attributes:{title:"Pages",containerClassName:"page-panel-container"},command:Kn,buttons:[{className:"pages__add-page fa fa-file",command:Yn,text:"+"}]},{id:"layer-manager-btn",className:"layer-manager-btn fa-solid fa-layer-group",attributes:{title:"Layers",containerClassName:"layer-manager-container"},command:"open-layers"},{id:"font-dialog-btn",className:"font-manager-btn fa-solid fa-font",attributes:{title:"Fonts"},command:()=>{Jr.runCommand(sn.cmdOpenFonts)}},{id:"settings-dialog-btn",className:"page-panel-btn fa-solid fa-gears",attributes:{title:"Settings"},command:ar},{id:"spacer",attributes:{},className:"project-bar-spacer"},{id:"dash2",className:"fa-solid fa-house",attributes:{title:"Dashboard"},command:()=>{window.location.href="/"}},{id:"help",className:"fa fa-fw fa-question-circle",attributes:{title:"Documentation"},command:()=>{window.open("https://docs.silex.me/","_blank")}},{id:"logout-button",className:"page-panel-btn fa fa-fw fa-sign-out",attributes:{title:"Sign out"},command:An}]},[Dr]:{appendTo:"options",websiteId:t},[Xn]:{cmdOpenNewPageDialog:rr,cmdOpenSettings:ar,appendTo:".page-panel-container"},[ht()]:{enableCount:!1,enablePerformance:!1},[mr]:{onError:t=>console.warn("Links errors:",t)},[dt()]:{blockLabel:"HTML",blockCustomCode:{category:Kr}},[nn]:{appendTo:".symbols-list-container",emptyText:"No symbol yet.",primaryColor:Vr,secondaryColor:Ur,highlightColor:Br},[an()]:{api_key:"AIzaSyAdJTYSLPlKz4w5Iqyy-JAF2o8uQKd1FKc"},[Hn]:{id:t},[Un]:{time:5e3}}}}let Jr;async function Xr(t){if(Jr)throw new Error("Grapesjs editor already created");return new Promise(((e,n)=>{try{Jr=ot().init(t)}catch(t){console.error("Error initializing GrapesJs with plugins:",Fr,t),n(t)}["text"].forEach((t=>Jr.Blocks.get(t)?.set("category","Basics"))),["image","video"].forEach((t=>Jr.Blocks.get(t)?.set("category","Media"))),["map"].forEach((t=>Jr.Blocks.get(t)?.set("category","Components"))),Jr.Blocks.render([]),Jr.Commands.add("gjs-open-import-webpage",function(t,e){const n=t.getConfig("stylePrefix"),r=t.Modal,o=t.CodeManager.getViewer("CodeMirror").clone(),i=document.createElement("div"),s=e.modalImportLabel,a=e.modalImportContent;let l=o.editor;const c=document.createElement("button");return c.type="button",c.innerHTML=e.modalImportButton,c.className=`${n}btn-prim ${n}btn-import`,c.onclick=e=>{t.setComponents(l.getValue().trim()),r.close()},o.set({codeName:"htmlmixed",theme:"hopscotch",readOnly:0,...e.importViewerOptions}),{run(u){if(!l){const t=document.createElement("textarea");if(s){const t=document.createElement("div");t.className=`${n}import-label`,t.innerHTML=s,i.appendChild(t)}i.appendChild(t),i.appendChild(c),o.init(t),l=o.editor}r.setTitle(e.modalImportTitle),r.setContent(i);const p="function"==typeof a?a(t):a;o.setContent(p||""),r.open().getModel().once("change:open",(()=>t.stopCommand(this.id))),l.refresh()},stop(){r.close()}}}(Jr,{modalImportLabel:"",modalImportContent:"Paste a web page HTML code here.",modalImportButton:"Import",modalImportTitle:"Import from website"})),Jr.on("load",(()=>{Jr.Panels.getPanel("views").buttons.remove("open-blocks"),Jr.Panels.getPanel("views").buttons.remove("open-layers"),Jr.Panels.getPanel("views").view.el.firstChild.style.justifyContent="initial",Jr.Panels.getPanel("options").buttons.remove("export-template"),Jr.BlockManager.render(null),Jr.StyleManager.addProperty("extra",{extend:"filter"}),e(Jr)}))}))}function Zr(){return Jr}class Qr extends nt{api=o;websiteId=new URL(location.href).searchParams.get("id")??u;storageId=new URL(location.href).searchParams.get("connectorId");lang=new URL(location.href).searchParams.get("lang")??p;rootUrl=window.location.origin+window.location.pathname.replace(/\/$/,"");debug=!1;grapesJsConfig;clientConfigUrl=`${this.rootUrl}/${d}`;initGrapesConfig(){this.grapesJsConfig=Yr(this.websiteId,this.storageId,this.rootUrl)}getEditor(){return Zr()}publicationTransformers=[];addPublicationTransformers(t){Array.isArray(t)||(t=[t]),t.forEach((t=>{!function(t){const e=["renderComponent","renderCssRule","transformFile","transformPermalink","transformPath"];Object.keys(t).forEach((t=>{if(!e.includes(t))throw new Error(`Publication transformer: unknown property ${t}`)})),e.forEach((e=>{if("function"!=typeof t[e]&&void 0!==t[e])throw new Error(`Publication transformer: ${e} must be a function`)}))}(t)})),this.publicationTransformers=this.publicationTransformers.concat(t)}}async function to(t={}){const e=new Qr;Object.assign(e,t),e.addPublicationTransformers(z),await e.addPlugin(e.clientConfigUrl,{}),e.debug&&console.warn("Silex starting in debug mode.",{config:e}),e.emit(_r.STARTUP_START),e.initGrapesConfig(),e.emit(_r.GRAPESJS_START);try{await Xr(e.grapesJsConfig)}catch(t){throw console.error("Error starting Silex",t),t}const n=Zr();n.getModel().set("config",e),e.emit(_r.GRAPESJS_END,{editor:n}),n.I18n.setLocale(e.lang),n.StorageManager.setAutosave(!1);try{await n.load(null)}catch(t){t.httpStatusCode}finally{setTimeout((()=>{n.editor.set("changesCount",0),n.StorageManager.setAutosave(!0),document.querySelector(".silex-loader").classList.add("silex-dialog-hide"),document.querySelector("#gjs").classList.remove("silex-dialog-hide"),e.emit(_r.STARTUP_END,{editor:n,config:e})}),100)}}console.info("\nSilex client loaded\n")})(),silex=r})();
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Silex website builder, free/libre no-code tool for makers.
|
|
3
|
+
* Copyright (c) 2023 lexoyo and Silex Labs foundation
|
|
4
|
+
*
|
|
5
|
+
* This program is free software: you can redistribute it and/or modify
|
|
6
|
+
* it under the terms of the GNU Affero General Public License as published by
|
|
7
|
+
* the Free Software Foundation, either version 3 of the License, or any later version.
|
|
8
|
+
*
|
|
9
|
+
* This program is distributed in the hope that it will be useful,
|
|
10
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
11
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
12
|
+
* GNU Affero General Public License for more details.
|
|
13
|
+
*
|
|
14
|
+
* You should have received a copy of the GNU Affero General Public License
|
|
15
|
+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
16
|
+
*/
|
|
17
|
+
/**
|
|
18
|
+
* @fileoverview This plugin adds CSS properties object-fit and object-position to the image component.
|
|
19
|
+
*/
|
|
20
|
+
export default (editor, opts) => {
|
|
21
|
+
// Wait for the editor to be ready
|
|
22
|
+
editor.on('load', () => {
|
|
23
|
+
// Add a sector to the style manager
|
|
24
|
+
const sector = editor.StyleManager.addSector('image', {
|
|
25
|
+
name: 'Image',
|
|
26
|
+
open: false,
|
|
27
|
+
properties: [{
|
|
28
|
+
label: 'object-fit',
|
|
29
|
+
property: 'object-fit',
|
|
30
|
+
type: 'select',
|
|
31
|
+
default: '',
|
|
32
|
+
/* @ts-ignore */
|
|
33
|
+
options: [
|
|
34
|
+
{ id: '', label: '' },
|
|
35
|
+
{ id: 'fill', label: 'fill' },
|
|
36
|
+
{ id: 'contain', label: 'contain' },
|
|
37
|
+
{ id: 'cover', label: 'cover' },
|
|
38
|
+
{ id: 'none', label: 'none' },
|
|
39
|
+
{ id: 'scale-down', label: 'scale-down' },
|
|
40
|
+
{ id: 'initial', label: 'initial' },
|
|
41
|
+
{ id: 'inherit', label: 'inherit' },
|
|
42
|
+
{ id: 'auto', label: 'auto' },
|
|
43
|
+
],
|
|
44
|
+
}, {
|
|
45
|
+
label: 'object-position',
|
|
46
|
+
property: 'object-position',
|
|
47
|
+
type: 'select',
|
|
48
|
+
default: '',
|
|
49
|
+
/* @ts-ignore */
|
|
50
|
+
options: [
|
|
51
|
+
{ id: '', label: '' },
|
|
52
|
+
{ id: 'left top', label: 'left top' },
|
|
53
|
+
{ id: 'left center', label: 'left center' },
|
|
54
|
+
{ id: 'left bottom', label: 'left bottom' },
|
|
55
|
+
{ id: 'right top', label: 'right top' },
|
|
56
|
+
{ id: 'right center', label: 'right center' },
|
|
57
|
+
{ id: 'right bottom', label: 'right bottom' },
|
|
58
|
+
{ id: 'center top', label: 'center top' },
|
|
59
|
+
{ id: 'center center', label: 'center center' },
|
|
60
|
+
{ id: 'center bottom', label: 'center bottom' },
|
|
61
|
+
{ id: 'initial', label: 'initial' },
|
|
62
|
+
{ id: 'inherit', label: 'inherit' },
|
|
63
|
+
{ id: 'unset', label: 'unset' },
|
|
64
|
+
],
|
|
65
|
+
}],
|
|
66
|
+
}, {
|
|
67
|
+
at: 1,
|
|
68
|
+
});
|
|
69
|
+
let showSector = false;
|
|
70
|
+
// It shows up when the selection is an image
|
|
71
|
+
editor.on('component:selected', (model) => {
|
|
72
|
+
if (model && model.get('type') === 'image') {
|
|
73
|
+
// Not necessary, grapesjs does it automatically
|
|
74
|
+
// sector.set('visible', true);
|
|
75
|
+
showSector = true;
|
|
76
|
+
}
|
|
77
|
+
else {
|
|
78
|
+
showSector = false;
|
|
79
|
+
sector.set('visible', false);
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
// Watch automatic changes and revert them if needed
|
|
83
|
+
sector.on('change:visible', (model, open) => {
|
|
84
|
+
if (sector.get('visible') !== showSector)
|
|
85
|
+
sector.set('visible', showSector);
|
|
86
|
+
});
|
|
87
|
+
});
|
|
88
|
+
};
|
|
89
|
+
//# sourceMappingURL=img.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"img.js","sourceRoot":"","sources":["../../../../../src/ts/client/grapesjs/img.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAIH;;GAEG;AAEH,eAAe,CAAC,MAAc,EAAE,IAAI,EAAE,EAAE;IACtC,kCAAkC;IAClC,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,GAAG,EAAE;QACrB,oCAAoC;QACpC,MAAM,MAAM,GAAG,MAAM,CAAC,YAAY,CAAC,SAAS,CAAC,OAAO,EAAE;YACpD,IAAI,EAAE,OAAO;YACb,IAAI,EAAE,KAAK;YACX,UAAU,EAAE,CAAC;oBACX,KAAK,EAAE,YAAY;oBACnB,QAAQ,EAAE,YAAY;oBACtB,IAAI,EAAE,QAAQ;oBACd,OAAO,EAAE,EAAE;oBACX,gBAAgB;oBAChB,OAAO,EAAE;wBACP,EAAE,EAAE,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE;wBACrB,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE;wBAC7B,EAAE,EAAE,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,EAAE;wBACnC,EAAE,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE;wBAC/B,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE;wBAC7B,EAAE,EAAE,EAAE,YAAY,EAAE,KAAK,EAAE,YAAY,EAAE;wBACzC,EAAE,EAAE,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,EAAE;wBACnC,EAAE,EAAE,EAA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AC,KAAK,EAAE,EAAE;YACxC,IAAI,KAAK,IAAI,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,OAAO,EAAE;gBAC1C,gDAAgD;gBAChD,+BAA+B;gBAC/B,UAAU,GAAG,IAAI,CAAA;aAClB;iBAAM;gBACL,UAAU,GAAG,KAAK,CAAA;gBAClB,MAAM,CAAC,GAAG,CAAC,SAAS,EAAE,KAAK,CAAC,CAAA;aAC7B;QACH,CAAC,CAAC,CAAA;QACF,oDAAoD;QACpD,MAAM,CAAC,EAAE,CAAC,gBAAgB,EAAE,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE;YAC1C,IAAG,MAAM,CAAC,GAAG,CAAC,SAAS,CAAC,KAAK,UAAU;gBAAE,MAAM,CAAC,GAAG,CAAC,SAAS,EAAE,UAAU,CAAC,CAAA;QAC5E,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;AACJ,CAAC,CAAA"}
|
|
@@ -35,6 +35,7 @@ import symbolDialogsPlugin, { cmdPromptAddSymbol } from './symbolDialogs';
|
|
|
35
35
|
import loginDialogPlugin, { cmdLogout } from './LoginDialog';
|
|
36
36
|
import footerPlugin from './footer';
|
|
37
37
|
import breadcrumbsPlugin from './breadcrumbs';
|
|
38
|
+
import imgPlugin from './img';
|
|
38
39
|
import rateLimitPlugin from '@silexlabs/grapesjs-storage-rate-limit';
|
|
39
40
|
import borderPugin from 'grapesjs-style-border';
|
|
40
41
|
import backgroundPlugin from 'grapesjs-style-bg';
|
|
@@ -72,6 +73,7 @@ const plugins = [
|
|
|
72
73
|
{ name: './LoginDialog', value: loginDialogPlugin },
|
|
73
74
|
{ name: '@silexlabs/grapesjs-loading', value: loadingPlugin },
|
|
74
75
|
{ name: './breadcrumbs', value: breadcrumbsPlugin },
|
|
76
|
+
{ name: './img', value: imgPlugin },
|
|
75
77
|
{ name: './footer', value: footerPlugin },
|
|
76
78
|
{ name: '@silexlabs/grapesjs-storage-rate-limit', value: rateLimitPlugin },
|
|
77
79
|
{ name: 'grapesjs-style-border', value: borderPugin },
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/ts/client/grapesjs/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,QAAkC,MAAM,UAAU,CAAA;AACzD,OAAO,UAAU,MAAM,cAAc,CAAA;AAErC;;;GAGG;AAEH,uBAAuB;AACvB,UAAU;AACV,uBAAuB;AACvB,OAAO,iBAAiB,MAAM,uBAAuB,CAAA;AACrD,OAAO,iBAAiB,MAAM,uBAAuB,CAAA;AACrD,OAAO,UAAU,MAAM,uBAAuB,CAAA;AAC9C,OAAO,UAAU,MAAM,sBAAsB,CAAA;AAC7C,OAAO,gBAAgB,MAAM,wCAAwC,CAAA;AACrE,OAAO,aAAa,MAAM,6BAA6B,CAAA;AACvD,OAAO,aAAa,MAAM,6BAA6B,CAAA;AACvD,OAAO,iBAAiB,EAAE,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AAC3E,OAAO,mBAAmB,EAAE,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAA;AACzE,OAAO,iBAAiB,EAAE,EAAsB,SAAS,EAAE,MAAM,eAAe,CAAA;AAChF,OAAO,YAAY,MAAM,UAAU,CAAA;AACnC,OAAO,iBAAiB,MAAM,eAAe,CAAA;AAC7C,OAAO,eAAe,MAAM,wCAAwC,CAAA;AACpE,OAAO,WAAW,MAAM,uBAAuB,CAAA;AAC/C,OAAO,gBAAgB,MAAM,mBAAmB,CAAA;AAEhD,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAC1E,OAAO,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAA;AACvE,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAA;AAChD,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAC5D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C,OAAO,CAAC,MAAM,CAAC,aAAa,CAAC,CAAA;YAC7D,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,aAAa,CAAC,CAAA;YAC7D,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,KAAK,CAAC,cAAc,GAAG,SAAS,CAAA,CAAC,aAAa;YACjG,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,iBAAiB,CAAC,CAAA;YAEnE,MAAM,CAAC,YAAY,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA;YAEhC,8BAA8B;YAC9B,MAAM,CAAC,YAAY,CAAC,WAAW,CAAC,OAAO,EAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,CAAA;YAE7D,2BAA2B;YAC3B,OAAO,CAAC,MAAM,CAAC,CAAA;QACjB,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;AACJ,CAAC;AAED,MAAM,UAAU,SAAS;IACvB,OAAO,MAAM,CAAA;AACf,CAAC"}
|
package/package.json
CHANGED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Silex website builder, free/libre no-code tool for makers.
|
|
3
|
+
* Copyright (c) 2023 lexoyo and Silex Labs foundation
|
|
4
|
+
*
|
|
5
|
+
* This program is free software: you can redistribute it and/or modify
|
|
6
|
+
* it under the terms of the GNU Affero General Public License as published by
|
|
7
|
+
* the Free Software Foundation, either version 3 of the License, or any later version.
|
|
8
|
+
*
|
|
9
|
+
* This program is distributed in the hope that it will be useful,
|
|
10
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
11
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
12
|
+
* GNU Affero General Public License for more details.
|
|
13
|
+
*
|
|
14
|
+
* You should have received a copy of the GNU Affero General Public License
|
|
15
|
+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
import { Editor } from 'grapesjs'
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* @fileoverview This plugin adds CSS properties object-fit and object-position to the image component.
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
export default (editor: Editor, opts) => {
|
|
25
|
+
// Wait for the editor to be ready
|
|
26
|
+
editor.on('load', () => {
|
|
27
|
+
// Add a sector to the style manager
|
|
28
|
+
const sector = editor.StyleManager.addSector('image', {
|
|
29
|
+
name: 'Image',
|
|
30
|
+
open: false,
|
|
31
|
+
properties: [{
|
|
32
|
+
label: 'object-fit',
|
|
33
|
+
property: 'object-fit',
|
|
34
|
+
type: 'select',
|
|
35
|
+
default: '',
|
|
36
|
+
/* @ts-ignore */
|
|
37
|
+
options: [
|
|
38
|
+
{ id: '', label: '' },
|
|
39
|
+
{ id: 'fill', label: 'fill' },
|
|
40
|
+
{ id: 'contain', label: 'contain' },
|
|
41
|
+
{ id: 'cover', label: 'cover' },
|
|
42
|
+
{ id: 'none', label: 'none' },
|
|
43
|
+
{ id: 'scale-down', label: 'scale-down' },
|
|
44
|
+
{ id: 'initial', label: 'initial' },
|
|
45
|
+
{ id: 'inherit', label: 'inherit' },
|
|
46
|
+
{ id: 'auto', label: 'auto' },
|
|
47
|
+
],
|
|
48
|
+
}, {
|
|
49
|
+
label: 'object-position',
|
|
50
|
+
property: 'object-position',
|
|
51
|
+
type: 'select',
|
|
52
|
+
default: '',
|
|
53
|
+
/* @ts-ignore */
|
|
54
|
+
options: [
|
|
55
|
+
{ id: '', label: '' },
|
|
56
|
+
{ id: 'left top', label: 'left top' },
|
|
57
|
+
{ id: 'left center', label: 'left center' },
|
|
58
|
+
{ id: 'left bottom', label: 'left bottom' },
|
|
59
|
+
{ id: 'right top', label: 'right top' },
|
|
60
|
+
{ id: 'right center', label: 'right center' },
|
|
61
|
+
{ id: 'right bottom', label: 'right bottom' },
|
|
62
|
+
{ id: 'center top', label: 'center top' },
|
|
63
|
+
{ id: 'center center', label: 'center center' },
|
|
64
|
+
{ id: 'center bottom', label: 'center bottom' },
|
|
65
|
+
{ id: 'initial', label: 'initial' },
|
|
66
|
+
{ id: 'inherit', label: 'inherit' },
|
|
67
|
+
{ id: 'unset', label: 'unset' },
|
|
68
|
+
],
|
|
69
|
+
}],
|
|
70
|
+
}, {
|
|
71
|
+
at: 1,
|
|
72
|
+
})
|
|
73
|
+
let showSector = false
|
|
74
|
+
// It shows up when the selection is an image
|
|
75
|
+
editor.on('component:selected', (model) => {
|
|
76
|
+
if (model && model.get('type') === 'image') {
|
|
77
|
+
// Not necessary, grapesjs does it automatically
|
|
78
|
+
// sector.set('visible', true);
|
|
79
|
+
showSector = true
|
|
80
|
+
} else {
|
|
81
|
+
showSector = false
|
|
82
|
+
sector.set('visible', false)
|
|
83
|
+
}
|
|
84
|
+
})
|
|
85
|
+
// Watch automatic changes and revert them if needed
|
|
86
|
+
sector.on('change:visible', (model, open) => {
|
|
87
|
+
if(sector.get('visible') !== showSector) sector.set('visible', showSector)
|
|
88
|
+
})
|
|
89
|
+
})
|
|
90
|
+
}
|
|
@@ -38,6 +38,7 @@ import symbolDialogsPlugin, { cmdPromptAddSymbol } from './symbolDialogs'
|
|
|
38
38
|
import loginDialogPlugin, { LoginDialogOptions, cmdLogout } from './LoginDialog'
|
|
39
39
|
import footerPlugin from './footer'
|
|
40
40
|
import breadcrumbsPlugin from './breadcrumbs'
|
|
41
|
+
import imgPlugin from './img'
|
|
41
42
|
import rateLimitPlugin from '@silexlabs/grapesjs-storage-rate-limit'
|
|
42
43
|
import borderPugin from 'grapesjs-style-border'
|
|
43
44
|
import backgroundPlugin from 'grapesjs-style-bg'
|
|
@@ -78,6 +79,7 @@ const plugins = [
|
|
|
78
79
|
{name: './LoginDialog', value: loginDialogPlugin},
|
|
79
80
|
{name: '@silexlabs/grapesjs-loading', value: loadingPlugin},
|
|
80
81
|
{name: './breadcrumbs', value: breadcrumbsPlugin},
|
|
82
|
+
{name: './img', value: imgPlugin},
|
|
81
83
|
{name: './footer', value: footerPlugin},
|
|
82
84
|
{name: '@silexlabs/grapesjs-storage-rate-limit', value: rateLimitPlugin},
|
|
83
85
|
{name: 'grapesjs-style-border', value: borderPugin},
|