forked from superdesk/superdesk-client-core
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into templates-e2e-test
- Loading branch information
Showing
21 changed files
with
182 additions
and
2,819 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import {test, expect} from '@playwright/test'; | ||
import {Monitoring} from './page-object-models/monitoring'; | ||
import {restoreDatabaseSnapshot, s} from './utils'; | ||
|
||
test.describe('article versions', async () => { | ||
test('reverting to a previous article version', async ({page}) => { | ||
const monitoring = new Monitoring(page); | ||
|
||
await restoreDatabaseSnapshot(); | ||
await page.goto('/#/workspace/monitoring'); | ||
await monitoring.selectDeskOrWorkspace('Sports'); | ||
|
||
await monitoring.executeActionOnMonitoringItem( | ||
page.locator(s('article-item=story 2')), | ||
'Edit', | ||
); | ||
await page.locator(s('authoring', 'field-slugline')).fill('story 2.1'); | ||
await page.locator(s('authoring-topbar', 'save')).click(); | ||
await expect(page.locator(s('authoring', 'field-slugline'))).toHaveValue('story 2.1'); | ||
|
||
await page.locator(s('navigation-tabs', 'authoring-widget=Versions/History')).click(); | ||
await page | ||
.locator(s('authoring-widget-panel=Versions/History', 'article-version=3')) | ||
.getByRole('button', {name: 'revert'}).click(); | ||
await expect(page.locator(s('authoring', 'field-slugline'))).toHaveValue('story 2'); | ||
}); | ||
}); |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
scripts/apps/authoring-react/copy-embedded-articles-into-associations.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import {CustomEditor3Entity} from 'core/editor3/constants'; | ||
import {getEntityMap} from 'core/editor3/helpers/get-entity-map'; | ||
import {IEditorDragDropArticleEmbed} from 'core/editor3/reducers/editor3'; | ||
import {ContentState} from 'draft-js'; | ||
import {IArticle} from 'superdesk-api'; | ||
|
||
export function copyEmbeddedArticlesIntoAssociations(contentState: ContentState, article: IArticle): void { | ||
/** | ||
* Putting embedded article into associations. | ||
* It's meant for external use after item is published. | ||
* see {@link AtomicBlockParser.parse} | ||
*/ | ||
getEntityMap(contentState).forEach((entity) => { | ||
if (entity.getType() === CustomEditor3Entity.ARTICLE_EMBED) { | ||
const data = entity.getData() as IEditorDragDropArticleEmbed['data']; | ||
const entityItem = data.item; | ||
|
||
if (article.associations == null) { | ||
article.associations = {}; | ||
} | ||
|
||
article.associations[entityItem._id] = entityItem; | ||
} | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import {ContentState} from 'draft-js'; | ||
import {Map} from 'immutable'; | ||
|
||
// .getEntityMap doesn't work | ||
// .entityMap appears to be private and only works sometimes. Other times it returns what appears to be a entity class. | ||
|
||
type DraftEntityInstance = ReturnType<ContentState['getEntity']>; | ||
|
||
export function getEntityMap(contentState: ContentState): Map<string, DraftEntityInstance> { | ||
let entityMap = Map<string, DraftEntityInstance>(); | ||
|
||
let endReached = false; | ||
let i = 1; | ||
|
||
while (!endReached) { | ||
try { | ||
const entity = contentState.getEntity(i.toString()); | ||
|
||
entityMap = entityMap.set(i.toString(), entity); | ||
|
||
i++; | ||
} catch (e) { | ||
endReached = true; | ||
} | ||
} | ||
|
||
return entityMap; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters