Skip to content

[WIP] #15 Html Editor improvements #17

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
"react-dom": "^18.0.0",
"react-konva": "^18.0.0-0",
"react-redux": "^7.2.6",
"react-resize-detector": "^7.0.0",
"react-router-dom": "^6.2.2",
"react-scripts": "5.0.0",
"react-split": "^2.0.14",
Expand Down
15 changes: 15 additions & 0 deletions src/hooks/useTitle.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import useRouteContextEffect from './useRouteContextEffect';
import produceState from '../utils/produceState';

const useTitle = (title: string) => {
useRouteContextEffect(
(setRouteContentState) => {
produceState(setRouteContentState, (context) => {
context.title = title;
});
},
[title]
);
};

export default useTitle;
12 changes: 2 additions & 10 deletions src/pages/dataUrlViewPage/DataUrlViewPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ import useQuery from '../../hooks/useQuery';
import styles from './DataUrlViewPage.module.scss';
import { Navigate } from 'react-router-dom';
import { routes } from '../../constants/router/routes';
import useRouteContextEffect from '../../hooks/useRouteContextEffect';
import produceState from '../../utils/produceState';
import useTitle from '../../hooks/useTitle';

export interface DataUrlViewPageQueryParams {
data?: string;
Expand All @@ -18,14 +17,7 @@ const DataUrlViewPage: FunctionComponent = () => {
return <Navigate to={routes.dataUrl.path} />;
}

useRouteContextEffect(
(setRouteContentState) => {
produceState(setRouteContentState, (context) => {
context.title = title ?? routes.dataUrlView.title;
});
},
[title]
);
useTitle(title ?? routes.dataUrlView.title);

return (
<div className={styles.container}>
Expand Down
92 changes: 55 additions & 37 deletions src/pages/htmlEditorPage/HtmlEditorPage.module.scss
Original file line number Diff line number Diff line change
@@ -1,14 +1,26 @@
@import '../../styles/main';

.titleExtra {
flex: 1;
display: flex;
flex-direction: row;
justify-content: space-between;
}

.container {
@include monacoBackground;

.containerRow {
height: 100%;
display: flex;
flex-direction: row;
flex: 1;
overflow: hidden;
max-width: 100%;

.col {
@include monacoBackground;

display: flex;
flex-direction: column;

Expand All @@ -17,57 +29,63 @@

&:only-child {
flex: 1;

& > * {
max-width: 100%;
overflow: auto;
}
}
}

.leftCol {
&:not(:only-child) {
border-right: 1px solid;
@include borderColor;
}

.editorTabs {
flex: 1;
display: flex;

& > *:last-child {
display: flex;
}

.editorTab {
flex: 1;
display: flex;

.editor {
flex: 1;
}
}

.tabTitleWrapper {
height: 20px !important;
width: 50px !important;

display: flex;
flex-direction: row;
justify-content: center;
align-items: center;

.tabTitle {
font-size: 28px;
}
}
}
}

.rightCol {
background: white;
.tabTitleWrapper {
.tabTitle {
font-size: 24px;
}
}
}

.resultFrame {
flex: 1;
border: none;
max-width: 100%;
overflow: auto;
background: white;
}
}
}

.editorTabs {
flex: 1;
display: flex;

& > *:last-child {
display: flex;
}

.editorTab {
flex: 1;
display: flex;

.editor {
flex: 1;
}
}

.tabTitleWrapper {
height: 20px !important;
width: 50px !important;

display: flex;
flex-direction: row;
justify-content: center;
align-items: center;

.tabTitle {
font-size: 28px;
}
}
}
5 changes: 5 additions & 0 deletions src/pages/htmlEditorPage/HtmlEditorPage.scss
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,9 @@
.gutter.gutter-horizontal {
background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAeCAYAAADkftS9AAAAIklEQVQoU2M4c+bMfxAGAgYYmwGrIIiDjrELjpo5aiZeMwF+yNnOs5KSvgAAAABJRU5ErkJggg==');
cursor: col-resize;
z-index: 1;

border-right: 1px solid;
border-left: 1px solid;
@include borderColor;
}
Loading