Skip to content

Commit 1166650

Browse files
authored
Merge branch 'develop' into fixes/editor-is-a-focus-trap
2 parents 483d703 + e495559 commit 1166650

File tree

14 files changed

+66
-30
lines changed

14 files changed

+66
-30
lines changed

client/modules/IDE/components/Editor/MobileEditor.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export const EditorContainer = styled.div`
99
transform: ${(props) =>
1010
props.expanded ? 'translateX(50%)' : 'translateX(0)'};
1111
12-
> header {
12+
> div {
1313
display: flex;
1414
${prop('MobilePanel.secondary')}
1515
> span {

client/modules/IDE/components/Editor/index.jsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -517,7 +517,7 @@ class Editor extends React.Component {
517517
{(matches) =>
518518
matches ? (
519519
<section className={editorSectionClass}>
520-
<header className="editor__header">
520+
<div className="editor__header">
521521
<button
522522
aria-label={this.props.t('Editor.OpenSketchARIA')}
523523
className="sidebar__contract"
@@ -542,7 +542,7 @@ class Editor extends React.Component {
542542
</span>
543543
<Timer />
544544
</div>
545-
</header>
545+
</div>
546546
<article
547547
ref={(element) => {
548548
this.codemirrorContainer = element;
@@ -559,7 +559,7 @@ class Editor extends React.Component {
559559
</section>
560560
) : (
561561
<EditorContainer expanded={this.props.isExpanded}>
562-
<header>
562+
<>
563563
<IconButton
564564
onClick={this.props.expandSidebar}
565565
icon={FolderIcon}
@@ -568,7 +568,7 @@ class Editor extends React.Component {
568568
{this.props.file.name}
569569
<UnsavedChangesIndicator />
570570
</span>
571-
</header>
571+
</>
572572
<section>
573573
<EditorHolder
574574
ref={(element) => {

client/modules/IDE/components/Header/Nav.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ const UnauthenticatedUserMenu = () => {
270270
</span>
271271
</Link>
272272
</li>
273-
<span className="nav__item-or">{t('Nav.LoginOr')}</span>
273+
<li className="nav__item-or">{t('Nav.LoginOr')}</li>
274274
<li className="nav__item">
275275
<Link to="/signup" className="nav__auth-button">
276276
<span className="nav__item-header" title="SignUp">

client/modules/IDE/components/Header/index.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@ const Header = (props) => {
1212
const isMobile = useIsMobile();
1313

1414
return (
15-
<header>
15+
<>
1616
<Nav />
1717
{!isMobile && (
1818
<Toolbar syncFileContent={props.syncFileContent} key={project.id} />
1919
)}
20-
</header>
20+
</>
2121
);
2222
};
2323

client/modules/IDE/hooks/useSketchActions.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ const useSketchActions = () => {
1616
const unsavedChanges = useSelector((state) => state.ide.unsavedChanges);
1717
const authenticated = useSelector((state) => state.user.authenticated);
1818
const project = useSelector((state) => state.project);
19+
const user = useSelector((state) => state.user);
1920
const canEditProjectName = useSelector(selectCanEditSketch);
2021
const dispatch = useDispatch();
2122
const { t } = useTranslation();
@@ -40,8 +41,10 @@ const useSketchActions = () => {
4041
}
4142

4243
function downloadSketch() {
43-
dispatch(autosaveProject());
44-
exportProjectAsZip(project.id);
44+
if (authenticated && user.id === project.owner.id) {
45+
dispatch(autosaveProject());
46+
exportProjectAsZip(project.id);
47+
}
4548
}
4649

4750
function shareSketch() {

kubernetes_app.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ spec:
6565
selector:
6666
matchLabels:
6767
app: web-editor
68-
replicas: 3
68+
replicas: 4
6969
template:
7070
metadata:
7171
labels:
@@ -99,8 +99,8 @@ metadata:
9999
name: web-editor-node
100100
namespace: production
101101
spec:
102-
maxReplicas: 6
103-
minReplicas: 2
102+
maxReplicas: 9
103+
minReplicas: 3
104104
scaleTargetRef:
105105
apiVersion: extensions/v1beta1
106106
kind: Deployment

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "p5.js-web-editor",
3-
"version": "2.12.11",
3+
"version": "2.12.13",
44
"description": "The web editor for p5.js.",
55
"scripts": {
66
"clean": "rimraf dist",

server/controllers/user.controller.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,16 @@ export async function updateSettings(req, res) {
295295
}
296296
user.username = req.body.username;
297297

298+
if (req.body.newPassword) {
299+
if (user.password === undefined) {
300+
user.password = req.body.newPassword;
301+
saveUser(res, user);
302+
}
303+
if (!req.body.currentPassword) {
304+
res.status(401).json({ error: 'Current password is not provided.' });
305+
return;
306+
}
307+
}
298308
if (req.body.currentPassword) {
299309
const isMatch = await user.comparePassword(req.body.currentPassword);
300310
if (!isMatch) {

server/domain-objects/createDefaultFiles.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ function draw() {
99
export const defaultHTML = `<!DOCTYPE html>
1010
<html lang="en">
1111
<head>
12-
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/1.9.3/p5.js"></script>
13-
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/1.9.3/addons/p5.sound.min.js"></script>
12+
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/1.9.4/p5.js"></script>
13+
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/1.9.4/addons/p5.sound.min.js"></script>
1414
<link rel="stylesheet" type="text/css" href="style.css">
1515
<meta charset="utf-8" />
1616

