Skip to content

feat: registration and API for event editor extensions - #2

Merged
odzhychko merged 1 commit into
mainfrom
registration-and-api
Nov 18, 2026
Merged

odzhychko merged 1 commit into
mainfrom
registration-and-api

Conversation

@odzhychko

@odzhychko odzhychko commented Nov 16, 2026 •

Copy link
Copy Markdown
Collaborator

Registration of event editor extensions and first API for Nextcloud Calendar to implement.

Part of nextcloud/calendar#8522

Why the proposed API

As simple example off an extension is:

// src/event-editor.ts
import { registerEventEditorExtension } from '@nextcloud/calendar'

const registration = registerEventEditorExtension({
	app: 'myapp',
	name: 'my-field',
	setup({ event, editor }) {
		const icon = document.createElement('div')
		// … e.g. render an icon into it

		const field = document.createElement('div')
		let value = ''
		// … render your input into it, e.g. with a component of @nextcloud/vue, and keep `value` up to date

		editor.addField({ icon, field })

		event.onSave({
			callback: () => {
				event.setProperty({ name: 'X-MYAPP-VALUE', value })
			},
		})
	},
})

It differs from the orginal plan in nextcloud/calendar#8522 (comment) for the following reasons:

  • enforce custom elements mostly just add complexity for implementers of extensions and for the Calendar App
    So methods like addField work just with Elementss.
    implementers can still use the custom elements if they want.

  • have a setup function (Inspired by Vue hooks)
    In the originally proposed APIs where more static.
    But extensions need to be more dynamic, because event editing is very dynamic.
    Editors sizes, property values change and extension need to react to it (e.g. hide fields, expand fields etc.)

    Also in the originally proposed API, each field, each onSave callback would have been its own extension.
    Extension authors would have need to coordinate different extension if the wanted to add relate fields (and other extension points).
    With the setup approach one extension can encapsulate many fields, together with onSave logic and logic for different editor size etc.

🤖 AI (if applicable)

  • The content of this PR was partly or fully generated using AI

@odzhychko
odzhychko changed the base branch from main to basic-workflows November 16, 2026 16:05
@odzhychko
odzhychko force-pushed the registration-and-api branch from f256857 to d15a509 Compare November 16, 2026 16:06
@odzhychko
odzhychko marked this pull request as draft November 16, 2026 17:39
@odzhychko
odzhychko force-pushed the registration-and-api branch 2 times, most recently from de3b152 to 54e0c75 Compare November 17, 2026 09:54
@odzhychko
odzhychko marked this pull request as ready for review November 17, 2026 10:55
@odzhychko
odzhychko added this pull request to stack #3 November 18, 2026 08:49
Base automatically changed from basic-workflows to main November 18, 2026 08:52
Assisted-by: ClaudeCode:claude-opus-5-5
Signed-off-by: Oleksandr Dzhychko <hey@oleks.dev>
@odzhychko
odzhychko force-pushed the registration-and-api branch from 54e0c75 to af24798 Compare November 18, 2026 08:52
@odzhychko
odzhychko merged commit 3808775 into main Nov 18, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants