diff --git a/e2e/client/specs/helpers/monitoring.ts b/e2e/client/specs/helpers/monitoring.ts index 60141cfc14..1da3f9d12d 100644 --- a/e2e/client/specs/helpers/monitoring.ts +++ b/e2e/client/specs/helpers/monitoring.ts @@ -434,8 +434,8 @@ class Monitoring { * @param {boolean} useFullButtonText * @param {boolean} confirm Accept confirmation dialog. */ - this.actionOnItem = function(action, group, item, useFullButtonText, confirm) { - var menu = this.openItemMenu(group, item); + this.actionOnItem = function(action, group, item, useFullButtonText = true, confirm) { + const menu: ElementFinder = this.openItemMenu(group, item); browser.wait(() => menu.isPresent(), 3000); @@ -471,14 +471,12 @@ class Monitoring { * @param {number} item */ this.actionOnItemSubmenu = function(action, submenu, group, item) { - var menu = this.openItemMenu(group, item); - var header = menu.element(by.partialButtonText(action)); - var btn = menu.all(by.partialButtonText(submenu)).first(); + const menu: ElementFinder = this.openItemMenu(group, item); + const header = menu.element(by.buttonText(action)); + const btn = menu.element(by.partialButtonText(submenu)); + + browser.actions().mouseMove(header, {x: -50, y: -50}).mouseMove(header).perform(); - browser.actions() - .mouseMove(header, {x: -50, y: -50}) - .mouseMove(header) - .perform(); waitFor(btn, 1000); btn.click(); }; diff --git a/e2e/client/specs/helpers/pages.ts b/e2e/client/specs/helpers/pages.ts index ecfb04884d..8e447b0dd2 100644 --- a/e2e/client/specs/helpers/pages.ts +++ b/e2e/client/specs/helpers/pages.ts @@ -1,7 +1,7 @@ /* eslint-disable @typescript-eslint/no-this-alias */ /* eslint-disable newline-per-chained-call */ -import {element, by, browser, $, $$, promise as wdpromise} from 'protractor'; +import {element, by, browser, $, $$, promise as wdpromise, ElementFinder} from 'protractor'; import './waitReady'; export {authoring} from './authoring'; export {content} from './content'; @@ -102,14 +102,14 @@ class SearchProvider { class IngestDashboard { dropDown: any; - ingestDashboard: any; + ingestDashboard: ElementFinder; openDropDown: () => any; getProviderList: () => any; getProvider: (index: any) => any; getProviderButton: (provider: any) => any; getDashboardList: () => any; getDashboard: (index: any) => any; - getDashboardSettings: (dashboard: any) => any; + getDashboardSettingsButton: (dashboard: any) => any; getDashboardSettingsStatusButton: (settings: any) => any; getDashboardStatus: (dashboard: any) => any; getDashboardSettingsIngestCountButton: (settings: any) => any; @@ -140,14 +140,14 @@ class IngestDashboard { }; this.getDashboardList = function() { - return self.ingestDashboard.all(by.repeater('item in items')); + return self.ingestDashboard.all(by.repeater('item in items track by item._id')); }; this.getDashboard = function(index) { return self.getDashboardList().get(index); }; - this.getDashboardSettings = function(dashboard) { + this.getDashboardSettingsButton = function(dashboard) { return dashboard.element(by.css('.dropdown')); }; @@ -156,7 +156,7 @@ class IngestDashboard { }; this.getDashboardStatus = function(dashboard) { - return dashboard.element(by.css('.status')); + return dashboard.element(by.className('status')); }; this.getDashboardSettingsIngestCountButton = function(settings) { @@ -164,7 +164,7 @@ class IngestDashboard { }; this.getDashboardIngestCount = function(dashboard) { - return dashboard.element(by.css('.ingested-count')); + return dashboard.element(by.className('ingested-count')); }; } } diff --git a/e2e/client/specs/helpers/utils.ts b/e2e/client/specs/helpers/utils.ts index 0dce2b2dab..2fe149dd2c 100644 --- a/e2e/client/specs/helpers/utils.ts +++ b/e2e/client/specs/helpers/utils.ts @@ -235,7 +235,7 @@ export function waitHidden(elem, time?) { } export function scrollToView(elem: ElementFinder) { - browser.executeScript('arguments[0].scrollIntoViewIfNeeded();', elem); + browser.executeScript('arguments[0]?.scrollIntoViewIfNeeded?.();', elem); } export function scrollRelative(elem: ElementFinder, direction: 'up'| 'down', pixelsToScroll: number) { diff --git a/e2e/client/specs/helpers/workspace.ts b/e2e/client/specs/helpers/workspace.ts index aac8f8c647..1207e8d45e 100644 --- a/e2e/client/specs/helpers/workspace.ts +++ b/e2e/client/specs/helpers/workspace.ts @@ -130,7 +130,7 @@ class Workspace { * @param {string} name */ this.showHighlightList = function(name) { - var item = this.getHighlightListItem(name); + const item = this.getHighlightListItem(name); browser.wait(ECE.elementToBeClickable(item), 1000); item.click(); @@ -146,7 +146,7 @@ class Workspace { * @return {promise} highlight element */ this.getHighlightListItem = function(name) { - var menu = element(by.id('highlightPackage')); + const menu = element(by.id('highlightPackage')); browser.actions() .mouseMove(menu) diff --git a/e2e/client/specs/ingest_provider_spec.ts b/e2e/client/specs/ingest_provider_spec.ts index 33c5d6baeb..d154002211 100644 --- a/e2e/client/specs/ingest_provider_spec.ts +++ b/e2e/client/specs/ingest_provider_spec.ts @@ -42,19 +42,20 @@ describe('ingest_provider', () => { it('Change settings for Ingest Provider', () => { addProvider(); expect(ingestDashboard.getDashboardList().count()).toEqual(1); - var dashboard = ingestDashboard.getDashboard(0); - var settings = ingestDashboard.getDashboardSettings(dashboard); - settings.click(); + const dashboard = ingestDashboard.getDashboard(0); + const mainSettingsButton = ingestDashboard.getDashboardSettingsButton(dashboard); + + mainSettingsButton.click(); // status expect(ingestDashboard.getDashboardStatus(dashboard).isDisplayed()).toBe(true); - ingestDashboard.getDashboardSettingsStatusButton(settings).click(); + ingestDashboard.getDashboardSettingsStatusButton(mainSettingsButton).click(); expect(ingestDashboard.getDashboardStatus(dashboard).isDisplayed()).toBe(false); // ingest count expect(ingestDashboard.getDashboardIngestCount(dashboard).isDisplayed()).toBe(true); - ingestDashboard.getDashboardSettingsIngestCountButton(settings).click(); + ingestDashboard.getDashboardSettingsIngestCountButton(mainSettingsButton).click(); expect(ingestDashboard.getDashboardIngestCount(dashboard).isDisplayed()).toBe(false); }); @@ -70,7 +71,7 @@ describe('ingest_provider', () => { it('Go to Ingest Providers and open dialog', () => { addProvider(); var dashboard = ingestDashboard.getDashboard(0); - var settings = ingestDashboard.getDashboardSettings(dashboard); + var settings = ingestDashboard.getDashboardSettingsButton(dashboard); settings.click(); settings.element(by.css('.icon-pencil')).click(); diff --git a/package-lock.json b/package-lock.json index f1a3e64804..19fefedbf1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -13955,9 +13955,9 @@ } }, "superdesk-ui-framework": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/superdesk-ui-framework/-/superdesk-ui-framework-4.0.0.tgz", - "integrity": "sha512-Wkie4yIfIKccJXEUN4Jk4ZW7TKjY3g6dxTvhwp1zk5TVg1FtRj5qPUFf6UU9pvnLSb4ziju4UTrimVIdYPgn7A==", + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/superdesk-ui-framework/-/superdesk-ui-framework-4.0.1.tgz", + "integrity": "sha512-Ft1uL6iayL1CEEUH5IkPbMNnSseTgSHENGKXQ0NAxGUtbbpIOKno/lENuqSahqbMv0sHWQbbGG7YUOrhACI3xQ==", "requires": { "@popperjs/core": "^2.4.0", "@superdesk/common": "0.0.28", diff --git a/package.json b/package.json index 073b7a67af..6f01d0d6d0 100644 --- a/package.json +++ b/package.json @@ -123,7 +123,7 @@ "sass-loader": "6.0.6", "shortid": "2.2.8", "style-loader": "0.20.2", - "superdesk-ui-framework": "^4.0.0", + "superdesk-ui-framework": "^4.0.1", "ts-loader": "3.5.0", "typescript": "4.9.5", "uuid": "8.3.1", diff --git a/scripts/apps/authoring-react/authoring-angular-integration.tsx b/scripts/apps/authoring-react/authoring-angular-integration.tsx index df4ab29c36..8cc48f3e7d 100644 --- a/scripts/apps/authoring-react/authoring-angular-integration.tsx +++ b/scripts/apps/authoring-react/authoring-angular-integration.tsx @@ -815,7 +815,7 @@ export function getAuthoringPrimaryToolbarWidgets( return { ...item, component: (props: {entity: IArticle}) => ( - + ), }; }) diff --git a/scripts/apps/authoring-react/authoring-angular-template-integration.tsx b/scripts/apps/authoring-react/authoring-angular-template-integration.tsx index e85db92689..e50fdf1e9c 100644 --- a/scripts/apps/authoring-react/authoring-angular-template-integration.tsx +++ b/scripts/apps/authoring-react/authoring-angular-template-integration.tsx @@ -16,7 +16,6 @@ export class AuthoringAngularTemplateIntegration extends React.PureComponent { this.props.template.data = computeLatestEntity(); diff --git a/scripts/apps/authoring-react/authoring-integration-wrapper.tsx b/scripts/apps/authoring-react/authoring-integration-wrapper.tsx index 37883b8c76..a6baa0bbf3 100644 --- a/scripts/apps/authoring-react/authoring-integration-wrapper.tsx +++ b/scripts/apps/authoring-react/authoring-integration-wrapper.tsx @@ -1,5 +1,6 @@ /* eslint-disable react/no-multi-comp */ /* eslint-disable no-case-declarations */ +/* eslint-disable react/display-name */ import React from 'react'; import { IArticle, @@ -44,6 +45,7 @@ import {PINNED_WIDGET_USER_PREFERENCE_SETTINGS, closedIntentionally} from 'apps/ import {AuthoringIntegrationWrapperSidebar} from './authoring-integration-wrapper-sidebar'; import {assertNever} from 'core/helpers/typescript-helpers'; import {ContentProfileDropdown} from './subcomponents/content-profile-dropdown'; +import {IconButton} from 'superdesk-ui-framework'; export function getWidgetsFromExtensions(article: IArticle): Array { return Object.values(extensions) @@ -52,16 +54,62 @@ export function getWidgetsFromExtensions(article: IArticle): Array a.order - b.order); } -const defaultToolbarItems: Array void; -}>> = [ - CreatedModifiedInfo, -]; - interface IProps { itemId: IArticle['_id']; } + +const getAuthoringCosmeticActions = (exposed: IExposedFromAuthoring): Array> => [{ + availableOffline: true, + component: () => ( + { + exposed.printPreview(); + }} + /> + ), + group: 'end', + priority: 1, + keyBindings: {'ctrl+shift+i': () => { + exposed.printPreview(); + }}, +}, +{ + availableOffline: true, + component: () => ( + { + exposed.toggleTheme(); + }} + /> + ), + group: 'end', + priority: 2, + keyBindings: {'ctrl+shift+t': () => { + exposed.toggleTheme(); + }}, +}, +{ + availableOffline: true, + component: () => ( + { + exposed.configureTheme(); + }} + /> + ), + group: 'end', + priority: 3, + keyBindings: {'ctrl+shift+c': () => { + exposed.configureTheme(); + }}, +}]; + export type ISideWidget = { activeId?: string; pinnedId?: string; @@ -221,9 +269,6 @@ interface IPropsWrapper extends IProps { actions: Array>; }; - // Hides the toolbar which includes the "Print Preview" button. - hideSecondaryToolbar?: boolean; - // If it's not passed then the sidebar is shown expanded and can't be collapsed. // If hidden is passed then it can't be expanded. // If it's set to true or false then it can be collapsed/expanded back. @@ -329,16 +374,11 @@ export class AuthoringIntegrationWrapper extends React.PureComponent activationResult?.contributions?.authoringTopbar2Widgets ?? []); - const secondaryToolbarWidgetsReady = defaultToolbarItems.concat(secondaryToolbarWidgetsFromExtensions) - .map((Component) => (props) => ); - return ( {(panelState, panelActions) => ( { this.authoringReactRef = component; }} @@ -550,7 +590,18 @@ export class AuthoringIntegrationWrapper extends React.PureComponent )} - secondaryToolbarWidgets={secondaryToolbarWidgetsReady} + getSecondaryToolbarWidgets={(exposed) => [ + { + availableOffline: true, + component: () => ( + + ), + group: 'start', + priority: 1, + }, + ...secondaryToolbarWidgetsFromExtensions, + ...getAuthoringCosmeticActions(exposed), + ]} validateBeforeSaving={false} getSideWidgetIdAtIndex={(article, index) => { return getWidgetsFromExtensions(article)[index]._id; diff --git a/scripts/apps/authoring-react/authoring-react.tsx b/scripts/apps/authoring-react/authoring-react.tsx index 89bc8e757c..95f95d2c8c 100644 --- a/scripts/apps/authoring-react/authoring-react.tsx +++ b/scripts/apps/authoring-react/authoring-react.tsx @@ -1211,6 +1211,22 @@ export class AuthoringReact extends React.PureCo storageAdapter: storageAdapter, fieldsAdapter: fieldsAdapter, sideWidget: this.props.sideWidget?.activeId, + toggleTheme: () => { + this.setState({ + ...state, + proofreadingEnabled: !state.proofreadingEnabled, + }); + }, + printPreview: () => { + previewAuthoringEntity( + state.profile, + state.profile, + state.fieldsDataWithChanges, + ); + }, + configureTheme: () => { + this.showThemeConfigModal(state); + }, toggleSideWidget: (id) => { const activeWidgetId = this.props.sideWidget?.activeId; @@ -1343,53 +1359,24 @@ export class AuthoringReact extends React.PureCo }; } - const primaryToolbarWidgets: Array> = authoringOptions?.actions != null ? [ - ...authoringOptions.actions, - { + const primaryToolbarWidgets: Array> = authoringOptions.actions ?? []; + + if (authoringActions.length > 0) { + primaryToolbarWidgets.push({ group: 'end', priority: 0.4, - component: () => { - return ( - authoringActions} /> - ); - }, + component: () => ( + authoringActions} /> + ), availableOffline: true, - }, - ] : []; - - const printPreviewAction = (() => { - const execute = () => { - previewAuthoringEntity( - state.itemWithChanges, - state.profile, - state.fieldsDataWithChanges, - ); - }; - - const preview = { - jsxButton: () => { - return ( - { - execute(); - }} - /> - ); - }, - keybindings: { - 'ctrl+shift+i': () => { - execute(); - }, - }, - }; + }); + } - return preview; - })(); + const extraPrimaryToolbarWidgets = this.props.getAuthoringPrimaryToolbarWidgets?.(exposed) ?? []; + const secondaryToolbarWidgets = this.props.getSecondaryToolbarWidgets?.(exposed) ?? []; const allKeyBindings: IKeyBindings = { - ...printPreviewAction.keybindings, + ...getKeyBindingsFromActions(secondaryToolbarWidgets), ...getKeyBindingsFromActions(authoringOptions?.actions ?? []), ...keyBindingsFromAuthoringActions, ...widgetKeybindings, @@ -1429,15 +1416,12 @@ export class AuthoringReact extends React.PureCo {() => ( @@ -1446,64 +1430,31 @@ export class AuthoringReact extends React.PureCo main={( - {this.props.secondaryToolbarWidgets.map((Component, i) => ( - { - if (this.hasUnsavedChanges()) { - exposed.handleUnsavedChanges().then(() => { - this.reinitialize(state, item); - }); - } else { - this.reinitialize(state, item); - } - }} - item={state.itemWithChanges} - /> - ))} - - {printPreviewAction.jsxButton()} - {this.props.themingEnabled === true && ( - <> - { - this.setState({ - ...state, - proofreadingEnabled: - !state.proofreadingEnabled, - }); - }} - /> - { - this.showThemeConfigModal(state); - }} - /> - - )} - - - - )} - headerPadding={{top: 8}} - authoringHeader={( -
+ toolBar={secondaryToolbarWidgets.length === 0 ? null : ( + + + )} + headerPadding={{ + top: 8, + bottom: state.profile.header.count() < 1 ? 8 : undefined, + }} + authoringHeader={( +
+ {this.props.headerToolbar != null && ( + + )} { const ids = [ 'categories', + 'default_categories', + 'languages', 'genre', - 'locators', - 'priority', 'urgency', + 'priority', + 'signal', + 'rightsinfo', + 'crop_sizes', + 'desk_types', + 'replace_words', + 'locators', + 'product_types', + 'annotation_types', + 'author_roles', + 'job_titles', + 'package-story-labels', + 'usageterms', + 'contact_mobile_usage', + 'contact_phone_usage', + 'countries', + 'regions', + 'type', + 'subscriber_types', + 'g2_content_type', + 'eventoccurstatus', + 'newscoveragestatus', + 'event_calendars', + 'assignment_priority', + 'camera', + 'custom-sorting', ]; for (const id of ids) { @@ -36,6 +62,7 @@ describe('field adapters', () => { return testVocabularies; }, + getCustomFieldVocabularies: () => [], getVocabularyItemLabel: (term) => term.name, }; diff --git a/scripts/apps/authoring-react/subcomponents/authoring-toolbar.tsx b/scripts/apps/authoring-react/subcomponents/authoring-toolbar.tsx index ccdd8e4854..70eaa7b12d 100644 --- a/scripts/apps/authoring-react/subcomponents/authoring-toolbar.tsx +++ b/scripts/apps/authoring-react/subcomponents/authoring-toolbar.tsx @@ -3,24 +3,23 @@ import {ITopBarWidget} from 'superdesk-api'; interface IProps { entity: T; - coreWidgets?: Array>; - extraWidgets?: Array>; + widgets?: Array>; backgroundColor?: React.CSSProperties['backgroundColor']; } export class AuthoringToolbar extends React.PureComponent> { render() { - const topbarWidgets = (this.props.coreWidgets ?? []).concat(this.props.extraWidgets ?? []); + const {widgets} = this.props; - const topbarWidgetsStart = topbarWidgets + const topbarWidgetsStart = widgets .filter(({group}) => group === 'start') .sort((a, b) => a.priority - b.priority); - const topbarWidgetsMiddle = topbarWidgets + const topbarWidgetsMiddle = widgets .filter(({group}) => group === 'middle') .sort((a, b) => a.priority - b.priority); - const topbarWidgetsEnd = topbarWidgets + const topbarWidgetsEnd = widgets .filter(({group}) => group === 'end') .sort((a, b) => a.priority - b.priority); diff --git a/scripts/apps/authoring-react/subcomponents/created-modified-info.tsx b/scripts/apps/authoring-react/subcomponents/created-modified-info.tsx index b63743c6a4..43539b2600 100644 --- a/scripts/apps/authoring-react/subcomponents/created-modified-info.tsx +++ b/scripts/apps/authoring-react/subcomponents/created-modified-info.tsx @@ -5,16 +5,15 @@ import {ModifiedInfo} from 'apps/authoring/authoring/modified-info'; interface IProps { article: IArticle; - reinitialize: () => void; } export class CreatedModifiedInfo extends React.PureComponent { render() { return (
- + - +
); } diff --git a/scripts/apps/authoring/authoring/authoring-topbar-react.tsx b/scripts/apps/authoring/authoring/authoring-topbar-react.tsx index 1d2ec72db0..3d64548765 100644 --- a/scripts/apps/authoring/authoring/authoring-topbar-react.tsx +++ b/scripts/apps/authoring/authoring/authoring-topbar-react.tsx @@ -84,7 +84,7 @@ export class AuthoringTopbarReact extends React.PureComponent { return ( > = [CreatedInfo, ModifiedInfo]; +const getDefaultToolbarItems = (item: IArticle): Array> => [{ + availableOffline: true, + component: () => ( + + ), + group: 'start', + priority: 1, +}, { + availableOffline: true, + component: () => ( + + ), + group: 'start', + priority: 2, +}]; interface IProps { article: IArticle; @@ -56,7 +77,7 @@ export class AuthoringTopbar2React extends React.PureComponent { return null; // fetching article from the server } - const articleDisplayWidgets = defaultToolbarItems.concat( + const articleDisplayWidgets = getDefaultToolbarItems(this.props.article).concat( flatMap( Object.values(extensions), (extension) => extension.activationResult?.contributions?.authoringTopbar2Widgets ?? [], @@ -67,19 +88,10 @@ export class AuthoringTopbar2React extends React.PureComponent { const articleUpdatedReference = {...this.props.article}; return ( -
- {articleDisplayWidgets.map( - (Component, i) => ( -
- -
- ), - )} -
+ ); } } diff --git a/scripts/apps/authoring/authoring/created-info.tsx b/scripts/apps/authoring/authoring/created-info.tsx index fd89b287da..d5399d1ebc 100644 --- a/scripts/apps/authoring/authoring/created-info.tsx +++ b/scripts/apps/authoring/authoring/created-info.tsx @@ -5,7 +5,7 @@ import {TimeElem} from 'apps/search/components/TimeElem'; import {dataApi} from 'core/helpers/CrudManager'; interface IProps { - article: IArticle; + entity: IArticle; } interface IState { @@ -27,7 +27,7 @@ export class CreatedInfo extends React.PureComponent { componentDidMount() { this._mounted = true; - dataApi.findOne('users', this.props.article.original_creator).then((user) => { + dataApi.findOne('users', this.props.entity.original_creator).then((user) => { if (this._mounted) { this.setState({user}); } @@ -37,7 +37,7 @@ export class CreatedInfo extends React.PureComponent { this._mounted = false; } render() { - const {article} = this.props; + const {entity} = this.props; const {user} = this.state; if (user == null) { @@ -48,7 +48,7 @@ export class CreatedInfo extends React.PureComponent {
{gettext('Created')}
{' '} -
+
{' '}
{gettext('by')}
{' '} diff --git a/scripts/apps/authoring/authoring/modified-info.tsx b/scripts/apps/authoring/authoring/modified-info.tsx index 9a095a5a39..e9ba87e194 100644 --- a/scripts/apps/authoring/authoring/modified-info.tsx +++ b/scripts/apps/authoring/authoring/modified-info.tsx @@ -4,14 +4,14 @@ import {gettext} from 'core/utils'; import {TimeElem} from 'apps/search/components/TimeElem'; interface IProps { - article: IArticle; + entity: IArticle; } export class ModifiedInfo extends React.PureComponent { render() { - const {article} = this.props; + const {entity} = this.props; - if (article.versioncreated == null) { + if (entity.versioncreated == null) { return null; } @@ -19,7 +19,7 @@ export class ModifiedInfo extends React.PureComponent {
{gettext('Modified')}
{' '} -
+
); } diff --git a/scripts/apps/authoring/tests/authoring.spec.ts b/scripts/apps/authoring/tests/authoring.spec.ts index 8971537ff5..95d7fc6e41 100644 --- a/scripts/apps/authoring/tests/authoring.spec.ts +++ b/scripts/apps/authoring/tests/authoring.spec.ts @@ -1857,8 +1857,9 @@ describe('authoring container directive', () => { })); describe('authoring embed directive', () => { - beforeEach(inject(($templateCache) => { + beforeEach(inject(($templateCache, preferencesService) => { $templateCache.put('scripts/apps/authoring/views/authoring.html', '
'); + spyOn(preferencesService, 'getSync').and.returnValue(null); })); it('applies kill template', diff --git a/scripts/apps/dictionaries/views/settings.html b/scripts/apps/dictionaries/views/settings.html index 8eea373caf..65ba04fdb8 100644 --- a/scripts/apps/dictionaries/views/settings.html +++ b/scripts/apps/dictionaries/views/settings.html @@ -5,10 +5,10 @@

Dictionary management

- + - +
- +
  • diff --git a/scripts/apps/ingest/views/dashboard/dashboard.html b/scripts/apps/ingest/views/dashboard/dashboard.html index 9d14f68ec1..c5854105dd 100644 --- a/scripts/apps/ingest/views/dashboard/dashboard.html +++ b/scripts/apps/ingest/views/dashboard/dashboard.html @@ -11,4 +11,4 @@
    -
    \ No newline at end of file + diff --git a/scripts/apps/search/components/ListItemInfo.tsx b/scripts/apps/search/components/ListItemInfo.tsx index a8599928ff..660491d822 100644 --- a/scripts/apps/search/components/ListItemInfo.tsx +++ b/scripts/apps/search/components/ListItemInfo.tsx @@ -76,11 +76,9 @@ export class ListItemInfo extends React.PureComponent { { articleDisplayWidgets.length < 1 ? null : (
    - { - articleDisplayWidgets.map((Component, i) => - , - ) - } + {articleDisplayWidgets.map((Component, i) => + , + )}
    ) } diff --git a/scripts/apps/search/components/PhotoDeskInfo.tsx b/scripts/apps/search/components/PhotoDeskInfo.tsx index d728aba908..158651396b 100644 --- a/scripts/apps/search/components/PhotoDeskInfo.tsx +++ b/scripts/apps/search/components/PhotoDeskInfo.tsx @@ -45,7 +45,7 @@ export const PhotoDeskInfo: React.StatelessComponent = (props) => {
    { articleDisplayWidgets.map((Component, i) => - , + , ) }
    diff --git a/scripts/core/superdesk-api.d.ts b/scripts/core/superdesk-api.d.ts index 5db1c728d8..05a9e7db57 100644 --- a/scripts/core/superdesk-api.d.ts +++ b/scripts/core/superdesk-api.d.ts @@ -147,6 +147,9 @@ declare module 'superdesk-api' { * we are passing a function instead. */ getLatestItem(options?: {preferIncomplete?: IStoreValueIncomplete}): T; + toggleTheme: () => void; + printPreview: () => void; + configureTheme: () => void; toggleSideWidget(id: string | null): void; contentProfile: IContentProfileV2; fieldsData: IFieldsData; @@ -161,7 +164,7 @@ declare module 'superdesk-api' { initiateClosing(): void; keepChangesAndClose(): void; stealLock(): void; - reinitialize: (item: T, profile?: IContentProfileV2) => void; + reinitialize(item: T, profile?: IContentProfileV2): void; addValidationErrors(validationErrors: IAuthoringValidationErrors): void; } @@ -188,8 +191,6 @@ declare module 'superdesk-api' { */ resourceNames: Array; - // Hides the toolbar which includes the "Print Preview" button. - hideSecondaryToolbar?: boolean; getLanguage(entity: T): string; onClose(): void; authoringStorage: IAuthoringStorage; @@ -197,9 +198,10 @@ declare module 'superdesk-api' { fieldsAdapter: IFieldsAdapter; getActions?(options: IExposedFromAuthoring): Array; // three dots menu actions getInlineToolbarActions?(options: IExposedFromAuthoring): IAuthoringOptions; - getAuthoringPrimaryToolbarWidgets?( - options: IExposedFromAuthoring, - ): Array>; + + getAuthoringPrimaryToolbarWidgets?(options: IExposedFromAuthoring): Array>; + getSecondaryToolbarWidgets?: (exposed: IExposedFromAuthoring) => Array>; + onEditingStart?(item: T): void; onEditingEnd?(item: T): void; @@ -211,10 +213,6 @@ declare module 'superdesk-api' { // used for side widgets getSidePanel?(options: IExposedFromAuthoring, readOnly: boolean): React.ReactNode; - secondaryToolbarWidgets: Array>; headerToolbar?: (options: IExposedFromAuthoring) => Array>; @@ -238,11 +236,7 @@ declare module 'superdesk-api' { ): IFieldsData; validateBeforeSaving?: boolean; // will block saving if invalid. defaults to true - headerCollapsed?: boolean; // initial value - - themingEnabled?: boolean; // only works with article; default false - autoFocus?: boolean; // defaults to true; will focus first input } @@ -759,26 +753,18 @@ declare module 'superdesk-api' { editor3?: { annotationInputTabs?: Array; } - articleListItemWidgets?: Array>; - articleGridItemWidgets?: Array>; + articleListItemWidgets?: Array['component']>; + articleGridItemWidgets?: Array['component']>; /** - * Display custom components at the top of authoring panel + * First toolbar of authoring panel */ - authoringTopbarWidgets?: Array<{ - component: React.ComponentType<{article: IArticle}>; - availableOffline: boolean; - priority: IDisplayPriority; - group: 'start' | 'middle' | 'end'; - }>; + authoringTopbarWidgets?: Array>; /** - * Display custom components in the second toolbar in authoring panel + * Second toolbar of authoring panel */ - authoringTopbar2Widgets?: Array void; - }>>; + authoringTopbar2Widgets?: Array>; authoringSideWidgets?: Array; diff --git a/scripts/extensions/broadcasting/src/rundown-templates/template-edit.tsx b/scripts/extensions/broadcasting/src/rundown-templates/template-edit.tsx index 377f9de1c9..7bcaf7a146 100644 --- a/scripts/extensions/broadcasting/src/rundown-templates/template-edit.tsx +++ b/scripts/extensions/broadcasting/src/rundown-templates/template-edit.tsx @@ -600,7 +600,6 @@ export class RundownTemplateViewEdit extends React.PureComponent }} getSideWidgetIdAtIndex={() => ''} getAuthoringPrimaryToolbarWidgets={() => []} - secondaryToolbarWidgets={[]} disableWidgetPinning /> ) diff --git a/scripts/extensions/broadcasting/src/rundowns/rundown-view-edit.tsx b/scripts/extensions/broadcasting/src/rundowns/rundown-view-edit.tsx index 8d8ebd4967..03b74eba49 100644 --- a/scripts/extensions/broadcasting/src/rundowns/rundown-view-edit.tsx +++ b/scripts/extensions/broadcasting/src/rundowns/rundown-view-edit.tsx @@ -665,7 +665,6 @@ export class RundownViewEditComponent extends React.PureComponent []} - secondaryToolbarWidgets={[]} getSidebarWidgetsCount={({item}) => { return getAvailableSideWidgets(item).length; }} diff --git a/scripts/extensions/broadcasting/src/rundowns/rundowns-list.tsx b/scripts/extensions/broadcasting/src/rundowns/rundowns-list.tsx index 173165d616..e63608d6a2 100644 --- a/scripts/extensions/broadcasting/src/rundowns/rundowns-list.tsx +++ b/scripts/extensions/broadcasting/src/rundowns/rundowns-list.tsx @@ -306,9 +306,7 @@ export class RundownsList extends React.PureComponent { }; return ( - + { + return class DisplayMarkedUser extends React.PureComponent<{entity: IArticle}> { render() { - if (this.props.article.marked_for_user == null) { + if (this.props.entity.marked_for_user == null) { return null; } else { return ( ); }