Skip to content

Commit

Permalink
use authoring-react in planning module (#4701)
Browse files Browse the repository at this point in the history
  • Loading branch information
tomaskikutis authored Dec 13, 2024
1 parent 89997bd commit 7d4f943
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion scripts/apps/authoring-react/authoring-react.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import {
IAuthoringOptions,
IStoreValueIncomplete,
IAuthoringSectionTheme,
IAuthoringValidationErrors,
} from 'superdesk-api';
import {
ButtonGroup,
Expand Down Expand Up @@ -253,7 +254,6 @@ export const getUiThemeFontSizeHeading = (value: IFontSizeOption) => {
* `true` means field is available - `false` - hidden.
*/
export type IToggledFields = {[fieldId: string]: boolean};
export type IAuthoringValidationErrors = {[fieldId: string]: string};

interface IStateLoaded<T> {
initialized: true;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import {IAuthoringSectionTheme, IAuthoringSectionClassNames, IFieldsV2, IVocabularyItem} from 'superdesk-api';
import {IAuthoringSectionTheme, IFieldsV2, IVocabularyItem, IAuthoringValidationErrors} from 'superdesk-api';
import {Map} from 'immutable';
import {IAuthoringValidationErrors, IToggledFields} from '../authoring-react';
import {IToggledFields} from '../authoring-react';
import {AuthoringSectionField} from './authoring-section-field';

export interface IPropsAuthoringSection<T> {
Expand Down
4 changes: 3 additions & 1 deletion scripts/core/menu/authoring-switch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,10 @@ export const setupAuthoringReact = (url: string) => {
(extensionUrl) => extensionUrl.startsWith(trimStartExact(parsedPath.hash, '#')),
) != null;

const isNavigatingToPlanning = parsedPath.hash.startsWith('#/planning');

const action: 'register' | 'deregister' = (() => {
if (isNavigatingToAnExtensionPage) {
if (isNavigatingToAnExtensionPage || isNavigatingToPlanning) {
// regardless of user setting, authoring-react
// must be enabled in extensions
return 'register';
Expand Down
2 changes: 2 additions & 0 deletions scripts/core/superdesk-api.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,8 @@ declare module 'superdesk-api' {

export type IFieldsData = import('immutable').Map<string, unknown>;

export type IAuthoringValidationErrors = {[fieldId: string]: string};

/**
* Check authoring-react.tsx for comments on individual methods.
*/
Expand Down

0 comments on commit 7d4f943

Please sign in to comment.