Fix issue 75,71 added content toolbar everywhere and media editor and media section (C039_geostory)#4107
Conversation
* it contains also tests
| }, | ||
| contentId: contextIndex && contextIndex.id, | ||
| sectionId: id | ||
| }; |
There was a problem hiding this comment.
I think we should not remove the backgroundId prop because it used in the stream for immersive layout to select the current background in view.
It seems also getContentIndex returns a content object instead of an index so I propose to change it to getContentInView.
example
({ id, backgroundId, contents = [] }) => {
const contentInView = getContentInView(contents, backgroundId) || {};
return {
background: get(contentInView, 'background') || { type: 'none' },
contentId: contentInView && contentInView.id,
sectionId: id
};
}| backgroundProp, | ||
| withHandlers({ | ||
| updateBackground: ({ sectionId, backgroundId, update = () => { } }) => (path, ...args) => update(`sections[{id: ${sectionId}}].contents[{id: ${backgroundId}}].background.` + path, ...args) | ||
| updateBackground: ({ sectionId, contentId, update = () => { } }) => (path, ...args) => update(`sections[{"id": "${sectionId}"}].contents[{"id": "${contentId}"}].background.` + path, ...args) |
There was a problem hiding this comment.
It seems your changes are correct but I wondering why the updateBackground was there even if it was not used before.
I propose to merge the handler with backgroundProp to create a single function to apply to sections that do not need stream to update background in view.
web/client/utils/GeoStoryUtils.js
Outdated
| * @prop {string} size one of 'full', 'large', 'medium' or 'small' | ||
| * @prop {string} fit one of 'cover' or 'fit' | ||
| */ | ||
| export const getClassNameFromProps = ({ theme = 'bright', align = 'center', size = 'large', fit = 'cover' }) => { |
There was a problem hiding this comment.
We can remove fit from here
* also restructured the sample story for new layout of paragraph * adding media toolbar on every Image
| /* mixin for align*/ | ||
| .align-center { margin-left: auto; margin-right: auto; } | ||
| .align-left { margin-left: 0; margin-right: auto; } | ||
| .align-right { margin-left: auto; margin-right: 0; } |
There was a problem hiding this comment.
We should add a specific prefix to avoid styles overrides around MapStore.
example
@ms-size-full: 100%; ->@ms-story-size-full:
...
.align-center -> .ms-story-align-center
...
| add('sections', id, SectionTypes.IMMERSIVE); | ||
| } | ||
| }]}/>} | ||
| }/*, |
There was a problem hiding this comment.
I think you are going to override this change in the next PR. If you don't please remove this commented code. Otherwise leave
There was a problem hiding this comment.
yes it has changed in the meanwhile :)
web/client/epics/geostory.js
Outdated
| action$.ofType(EDIT_MEDIA) | ||
| .switchMap(({path, owner}) => { | ||
| const state = store.getState(); | ||
| const resourceId = get(state, getEffectivePath(`geostory.currentStory.${path}.resourceId`, state), ""); |
There was a problem hiding this comment.
Maybe is a good idea if
path => state => get(state, getEffectivePath(`geostory.currentStory.${path}`, state));
this is a selectorCreator and you use it this way.
const resourceId = pathSelectorCreator(`${path}.resourceId`)(state) || "" // <-- Are you sure that a default like "" is ok?
* issue 71
…o 75_background_toolbar # Conflicts: # web/client/components/geostory/layouts/sections/Paragraph.jsx
* Geostory scheleton (#4014) * Geostory sections (#4029) Add base structure for geostory scroll handlers and background setup (base support for immersive or cover backgrounds) . * Geostory base text editing and content wrapper (#4033) * Fix #9 Contents - Image (#4038) * Geostory scroll immersive (#4044) * Fix #69 Builder - Section Editor - Section selector - Title (#4063) * Geostory add Section (#4078) * Fix random failure of getFeatureInfoOnFeatureInfoClick WMS test (#4091) (#4099) * Fix issue 78 Load story configuration (C039_geostory) (#4096) * Fix issue 78 Load story configuration * removed unneeded action in epic stream * removed unneeded comment * skip failing test * Fix issue 62 Media Editor - Image (C039_geostory) (#4101) * First version of media editor (missing tests) * Adding tests and documentation * adding modify logic for media image with tests * mediaEditor closed by default * update node version to 8.6.0 in .travis.yml * skip failing test for the moment * Geostory - Normal editor - Title (C039_geostory) (#4102) * Fix issue 75,71 added content toolbar everywhere and media editor and media section (C039_geostory) (#4107) * Fix Background content toolbar (C039_geostory) * it contains also tests * added editing for media and correct update of resource id * also restructured the sample story for new layout of paragraph * adding media toolbar on every Image * missed one test in prevois commit * Adding Media Section for GeoStory * issue 71 * add some styles for immersive layout * Removed section typemedia * Fixed missing parts of SectionTemplate removals * Fixed styles and minor changes * fix add button position in geostory column content * Fix media section toolbar as paragraph * removed .only in tests * Add column and immersive tests * revert error commit * revert error commit * Fixed immersive tests * Fixed column test * Add remove button for images and immersive background * Fixed remove buttons * improve style of cascade layout * Fixed array remove * * removed path geostory * image placeholder * fix tests * Add default resources for newgeostory fix edit for empty background * fix scrollbar in media editor * Add remove to text. Add recursive conainer removal * add tests for column and actions and content toolbars * resotred tests.webpack.js changes committed in error * removed temp comment * update toolbar position and patterns * fix failing epic test * fix edit media for media inside immersive columns * Add auto scroll for new content * fix lint error
Description
This pr adds the toolbar to the Background and every other content:
it also adds the possibility to add a Media Section
Issues
Please check if the PR fulfills these requirements
What kind of change does this PR introduce? (check one with "x", remove the others)
What is the current behavior? (You can also link to an open issue here)
Background content has no toolbar
What is the new behavior?
it has
Does this PR introduce a breaking change? (check one with "x", remove the other)
If this PR contains a breaking change, please describe the impact and migration path for existing applications: ...
Other information: