Skip to content

Commit

Permalink
Deploying to gh-pages from @ 3cdabf1 🚀
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremywiebe committed Dec 3, 2024
1 parent 11e5e3d commit a4a8f18
Show file tree
Hide file tree
Showing 56 changed files with 2,783 additions and 2,776 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 r}from"./jsx-runtime-63Ea5SlK.js";import"./article-renderer-h_m-tvVP.js";import{_ as p}from"./jquery-yG1GhClm.js";import"./util-AYeX86gl.js";import"./phet-simulation-_7qOO4_B.js";import"./version-akiLXZts.js";import{P as d,E as y}from"./perseus-error-l3K_anoI.js";import"./dependencies-CP7Uh8Kq.js";import{A as m}from"./perseus-api-1-ethIrW.js";import"./perseus-item-334dAsMX.js";import"./hints-renderer-Ebeftjch.js";import"./renderer-yXFj-6ty.js";import"./base-radio-XsQBfrsT.js";import{c}from"./components-2XngBvY8.js";import{i as b}from"./icon-paths-5JCXzGsq.js";import"./index-k-0mNqHS.js";import"./i18n-context-fsWEgybQ.js";import"./svg-image-FcZanvM1.js";import"./index-smZ6iCr_.js";import{r as v}from"./index-6oxdNXpR.js";import{D as w}from"./device-framer-MUDr0WgQ.js";import{I as f,J as k}from"./register-all-widgets-and-editors-for-testing-4tsEoT6X.js";import{S as i}from"./section-control-button-Hi-3GzxK.js";import{E as q}from"./editor-JBlHUPac.js";import{i as h,a as R,b as T}from"./icon-paths-EoBkHOLI.js";const{HUD:A,InlineIcon:j}=c,l=class l extends v.Component{constructor(){super(...arguments),this.state={highlightLint:!0},this._handleJsonChange=t=>{this.props.onChange({json:t})},this._handleEditorChange=(t,e)=>{const n=[...this._sections()];n[t]={...n[t],...e},this.props.onChange({json:n})}}componentDidMount(){this._updatePreviewFrames()}componentDidUpdate(){this._updatePreviewFrames()}_updatePreviewFrames(){this.props.mode==="preview"?this.refs["frame-all"].sendNewData({type:"article-all",data:this._sections().map((t,e)=>this._apiOptionsForSection(t,e))}):this.props.mode==="edit"&&this._sections().forEach((t,e)=>{this.refs["frame-"+e].sendNewData({type:"article",data:this._apiOptionsForSection(t,e)})})}_apiOptionsForSection(t,e){const n=this.refs[`editor${e}`];return{apiOptions:{...m.defaults,...this.props.apiOptions,showAlignmentOptions:!0,isArticle:!0},json:t,useNewStyles:this.props.useNewStyles,linterContext:{contentType:"article",highlightLint:this.state.highlightLint,paths:this.props.contentPaths},legacyPerseusLint:n?n.getSaveWarnings():[]}}_sections(){return Array.isArray(this.props.json)?this.props.json:[this.props.json]}_renderEditor(){const{imageUploader:t,sectionImageUploadGenerator:e}=this.props,n={...m.defaults,...this.props.apiOptions,showAlignmentOptions:!0,isArticle:!0},u=this._sections();return r.jsxs("div",{className:"perseus-editor-table",children:[u.map((g,a)=>[r.jsxs("div",{className:"perseus-editor-row",children:[r.jsxs("div",{className:"perseus-editor-left-cell",children:[r.jsxs("div",{className:"pod-title",children:["Section ",a+1,r.jsxs("div",{style:{display:"inline-block",float:"right"},children:[e(a),r.jsx(i,{icon:h,onClick:()=>{this._handleAddSectionAfter(a)},title:"Add a new section after this one"}),a+1<u.length&&r.jsx(i,{icon:R,onClick:()=>{this._handleMoveSectionLater(a)},title:"Move this section down"}),a>0&&r.jsx(i,{icon:T,onClick:()=>{this._handleMoveSectionEarlier(a)},title:"Move this section up"}),r.jsx(i,{icon:b,onClick:()=>{const s="Are you sure you want to delete section "+(a+1)+"?";confirm(s)&&this._handleRemoveSection(a)},title:"Delete this section"})]})]}),r.jsx(q,{...g,apiOptions:n,imageUploader:t,onChange:s=>this._handleEditorChange(a,s),placeholder:"Type your section text here...",ref:"editor"+a})]}),r.jsx("div",{className:"editor-preview",children:this._renderIframePreview(a,!0)})]},a)]),this._renderAddSection(),this._renderLinterHUD()]})}_renderAddSection(){return r.jsx("div",{className:"perseus-editor-row",children:r.jsx("div",{className:"perseus-editor-left-cell",children:r.jsxs("a",{href:"#",className:"simple-button orange",onClick:()=>{this._handleAddSectionAfter(this._sections().length-1)},children:[r.jsx(j,{...h})," Add a section"]})})})}_renderLinterHUD(){return r.jsx(A,{message:"Style warnings",enabled:this.state.highlightLint,onClick:()=>{this.setState({highlightLint:!this.state.highlightLint})}})}_renderIframePreview(t,e){const n=this.props.screen==="phone"||this.props.screen==="tablet";return r.jsx(w,{deviceType:this.props.screen,nochrome:e,children:r.jsx(f,{ref:"frame-"+t,datasetKey:"mobile",datasetValue:n,seamless:e,url:this.props.previewURL},this.props.screen)})}_renderPreviewMode(){return r.jsx("div",{className:"standalone-preview",children:this._renderIframePreview("all",!1)})}_handleMoveSectionEarlier(t){if(t===0)return;const e=[...this._sections()],n=e[t];e.splice(t,1),e.splice(t-1,0,n),this.props.onChange({json:e})}_handleMoveSectionLater(t){const e=[...this._sections()];if(t+1===e.length)return;const n=e[t];e.splice(t,1),e.splice(t+1,0,n),this.props.onChange({json:e})}_handleAddSectionAfter(t){const e=p.clone(this.serialize()),n=t>=0?{widgets:e[t].widgets}:{};e.splice(t+1,0,n),this.props.onChange({json:e})}_handleRemoveSection(t){const e=[...this._sections()];e.splice(t,1),this.props.onChange({json:e})}serialize(){if(this.props.mode==="edit")return this._sections().map((t,e)=>this.refs["editor"+e].serialize());if(this.props.mode==="preview"||this.props.mode==="json")return this.props.json;throw new d("Could not serialize; mode "+this.props.mode+" not found",y.Internal)}getSaveWarnings(){if(this.props.mode!=="edit")throw new d("Can only get save warnings in edit mode.",y.NotAllowed);return this._sections().map((t,e)=>this.refs["editor"+e].getSaveWarnings())}render(){return r.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"&&r.jsxs("div",{className:"json-editor",children:[r.jsx("div",{className:"json-editor-warning",children:r.jsx("span",{children:"Warning: Editing in this mode can lead to broken articles!"})}),r.jsx(k,{multiLine:!0,onChange:this._handleJsonChange,value:this.props.json})]})]})}};l.defaultProps={contentPaths:[],json:[{}],mode:"edit",screen:"desktop",sectionImageUploadGenerator:()=>r.jsx("span",{}),useNewStyles:!1};let o=l;o.__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 r}from"./jsx-runtime-63Ea5SlK.js";import"./article-renderer-h_m-tvVP.js";import{_ as p}from"./jquery-yG1GhClm.js";import"./util-AYeX86gl.js";import"./phet-simulation-_7qOO4_B.js";import"./version-akiLXZts.js";import{P as d,E as y}from"./perseus-error-l3K_anoI.js";import"./dependencies-CP7Uh8Kq.js";import{A as m}from"./perseus-api-1-ethIrW.js";import"./perseus-item-334dAsMX.js";import"./hints-renderer-Ebeftjch.js";import"./renderer-yXFj-6ty.js";import"./base-radio-XsQBfrsT.js";import{c}from"./components-2XngBvY8.js";import{i as b}from"./icon-paths-5JCXzGsq.js";import"./index-k-0mNqHS.js";import"./i18n-context-fsWEgybQ.js";import"./svg-image-FcZanvM1.js";import"./index-smZ6iCr_.js";import{r as v}from"./index-6oxdNXpR.js";import{D as w}from"./device-framer-MUDr0WgQ.js";import{I as f,J as k}from"./register-all-widgets-and-editors-for-testing-QKLCyv1G.js";import{S as i}from"./section-control-button-Hi-3GzxK.js";import{E as q}from"./editor-JBlHUPac.js";import{i as h,a as R,b as T}from"./icon-paths-EoBkHOLI.js";const{HUD:A,InlineIcon:j}=c,l=class l extends v.Component{constructor(){super(...arguments),this.state={highlightLint:!0},this._handleJsonChange=t=>{this.props.onChange({json:t})},this._handleEditorChange=(t,e)=>{const n=[...this._sections()];n[t]={...n[t],...e},this.props.onChange({json:n})}}componentDidMount(){this._updatePreviewFrames()}componentDidUpdate(){this._updatePreviewFrames()}_updatePreviewFrames(){this.props.mode==="preview"?this.refs["frame-all"].sendNewData({type:"article-all",data:this._sections().map((t,e)=>this._apiOptionsForSection(t,e))}):this.props.mode==="edit"&&this._sections().forEach((t,e)=>{this.refs["frame-"+e].sendNewData({type:"article",data:this._apiOptionsForSection(t,e)})})}_apiOptionsForSection(t,e){const n=this.refs[`editor${e}`];return{apiOptions:{...m.defaults,...this.props.apiOptions,showAlignmentOptions:!0,isArticle:!0},json:t,useNewStyles:this.props.useNewStyles,linterContext:{contentType:"article",highlightLint:this.state.highlightLint,paths:this.props.contentPaths},legacyPerseusLint:n?n.getSaveWarnings():[]}}_sections(){return Array.isArray(this.props.json)?this.props.json:[this.props.json]}_renderEditor(){const{imageUploader:t,sectionImageUploadGenerator:e}=this.props,n={...m.defaults,...this.props.apiOptions,showAlignmentOptions:!0,isArticle:!0},u=this._sections();return r.jsxs("div",{className:"perseus-editor-table",children:[u.map((g,a)=>[r.jsxs("div",{className:"perseus-editor-row",children:[r.jsxs("div",{className:"perseus-editor-left-cell",children:[r.jsxs("div",{className:"pod-title",children:["Section ",a+1,r.jsxs("div",{style:{display:"inline-block",float:"right"},children:[e(a),r.jsx(i,{icon:h,onClick:()=>{this._handleAddSectionAfter(a)},title:"Add a new section after this one"}),a+1<u.length&&r.jsx(i,{icon:R,onClick:()=>{this._handleMoveSectionLater(a)},title:"Move this section down"}),a>0&&r.jsx(i,{icon:T,onClick:()=>{this._handleMoveSectionEarlier(a)},title:"Move this section up"}),r.jsx(i,{icon:b,onClick:()=>{const s="Are you sure you want to delete section "+(a+1)+"?";confirm(s)&&this._handleRemoveSection(a)},title:"Delete this section"})]})]}),r.jsx(q,{...g,apiOptions:n,imageUploader:t,onChange:s=>this._handleEditorChange(a,s),placeholder:"Type your section text here...",ref:"editor"+a})]}),r.jsx("div",{className:"editor-preview",children:this._renderIframePreview(a,!0)})]},a)]),this._renderAddSection(),this._renderLinterHUD()]})}_renderAddSection(){return r.jsx("div",{className:"perseus-editor-row",children:r.jsx("div",{className:"perseus-editor-left-cell",children:r.jsxs("a",{href:"#",className:"simple-button orange",onClick:()=>{this._handleAddSectionAfter(this._sections().length-1)},children:[r.jsx(j,{...h})," Add a section"]})})})}_renderLinterHUD(){return r.jsx(A,{message:"Style warnings",enabled:this.state.highlightLint,onClick:()=>{this.setState({highlightLint:!this.state.highlightLint})}})}_renderIframePreview(t,e){const n=this.props.screen==="phone"||this.props.screen==="tablet";return r.jsx(w,{deviceType:this.props.screen,nochrome:e,children:r.jsx(f,{ref:"frame-"+t,datasetKey:"mobile",datasetValue:n,seamless:e,url:this.props.previewURL},this.props.screen)})}_renderPreviewMode(){return r.jsx("div",{className:"standalone-preview",children:this._renderIframePreview("all",!1)})}_handleMoveSectionEarlier(t){if(t===0)return;const e=[...this._sections()],n=e[t];e.splice(t,1),e.splice(t-1,0,n),this.props.onChange({json:e})}_handleMoveSectionLater(t){const e=[...this._sections()];if(t+1===e.length)return;const n=e[t];e.splice(t,1),e.splice(t+1,0,n),this.props.onChange({json:e})}_handleAddSectionAfter(t){const e=p.clone(this.serialize()),n=t>=0?{widgets:e[t].widgets}:{};e.splice(t+1,0,n),this.props.onChange({json:e})}_handleRemoveSection(t){const e=[...this._sections()];e.splice(t,1),this.props.onChange({json:e})}serialize(){if(this.props.mode==="edit")return this._sections().map((t,e)=>this.refs["editor"+e].serialize());if(this.props.mode==="preview"||this.props.mode==="json")return this.props.json;throw new d("Could not serialize; mode "+this.props.mode+" not found",y.Internal)}getSaveWarnings(){if(this.props.mode!=="edit")throw new d("Can only get save warnings in edit mode.",y.NotAllowed);return this._sections().map((t,e)=>this.refs["editor"+e].getSaveWarnings())}render(){return r.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"&&r.jsxs("div",{className:"json-editor",children:[r.jsx("div",{className:"json-editor-warning",children:r.jsx("span",{children:"Warning: Editing in this mode can lead to broken articles!"})}),r.jsx(k,{multiLine:!0,onChange:this._handleJsonChange,value:this.props.json})]})]})}};l.defaultProps={contentPaths:[],json:[{}],mode:"edit",screen:"desktop",sectionImageUploadGenerator:()=>r.jsx("span",{}),useNewStyles:!1};let o=l;o.__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 a4a8f18

Please sign in to comment.