Skip to content
This repository has been archived by the owner on Sep 8, 2023. It is now read-only.

Implement reference preview rendering #743

Merged
merged 14 commits into from
Aug 31, 2022
Merged

Implement reference preview rendering #743

merged 14 commits into from
Aug 31, 2022

Conversation

juliusknorr
Copy link
Collaborator

@juliusknorr juliusknorr commented Aug 10, 2022

  • Add stylesheets
  • expose widget API
  • use axios for fetching
  • decide to finish vite migration Switch to vite for packaging #707 or push forward without markdown support for now
  • Validate that bundling is working properly
  • Default widget design review
    • Move image to the left
    • One header line
    • 3 summary lines
    • 1 link line
    • All text with equal spacing
    • Border 2px solid
  • Add regex matching to only perform requests if a reference is matched
  • If the preview can not be loaded, there should not be extra whitespace
  • Link subline could get its https:// / http:// cut from the beginning so more of the link is visible

Follow ups

Usage

Fetch reference data on the fly:

<RichText :text="text" :arguments="args" :autolink="true" :reference-limit="10" />

Provide reference data on the fly:

<RichText :text="text" :arguments="args" :autolink="true" :references="referenceData" :reference-limit="1" />

As an alternative the ReferenceList component is also exported so can be used standalone as well.

Registering a custom view

import { registerWidget } from '@nextcloud/vue-richtext'
import FileWidget from './FileWidget.vue'

registerWidget('file', (el, { richObjectType, richObject, accessible }) => {
	const Widget = Vue.extend(FileWidget)
	new Widget({
		propsData: {
			richObjectType,
			richObject,
			accessible
		}
	}).$mount(el)
})

Screenshot

Screenshot 2022-08-30 at 09 02 43

Screenshot 2022-08-30 at 09 02 48

Screenshot 2022-08-30 at 09 02 38

src/References.vue Outdated Show resolved Hide resolved
@juliusknorr juliusknorr changed the base branch from master to vite August 12, 2022 14:36
Base automatically changed from vite to master August 12, 2022 14:43
@juliusknorr juliusknorr force-pushed the enh/reference branch 2 times, most recently from eadf0f6 to 33f7e57 Compare August 12, 2022 15:17
@juliusknorr juliusknorr mentioned this pull request Aug 12, 2022
5 tasks
src/ReferenceWidget.vue Outdated Show resolved Hide resolved
src/ReferenceWidget.vue Outdated Show resolved Hide resolved
src/ReferenceList.vue Outdated Show resolved Hide resolved
src/ReferenceList.vue Outdated Show resolved Hide resolved
src/ReferenceList.vue Outdated Show resolved Hide resolved
Signed-off-by: Julius Härtl <[email protected]>
@nickvergessen
Copy link
Collaborator

I get this when trying to build:

'URL_PATTERN_AUTOLINK' is not exported by src/helpers.js, imported by src/autolink.js

@juliusknorr
Copy link
Collaborator Author

Will push shortly with the compact mode adjustment that I just made together with @jancborchardt

Copy link
Collaborator

@nickvergessen nickvergessen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works in talk main view. The compact handling can be done in a follow up.

@juliusknorr juliusknorr merged commit 27b62c3 into master Aug 31, 2022
@juliusknorr juliusknorr deleted the enh/reference branch August 31, 2022 12:43
@juliusknorr
Copy link
Collaborator Author

Published as @nextcloud/[email protected]

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants