-
Notifications
You must be signed in to change notification settings - Fork 7
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
use NcReferenceList in whiteboard #73
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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,16 @@ | ||
/** | ||
* SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors | ||
* SPDX-License-Identifier: AGPL-3.0-or-later | ||
*/ | ||
import { NcReferenceList } from '@nextcloud/vue/dist/Components/NcRichText.js' | ||
|
||
import VueWrapper from './VueWrapper' | ||
|
||
/** | ||
* | ||
* @param props componentProps and component to be rendered in Vue | ||
*/ | ||
export default function(props) { | ||
const referenceProps = { text: props.link, limit: 1, interactive: true } | ||
return React.createElement(VueWrapper, { componentProps: referenceProps, component: NcReferenceList }) | ||
} |
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,50 @@ | ||
/** | ||
* SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors | ||
* SPDX-License-Identifier: AGPL-3.0-or-later | ||
*/ | ||
import Vue from 'vue' | ||
|
||
const VueWrapper = function( | ||
{ componentProps, component }) { | ||
const vueRef = React.useRef(null) | ||
const [vueInstance, setVueInstance] = React.useState(undefined) | ||
|
||
React.useEffect(() => { | ||
/** | ||
* | ||
*/ | ||
async function createVueInstance() { | ||
} | ||
|
||
createVueInstance() | ||
|
||
setVueInstance(new Vue({ | ||
el: vueRef.current, | ||
data() { | ||
return { | ||
props: componentProps, | ||
} | ||
}, | ||
render(h) { | ||
return h(component, { | ||
props: this.props, | ||
}) | ||
}, | ||
})) | ||
|
||
return () => { | ||
vueInstance?.$destroy() | ||
} | ||
}, []) | ||
|
||
React.useEffect(() => { | ||
if (vueInstance) { | ||
const keys = Object.keys(componentProps) | ||
keys.forEach(key => { vueInstance.props[key] = componentProps[key] }) | ||
} | ||
}, [Object.values(componentProps)]) | ||
|
||
return <div id="vue-component" ref={vueRef}></div> | ||
} | ||
|
||
export default VueWrapper |
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
Empty file.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
checking if the objects are DeepEqual is a workaround. Not entirely certain, but I do think if we could use the lib like excalidraw.com does here: https://github.com/excalidraw/excalidraw/blob/master/excalidraw-app/collab/Collab.tsx#L751 we would not need this workaround. However I couldn't figure out how to use the master version of excalidraws library in our build process.
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.
Sounds good, being able to build from master or another branch/a fork there is something that could certainly be useful, but we can check that separately