-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #73 from nextcloud/feat/custom-web-embed
use NcReferenceList in whiteboard
- Loading branch information
Showing
8 changed files
with
1,986 additions
and
10 deletions.
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.