Page Menu
Home
Sealhub
Search
Configure Global Search
Log In
Files
F22393754
body-page-editor.jsx
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Authored By
Unknown
Size
1 KB
Referenced Files
None
Subscribers
None
body-page-editor.jsx
View Options
import
React
,
{
Component
}
from
'react'
;
import
List
from
'./list'
;
import
Preview
from
'./preview'
;
import
components_map
from
'../../components/components.map'
;
export
default
class
BodyPageEditor
extends
Component
{
constructor
(
props
)
{
super
(
props
);
this
.
state
=
{
createdComponents
:
[],
renderedHtml
:
''
,
};
this
.
handleChange
=
this
.
handleChange
.
bind
(
this
);
}
componentDidMount
()
{
console
.
log
(
components_map
.
Markdown
(
'# Test'
));
}
handleChange
(
event
)
{
this
.
setState
({
value
:
event
.
target
.
value
});
}
async
renderPreview
()
{
let
html
=
''
;
for
(
const
segment
of
this
.
state
.
createdComponents
)
{
// TO DO: push data from segment element to function html.js
html
+=
await
segment
();
}
return
html
;
}
render
()
{
return
(
<
React
.
Fragment
>
<
h2
>
Body
Page
Editor
<
/h2>
<
div
style
=
{{
display
:
'flex'
,
flexFlow
:
'row'
}}
>
<
List
createdComponents
=
{
this
.
state
.
createdComponents
}
/>
<
Preview
renderedHtml
=
{
this
.
state
.
renderedHtml
}
/>
<
/div>
<
label
htmlFor
=
"select-component"
>
Select
a
component
:
<
/label>
<
select
id
=
"select-component"
onChange
=
{
this
.
handleChange
}
>
<
option
value
=
""
>--
Please
choose
an
option
--<
/option>
{
Object
.
keys
(
components_map
).
map
(
component
=>
{
return
(
<
option
key
=
{
component
}
value
=
{
component
}
>
{
component
}
<
/option>
);
})}
<
/select>
<
/React.Fragment>
);
}
}
File Metadata
Details
Attached
Mime Type
application/javascript
Expires
Fri, Nov 27, 16:09 (1 d, 16 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1223594
Default Alt Text
body-page-editor.jsx (1 KB)
Attached To
Mode
rSEALPAGE Sealpage
Attached
Detach File
Event Timeline