Skip to content

feat(referencePicker): introduce getReferenceWithPicker()#8532

Open
mejo- wants to merge 2 commits into
mainfrom
feat/reference_picker_return_object
Open

feat(referencePicker): introduce getReferenceWithPicker()#8532
mejo- wants to merge 2 commits into
mainfrom
feat/reference_picker_return_object

Conversation

@mejo-
Copy link
Copy Markdown
Contributor

@mejo- mejo- commented May 13, 2026

Required for Text and Collectives to pass the link title from the picker (e.g. Collectives PagePicker.vue) to the consumer (menubar in Text).

🏁 Checklist

  • ⛑️ Tests are included or are not applicable
  • 📘 Component documentation has been extended, updated or is not applicable
  • 2️⃣ Backport to stable8 for maintained Vue 2 version or not applicable

@mejo- mejo- self-assigned this May 13, 2026
@mejo- mejo- added 3. to review Waiting for reviews feature: functions composables, functions, mixins and other non-components labels May 13, 2026
@mejo-
Copy link
Copy Markdown
Contributor Author

mejo- commented May 13, 2026

/backport to stable8

@mejo- mejo- requested review from Antreesy and susnux May 13, 2026 12:37
@codecov
Copy link
Copy Markdown

codecov Bot commented May 13, 2026

Codecov Report

❌ Patch coverage is 0% with 25 lines in your changes missing coverage. Please review.
✅ Project coverage is 54.31%. Comparing base (1b5d050) to head (9e64b40).
⚠️ Report is 22 commits behind head on main.

Files with missing lines Patch % Lines
src/functions/reference/referencePickerModal.ts 0.00% 15 Missing and 3 partials ⚠️
...chText/NcReferencePicker/NcCustomPickerElement.vue 0.00% 2 Missing and 1 partial ⚠️
...NcRichText/NcReferencePicker/NcReferencePicker.vue 0.00% 2 Missing ⚠️
...ts/NcRichText/NcReferencePicker/NcProviderList.vue 0.00% 1 Missing ⚠️
...ts/NcRichText/NcReferencePicker/NcRawLinkInput.vue 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8532      +/-   ##
==========================================
- Coverage   54.57%   54.31%   -0.26%     
==========================================
  Files         106      106              
  Lines        3443     3461      +18     
  Branches     1004     1009       +5     
==========================================
+ Hits         1879     1880       +1     
- Misses       1323     1336      +13     
- Partials      241      245       +4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@mejo-
Copy link
Copy Markdown
Contributor Author

mejo- commented May 13, 2026

/backport to stable8

@mejo- mejo- requested a review from max-nextcloud May 14, 2026 22:13
@mejo- mejo- force-pushed the feat/reference_picker_return_object branch from 53cfef4 to 367d86b Compare May 18, 2026 08:41
@mejo- mejo- changed the title feat(referencePicker): optionally return object in getLinkWithPicker() feat(referencePicker): introduce getReferenceWithPicker() May 18, 2026
@mejo- mejo- force-pushed the feat/reference_picker_return_object branch 2 times, most recently from 638da91 to 7113c3d Compare May 18, 2026 09:12
Copy link
Copy Markdown
Contributor

@ShGKme ShGKme left a comment

Choose a reason for hiding this comment

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

If I understand the change correctly, the following components have changed public API:

  • NcReferencePicker
  • NcSearch

Comment on lines +53 to +56
const modalId = 'referencePickerModal'
const modalElement = document.createElement('div')
modalElement.id = modalId
document.body.append(modalElement)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We have spawnDialog util to mount dialogs

Comment thread src/functions/reference/index.ts Outdated
* @param providerId - Optional ID of initial selected provider
* @param isInsideViewer - Should be true if this function is called while the Viewer is displayed
*/
export async function getReferenceWithPicker(providerId?: string, isInsideViewer?: boolean): Promise<PickerSubmitResult> {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Having isInsideViewer as a position parameter seems unexpected to me. Picker shouldn't know, it is it in Viewer. If it's really needed, I'd make it an option rather than a second position parameter.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

As written in 1:1 chat, I kept it that way to keep getLinkWithPicker() and getReferenceWithPicker() as similar as possible to make it a no-brainer to migrate from one to the other.

@mejo- mejo- force-pushed the feat/reference_picker_return_object branch 2 times, most recently from 481340b to a4a1f78 Compare May 18, 2026 12:31
mejo- added 2 commits May 18, 2026 14:42
Required for Text and Collectives to pass the link title from the picker
(e.g. Collectives PagePicker.vue) to the consumer (menubar in Text).

Signed-off-by: Jonas <jonas@freesources.org>
- In NcCustomPickerElement we cannot control the submitted type, so let's
  add the type check there as well.
- NcSearch is exported publically and used by apps, so changing its
  return type would introduce a backwards-incompatibility.
- NcProviderList, NcRawLinkInput and NcCustomPickerElement are not
  publically exposed, so we can change the emitted type there.

Signed-off-by: Jonas <jonas@freesources.org>
@mejo- mejo- force-pushed the feat/reference_picker_return_object branch from a4a1f78 to 9e64b40 Compare May 18, 2026 12:42
mejo- added a commit to nextcloud/text that referenced this pull request May 18, 2026
Requires nextcloud-libraries/nextcloud-vue#8532 to have an effect.

Signed-off-by: Jonas <jonas@freesources.org>
@mejo-
Copy link
Copy Markdown
Contributor Author

mejo- commented May 18, 2026

nextcloud/text#8615 and nextcloud/collectives#2522 are the respective PRs in Text and Collectives to use this new feature.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3. to review Waiting for reviews backport-request feature: functions composables, functions, mixins and other non-components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants