Skip to content
Closed
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
16 changes: 16 additions & 0 deletions src/lib/define-dynamic-block.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,27 @@ const defineDynamicBlock = (ScratchBlocks, categoryInfo, staticBlockInfo, extend
const arg = blockInfo.arguments[argName];
switch (arg.type) {
case ArgumentType.STRING:
case ArgumentType.NUMBER:
case ArgumentType.ANGLE:
case ArgumentType.MATRIX:
case ArgumentType.NOTE:
case ArgumentType.COLOR:
case ArgumentType.COSTUME:
case ArgumentType.SOUND:
args.push({type: 'input_value', name: argName});
break;
case ArgumentType.BOOLEAN:
args.push({type: 'input_value', name: argName, check: 'Boolean'});
break;
case ArgumentType.IMAGE:
args.push({
type: 'field_image',
src: arg.dataURI || '',
width: 24,
height: 24,
flip_rtl: arg.flipRTL || false
});
break;
}
return `%${++argCount}`;
});
Expand Down
19 changes: 14 additions & 5 deletions src/lib/titled-hoc.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ const TitledHOC = function (WrappedComponent) {
// if project is a new default project, and has loaded,
if (this.props.isShowingWithoutId && prevProps.isAnyCreatingNewState) {
// reset title to default
const defaultProjectTitle = this.handleReceivedProjectTitle();
this.props.onUpdateProjectTitle(defaultProjectTitle, true);
const {title, isDefault} = this.handleReceivedProjectTitle();
this.props.onUpdateProjectTitle(title, isDefault);
}
// if the projectTitle hasn't changed, but the reduxProjectTitle
// HAS changed, we need to report that change to the projectTitle's owner
Expand All @@ -51,11 +51,20 @@ const TitledHOC = function (WrappedComponent) {
let newTitle = requestedTitle;
let isDefault = false;
if (newTitle === null || typeof newTitle === 'undefined') {
newTitle = this.props.intl.formatMessage(messages.defaultProjectTitle);
isDefault = true;
const urlTitle = typeof URLSearchParams !== 'undefined' &&
new URLSearchParams(location.search).get('project_title');
if (urlTitle) {
newTitle = urlTitle;
} else {
newTitle = this.props.intl.formatMessage(messages.defaultProjectTitle);
isDefault = true;
}
}
this.props.onChangedProjectTitle(newTitle, isDefault);
return newTitle;
return {
title: newTitle,
isDefault
};
}
render () {
const {
Expand Down
Loading