diff --git a/scripts/apps/search/MultiImageEdit.ts b/scripts/apps/search/MultiImageEdit.ts index 9b5ccfcccc..bbbae912e5 100644 --- a/scripts/apps/search/MultiImageEdit.ts +++ b/scripts/apps/search/MultiImageEdit.ts @@ -116,10 +116,8 @@ export function MultiImageEditController( $scope.cancelHandler(); } }); - } else { - if (typeof $scope.cancelHandler === 'function') { - $scope.cancelHandler(); - } + } else if (typeof $scope.cancelHandler === 'function') { + $scope.cancelHandler(); } }; diff --git a/scripts/apps/settings/settings.tsx b/scripts/apps/settings/settings.tsx index f423ccd7cf..e0985a2e3a 100644 --- a/scripts/apps/settings/settings.tsx +++ b/scripts/apps/settings/settings.tsx @@ -36,7 +36,11 @@ class SettingsComponent extends React.Component { } superdesk.getMenu(superdesk.MENU_SETTINGS).then((flatMenuItems) => { - this.setState({flatMenuItems: flatMenuItems, loading: false}); + this.setState({ + flatMenuItems: flatMenuItems.sort((a, b) => + b.settings_menu_group.priority - a.settings_menu_group.priority), + loading: false, + }); }); } render() { diff --git a/scripts/apps/vocabularies/constants.ts b/scripts/apps/vocabularies/constants.ts new file mode 100644 index 0000000000..8fc024720e --- /dev/null +++ b/scripts/apps/vocabularies/constants.ts @@ -0,0 +1,38 @@ +import {get} from 'lodash'; +// Adding the following because planning webpack when compiled for test cases +// won't be aware of gettext. +const gettext = get(window, 'gettext', (text) => text); + +export const MEDIA_TYPES = { + GALLERY: { + id: 'media', + label: gettext('Media gallery'), + }, + RELATED_CONTENT: { + id: 'related_content', + label: gettext('Related items'), + }, +}; + +export const MEDIA_TYPE_KEYS = Object.keys(MEDIA_TYPES).map((type) => MEDIA_TYPES[type].id); + +export const VOCABULARY_SELECTION_TYPES = { + SINGLE_SELECTION: { + id: 'single selection', + label: gettext('Single selection'), + }, + MULTIPLE_SELECTION: { + id: 'multi selection', + label: gettext('Multi selection'), + }, + DO_NOT_SHOW: { + id: 'do not show', + label: gettext('Do not show'), + }, +}; + +export const DEFAULT_SCHEMA = { + name: {}, + qcode: {}, + parent: {}, +}; diff --git a/scripts/core/editor3/components/BaseUnstyledComponent.tsx b/scripts/core/editor3/components/BaseUnstyledComponent.tsx index 95c990fc33..57a092193a 100644 --- a/scripts/core/editor3/components/BaseUnstyledComponent.tsx +++ b/scripts/core/editor3/components/BaseUnstyledComponent.tsx @@ -49,12 +49,16 @@ class BaseUnstyledComponent extends React.Component { const blockKey = this.getDropBlockKey(); const link = event.originalEvent.dataTransfer.getData('URL'); - if (typeof link === 'string' && link.startsWith('http')) { + if ( + typeof link === 'string' + && link.startsWith('http') + && this.props.editorProps.editorFormat.includes('embed') + ) { getEmbedObject(link) .then((oEmbed) => { this.props.dispatch(embed(oEmbed, blockKey)); }); - } else if (mediaType === 'text/html') { + } else if (mediaType === 'text/html' && this.props.editorProps.editorFormat.includes('embed')) { this.props.dispatch(embed(event.originalEvent.dataTransfer.getData(mediaType), blockKey)); } else if (canDropMedia(event, this.props.editorProps)) { // Dropping new media const {dataTransfer} = event.originalEvent;