diff --git a/web/app/components/CalendarInput.nuxt.test.ts b/web/app/components/CalendarInput.nuxt.test.ts index 75fc1cc1..42efe0ad 100644 --- a/web/app/components/CalendarInput.nuxt.test.ts +++ b/web/app/components/CalendarInput.nuxt.test.ts @@ -25,29 +25,29 @@ describe("", { concurrent: false }, () => { it("shows the placeholder while nothing is picked", async ({ expect }) => { const wrapper = await mountInput({ - placeholder: t("editor.hooks.time-expiration.calendar-placeholder"), + placeholder: t("editor.hooks.scheduled-reminder.calendar-placeholder"), }) expect(wrapper.text()).toContain( - t("editor.hooks.time-expiration.calendar-placeholder"), + t("editor.hooks.scheduled-reminder.calendar-placeholder"), ) }) it("shows the picked date instead of the placeholder", async ({ expect }) => { const wrapper = await mountInput({ - placeholder: t("editor.hooks.time-expiration.calendar-placeholder"), + placeholder: t("editor.hooks.scheduled-reminder.calendar-placeholder"), modelValue: new CalendarDate(2026, 3, 14), }) expect(wrapper.text()).toContain("March 14, 2026") expect(wrapper.text()).not.toContain( - t("editor.hooks.time-expiration.calendar-placeholder"), + t("editor.hooks.scheduled-reminder.calendar-placeholder"), ) }) it("greys out the trigger while nothing is picked", async ({ expect }) => { const wrapper = await mountInput({ - placeholder: t("editor.hooks.time-expiration.calendar-placeholder"), + placeholder: t("editor.hooks.scheduled-reminder.calendar-placeholder"), }) expect(wrapper.get("button").classes()).toContain("text-muted-foreground") @@ -57,7 +57,7 @@ describe("", { concurrent: false }, () => { expect, }) => { const wrapper = await mountInput({ - placeholder: t("editor.hooks.time-expiration.calendar-placeholder"), + placeholder: t("editor.hooks.scheduled-reminder.calendar-placeholder"), modelValue: new CalendarDate(2026, 3, 14), }) @@ -70,7 +70,7 @@ describe("", { concurrent: false }, () => { expect, }) => { await mountInput({ - placeholder: t("editor.hooks.time-expiration.calendar-placeholder"), + placeholder: t("editor.hooks.scheduled-reminder.calendar-placeholder"), }) expect(popoverText()).not.toContain("March") @@ -78,7 +78,7 @@ describe("", { concurrent: false }, () => { it("opens the calendar when the trigger is pressed", async ({ expect }) => { const wrapper = await mountInput({ - placeholder: t("editor.hooks.time-expiration.calendar-placeholder"), + placeholder: t("editor.hooks.scheduled-reminder.calendar-placeholder"), modelValue: new CalendarDate(2026, 3, 14), }) @@ -91,7 +91,7 @@ describe("", { concurrent: false }, () => { it("closes the calendar once a date is picked", async ({ expect }) => { const wrapper = await mountInput({ - placeholder: t("editor.hooks.time-expiration.calendar-placeholder"), + placeholder: t("editor.hooks.scheduled-reminder.calendar-placeholder"), modelValue: new CalendarDate(2026, 3, 14), }) await wrapper.get("button").trigger("click") @@ -105,7 +105,7 @@ describe("", { concurrent: false }, () => { it("reports the day the user clicks in the calendar", async ({ expect }) => { const wrapper = await mountInput({ - placeholder: t("editor.hooks.time-expiration.calendar-placeholder"), + placeholder: t("editor.hooks.scheduled-reminder.calendar-placeholder"), modelValue: new CalendarDate(2026, 3, 14), }) await wrapper.get("button").trigger("click") @@ -125,7 +125,7 @@ describe("", { concurrent: false }, () => { it("leaves every day selectable by default", async ({ expect }) => { vi.setSystemTime(new Date("2026-03-14T12:00:00Z")) const wrapper = await mountInput({ - placeholder: t("editor.hooks.time-expiration.calendar-placeholder"), + placeholder: t("editor.hooks.scheduled-reminder.calendar-placeholder"), modelValue: new CalendarDate(2026, 3, 14), }) @@ -142,7 +142,7 @@ describe("", { concurrent: false }, () => { }) => { vi.setSystemTime(new Date("2026-03-14T12:00:00Z")) const wrapper = await mountInput({ - placeholder: t("editor.hooks.time-expiration.calendar-placeholder"), + placeholder: t("editor.hooks.scheduled-reminder.calendar-placeholder"), modelValue: new CalendarDate(2026, 3, 20), availableFromTomorrow: true, }) diff --git a/web/app/components/NotificationBox.vue b/web/app/components/NotificationBox.vue index eb75b6b4..e627740a 100644 --- a/web/app/components/NotificationBox.vue +++ b/web/app/components/NotificationBox.vue @@ -178,7 +178,7 @@ function buildNotificationDescription(notification: Notification) { hook = t("editor.hooks.github-tracking.title") break case DocumentHookType.ScheduledReminder: - hook = t("editor.hooks.time-expiration.title") + hook = t("editor.hooks.scheduled-reminder.title") break case DocumentHookType.ContainerImageWatcher: hook = t("editor.hooks.container-image-watcher.title") diff --git a/web/app/components/editor/ContentEditor.nuxt.test.ts b/web/app/components/editor/ContentEditor.nuxt.test.ts index 5662777f..55bfd64f 100644 --- a/web/app/components/editor/ContentEditor.nuxt.test.ts +++ b/web/app/components/editor/ContentEditor.nuxt.test.ts @@ -70,7 +70,7 @@ function paragraph(text: string, uid: string) { } function mountEditor( - options: { branch?: Branch; documentHooks?: DocumentHook[] } = {}, + options: { branch?: Branch; activeBranchHooks?: DocumentHook[] } = {}, ) { const branch = options.branch ?? makeBranch() @@ -78,7 +78,7 @@ function mountEditor( props: { activeBranchProvider: branch.provider, activeBranchYdoc: branch.ydoc, - documentHooks: options.documentHooks ?? [], + activeBranchHooks: options.activeBranchHooks ?? [], nameEditor: null, userCaretDetails: { name: "Me", color: "#ff0000" }, }, @@ -300,7 +300,7 @@ describe("", { concurrent: false }, () => { const called = watchCommands(editorOf(wrapper)) await wrapper.setProps({ - documentHooks: [ + activeBranchHooks: [ { id: "hook-1", blockId: "block-1", diff --git a/web/app/components/editor/ContentEditor.vue b/web/app/components/editor/ContentEditor.vue index 52e4ad1e..84cb4fbf 100644 --- a/web/app/components/editor/ContentEditor.vue +++ b/web/app/components/editor/ContentEditor.vue @@ -48,7 +48,7 @@ import { SUPPRESS_SCROLL_TO_SELECTION_META } from "./scroll-control" const props = defineProps<{ activeBranchProvider: HocuspocusProvider activeBranchYdoc: Y.Doc - documentHooks: DocumentHook[] + activeBranchHooks: DocumentHook[] nameEditor: Editor | null | undefined userCaretDetails: { name: string; color: string } }>() @@ -66,13 +66,10 @@ const linkBubbleMenuElem = useTemplateRef("link-bubble-menu") const editorStore = useEditorStore() const { uploadDocumentFile } = useDocumentFileAPI() const suppressNextSelectionScroll = ref(false) -const { isEditable } = useEditorMeta() -const isEditingDisabled = computed(() => { - return !isEditable.value || editorStore.reviewableDiffActive -}) +const { isReadOnlyOrDiff } = useEditorMeta() const textCommentState = ref(null) -const editorExtensions = contentExtensionsWithIDs(t, isEditingDisabled, { +const editorExtensions = contentExtensionsWithIDs(t, isReadOnlyOrDiff, { onIndicatorStateChange: (v) => { textCommentState.value = v }, @@ -174,7 +171,7 @@ const contentEditor = useEditor({ }), HookDecorator.configure({ attributeName: "uid", - getHooks: () => props.documentHooks, + getHooks: () => props.activeBranchHooks, }), Typography, Collaboration.configure({ @@ -308,7 +305,7 @@ watch( ) watchDeep( - () => props.documentHooks, + () => props.activeBranchHooks, () => { contentEditor.value?.commands.refreshHookDecorations() }, @@ -375,7 +372,7 @@ function setTextCommentIndicatorHoverChange( ref="editor-container" :class="[ 'group/content-editor content-editor relative z-editor-content w-full min-w-0 flex-1 bg-transparent', - { 'editor-not-editable': isEditingDisabled }, + { 'editor-not-editable': isReadOnlyOrDiff }, ]" >