From f2b6389b7edda4b94c37cc306e88030fb2822873 Mon Sep 17 00:00:00 2001 From: David <33458145+davidmcpowell@users.noreply.github.com> Date: Wed, 26 Mar 2025 13:06:47 +0000 Subject: [PATCH] Merge pull request #24442 from overleaf/dp-writefull-parent Provide writefull with element selectors to insert into GitOrigin-RevId: 87c9a939f7024e54adfe0b970dddb96b7f56d6b3 --- .../source-editor/extensions/toolbar/toolbar-panel.ts | 1 + .../js/shared/context/types/writefull-instance.ts | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/services/web/frontend/js/features/source-editor/extensions/toolbar/toolbar-panel.ts b/services/web/frontend/js/features/source-editor/extensions/toolbar/toolbar-panel.ts index ebc12b28a1..ae8dfc8578 100644 --- a/services/web/frontend/js/features/source-editor/extensions/toolbar/toolbar-panel.ts +++ b/services/web/frontend/js/features/source-editor/extensions/toolbar/toolbar-panel.ts @@ -18,6 +18,7 @@ const toolbarState = StateField.define({ export function createToolbarPanel() { const dom = document.createElement('div') dom.classList.add('ol-cm-toolbar-portal') + dom.id = 'ol-cm-toolbar-portal' return { dom, top: true } } diff --git a/services/web/frontend/js/shared/context/types/writefull-instance.ts b/services/web/frontend/js/shared/context/types/writefull-instance.ts index 7dab3e0913..0040422548 100644 --- a/services/web/frontend/js/shared/context/types/writefull-instance.ts +++ b/services/web/frontend/js/shared/context/types/writefull-instance.ts @@ -6,11 +6,20 @@ export interface WritefullEvents { 'writefull-register-as-auto-account': { email: string } } +type InsertPosition = { + parentSelector: string + insertBeforeSelector?: string +} + export interface WritefullAPI { init({ + toolbarPosition, + iconPosition, hasAgreedToTOS, overleafUserId, }: { + toolbarPosition: InsertPosition + iconPosition: InsertPosition hasAgreedToTOS: boolean overleafUserId: string }): Promise