Skip to content

Commit

Permalink
Deploying to gh-pages from @ af8f5d3 🚀
Browse files Browse the repository at this point in the history
  • Loading branch information
handeyeco committed Jan 30, 2025
1 parent ed684d5 commit bf829a7
Show file tree
Hide file tree
Showing 20 changed files with 2,038 additions and 2,011 deletions.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import{j as t}from"./jsx-runtime-63Ea5SlK.js";import"./article-renderer-u63A9T1f.js";import{_ as g}from"./index-default-4_ZsnO94.js";import"./index-VBBZE5E5.js";import{P as c,E as u}from"./perseus-error-l3K_anoI.js";import"./util-Deofanvy.js";import"./jquery-5v7aFUvu.js";import"./phet-simulation-VzxNL4J6.js";import"./dependencies-CP7Uh8Kq.js";import{A as p}from"./perseus-api-_PWPZoDE.js";import"./server-item-renderer-cMyR_prU.js";import"./hints-renderer-938D-MIy.js";import"./renderer-BI1FyBLz.js";import"./base-radio-9naw8cnM.js";import{c as y}from"./components-Kytl9QRM.js";import{i as f}from"./icon-paths-5JCXzGsq.js";import"./i18n-context-YAdgKrxn.js";import"./svg-image-Ah59ySlS.js";import"./index-smZ6iCr_.js";import{r as w}from"./index-6oxdNXpR.js";import{D as b}from"./device-framer-MUDr0WgQ.js";import{I as v,J as k}from"./register-all-widgets-and-editors-for-testing-hnqPHKU-.js";import{S as i}from"./section-control-button-jnqUpuD1.js";import{E as R}from"./editor-NLRcq_Ae.js";import{i as m,a as P,b as T}from"./icon-paths-naSxOxXw.js";const{HUD:A,InlineIcon:x}=y,l=class l extends w.Component{constructor(){super(...arguments),this.state={highlightLint:!0},this._handleJsonChange=n=>{this.props.onChange({json:n})},this._handleEditorChange=(n,e)=>{const a=[...this._sections()];a[n]={...a[n],...e},this.props.onChange({json:a})}}componentDidMount(){this._updatePreviewFrames()}componentDidUpdate(){this._updatePreviewFrames()}_updatePreviewFrames(){this.props.mode==="preview"?this.refs["frame-all"].sendNewData({type:"article-all",data:this._sections().map((n,e)=>this._apiOptionsForSection(n,e))}):this.props.mode==="edit"&&this._sections().forEach((n,e)=>{this.refs["frame-"+e].sendNewData({type:"article",data:this._apiOptionsForSection(n,e)})})}_apiOptionsForSection(n,e){const a=this.refs[`editor${e}`];return{apiOptions:{...p.defaults,...this.props.apiOptions,showAlignmentOptions:!0,isArticle:!0},json:n,useNewStyles:this.props.useNewStyles,linterContext:{contentType:"article",highlightLint:this.state.highlightLint,paths:this.props.contentPaths},legacyPerseusLint:a?a.getSaveWarnings():[]}}_sections(){return Array.isArray(this.props.json)?this.props.json:[this.props.json]}_renderEditor(){const{imageUploader:n,sectionImageUploadGenerator:e}=this.props,a={...p.defaults,...this.props.apiOptions,showAlignmentOptions:!0,isArticle:!0},d=this._sections();return t.jsxs("div",{className:"perseus-editor-table",children:[d.map((h,r)=>[t.jsxs("div",{className:"perseus-editor-row",children:[t.jsxs("div",{className:"perseus-editor-left-cell",children:[t.jsxs("div",{className:"pod-title",children:["Section ",r+1,t.jsxs("div",{style:{display:"inline-block",float:"right"},children:[e(r),t.jsx(i,{icon:m,onClick:()=>{this._handleAddSectionAfter(r)},title:"Add a new section after this one"}),r+1<d.length&&t.jsx(i,{icon:P,onClick:()=>{this._handleMoveSectionLater(r)},title:"Move this section down"}),r>0&&t.jsx(i,{icon:T,onClick:()=>{this._handleMoveSectionEarlier(r)},title:"Move this section up"}),t.jsx(i,{icon:f,onClick:()=>{const o="Are you sure you want to delete section "+(r+1)+"?";confirm(o)&&this._handleRemoveSection(r)},title:"Delete this section"})]})]}),t.jsx(R,{...h,apiOptions:a,imageUploader:n,onChange:o=>this._handleEditorChange(r,o),placeholder:"Type your section text here...",ref:"editor"+r})]}),t.jsx("div",{className:"editor-preview",children:this._renderIframePreview(r,!0)})]},r)]),this._renderAddSection(),this._renderLinterHUD()]})}_renderAddSection(){return t.jsx("div",{className:"perseus-editor-row",children:t.jsx("div",{className:"perseus-editor-left-cell",children:t.jsxs("a",{href:"#",className:"simple-button orange",onClick:()=>{this._handleAddSectionAfter(this._sections().length-1)},children:[t.jsx(x,{...m})," Add a section"]})})})}_renderLinterHUD(){return t.jsx(A,{message:"Style warnings",enabled:this.state.highlightLint,onClick:()=>{this.setState({highlightLint:!this.state.highlightLint})}})}_renderIframePreview(n,e){const a=this.props.screen==="phone"||this.props.screen==="tablet";return t.jsx(b,{deviceType:this.props.screen,nochrome:e,children:t.jsx(v,{ref:"frame-"+n,datasetKey:"mobile",datasetValue:a,seamless:e,url:this.props.previewURL},this.props.screen)})}_renderPreviewMode(){return t.jsx("div",{className:"standalone-preview",children:this._renderIframePreview("all",!1)})}_handleMoveSectionEarlier(n){if(n===0)return;const e=[...this._sections()],a=e[n];e.splice(n,1),e.splice(n-1,0,a),this.props.onChange({json:e})}_handleMoveSectionLater(n){const e=[...this._sections()];if(n+1===e.length)return;const a=e[n];e.splice(n,1),e.splice(n+1,0,a),this.props.onChange({json:e})}_handleAddSectionAfter(n){const e=g.clone(this.serialize()),a=n>=0?{widgets:e[n].widgets}:{};e.splice(n+1,0,a),this.props.onChange({json:e})}_handleRemoveSection(n){const e=[...this._sections()];e.splice(n,1),this.props.onChange({json:e})}serialize(){if(this.props.mode==="edit")return this._sections().map((n,e)=>this.refs["editor"+e].serialize());if(this.props.mode==="preview"||this.props.mode==="json")return this.props.json;throw new c("Could not serialize; mode "+this.props.mode+" not found",u.Internal)}getSaveWarnings(){if(this.props.mode!=="edit")throw new c("Can only get save warnings in edit mode.",u.NotAllowed);return this._sections().map((n,e)=>this.refs["editor"+e].getSaveWarnings())}render(){return t.jsxs("div",{className:"framework-perseus perseus-article-editor",children:[this.props.mode==="edit"&&this._renderEditor(),this.props.mode==="preview"&&this._renderPreviewMode(),this.props.mode==="json"&&t.jsxs("div",{className:"json-editor",children:[t.jsx("div",{className:"json-editor-warning",children:t.jsx("span",{children:"Warning: Editing in this mode can lead to broken articles!"})}),t.jsx(k,{multiLine:!0,onChange:this._handleJsonChange,value:this.props.json})]})]})}};l.defaultProps={contentPaths:[],json:[{}],mode:"edit",screen:"desktop",sectionImageUploadGenerator:()=>t.jsx("span",{}),useNewStyles:!1};let s=l;s.__docgenInfo={description:"",methods:[{name:"_updatePreviewFrames",docblock:null,modifiers:[],params:[],returns:null},{name:"_apiOptionsForSection",docblock:null,modifiers:[],params:[{name:"section",optional:!1,type:{name:"signature",type:"object",raw:`{
import{j as t}from"./jsx-runtime-63Ea5SlK.js";import"./article-renderer-u63A9T1f.js";import{_ as g}from"./index-default-4_ZsnO94.js";import"./index-VBBZE5E5.js";import{P as c,E as u}from"./perseus-error-l3K_anoI.js";import"./util-Deofanvy.js";import"./jquery-5v7aFUvu.js";import"./phet-simulation-VzxNL4J6.js";import"./dependencies-CP7Uh8Kq.js";import{A as p}from"./perseus-api-_PWPZoDE.js";import"./server-item-renderer-cMyR_prU.js";import"./hints-renderer-938D-MIy.js";import"./renderer-BI1FyBLz.js";import"./base-radio-9naw8cnM.js";import{c as y}from"./components-Kytl9QRM.js";import{i as f}from"./icon-paths-5JCXzGsq.js";import"./i18n-context-YAdgKrxn.js";import"./svg-image-Ah59ySlS.js";import"./index-smZ6iCr_.js";import{r as w}from"./index-6oxdNXpR.js";import{D as b}from"./device-framer-MUDr0WgQ.js";import{I as v,J as k}from"./register-all-widgets-and-editors-for-testing-djh_0b57.js";import{S as i}from"./section-control-button-jnqUpuD1.js";import{E as R}from"./editor-NLRcq_Ae.js";import{i as m,a as P,b as T}from"./icon-paths-naSxOxXw.js";const{HUD:A,InlineIcon:x}=y,l=class l extends w.Component{constructor(){super(...arguments),this.state={highlightLint:!0},this._handleJsonChange=n=>{this.props.onChange({json:n})},this._handleEditorChange=(n,e)=>{const a=[...this._sections()];a[n]={...a[n],...e},this.props.onChange({json:a})}}componentDidMount(){this._updatePreviewFrames()}componentDidUpdate(){this._updatePreviewFrames()}_updatePreviewFrames(){this.props.mode==="preview"?this.refs["frame-all"].sendNewData({type:"article-all",data:this._sections().map((n,e)=>this._apiOptionsForSection(n,e))}):this.props.mode==="edit"&&this._sections().forEach((n,e)=>{this.refs["frame-"+e].sendNewData({type:"article",data:this._apiOptionsForSection(n,e)})})}_apiOptionsForSection(n,e){const a=this.refs[`editor${e}`];return{apiOptions:{...p.defaults,...this.props.apiOptions,showAlignmentOptions:!0,isArticle:!0},json:n,useNewStyles:this.props.useNewStyles,linterContext:{contentType:"article",highlightLint:this.state.highlightLint,paths:this.props.contentPaths},legacyPerseusLint:a?a.getSaveWarnings():[]}}_sections(){return Array.isArray(this.props.json)?this.props.json:[this.props.json]}_renderEditor(){const{imageUploader:n,sectionImageUploadGenerator:e}=this.props,a={...p.defaults,...this.props.apiOptions,showAlignmentOptions:!0,isArticle:!0},d=this._sections();return t.jsxs("div",{className:"perseus-editor-table",children:[d.map((h,r)=>[t.jsxs("div",{className:"perseus-editor-row",children:[t.jsxs("div",{className:"perseus-editor-left-cell",children:[t.jsxs("div",{className:"pod-title",children:["Section ",r+1,t.jsxs("div",{style:{display:"inline-block",float:"right"},children:[e(r),t.jsx(i,{icon:m,onClick:()=>{this._handleAddSectionAfter(r)},title:"Add a new section after this one"}),r+1<d.length&&t.jsx(i,{icon:P,onClick:()=>{this._handleMoveSectionLater(r)},title:"Move this section down"}),r>0&&t.jsx(i,{icon:T,onClick:()=>{this._handleMoveSectionEarlier(r)},title:"Move this section up"}),t.jsx(i,{icon:f,onClick:()=>{const o="Are you sure you want to delete section "+(r+1)+"?";confirm(o)&&this._handleRemoveSection(r)},title:"Delete this section"})]})]}),t.jsx(R,{...h,apiOptions:a,imageUploader:n,onChange:o=>this._handleEditorChange(r,o),placeholder:"Type your section text here...",ref:"editor"+r})]}),t.jsx("div",{className:"editor-preview",children:this._renderIframePreview(r,!0)})]},r)]),this._renderAddSection(),this._renderLinterHUD()]})}_renderAddSection(){return t.jsx("div",{className:"perseus-editor-row",children:t.jsx("div",{className:"perseus-editor-left-cell",children:t.jsxs("a",{href:"#",className:"simple-button orange",onClick:()=>{this._handleAddSectionAfter(this._sections().length-1)},children:[t.jsx(x,{...m})," Add a section"]})})})}_renderLinterHUD(){return t.jsx(A,{message:"Style warnings",enabled:this.state.highlightLint,onClick:()=>{this.setState({highlightLint:!this.state.highlightLint})}})}_renderIframePreview(n,e){const a=this.props.screen==="phone"||this.props.screen==="tablet";return t.jsx(b,{deviceType:this.props.screen,nochrome:e,children:t.jsx(v,{ref:"frame-"+n,datasetKey:"mobile",datasetValue:a,seamless:e,url:this.props.previewURL},this.props.screen)})}_renderPreviewMode(){return t.jsx("div",{className:"standalone-preview",children:this._renderIframePreview("all",!1)})}_handleMoveSectionEarlier(n){if(n===0)return;const e=[...this._sections()],a=e[n];e.splice(n,1),e.splice(n-1,0,a),this.props.onChange({json:e})}_handleMoveSectionLater(n){const e=[...this._sections()];if(n+1===e.length)return;const a=e[n];e.splice(n,1),e.splice(n+1,0,a),this.props.onChange({json:e})}_handleAddSectionAfter(n){const e=g.clone(this.serialize()),a=n>=0?{widgets:e[n].widgets}:{};e.splice(n+1,0,a),this.props.onChange({json:e})}_handleRemoveSection(n){const e=[...this._sections()];e.splice(n,1),this.props.onChange({json:e})}serialize(){if(this.props.mode==="edit")return this._sections().map((n,e)=>this.refs["editor"+e].serialize());if(this.props.mode==="preview"||this.props.mode==="json")return this.props.json;throw new c("Could not serialize; mode "+this.props.mode+" not found",u.Internal)}getSaveWarnings(){if(this.props.mode!=="edit")throw new c("Can only get save warnings in edit mode.",u.NotAllowed);return this._sections().map((n,e)=>this.refs["editor"+e].getSaveWarnings())}render(){return t.jsxs("div",{className:"framework-perseus perseus-article-editor",children:[this.props.mode==="edit"&&this._renderEditor(),this.props.mode==="preview"&&this._renderPreviewMode(),this.props.mode==="json"&&t.jsxs("div",{className:"json-editor",children:[t.jsx("div",{className:"json-editor-warning",children:t.jsx("span",{children:"Warning: Editing in this mode can lead to broken articles!"})}),t.jsx(k,{multiLine:!0,onChange:this._handleJsonChange,value:this.props.json})]})]})}};l.defaultProps={contentPaths:[],json:[{}],mode:"edit",screen:"desktop",sectionImageUploadGenerator:()=>t.jsx("span",{}),useNewStyles:!1};let s=l;s.__docgenInfo={description:"",methods:[{name:"_updatePreviewFrames",docblock:null,modifiers:[],params:[],returns:null},{name:"_apiOptionsForSection",docblock:null,modifiers:[],params:[{name:"section",optional:!1,type:{name:"signature",type:"object",raw:`{
content?: string;
widgets?: any;
images?: any;
Expand Down
Loading

0 comments on commit bf829a7

Please sign in to comment.