server/previewServer.js

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,24 @@ const app = new Express();
1515
// This also works if you take out the mongoose connection
1616
// but i have no idea why
1717
const mongoConnectionString = process.env.MONGO_URL;
18+
1819
// Connect to MongoDB
19-
mongoose.Promise = global.Promise;
20-
mongoose.connect(mongoConnectionString, {
21-
useNewUrlParser: true,
22-
useUnifiedTopology: true
23-
});
20+
const connectToMongoDB = async () => {
21+
try {
22+
await mongoose.connect(mongoConnectionString, {
23+
useNewUrlParser: true,
24+
useUnifiedTopology: true,
25+
useCreateIndex: true,
26+
useFindAndModify: false
27+
});
28+
} catch (error) {
29+
console.error('Failed to connect to MongoDB: ', error);
30+
process.exit(1);
31+
}
32+
};
33+
34+
connectToMongoDB();
35+
2436
mongoose.set('useCreateIndex', true);
2537
mongoose.connection.on('error', () => {
2638
console.error(

server/server.js

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -152,11 +152,22 @@ app.use('/', passportRoutes);
152152
require('./config/passport');
153153

154154
// Connect to MongoDB
155-
mongoose.Promise = global.Promise;
156-
mongoose.connect(mongoConnectionString, {
157-
useNewUrlParser: true,
158-
useUnifiedTopology: true
159-
});
155+
const connectToMongoDB = async () => {
156+
try {
157+
await mongoose.connect(mongoConnectionString, {
158+
useNewUrlParser: true,
159+
useUnifiedTopology: true,
160+
useCreateIndex: true,
161+
useFindAndModify: false
162+
});
163+
} catch (error) {
164+
console.error('Failed to connect to MongoDB: ', error);
165+
process.exit(1);
166+
}
167+
};
168+
169+
connectToMongoDB();
170+
160171
mongoose.set('useCreateIndex', true);
161172
mongoose.connection.on('error', () => {
162173
console.error(

translations/locales/hi/translations.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,6 @@
109109
"PrivacyPolicy": "गोपनीयता नीति",
110110
"TermsOfUse": "उपयोग की शर्तें",
111111
"CodeOfConduct": "आचार संहिता"
112-
"WebEditor": "वेब एडिटर"
113112
},
114113
"Toast": {
115114
"OpenedNewSketch": "नया स्केच खोला",

translations/locales/ja/translations.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,8 @@
358358
"Description": "ユーザー登録",
359359
"Or": "もしくは",
360360
"AlreadyHave": "既にアカウントをお持ちですか?",
361-
"Login": "ログイン"
361+
"Login": "ログイン",
362+
"Warning": "アカウント作成をすると、p5.js エディターの <0>利用規約</0> と <1>プライバシー ポリシー</1> に同意したことになります。"
362363
},
363364
"EmailVerificationView": {
364365
"Title": "p5.js ウェブエディター | メールアドレス認証",

0 commit comments

Comments
 (0)