-
Notifications
You must be signed in to change notification settings - Fork 409
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Builder - Content Editor - Web page (C039 - #32) #4600
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi, there are some problems with this pr
@tdipisa I noticed that you cannot add directly a web page content, you have to add a media section or paragraph
- Open a new story
- Add a media section and select an image
- Add a first web content with aaaa
- Add a second web content with bbb, below the previous one
- edit the first one with ccccc
current result
expected
-
to save correct web content
-
I'm not able to reproduce the following error
Uncaught Invariant Violation: branch(Preview)(...): Nothing was returned from render. This usually means a return statement is missing. Or, to render nothing, return null.
at eval (webpack:///./node_modules/react-dom/cjs/react-dom.development.js?:15693:36)
at reconcileChildFibers (webpack:///./node_modules/react-dom/cjs/react-dom.development.js?:15696:15)
at reconcileChildren (webpack:///./node_modules/react-dom/cjs/react-dom.development.js?:18026:28)
at mountIndeterminateComponent (webpack:///./node_modules/react-dom/cjs/react-dom.development.js?:18794:5)
at beginWork$1 (webpack:///./node_modules/react-dom/cjs/react-dom.development.js?:20084:16)
at HTMLUnknownElement.callCallback (webpack:///./node_modules/react-dom/cjs/react-dom.development.js?:362:14)
at Object.invokeGuardedCallbackDev (webpack:///./node_modules/react-dom/cjs/react-dom.development.js?:411:16)
at invokeGuardedCallback (webpack:///./node_modules/react-dom/cjs/react-dom.development.js?:466:31)
at beginWork$$1 (webpack:///./node_modules/react-dom/cjs/react-dom.development.js?:25730:7)
at performUnitOfWork (webpack:///./node_modules/react-dom/cjs/react-dom.development.js?:24638:12)
at workLoopSync (webpack:///./node_modules/react-dom/cjs/react-dom.development.js?:24614:22)
at performSyncWorkOnRoot (webpack:///./node_modules/react-dom/cjs/react-dom.development.js?:24182:11)
at eval (webpack:///./node_modules/react-dom/cjs/react-dom.development.js?:12238:24)
at unstable_runWithPriority (webpack:///./node_modules/scheduler/cjs/scheduler.development.js?:815:12)
at runWithPriority$2 (webpack:///./node_modules/react-dom/cjs/react-dom.development.js?:12188:10)
at flushSyncCallbackQueueImpl (webpack:///./node_modules/react-dom/cjs/react-dom.development.js?:12233:7)
@kboczkowski-clurgo please fix the issues identified by @MV88, the Web Page content must be added not only as an additional content of an existing section (immersive or not) but also as a section per se like the other ones (images, paragraph etc). The requirement in the issue description is quite clear about that I think. |
@kboczkowski-clurgo looking at the last commit message I suppose that latest updates don't fix this problem but only the consol error. Isn't it? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi, I have found something that can be improved.
-
For the moment, use the same "code" icon for webpage content in section p
-
Please align the webpage section with other ones in a single row
-
can you avoid to close the modal by clicking on the shadow (similar to media editor)?
-
I have found a weird interaction with drag and drop of web page content
The drag and drop, works, but the modal appears -
Add url validation, maybe via a regex. See if there is already something in the codebase, maybe among utils
#4600 (review) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi, i was not able to load these urls:
@@ -139,6 +140,7 @@ const previewContents = { | |||
const contentType = content.type === 'column' | |||
? `${content.type}${content.align || 'center'}` | |||
: content.type; | |||
console.log(contentType, content.type); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
console.log(contentType, content.type); |
web/client/utils/URLUtils.js
Outdated
* Validator of URL | ||
* @param {string} url - url to validate | ||
*/ | ||
export const isValidURL = (url) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello, can you add tests for this, to see which use cases we are considering
This doesn't make sens to me, why we should support these kind of URLs? Maybe what we can do here is just to make the regex configurable from plugin config @offtherailz what do you think? |
the only problem concerns "localhost", because the regex denies domain names without a point. This may fail with host files or local DNS. Because the system may need to satisfy different requirements, as @tdipisa suggested, I should allow to configure the regex (2nd param of isValidURL may be the regex, by default the one currently used, maybe without the |
@MV88 @tdipisa @offtherailz PR is updated with changes suggested by @offtherailz. Now validation util has optional parameter to pass custom regexp. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @kboczkowski-clurgo just a minor update needed
|
||
save = () => { | ||
const { url } = this.state; | ||
const error = !isValidURL(url); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you pass ConfigUtils.getConfigProp("GeoStoryValidIframeURLRegex") as second argument?
in that case we can override it anytime without changing the code
Verify that if the property is missing in config, then it uses the default one
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@MV88 done
save = () => { | ||
const { url } = this.state; | ||
const error = !isValidURL(url); | ||
this.setState({ error: !isValidURL(url) }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this.setState({ error: !isValidURL(url) }); | |
this.setState({ error }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi, i think now we are good
Description
In this PR I've addeed create new geostory component mechanism - WebPage
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)
What is the new behavior?
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: